diff --git a/Control/Applicative.hs b/Control/Applicative.hs
--- a/Control/Applicative.hs
+++ b/Control/Applicative.hs
@@ -43,7 +43,7 @@
     Const(..), WrappedMonad(..), WrappedArrow(..), ZipList(..),
     -- * Utility functions
     (<$>), (<$), (<**>),
-    liftA, liftA2, liftA3,
+    liftA, liftA3,
     optional,
     ) where
 
@@ -66,13 +66,17 @@
 newtype WrappedMonad m a = WrapMonad { unwrapMonad :: m a }
                          deriving (Generic, Generic1, Monad)
 
+-- | @since 2.01
 instance Monad m => Functor (WrappedMonad m) where
     fmap f (WrapMonad v) = WrapMonad (liftM f v)
 
+-- | @since 2.01
 instance Monad m => Applicative (WrappedMonad m) where
     pure = WrapMonad . pure
     WrapMonad f <*> WrapMonad v = WrapMonad (f `ap` v)
+    liftA2 f (WrapMonad x) (WrapMonad y) = WrapMonad (liftM2 f x y)
 
+-- | @since 2.01
 instance MonadPlus m => Alternative (WrappedMonad m) where
     empty = WrapMonad mzero
     WrapMonad u <|> WrapMonad v = WrapMonad (u `mplus` v)
@@ -80,29 +84,42 @@
 newtype WrappedArrow a b c = WrapArrow { unwrapArrow :: a b c }
                            deriving (Generic, Generic1)
 
+-- | @since 2.01
 instance Arrow a => Functor (WrappedArrow a b) where
     fmap f (WrapArrow a) = WrapArrow (a >>> arr f)
 
+-- | @since 2.01
 instance Arrow a => Applicative (WrappedArrow a b) where
     pure x = WrapArrow (arr (const x))
-    WrapArrow f <*> WrapArrow v = WrapArrow (f &&& v >>> arr (uncurry id))
+    liftA2 f (WrapArrow u) (WrapArrow v) =
+      WrapArrow (u &&& v >>> arr (uncurry f))
 
+-- | @since 2.01
 instance (ArrowZero a, ArrowPlus a) => Alternative (WrappedArrow a b) where
     empty = WrapArrow zeroArrow
     WrapArrow u <|> WrapArrow v = WrapArrow (u <+> v)
 
--- | Lists, but with an 'Applicative' functor based on zipping, so that
---
--- @f '<$>' 'ZipList' xs1 '<*>' ... '<*>' 'ZipList' xsn = 'ZipList' (zipWithn f xs1 ... xsn)@
---
+-- | Lists, but with an 'Applicative' functor based on zipping.
 newtype ZipList a = ZipList { getZipList :: [a] }
                   deriving ( Show, Eq, Ord, Read, Functor
                            , Foldable, Generic, Generic1)
--- See Data.Traversable for Traversabel instance due to import loops
+-- See Data.Traversable for Traversable instance due to import loops
 
+-- |
+-- > f '<$>' 'ZipList' xs1 '<*>' ... '<*>' 'ZipList' xsN
+--       = 'ZipList' (zipWithN f xs1 ... xsN)
+--
+-- where @zipWithN@ refers to the @zipWith@ function of the appropriate arity
+-- (@zipWith@, @zipWith3@, @zipWith4@, ...). For example:
+--
+-- > (\a b c -> stimes c [a, b]) <$> ZipList "abcd" <*> ZipList "567" <*> ZipList [1..]
+-- >     = ZipList (zipWith3 (\a b c -> stimes c [a, b]) "abcd" "567" [1..])
+-- >     = ZipList {getZipList = ["a5","b6b6","c7c7c7"]}
+--
+-- @since 2.01
 instance Applicative ZipList where
     pure x = ZipList (repeat x)
-    ZipList fs <*> ZipList xs = ZipList (zipWith id fs xs)
+    liftA2 f (ZipList xs) (ZipList ys) = ZipList (zipWith f xs ys)
 
 -- extra functions
 
diff --git a/Control/Arrow.hs b/Control/Arrow.hs
--- a/Control/Arrow.hs
+++ b/Control/Arrow.hs
@@ -139,6 +139,7 @@
 
 -- Ordinary functions are arrows.
 
+-- | @since 2.01
 instance Arrow (->) where
     arr f = f
 --  (f *** g) ~(x,y) = (f x, g y)
@@ -148,10 +149,12 @@
 -- | Kleisli arrows of a monad.
 newtype Kleisli m a b = Kleisli { runKleisli :: a -> m b }
 
+-- | @since 3.0
 instance Monad m => Category (Kleisli m) where
     id = Kleisli return
     (Kleisli f) . (Kleisli g) = Kleisli (\b -> g b >>= f)
 
+-- | @since 2.01
 instance Monad m => Arrow (Kleisli m) where
     arr f = Kleisli (return . f)
     first (Kleisli f) = Kleisli (\ ~(b,d) -> f b >>= \c -> return (c,d))
@@ -180,6 +183,7 @@
 class Arrow a => ArrowZero a where
     zeroArrow :: a b c
 
+-- | @since 2.01
 instance MonadPlus m => ArrowZero (Kleisli m) where
     zeroArrow = Kleisli (\_ -> mzero)
 
@@ -188,6 +192,7 @@
     -- | An associative operation with identity 'zeroArrow'.
     (<+>) :: a b c -> a b c -> a b c
 
+-- | @since 2.01
 instance MonadPlus m => ArrowPlus (Kleisli m) where
     Kleisli f <+> Kleisli g = Kleisli (\x -> f x `mplus` g x)
 
@@ -269,12 +274,14 @@
                 right f . right g = right (f . g)
  #-}
 
+-- | @since 2.01
 instance ArrowChoice (->) where
     left f = f +++ id
     right f = id +++ f
     f +++ g = (Left . f) ||| (Right . g)
     (|||) = either
 
+-- | @since 2.01
 instance Monad m => ArrowChoice (Kleisli m) where
     left f = f +++ arr id
     right f = arr id +++ f
@@ -295,9 +302,11 @@
 class Arrow a => ArrowApply a where
     app :: a (a b c, b) c
 
+-- | @since 2.01
 instance ArrowApply (->) where
     app (f,x) = f x
 
+-- | @since 2.01
 instance Monad m => ArrowApply (Kleisli m) where
     app = Kleisli (\(Kleisli f, x) -> f x)
 
@@ -306,24 +315,27 @@
 
 newtype ArrowMonad a b = ArrowMonad (a () b)
 
+-- | @since 4.6.0.0
 instance Arrow a => Functor (ArrowMonad a) where
     fmap f (ArrowMonad m) = ArrowMonad $ m >>> arr f
 
+-- | @since 4.6.0.0
 instance Arrow a => Applicative (ArrowMonad a) where
    pure x = ArrowMonad (arr (const x))
    ArrowMonad f <*> ArrowMonad x = ArrowMonad (f &&& x >>> arr (uncurry id))
 
+-- | @since 2.01
 instance ArrowApply a => Monad (ArrowMonad a) where
     ArrowMonad m >>= f = ArrowMonad $
         m >>> arr (\x -> let ArrowMonad h = f x in (h, ())) >>> app
 
+-- | @since 4.6.0.0
 instance ArrowPlus a => Alternative (ArrowMonad a) where
    empty = ArrowMonad zeroArrow
    ArrowMonad x <|> ArrowMonad y = ArrowMonad (x <+> y)
 
-instance (ArrowApply a, ArrowPlus a) => MonadPlus (ArrowMonad a) where
-   mzero = ArrowMonad zeroArrow
-   ArrowMonad x `mplus` ArrowMonad y = ArrowMonad (x <+> y)
+-- | @since 4.6.0.0
+instance (ArrowApply a, ArrowPlus a) => MonadPlus (ArrowMonad a)
 
 -- | Any instance of 'ArrowApply' can be made into an instance of
 --   'ArrowChoice' by defining 'left' = 'leftApp'.
@@ -363,12 +375,15 @@
 class Arrow a => ArrowLoop a where
     loop :: a (b,d) (c,d) -> a b c
 
+-- | @since 2.01
 instance ArrowLoop (->) where
     loop f b = let (c,d) = f (b,d) in c
 
 -- | Beware that for many monads (those for which the '>>=' operation
 -- is strict) this instance will /not/ satisfy the right-tightening law
 -- required by the 'ArrowLoop' class.
+--
+-- @since 2.01
 instance MonadFix m => ArrowLoop (Kleisli m) where
     loop (Kleisli f) = Kleisli (liftM fst . mfix . f')
       where f' x y = f (x, snd y)
diff --git a/Control/Category.hs b/Control/Category.hs
--- a/Control/Category.hs
+++ b/Control/Category.hs
@@ -46,14 +46,22 @@
                 (p . q) . r = p . (q . r)
  #-}
 
+-- | @since 3.0
 instance Category (->) where
     id = GHC.Base.id
     (.) = (GHC.Base..)
 
+-- | @since 4.7.0.0
 instance Category (:~:) where
   id          = Refl
   Refl . Refl = Refl
 
+-- | @since 4.10.0.0
+instance Category (:~~:) where
+  id            = HRefl
+  HRefl . HRefl = HRefl
+
+-- | @since 4.7.0.0
 instance Category Coercion where
   id = Coercion
   (.) Coercion = coerce
diff --git a/Control/Concurrent.hs b/Control/Concurrent.hs
--- a/Control/Concurrent.hs
+++ b/Control/Concurrent.hs
@@ -253,7 +253,7 @@
 -- If @rtsSupportsBoundThreads@ is 'False', 'isCurrentThreadBound'
 -- will always return 'False' and both 'forkOS' and 'runInBoundThread' will
 -- fail.
-foreign import ccall rtsSupportsBoundThreads :: Bool
+foreign import ccall unsafe rtsSupportsBoundThreads :: Bool
 
 
 {- |
@@ -308,7 +308,7 @@
                         MaskedInterruptible -> action0
                         MaskedUninterruptible -> uninterruptibleMask_ action0
 
-            action_plus = catchException action1 childHandler
+            action_plus = catch action1 childHandler
 
         entry <- newStablePtr (myThreadId >>= putMVar mv >> action_plus)
         err <- forkOS_createThread entry
diff --git a/Control/Concurrent/Chan.hs b/Control/Concurrent/Chan.hs
--- a/Control/Concurrent/Chan.hs
+++ b/Control/Concurrent/Chan.hs
@@ -100,7 +100,13 @@
 -- completes and before modifyMVar_ installs the new value, it will set the
 -- Chan's write end to a filled hole.
 
--- |Read the next value from the 'Chan'.
+-- |Read the next value from the 'Chan'. Blocks when the channel is empty. Since
+-- the read end of a channel is an 'MVar', this operation inherits fairness
+-- guarantees of 'MVar's (e.g. threads blocked in this operation are woken up in
+-- FIFO order).
+--
+-- Throws 'BlockedIndefinitelyOnMVar' when the channel is empty and no other
+-- thread holds a reference to the channel.
 readChan :: Chan a -> IO a
 readChan (Chan readVar _) = do
   modifyMVarMasked readVar $ \read_end -> do -- Note [modifyMVarMasked]
diff --git a/Control/Exception.hs b/Control/Exception.hs
--- a/Control/Exception.hs
+++ b/Control/Exception.hs
@@ -49,6 +49,7 @@
         BlockedIndefinitelyOnMVar(..),
         BlockedIndefinitelyOnSTM(..),
         AllocationLimitExceeded(..),
+        CompactionFailed(..),
         Deadlock(..),
         NoMethodError(..),
         PatternMatchFail(..),
@@ -140,6 +141,7 @@
 -- | You need this when using 'catches'.
 data Handler a = forall e . Exception e => Handler (e -> IO a)
 
+-- | @since 4.6.0.0
 instance Functor Handler where
      fmap f (Handler h) = Handler (fmap f . h)
 
@@ -304,7 +306,7 @@
 interruptible (or call other interruptible operations).  In many cases
 these operations may themselves raise exceptions, such as I\/O errors,
 so the caller will usually be prepared to handle exceptions arising from the
-operation anyway.  To perfom an explicit poll for asynchronous exceptions
+operation anyway.  To perform an explicit poll for asynchronous exceptions
 inside 'mask', use 'allowInterrupt'.
 
 Sometimes it is too onerous to handle exceptions in the middle of a
diff --git a/Control/Exception/Base.hs b/Control/Exception/Base.hs
--- a/Control/Exception/Base.hs
+++ b/Control/Exception/Base.hs
@@ -32,6 +32,7 @@
         BlockedIndefinitelyOnMVar(..),
         BlockedIndefinitelyOnSTM(..),
         AllocationLimitExceeded(..),
+        CompactionFailed(..),
         Deadlock(..),
         NoMethodError(..),
         PatternMatchFail(..),
@@ -110,45 +111,6 @@
 -----------------------------------------------------------------------------
 -- Catching exceptions
 
--- |This is the simplest of the exception-catching functions.  It
--- takes a single argument, runs it, and if an exception is raised
--- the \"handler\" is executed, with the value of the exception passed as an
--- argument.  Otherwise, the result is returned as normal.  For example:
---
--- >   catch (readFile f)
--- >         (\e -> do let err = show (e :: IOException)
--- >                   hPutStr stderr ("Warning: Couldn't open " ++ f ++ ": " ++ err)
--- >                   return "")
---
--- Note that we have to give a type signature to @e@, or the program
--- will not typecheck as the type is ambiguous. While it is possible
--- to catch exceptions of any type, see the section \"Catching all
--- exceptions\" (in "Control.Exception") for an explanation of the problems with doing so.
---
--- For catching exceptions in pure (non-'IO') expressions, see the
--- function 'evaluate'.
---
--- Note that due to Haskell\'s unspecified evaluation order, an
--- expression may throw one of several possible exceptions: consider
--- the expression @(error \"urk\") + (1 \`div\` 0)@.  Does
--- the expression throw
--- @ErrorCall \"urk\"@, or @DivideByZero@?
---
--- The answer is \"it might throw either\"; the choice is
--- non-deterministic. If you are catching any type of exception then you
--- might catch either. If you are calling @catch@ with type
--- @IO Int -> (ArithException -> IO Int) -> IO Int@ then the handler may
--- get run with @DivideByZero@ as an argument, or an @ErrorCall \"urk\"@
--- exception may be propogated further up. If you call it again, you
--- might get a the opposite behaviour. This is ok, because 'catch' is an
--- 'IO' computation.
---
-catch   :: Exception e
-        => IO a         -- ^ The computation to run
-        -> (e -> IO a)  -- ^ Handler to invoke if an exception is raised
-        -> IO a
-catch act = catchException (lazy act)
-
 -- | The function 'catchJust' is like 'catch', but it takes an extra
 -- argument which is an /exception predicate/, a function which
 -- selects which type of exceptions we\'re interested in.
@@ -299,9 +261,11 @@
 -- source location of the pattern.
 newtype PatternMatchFail = PatternMatchFail String
 
+-- | @since 4.0
 instance Show PatternMatchFail where
     showsPrec _ (PatternMatchFail err) = showString err
 
+-- | @since 4.0
 instance Exception PatternMatchFail
 
 -----
@@ -313,9 +277,11 @@
 -- location of the record selector.
 newtype RecSelError = RecSelError String
 
+-- | @since 4.0
 instance Show RecSelError where
     showsPrec _ (RecSelError err) = showString err
 
+-- | @since 4.0
 instance Exception RecSelError
 
 -----
@@ -325,9 +291,11 @@
 -- constructed.
 newtype RecConError = RecConError String
 
+-- | @since 4.0
 instance Show RecConError where
     showsPrec _ (RecConError err) = showString err
 
+-- | @since 4.0
 instance Exception RecConError
 
 -----
@@ -339,9 +307,11 @@
 -- location of the record update.
 newtype RecUpdError = RecUpdError String
 
+-- | @since 4.0
 instance Show RecUpdError where
     showsPrec _ (RecUpdError err) = showString err
 
+-- | @since 4.0
 instance Exception RecUpdError
 
 -----
@@ -351,9 +321,11 @@
 -- @String@ gives information about which method it was.
 newtype NoMethodError = NoMethodError String
 
+-- | @since 4.0
 instance Show NoMethodError where
     showsPrec _ (NoMethodError err) = showString err
 
+-- | @since 4.0
 instance Exception NoMethodError
 
 -----
@@ -365,9 +337,11 @@
 -- @since 4.9.0.0
 newtype TypeError = TypeError String
 
+-- | @since 4.9.0.0
 instance Show TypeError where
     showsPrec _ (TypeError err) = showString err
 
+-- | @since 4.9.0.0
 instance Exception TypeError
 
 -----
@@ -378,9 +352,11 @@
 -- guaranteed to terminate or not.
 data NonTermination = NonTermination
 
+-- | @since 4.0
 instance Show NonTermination where
     showsPrec _ NonTermination = showString "<<loop>>"
 
+-- | @since 4.0
 instance Exception NonTermination
 
 -----
@@ -389,9 +365,11 @@
 -- package, inside another call to @atomically@.
 data NestedAtomically = NestedAtomically
 
+-- | @since 4.0
 instance Show NestedAtomically where
     showsPrec _ NestedAtomically = showString "Control.Concurrent.STM.atomically was nested"
 
+-- | @since 4.0
 instance Exception NestedAtomically
 
 -----
diff --git a/Control/Monad.hs b/Control/Monad.hs
--- a/Control/Monad.hs
+++ b/Control/Monad.hs
@@ -117,7 +117,7 @@
 forever     :: (Applicative f) => f a -> f b
 {-# INLINE forever #-}
 forever a   = let a' = a *> a' in a'
--- Use explicit sharing here, as it is prevents a space leak regardless of
+-- Use explicit sharing here, as it prevents a space leak regardless of
 -- optimizations.
 
 -- -----------------------------------------------------------------------------
@@ -162,21 +162,21 @@
 -}
 
 foldM          :: (Foldable t, Monad m) => (b -> a -> m b) -> b -> t a -> m b
-{-# INLINEABLE foldM #-}
+{-# INLINABLE foldM #-}
 {-# SPECIALISE foldM :: (a -> b -> IO a) -> a -> [b] -> IO a #-}
 {-# SPECIALISE foldM :: (a -> b -> Maybe a) -> a -> [b] -> Maybe a #-}
 foldM          = foldlM
 
 -- | Like 'foldM', but discards the result.
 foldM_         :: (Foldable t, Monad m) => (b -> a -> m b) -> b -> t a -> m ()
-{-# INLINEABLE foldM_ #-}
+{-# INLINABLE foldM_ #-}
 {-# SPECIALISE foldM_ :: (a -> b -> IO a) -> a -> [b] -> IO () #-}
 {-# SPECIALISE foldM_ :: (a -> b -> Maybe a) -> a -> [b] -> Maybe () #-}
 foldM_ f a xs  = foldlM f a xs >> return ()
 
 {-
-Note [Worker/wrapper transform on replicateM/replicateM_
---------------------------------------------------------
+Note [Worker/wrapper transform on replicateM/replicateM_]
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
 The implementations of replicateM and replicateM_ both leverage the
 worker/wrapper transform. The simpler implementation of replicateM_, as an
@@ -185,23 +185,20 @@
     replicateM_ 0 _ = pure ()
     replicateM_ n f = f *> replicateM_ (n - 1) f
 
-However, the self-recrusive nature of this implementation inhibits inlining,
+However, the self-recursive nature of this implementation inhibits inlining,
 which means we never get to specialise to the action (`f` in the code above).
 By contrast, the implementation below with a local loop makes it possible to
-inline the entire definition (as hapens for foldr, for example) thereby
+inline the entire definition (as happens for foldr, for example) thereby
 specialising for the particular action.
 
 For further information, see this Trac comment, which includes side-by-side
-Core.
-
-https://ghc.haskell.org/trac/ghc/ticket/11795#comment:6
-
+Core: https://ghc.haskell.org/trac/ghc/ticket/11795#comment:6
 -}
 
 -- | @'replicateM' n act@ performs the action @n@ times,
 -- gathering the results.
 replicateM        :: (Applicative m) => Int -> m a -> m [a]
-{-# INLINEABLE replicateM #-}
+{-# INLINABLE replicateM #-}
 {-# SPECIALISE replicateM :: Int -> IO a -> IO [a] #-}
 {-# SPECIALISE replicateM :: Int -> Maybe a -> Maybe [a] #-}
 replicateM cnt0 f =
@@ -213,7 +210,7 @@
 
 -- | Like 'replicateM', but discards the result.
 replicateM_       :: (Applicative m) => Int -> m a -> m ()
-{-# INLINEABLE replicateM_ #-}
+{-# INLINABLE replicateM_ #-}
 {-# SPECIALISE replicateM_ :: Int -> IO a -> IO () #-}
 {-# SPECIALISE replicateM_ :: Int -> Maybe a -> Maybe () #-}
 replicateM_ cnt0 f =
@@ -226,7 +223,7 @@
 
 -- | The reverse of 'when'.
 unless            :: (Applicative f) => Bool -> f () -> f ()
-{-# INLINEABLE unless #-}
+{-# INLINABLE unless #-}
 {-# SPECIALISE unless :: Bool -> IO () -> IO () #-}
 {-# SPECIALISE unless :: Bool -> Maybe () -> Maybe () #-}
 unless p s        =  if p then pure () else s
@@ -254,7 +251,7 @@
 -- @mfilter odd (Just 2) == Nothing@
 
 mfilter :: (MonadPlus m) => (a -> Bool) -> m a -> m a
-{-# INLINEABLE mfilter #-}
+{-# INLINABLE mfilter #-}
 mfilter p ma = do
   a <- ma
   if p a then return a else mzero
diff --git a/Control/Monad/Fail.hs b/Control/Monad/Fail.hs
--- a/Control/Monad/Fail.hs
+++ b/Control/Monad/Fail.hs
@@ -67,12 +67,15 @@
     fail :: String -> m a
 
 
+-- | @since 4.9.0.0
 instance MonadFail Maybe where
     fail _ = Nothing
 
+-- | @since 4.9.0.0
 instance MonadFail [] where
     {-# INLINE fail #-}
     fail _ = []
 
+-- | @since 4.9.0.0
 instance MonadFail IO where
     fail = failIO
diff --git a/Control/Monad/Fix.hs b/Control/Monad/Fix.hs
--- a/Control/Monad/Fix.hs
+++ b/Control/Monad/Fix.hs
@@ -62,60 +62,76 @@
 
 -- Instances of MonadFix for Prelude monads
 
+-- | @since 2.01
 instance MonadFix Maybe where
     mfix f = let a = f (unJust a) in a
              where unJust (Just x) = x
                    unJust Nothing  = errorWithoutStackTrace "mfix Maybe: Nothing"
 
+-- | @since 2.01
 instance MonadFix [] where
     mfix f = case fix (f . head) of
                []    -> []
                (x:_) -> x : mfix (tail . f)
 
+-- | @since 2.01
 instance MonadFix IO where
     mfix = fixIO
 
+-- | @since 2.01
 instance MonadFix ((->) r) where
     mfix f = \ r -> let a = f a r in a
 
+-- | @since 4.3.0.0
 instance MonadFix (Either e) where
     mfix f = let a = f (unRight a) in a
              where unRight (Right x) = x
                    unRight (Left  _) = errorWithoutStackTrace "mfix Either: Left"
 
+-- | @since 2.01
 instance MonadFix (ST s) where
         mfix = fixST
 
 -- Instances of Data.Monoid wrappers
 
+-- | @since 4.8.0.0
 instance MonadFix Dual where
     mfix f   = Dual (fix (getDual . f))
 
+-- | @since 4.8.0.0
 instance MonadFix Sum where
     mfix f   = Sum (fix (getSum . f))
 
+-- | @since 4.8.0.0
 instance MonadFix Product where
     mfix f   = Product (fix (getProduct . f))
 
+-- | @since 4.8.0.0
 instance MonadFix First where
     mfix f   = First (mfix (getFirst . f))
 
+-- | @since 4.8.0.0
 instance MonadFix Last where
     mfix f   = Last (mfix (getLast . f))
 
+-- | @since 4.8.0.0
 instance MonadFix f => MonadFix (Alt f) where
     mfix f   = Alt (mfix (getAlt . f))
 
 -- Instances for GHC.Generics
+-- | @since 4.9.0.0
 instance MonadFix Par1 where
     mfix f = Par1 (fix (unPar1 . f))
 
+-- | @since 4.9.0.0
 instance MonadFix f => MonadFix (Rec1 f) where
     mfix f = Rec1 (mfix (unRec1 . f))
 
+-- | @since 4.9.0.0
 instance MonadFix f => MonadFix (M1 i c f) where
     mfix f = M1 (mfix (unM1. f))
 
+-- | @since 4.9.0.0
 instance (MonadFix f, MonadFix g) => MonadFix (f :*: g) where
     mfix f = (mfix (fstP . f)) :*: (mfix (sndP . f))
       where
diff --git a/Control/Monad/IO/Class.hs b/Control/Monad/IO/Class.hs
--- a/Control/Monad/IO/Class.hs
+++ b/Control/Monad/IO/Class.hs
@@ -32,5 +32,6 @@
     -- | Lift a computation from the 'IO' monad.
     liftIO :: IO a -> m a
 
+-- | @since 4.9.0.0
 instance MonadIO IO where
     liftIO = id
diff --git a/Control/Monad/ST/Imp.hs b/Control/Monad/ST/Imp.hs
--- a/Control/Monad/ST/Imp.hs
+++ b/Control/Monad/ST/Imp.hs
@@ -29,10 +29,12 @@
 
         -- * Unsafe operations
         unsafeInterleaveST,
+        unsafeDupableInterleaveST,
         unsafeIOToST,
         unsafeSTToIO
     ) where
 
-import GHC.ST           ( ST, runST, fixST, unsafeInterleaveST )
+import GHC.ST           ( ST, runST, fixST, unsafeInterleaveST
+                        , unsafeDupableInterleaveST )
 import GHC.Base         ( RealWorld )
 import GHC.IO           ( stToIO, unsafeIOToST, unsafeSTToIO )
diff --git a/Control/Monad/ST/Lazy/Imp.hs b/Control/Monad/ST/Lazy/Imp.hs
--- a/Control/Monad/ST/Lazy/Imp.hs
+++ b/Control/Monad/ST/Lazy/Imp.hs
@@ -1,4 +1,5 @@
 {-# LANGUAGE Unsafe #-}
+{-# LANGUAGE BangPatterns #-}
 {-# LANGUAGE MagicHash, UnboxedTuples, RankNTypes #-}
 {-# OPTIONS_HADDOCK hide #-}
 
@@ -43,6 +44,7 @@
 
 import qualified GHC.ST as GHC.ST
 import GHC.Base
+import qualified Control.Monad.Fail as Fail
 
 -- | The lazy state-transformer monad.
 -- A computation of type @'ST' s a@ transforms an internal state indexed
@@ -59,39 +61,148 @@
 -- The '>>=' and '>>' operations are not strict in the state.  For example,
 --
 -- @'runST' (writeSTRef _|_ v >>= readSTRef _|_ >> return 2) = 2@
-newtype ST s a = ST (State s -> (a, State s))
+newtype ST s a = ST { unST :: State s -> (a, State s) }
+
+-- A lifted state token. This can be imagined as a moment in the timeline
+-- of a lazy state thread. Forcing the token forces all delayed actions in
+-- the thread up until that moment to be performed.
 data State s = S# (State# s)
 
+{- Note [Lazy ST and multithreading]
+
+We used to imagine that passing a polymorphic state token was all that we
+needed to keep state threads separate (see Launchbury and Peyton Jones, 1994:
+https://www.microsoft.com/en-us/research/publication/lazy-functional-state-threads/).
+But this breaks down in the face of concurrency (see #11760). Whereas a strict
+ST computation runs to completion before producing anything, a value produced
+by running a lazy ST computation may contain a thunk that, when forced, will
+lead to further stateful computations. If such a thunk is entered by more than
+one thread, then they may both read from and write to the same references and
+arrays, interfering with each other. To work around this, any time we lazily
+suspend execution of a lazy ST computation, we bind the result pair to a
+NOINLINE binding (ensuring that it is not duplicated) and calculate that
+pair using (unsafePerformIO . evaluate), ensuring that only one thread will
+enter the thunk. We still use lifted state tokens to actually drive execution,
+so in these cases we effectively deal with *two* state tokens: the lifted
+one we get from the previous computation, and the unlifted one we pull out of
+thin air. -}
+
+{- Note [Lazy ST: not producing lazy pairs]
+
+The fixST and strictToLazyST functions used to construct functions that
+produced lazy pairs. Why don't we need that laziness? The ST type is kept
+abstract, so no one outside this module can ever get their hands on a (result,
+State s) pair. We ourselves never match on such pairs when performing ST
+computations unless we also force one of their components. So no one should be
+able to detect the change. By refraining from producing such thunks (which
+reference delayed ST computations), we avoid having to ask whether we have to
+wrap them up with unsafePerformIO. See Note [Lazy ST and multithreading]. -}
+
+-- | This is a terrible hack to prevent a thunk from being entered twice.
+-- Simon Peyton Jones would very much like to be rid of it.
+noDup :: a -> a
+noDup a = runRW# (\s ->
+  case noDuplicate# s of
+    _ -> a)
+
+-- | @since 2.01
 instance Functor (ST s) where
     fmap f m = ST $ \ s ->
       let
-       ST m_a = m
-       (r,new_s) = m_a s
+        -- See Note [Lazy ST and multithreading]
+        {-# NOINLINE res #-}
+        res = noDup (unST m s)
+        (r,new_s) = res
       in
-      (f r,new_s)
+        (f r,new_s)
 
+    x <$ m = ST $ \ s ->
+      let
+        {-# NOINLINE s' #-}
+        -- See Note [Lazy ST and multithreading]
+        s' = noDup (snd (unST m s))
+      in (x, s')
+
+-- | @since 2.01
 instance Applicative (ST s) where
     pure a = ST $ \ s -> (a,s)
-    (<*>) = ap
 
+    fm <*> xm = ST $ \ s ->
+       let
+         {-# NOINLINE res1 #-}
+         !res1 = unST fm s
+         !(f, s') = res1
+
+         {-# NOINLINE res2 #-}
+         -- See Note [Lazy ST and multithreading]
+         res2 = noDup (unST xm s')
+         (x, s'') = res2
+       in (f x, s'')
+    -- Why can we use a strict binding for res1? If someone
+    -- forces the (f x, s'') pair, then they must need
+    -- f or s''. To get s'', they need s'.
+
+    liftA2 f m n = ST $ \ s ->
+      let
+        {-# NOINLINE res1 #-}
+        -- See Note [Lazy ST and multithreading]
+        res1 = noDup (unST m s)
+        (x, s') = res1
+
+        {-# NOINLINE res2 #-}
+        res2 = noDup (unST n s')
+        (y, s'') = res2
+      in (f x y, s'')
+    -- We don't get to be strict in liftA2, but we clear out a
+    -- NOINLINE in comparison to the default definition, which may
+    -- help the simplifier.
+
+    m *> n = ST $ \s ->
+       let
+         {-# NOINLINE s' #-}
+         -- See Note [Lazy ST and multithreading]
+         s' = noDup (snd (unST m s))
+       in unST n s'
+
+    m <* n = ST $ \s ->
+       let
+         {-# NOINLINE res1 #-}
+         !res1 = unST m s
+         !(mr, s') = res1
+
+         {-# NOINLINE s'' #-}
+         -- See Note [Lazy ST and multithreading]
+         s'' = noDup (snd (unST n s'))
+       in (mr, s'')
+    -- Why can we use a strict binding for res1? The same reason as
+    -- in <*>. If someone demands the (mr, s'') pair, then they will
+    -- force mr or s''. To get s'', they need s'.
+
+-- | @since 2.01
 instance Monad (ST s) where
 
-        fail s   = errorWithoutStackTrace s
+    fail s   = errorWithoutStackTrace s
 
-        (ST m) >>= k
-         = ST $ \ s ->
-           let
-             (r,new_s) = m s
-             ST k_a = k r
-           in
-           k_a new_s
+    (>>) = (*>)
 
-{-# NOINLINE runST #-}
+    m >>= k = ST $ \ s ->
+       let
+         -- See Note [Lazy ST and multithreading]
+         {-# NOINLINE res #-}
+         res = noDup (unST m s)
+         (r,new_s) = res
+       in
+         unST (k r) new_s
+
+-- | @since 4.10
+instance Fail.MonadFail (ST s) where
+    fail s = errorWithoutStackTrace s
+
 -- | Return the value computed by a state transformer computation.
 -- The @forall@ ensures that the internal state used by the 'ST'
 -- computation is inaccessible to the rest of the program.
 runST :: (forall s. ST s a) -> a
-runST st = case st of ST the_st -> let (r,_) = the_st (S# realWorld#) in r
+runST (ST st) = runRW# (\s -> case st (S# s) of (r, _) -> r)
 
 -- | Allow the result of a state transformer computation to be used (lazily)
 -- inside the computation.
@@ -99,11 +210,15 @@
 fixST :: (a -> ST s a) -> ST s a
 fixST m = ST (\ s -> 
                 let 
-                   ST m_r = m r
-                   (r,s') = m_r s
-                in
-                   (r,s'))
+                   q@(r,_s') = unST (m r) s
+                in q)
+-- Why don't we need unsafePerformIO in fixST? We create a thunk, q,
+-- to perform a lazy state computation, and we pass a reference to that
+-- thunk, r, to m. Uh oh? No, I think it should be fine, because that thunk
+-- itself is demanded directly in the `let` body. See also
+-- Note [Lazy ST: not producing lazy pairs].
 
+-- | @since 2.01
 instance MonadFix (ST s) where
         mfix = fixST
 
@@ -116,13 +231,10 @@
 the lazy state thread it returns is demanded.
 -}
 strictToLazyST :: ST.ST s a -> ST s a
-strictToLazyST m = ST $ \s ->
-        let 
-           pr = case s of { S# s# -> GHC.ST.liftST m s# }
-           r  = case pr of { GHC.ST.STret _ v -> v }
-           s' = case pr of { GHC.ST.STret s2# _ -> S# s2# }
-        in
-        (r, s')
+strictToLazyST (GHC.ST.ST m) = ST $ \(S# s) ->
+  case m s of
+    (# s', a #) -> (a, S# s')
+-- See Note [Lazy ST: not producing lazy pairs]
 
 {-| 
 Convert a lazy 'ST' computation into a strict one.
diff --git a/Control/Monad/ST/Unsafe.hs b/Control/Monad/ST/Unsafe.hs
--- a/Control/Monad/ST/Unsafe.hs
+++ b/Control/Monad/ST/Unsafe.hs
@@ -21,6 +21,7 @@
 module Control.Monad.ST.Unsafe (
         -- * Unsafe operations
         unsafeInterleaveST,
+        unsafeDupableInterleaveST,
         unsafeIOToST,
         unsafeSTToIO
     ) where
diff --git a/Control/Monad/Zip.hs b/Control/Monad/Zip.hs
--- a/Control/Monad/Zip.hs
+++ b/Control/Monad/Zip.hs
@@ -19,6 +19,7 @@
 module Control.Monad.Zip where
 
 import Control.Monad (liftM, liftM2)
+import Data.Functor.Identity
 import Data.Monoid
 import Data.Proxy
 import GHC.Generics
@@ -52,48 +53,67 @@
     -- you can implement it more efficiently than the
     -- above default code.  See Trac #4370 comment by giorgidze
 
+-- | @since 4.3.1.0
 instance MonadZip [] where
     mzip     = zip
     mzipWith = zipWith
     munzip   = unzip
 
+-- | @since 4.8.0.0
+instance MonadZip Identity where
+    mzipWith                 = liftM2
+    munzip (Identity (a, b)) = (Identity a, Identity b)
+
+-- | @since 4.8.0.0
 instance MonadZip Dual where
     -- Cannot use coerce, it's unsafe
     mzipWith = liftM2
 
+-- | @since 4.8.0.0
 instance MonadZip Sum where
     mzipWith = liftM2
 
+-- | @since 4.8.0.0
 instance MonadZip Product where
     mzipWith = liftM2
 
+-- | @since 4.8.0.0
 instance MonadZip Maybe where
     mzipWith = liftM2
 
+-- | @since 4.8.0.0
 instance MonadZip First where
     mzipWith = liftM2
 
+-- | @since 4.8.0.0
 instance MonadZip Last where
     mzipWith = liftM2
 
+-- | @since 4.8.0.0
 instance MonadZip f => MonadZip (Alt f) where
     mzipWith f (Alt ma) (Alt mb) = Alt (mzipWith f ma mb)
 
+-- | @since 4.9.0.0
 instance MonadZip Proxy where
     mzipWith _ _ _ = Proxy
 
 -- Instances for GHC.Generics
+-- | @since 4.9.0.0
 instance MonadZip U1 where
     mzipWith _ _ _ = U1
 
+-- | @since 4.9.0.0
 instance MonadZip Par1 where
     mzipWith = liftM2
 
+-- | @since 4.9.0.0
 instance MonadZip f => MonadZip (Rec1 f) where
     mzipWith f (Rec1 fa) (Rec1 fb) = Rec1 (mzipWith f fa fb)
 
+-- | @since 4.9.0.0
 instance MonadZip f => MonadZip (M1 i c f) where
     mzipWith f (M1 fa) (M1 fb) = M1 (mzipWith f fa fb)
 
+-- | @since 4.9.0.0
 instance (MonadZip f, MonadZip g) => MonadZip (f :*: g) where
     mzipWith f (x1 :*: y1) (x2 :*: y2) = mzipWith f x1 x2 :*: mzipWith f y1 y2
diff --git a/Data/Bifoldable.hs b/Data/Bifoldable.hs
new file mode 100644
--- /dev/null
+++ b/Data/Bifoldable.hs
@@ -0,0 +1,429 @@
+{-# LANGUAGE Safe #-}
+{-# LANGUAGE ScopedTypeVariables #-}
+
+-----------------------------------------------------------------------------
+-- |
+-- Module      :  Data.Bifoldable
+-- Copyright   :  (C) 2011-2016 Edward Kmett
+-- License     :  BSD-style (see the file LICENSE)
+--
+-- Maintainer  :  libraries@haskell.org
+-- Stability   :  provisional
+-- Portability :  portable
+--
+-- @since 4.10.0.0
+----------------------------------------------------------------------------
+module Data.Bifoldable
+  ( Bifoldable(..)
+  , bifoldr'
+  , bifoldr1
+  , bifoldrM
+  , bifoldl'
+  , bifoldl1
+  , bifoldlM
+  , bitraverse_
+  , bifor_
+  , bimapM_
+  , biforM_
+  , bimsum
+  , bisequenceA_
+  , bisequence_
+  , biasum
+  , biList
+  , binull
+  , bilength
+  , bielem
+  , bimaximum
+  , biminimum
+  , bisum
+  , biproduct
+  , biconcat
+  , biconcatMap
+  , biand
+  , bior
+  , biany
+  , biall
+  , bimaximumBy
+  , biminimumBy
+  , binotElem
+  , bifind
+  ) where
+
+import Control.Applicative
+import Data.Functor.Utils (Max(..), Min(..), (#.))
+import Data.Maybe (fromMaybe)
+import Data.Monoid
+import GHC.Generics (K1(..))
+
+-- | 'Bifoldable' identifies foldable structures with two different varieties
+-- of elements (as opposed to 'Foldable', which has one variety of element).
+-- Common examples are 'Either' and '(,)':
+--
+-- > instance Bifoldable Either where
+-- >   bifoldMap f _ (Left  a) = f a
+-- >   bifoldMap _ g (Right b) = g b
+-- >
+-- > instance Bifoldable (,) where
+-- >   bifoldr f g z (a, b) = f a (g b z)
+--
+-- A minimal 'Bifoldable' definition consists of either 'bifoldMap' or
+-- 'bifoldr'. When defining more than this minimal set, one should ensure
+-- that the following identities hold:
+--
+-- @
+-- 'bifold' ≡ 'bifoldMap' 'id' 'id'
+-- 'bifoldMap' f g ≡ 'bifoldr' ('mappend' . f) ('mappend' . g) 'mempty'
+-- 'bifoldr' f g z t ≡ 'appEndo' ('bifoldMap' (Endo . f) (Endo . g) t) z
+-- @
+--
+-- If the type is also a 'Bifunctor' instance, it should satisfy:
+--
+-- > 'bifoldMap' f g ≡ 'bifold' . 'bimap' f g
+--
+-- which implies that
+--
+-- > 'bifoldMap' f g . 'bimap' h i ≡ 'bifoldMap' (f . h) (g . i)
+--
+-- @since 4.10.0.0
+class Bifoldable p where
+  {-# MINIMAL bifoldr | bifoldMap #-}
+
+  -- | Combines the elements of a structure using a monoid.
+  --
+  -- @'bifold' ≡ 'bifoldMap' 'id' 'id'@
+  --
+  -- @since 4.10.0.0
+  bifold :: Monoid m => p m m -> m
+  bifold = bifoldMap id id
+
+  -- | Combines the elements of a structure, given ways of mapping them to a
+  -- common monoid.
+  --
+  -- @'bifoldMap' f g
+  --     ≡ 'bifoldr' ('mappend' . f) ('mappend' . g) 'mempty'@
+  --
+  -- @since 4.10.0.0
+  bifoldMap :: Monoid m => (a -> m) -> (b -> m) -> p a b -> m
+  bifoldMap f g = bifoldr (mappend . f) (mappend . g) mempty
+
+  -- | Combines the elements of a structure in a right associative manner.
+  -- Given a hypothetical function @toEitherList :: p a b -> [Either a b]@
+  -- yielding a list of all elements of a structure in order, the following
+  -- would hold:
+  --
+  -- @'bifoldr' f g z ≡ 'foldr' ('either' f g) z . toEitherList@
+  --
+  -- @since 4.10.0.0
+  bifoldr :: (a -> c -> c) -> (b -> c -> c) -> c -> p a b -> c
+  bifoldr f g z t = appEndo (bifoldMap (Endo #. f) (Endo #. g) t) z
+
+  -- | Combines the elments of a structure in a left associative manner. Given
+  -- a hypothetical function @toEitherList :: p a b -> [Either a b]@ yielding a
+  -- list of all elements of a structure in order, the following would hold:
+  --
+  -- @'bifoldl' f g z
+  --     ≡ 'foldl' (\acc -> 'either' (f acc) (g acc)) z . toEitherList@
+  --
+  -- Note that if you want an efficient left-fold, you probably want to use
+  -- 'bifoldl'' instead of 'bifoldl'. The reason is that the latter does not
+  -- force the "inner" results, resulting in a thunk chain which then must be
+  -- evaluated from the outside-in.
+  --
+  -- @since 4.10.0.0
+  bifoldl :: (c -> a -> c) -> (c -> b -> c) -> c -> p a b -> c
+  bifoldl f g z t = appEndo (getDual (bifoldMap (Dual . Endo . flip f)
+                                                (Dual . Endo . flip g) t)) z
+
+-- | @since 4.10.0.0
+instance Bifoldable (,) where
+  bifoldMap f g ~(a, b) = f a `mappend` g b
+
+-- | @since 4.10.0.0
+instance Bifoldable Const where
+  bifoldMap f _ (Const a) = f a
+
+-- | @since 4.10.0.0
+instance Bifoldable (K1 i) where
+  bifoldMap f _ (K1 c) = f c
+
+-- | @since 4.10.0.0
+instance Bifoldable ((,,) x) where
+  bifoldMap f g ~(_,a,b) = f a `mappend` g b
+
+-- | @since 4.10.0.0
+instance Bifoldable ((,,,) x y) where
+  bifoldMap f g ~(_,_,a,b) = f a `mappend` g b
+
+-- | @since 4.10.0.0
+instance Bifoldable ((,,,,) x y z) where
+  bifoldMap f g ~(_,_,_,a,b) = f a `mappend` g b
+
+-- | @since 4.10.0.0
+instance Bifoldable ((,,,,,) x y z w) where
+  bifoldMap f g ~(_,_,_,_,a,b) = f a `mappend` g b
+
+-- | @since 4.10.0.0
+instance Bifoldable ((,,,,,,) x y z w v) where
+  bifoldMap f g ~(_,_,_,_,_,a,b) = f a `mappend` g b
+
+-- | @since 4.10.0.0
+instance Bifoldable Either where
+  bifoldMap f _ (Left a) = f a
+  bifoldMap _ g (Right b) = g b
+
+-- | As 'bifoldr', but strict in the result of the reduction functions at each
+-- step.
+--
+-- @since 4.10.0.0
+bifoldr' :: Bifoldable t => (a -> c -> c) -> (b -> c -> c) -> c -> t a b -> c
+bifoldr' f g z0 xs = bifoldl f' g' id xs z0 where
+  f' k x z = k $! f x z
+  g' k x z = k $! g x z
+
+-- | A variant of 'bifoldr' that has no base case,
+-- and thus may only be applied to non-empty structures.
+--
+-- @since 4.10.0.0
+bifoldr1 :: Bifoldable t => (a -> a -> a) -> t a a -> a
+bifoldr1 f xs = fromMaybe (error "bifoldr1: empty structure")
+                  (bifoldr mbf mbf Nothing xs)
+  where
+    mbf x m = Just (case m of
+                      Nothing -> x
+                      Just y  -> f x y)
+
+-- | Right associative monadic bifold over a structure.
+--
+-- @since 4.10.0.0
+bifoldrM :: (Bifoldable t, Monad m)
+         => (a -> c -> m c) -> (b -> c -> m c) -> c -> t a b -> m c
+bifoldrM f g z0 xs = bifoldl f' g' return xs z0 where
+  f' k x z = f x z >>= k
+  g' k x z = g x z >>= k
+
+-- | As 'bifoldl', but strict in the result of the reduction functions at each
+-- step.
+--
+-- This ensures that each step of the bifold is forced to weak head normal form
+-- before being applied, avoiding the collection of thunks that would otherwise
+-- occur. This is often what you want to strictly reduce a finite structure to
+-- a single, monolithic result (e.g., 'bilength').
+--
+-- @since 4.10.0.0
+bifoldl':: Bifoldable t => (a -> b -> a) -> (a -> c -> a) -> a -> t b c -> a
+bifoldl' f g z0 xs = bifoldr f' g' id xs z0 where
+  f' x k z = k $! f z x
+  g' x k z = k $! g z x
+
+-- | A variant of 'bifoldl' that has no base case,
+-- and thus may only be applied to non-empty structures.
+--
+-- @since 4.10.0.0
+bifoldl1 :: Bifoldable t => (a -> a -> a) -> t a a -> a
+bifoldl1 f xs = fromMaybe (error "bifoldl1: empty structure")
+                  (bifoldl mbf mbf Nothing xs)
+  where
+    mbf m y = Just (case m of
+                      Nothing -> y
+                      Just x  -> f x y)
+
+-- | Left associative monadic bifold over a structure.
+--
+-- @since 4.10.0.0
+bifoldlM :: (Bifoldable t, Monad m)
+         => (a -> b -> m a) -> (a -> c -> m a) -> a -> t b c -> m a
+bifoldlM f g z0 xs = bifoldr f' g' return xs z0 where
+  f' x k z = f z x >>= k
+  g' x k z = g z x >>= k
+
+-- | Map each element of a structure using one of two actions, evaluate these
+-- actions from left to right, and ignore the results. For a version that
+-- doesn't ignore the results, see 'Data.Bitraversable.bitraverse'.
+--
+-- @since 4.10.0.0
+bitraverse_ :: (Bifoldable t, Applicative f)
+            => (a -> f c) -> (b -> f d) -> t a b -> f ()
+bitraverse_ f g = bifoldr ((*>) . f) ((*>) . g) (pure ())
+
+-- | As 'bitraverse_', but with the structure as the primary argument. For a
+-- version that doesn't ignore the results, see 'Data.Bitraversable.bifor'.
+--
+-- >>> > bifor_ ('a', "bc") print (print . reverse)
+-- 'a'
+-- "cb"
+--
+-- @since 4.10.0.0
+bifor_ :: (Bifoldable t, Applicative f)
+       => t a b -> (a -> f c) -> (b -> f d) -> f ()
+bifor_ t f g = bitraverse_ f g t
+
+-- | Alias for 'bitraverse_'.
+--
+-- @since 4.10.0.0
+bimapM_ :: (Bifoldable t, Applicative f)
+        => (a -> f c) -> (b -> f d) -> t a b -> f ()
+bimapM_ = bitraverse_
+
+-- | Alias for 'bifor_'.
+--
+-- @since 4.10.0.0
+biforM_ :: (Bifoldable t, Applicative f)
+        => t a b ->  (a -> f c) -> (b -> f d) -> f ()
+biforM_ = bifor_
+
+-- | Alias for 'bisequence_'.
+--
+-- @since 4.10.0.0
+bisequenceA_ :: (Bifoldable t, Applicative f) => t (f a) (f b) -> f ()
+bisequenceA_ = bisequence_
+
+-- | Evaluate each action in the structure from left to right, and ignore the
+-- results. For a version that doesn't ignore the results, see
+-- 'Data.Bitraversable.bisequence'.
+--
+-- @since 4.10.0.0
+bisequence_ :: (Bifoldable t, Applicative f) => t (f a) (f b) -> f ()
+bisequence_ = bifoldr (*>) (*>) (pure ())
+
+-- | The sum of a collection of actions, generalizing 'biconcat'.
+--
+-- @since 4.10.0.0
+biasum :: (Bifoldable t, Alternative f) => t (f a) (f a) -> f a
+biasum = bifoldr (<|>) (<|>) empty
+
+-- | Alias for 'biasum'.
+--
+-- @since 4.10.0.0
+bimsum :: (Bifoldable t, Alternative f) => t (f a) (f a) -> f a
+bimsum = biasum
+
+-- | Collects the list of elements of a structure, from left to right.
+--
+-- @since 4.10.0.0
+biList :: Bifoldable t => t a a -> [a]
+biList = bifoldr (:) (:) []
+
+-- | Test whether the structure is empty.
+--
+-- @since 4.10.0.0
+binull :: Bifoldable t => t a b -> Bool
+binull = bifoldr (\_ _ -> False) (\_ _ -> False) True
+
+-- | Returns the size/length of a finite structure as an 'Int'.
+--
+-- @since 4.10.0.0
+bilength :: Bifoldable t => t a b -> Int
+bilength = bifoldl' (\c _ -> c+1) (\c _ -> c+1) 0
+
+-- | Does the element occur in the structure?
+--
+-- @since 4.10.0.0
+bielem :: (Bifoldable t, Eq a) => a -> t a a -> Bool
+bielem x = biany (== x) (== x)
+
+-- | Reduces a structure of lists to the concatenation of those lists.
+--
+-- @since 4.10.0.0
+biconcat :: Bifoldable t => t [a] [a] -> [a]
+biconcat = bifold
+
+-- | The largest element of a non-empty structure.
+--
+-- @since 4.10.0.0
+bimaximum :: forall t a. (Bifoldable t, Ord a) => t a a -> a
+bimaximum = fromMaybe (error "bimaximum: empty structure") .
+    getMax . bifoldMap mj mj
+  where mj = Max #. (Just :: a -> Maybe a)
+
+-- | The least element of a non-empty structure.
+--
+-- @since 4.10.0.0
+biminimum :: forall t a. (Bifoldable t, Ord a) => t a a -> a
+biminimum = fromMaybe (error "biminimum: empty structure") .
+    getMin . bifoldMap mj mj
+  where mj = Min #. (Just :: a -> Maybe a)
+
+-- | The 'bisum' function computes the sum of the numbers of a structure.
+--
+-- @since 4.10.0.0
+bisum :: (Bifoldable t, Num a) => t a a -> a
+bisum = getSum #. bifoldMap Sum Sum
+
+-- | The 'biproduct' function computes the product of the numbers of a
+-- structure.
+--
+-- @since 4.10.0.0
+biproduct :: (Bifoldable t, Num a) => t a a -> a
+biproduct = getProduct #. bifoldMap Product Product
+
+-- | Given a means of mapping the elements of a structure to lists, computes the
+-- concatenation of all such lists in order.
+--
+-- @since 4.10.0.0
+biconcatMap :: Bifoldable t => (a -> [c]) -> (b -> [c]) -> t a b -> [c]
+biconcatMap = bifoldMap
+
+-- | 'biand' returns the conjunction of a container of Bools.  For the
+-- result to be 'True', the container must be finite; 'False', however,
+-- results from a 'False' value finitely far from the left end.
+--
+-- @since 4.10.0.0
+biand :: Bifoldable t => t Bool Bool -> Bool
+biand = getAll #. bifoldMap All All
+
+-- | 'bior' returns the disjunction of a container of Bools.  For the
+-- result to be 'False', the container must be finite; 'True', however,
+-- results from a 'True' value finitely far from the left end.
+--
+-- @since 4.10.0.0
+bior :: Bifoldable t => t Bool Bool -> Bool
+bior = getAny #. bifoldMap Any Any
+
+-- | Determines whether any element of the structure satisfies its appropriate
+-- predicate argument.
+--
+-- @since 4.10.0.0
+biany :: Bifoldable t => (a -> Bool) -> (b -> Bool) -> t a b -> Bool
+biany p q = getAny #. bifoldMap (Any . p) (Any . q)
+
+-- | Determines whether all elements of the structure satisfy their appropriate
+-- predicate argument.
+--
+-- @since 4.10.0.0
+biall :: Bifoldable t => (a -> Bool) -> (b -> Bool) -> t a b -> Bool
+biall p q = getAll #. bifoldMap (All . p) (All . q)
+
+-- | The largest element of a non-empty structure with respect to the
+-- given comparison function.
+--
+-- @since 4.10.0.0
+bimaximumBy :: Bifoldable t => (a -> a -> Ordering) -> t a a -> a
+bimaximumBy cmp = bifoldr1 max'
+  where max' x y = case cmp x y of
+                        GT -> x
+                        _  -> y
+
+-- | The least element of a non-empty structure with respect to the
+-- given comparison function.
+--
+-- @since 4.10.0.0
+biminimumBy :: Bifoldable t => (a -> a -> Ordering) -> t a a -> a
+biminimumBy cmp = bifoldr1 min'
+  where min' x y = case cmp x y of
+                        GT -> y
+                        _  -> x
+
+-- | 'binotElem' is the negation of 'bielem'.
+--
+-- @since 4.10.0.0
+binotElem :: (Bifoldable t, Eq a) => a -> t a a-> Bool
+binotElem x =  not . bielem x
+
+-- | The 'bifind' function takes a predicate and a structure and returns
+-- the leftmost element of the structure matching the predicate, or
+-- 'Nothing' if there is no such element.
+--
+-- @since 4.10.0.0
+bifind :: Bifoldable t => (a -> Bool) -> t a a -> Maybe a
+bifind p = getFirst . bifoldMap finder finder
+  where finder x = First (if p x then Just x else Nothing)
diff --git a/Data/Bifunctor.hs b/Data/Bifunctor.hs
--- a/Data/Bifunctor.hs
+++ b/Data/Bifunctor.hs
@@ -75,31 +75,40 @@
     second = bimap id
 
 
+-- | @since 4.8.0.0
 instance Bifunctor (,) where
     bimap f g ~(a, b) = (f a, g b)
 
+-- | @since 4.8.0.0
 instance Bifunctor ((,,) x1) where
     bimap f g ~(x1, a, b) = (x1, f a, g b)
 
+-- | @since 4.8.0.0
 instance Bifunctor ((,,,) x1 x2) where
     bimap f g ~(x1, x2, a, b) = (x1, x2, f a, g b)
 
+-- | @since 4.8.0.0
 instance Bifunctor ((,,,,) x1 x2 x3) where
     bimap f g ~(x1, x2, x3, a, b) = (x1, x2, x3, f a, g b)
 
+-- | @since 4.8.0.0
 instance Bifunctor ((,,,,,) x1 x2 x3 x4) where
     bimap f g ~(x1, x2, x3, x4, a, b) = (x1, x2, x3, x4, f a, g b)
 
+-- | @since 4.8.0.0
 instance Bifunctor ((,,,,,,) x1 x2 x3 x4 x5) where
     bimap f g ~(x1, x2, x3, x4, x5, a, b) = (x1, x2, x3, x4, x5, f a, g b)
 
 
+-- | @since 4.8.0.0
 instance Bifunctor Either where
     bimap f _ (Left a) = Left (f a)
     bimap _ g (Right b) = Right (g b)
 
+-- | @since 4.8.0.0
 instance Bifunctor Const where
     bimap f _ (Const a) = Const (f a)
 
+-- | @since 4.9.0.0
 instance Bifunctor (K1 i) where
     bimap f _ (K1 c) = K1 (f c)
diff --git a/Data/Bitraversable.hs b/Data/Bitraversable.hs
new file mode 100644
--- /dev/null
+++ b/Data/Bitraversable.hs
@@ -0,0 +1,248 @@
+{-# LANGUAGE Trustworthy #-}
+{-# LANGUAGE ScopedTypeVariables #-}
+
+-----------------------------------------------------------------------------
+-- |
+-- Module      :  Data.Bitraversable
+-- Copyright   :  (C) 2011-2016 Edward Kmett
+-- License     :  BSD-style (see the file LICENSE)
+--
+-- Maintainer  :  libraries@haskell.org
+-- Stability   :  provisional
+-- Portability :  portable
+--
+-- @since 4.10.0.0
+----------------------------------------------------------------------------
+module Data.Bitraversable
+  ( Bitraversable(..)
+  , bisequenceA
+  , bisequence
+  , bimapM
+  , bifor
+  , biforM
+  , bimapAccumL
+  , bimapAccumR
+  , bimapDefault
+  , bifoldMapDefault
+  ) where
+
+import Control.Applicative
+import Data.Bifunctor
+import Data.Bifoldable
+import Data.Coerce
+import Data.Functor.Identity (Identity(..))
+import Data.Functor.Utils (StateL(..), StateR(..))
+import GHC.Generics (K1(..))
+
+-- | 'Bitraversable' identifies bifunctorial data structures whose elements can
+-- be traversed in order, performing 'Applicative' or 'Monad' actions at each
+-- element, and collecting a result structure with the same shape.
+--
+-- As opposed to 'Traversable' data structures, which have one variety of
+-- element on which an action can be performed, 'Bitraversable' data structures
+-- have two such varieties of elements.
+--
+-- A definition of 'bitraverse' must satisfy the following laws:
+--
+-- [/naturality/]
+--   @'bitraverse' (t . f) (t . g) ≡ t . 'bitraverse' f g@
+--   for every applicative transformation @t@
+--
+-- [/identity/]
+--   @'bitraverse' 'Identity' 'Identity' ≡ 'Identity'@
+--
+-- [/composition/]
+--   @'Compose' . 'fmap' ('bitraverse' g1 g2) . 'bitraverse' f1 f2
+--     ≡ 'traverse' ('Compose' . 'fmap' g1 . f1) ('Compose' . 'fmap' g2 . f2)@
+--
+-- where an /applicative transformation/ is a function
+--
+-- @t :: ('Applicative' f, 'Applicative' g) => f a -> g a@
+--
+-- preserving the 'Applicative' operations:
+--
+-- @
+-- t ('pure' x) = 'pure' x
+-- t (f '<*>' x) = t f '<*>' t x
+-- @
+--
+-- and the identity functor 'Identity' and composition functors 'Compose' are
+-- defined as
+--
+-- > newtype Identity a = Identity { runIdentity :: a }
+-- >
+-- > instance Functor Identity where
+-- >   fmap f (Identity x) = Identity (f x)
+-- >
+-- > instance Applicative Identity where
+-- >   pure = Identity
+-- >   Identity f <*> Identity x = Identity (f x)
+-- >
+-- > newtype Compose f g a = Compose (f (g a))
+-- >
+-- > instance (Functor f, Functor g) => Functor (Compose f g) where
+-- >   fmap f (Compose x) = Compose (fmap (fmap f) x)
+-- >
+-- > instance (Applicative f, Applicative g) => Applicative (Compose f g) where
+-- >   pure = Compose . pure . pure
+-- >   Compose f <*> Compose x = Compose ((<*>) <$> f <*> x)
+--
+-- Some simple examples are 'Either' and '(,)':
+--
+-- > instance Bitraversable Either where
+-- >   bitraverse f _ (Left x) = Left <$> f x
+-- >   bitraverse _ g (Right y) = Right <$> g y
+-- >
+-- > instance Bitraversable (,) where
+-- >   bitraverse f g (x, y) = (,) <$> f x <*> g y
+--
+-- 'Bitraversable' relates to its superclasses in the following ways:
+--
+-- @
+-- 'bimap' f g ≡ 'runIdentity' . 'bitraverse' ('Identity' . f) ('Identity' . g)
+-- 'bifoldMap' f g = 'getConst' . 'bitraverse' ('Const' . f) ('Const' . g)
+-- @
+--
+-- These are available as 'bimapDefault' and 'bifoldMapDefault' respectively.
+--
+-- @since 4.10.0.0
+class (Bifunctor t, Bifoldable t) => Bitraversable t where
+  -- | Evaluates the relevant functions at each element in the structure,
+  -- running the action, and builds a new structure with the same shape, using
+  -- the results produced from sequencing the actions.
+  --
+  -- @'bitraverse' f g ≡ 'bisequenceA' . 'bimap' f g@
+  --
+  -- For a version that ignores the results, see 'bitraverse_'.
+  --
+  -- @since 4.10.0.0
+  bitraverse :: Applicative f => (a -> f c) -> (b -> f d) -> t a b -> f (t c d)
+  bitraverse f g = bisequenceA . bimap f g
+
+-- | Alias for 'bisequence'.
+--
+-- @since 4.10.0.0
+bisequenceA :: (Bitraversable t, Applicative f) => t (f a) (f b) -> f (t a b)
+bisequenceA = bisequence
+
+-- | Alias for 'bitraverse'.
+--
+-- @since 4.10.0.0
+bimapM :: (Bitraversable t, Applicative f)
+       => (a -> f c) -> (b -> f d) -> t a b -> f (t c d)
+bimapM = bitraverse
+
+-- | Sequences all the actions in a structure, building a new structure with
+-- the same shape using the results of the actions. For a version that ignores
+-- the results, see 'bisequence_'.
+--
+-- @'bisequence' ≡ 'bitraverse' 'id' 'id'@
+--
+-- @since 4.10.0.0
+bisequence :: (Bitraversable t, Applicative f) => t (f a) (f b) -> f (t a b)
+bisequence = bitraverse id id
+
+-- | @since 4.10.0.0
+instance Bitraversable (,) where
+  bitraverse f g ~(a, b) = liftA2 (,) (f a) (g b)
+
+-- | @since 4.10.0.0
+instance Bitraversable ((,,) x) where
+  bitraverse f g ~(x, a, b) = liftA2 ((,,) x) (f a) (g b)
+
+-- | @since 4.10.0.0
+instance Bitraversable ((,,,) x y) where
+  bitraverse f g ~(x, y, a, b) = liftA2 ((,,,) x y) (f a) (g b)
+
+-- | @since 4.10.0.0
+instance Bitraversable ((,,,,) x y z) where
+  bitraverse f g ~(x, y, z, a, b) = liftA2 ((,,,,) x y z) (f a) (g b)
+
+-- | @since 4.10.0.0
+instance Bitraversable ((,,,,,) x y z w) where
+  bitraverse f g ~(x, y, z, w, a, b) = liftA2 ((,,,,,) x y z w) (f a) (g b)
+
+-- | @since 4.10.0.0
+instance Bitraversable ((,,,,,,) x y z w v) where
+  bitraverse f g ~(x, y, z, w, v, a, b) =
+    liftA2 ((,,,,,,) x y z w v) (f a) (g b)
+
+-- | @since 4.10.0.0
+instance Bitraversable Either where
+  bitraverse f _ (Left a) = Left <$> f a
+  bitraverse _ g (Right b) = Right <$> g b
+
+-- | @since 4.10.0.0
+instance Bitraversable Const where
+  bitraverse f _ (Const a) = Const <$> f a
+
+-- | @since 4.10.0.0
+instance Bitraversable (K1 i) where
+  bitraverse f _ (K1 c) = K1 <$> f c
+
+-- | 'bifor' is 'bitraverse' with the structure as the first argument. For a
+-- version that ignores the results, see 'bifor_'.
+--
+-- @since 4.10.0.0
+bifor :: (Bitraversable t, Applicative f)
+      => t a b -> (a -> f c) -> (b -> f d) -> f (t c d)
+bifor t f g = bitraverse f g t
+
+-- | Alias for 'bifor'.
+--
+-- @since 4.10.0.0
+biforM :: (Bitraversable t, Applicative f)
+       => t a b -> (a -> f c) -> (b -> f d) -> f (t c d)
+biforM = bifor
+
+-- | The 'bimapAccumL' function behaves like a combination of 'bimap' and
+-- 'bifoldl'; it traverses a structure from left to right, threading a state
+-- of type @a@ and using the given actions to compute new elements for the
+-- structure.
+--
+-- @since 4.10.0.0
+bimapAccumL :: Bitraversable t => (a -> b -> (a, c)) -> (a -> d -> (a, e))
+            -> a -> t b d -> (a, t c e)
+bimapAccumL f g s t
+  = runStateL (bitraverse (StateL . flip f) (StateL . flip g) t) s
+
+-- | The 'bimapAccumR' function behaves like a combination of 'bimap' and
+-- 'bifoldl'; it traverses a structure from right to left, threading a state
+-- of type @a@ and using the given actions to compute new elements for the
+-- structure.
+--
+-- @since 4.10.0.0
+bimapAccumR :: Bitraversable t => (a -> b -> (a, c)) -> (a -> d -> (a, e))
+            -> a -> t b d -> (a, t c e)
+bimapAccumR f g s t
+  = runStateR (bitraverse (StateR . flip f) (StateR . flip g) t) s
+
+-- | A default definition of 'bimap' in terms of the 'Bitraversable'
+-- operations.
+--
+-- @'bimapDefault' f g ≡
+--     'runIdentity' . 'bitraverse' ('Identity' . f) ('Identity' . g)@
+--
+-- @since 4.10.0.0
+bimapDefault :: forall t a b c d . Bitraversable t
+             => (a -> b) -> (c -> d) -> t a c -> t b d
+-- See Note [Function coercion] in Data.Functor.Utils.
+bimapDefault = coerce
+  (bitraverse :: (a -> Identity b)
+              -> (c -> Identity d) -> t a c -> Identity (t b d))
+{-# INLINE bimapDefault #-}
+
+-- | A default definition of 'bifoldMap' in terms of the 'Bitraversable'
+-- operations.
+--
+-- @'bifoldMapDefault' f g ≡
+--    'getConst' . 'bitraverse' ('Const' . f) ('Const' . g)@
+--
+-- @since 4.10.0.0
+bifoldMapDefault :: forall t m a b . (Bitraversable t, Monoid m)
+                 => (a -> m) -> (b -> m) -> t a b -> m
+-- See Note [Function coercion] in Data.Functor.Utils.
+bifoldMapDefault = coerce
+  (bitraverse :: (a -> Const m ())
+              -> (b -> Const m ()) -> t a b -> Const m (t () ()))
+{-# INLINE bifoldMapDefault #-}
diff --git a/Data/Bits.hs b/Data/Bits.hs
--- a/Data/Bits.hs
+++ b/Data/Bits.hs
@@ -397,7 +397,9 @@
 {-# INLINABLE popCountDefault #-}
 
 
--- Interpret 'Bool' as 1-bit bit-field; @since 4.7.0.0
+-- | Interpret 'Bool' as 1-bit bit-field
+--
+--  @since 4.7.0.0
 instance Bits Bool where
     (.&.) = (&&)
 
@@ -427,11 +429,13 @@
     popCount False = 0
     popCount True  = 1
 
+-- | @since 4.7.0.0
 instance FiniteBits Bool where
     finiteBitSize _ = 1
     countTrailingZeros x = if x then 0 else 1
     countLeadingZeros  x = if x then 0 else 1
 
+-- | @since 2.01
 instance Bits Int where
     {-# INLINE shift #-}
     {-# INLINE bit #-}
@@ -468,11 +472,13 @@
 
     isSigned _             = True
 
+-- | @since 4.6.0.0
 instance FiniteBits Int where
     finiteBitSize _ = WORD_SIZE_IN_BITS
     countLeadingZeros  (I# x#) = I# (word2Int# (clz# (int2Word# x#)))
     countTrailingZeros (I# x#) = I# (word2Int# (ctz# (int2Word# x#)))
 
+-- | @since 2.01
 instance Bits Word where
     {-# INLINE shift #-}
     {-# INLINE bit #-}
@@ -503,11 +509,13 @@
     bit                      = bitDefault
     testBit                  = testBitDefault
 
+-- | @since 4.6.0.0
 instance FiniteBits Word where
     finiteBitSize _ = WORD_SIZE_IN_BITS
     countLeadingZeros  (W# x#) = I# (word2Int# (clz# x#))
     countTrailingZeros (W# x#) = I# (word2Int# (ctz# x#))
 
+-- | @since 2.01
 instance Bits Integer where
    (.&.) = andInteger
    (.|.) = orInteger
@@ -582,7 +590,7 @@
                             then Just (bit (yW-1)-1)
                             else Just (bit yW-1)
       | otherwise = Nothing
-{-# INLINEABLE toIntegralSized #-}
+{-# INLINABLE toIntegralSized #-}
 
 -- | 'True' if the size of @a@ is @<=@ the size of @b@, where size is measured
 -- by 'bitSizeMaybe' and 'isSigned'.
diff --git a/Data/Complex.hs b/Data/Complex.hs
--- a/Data/Complex.hs
+++ b/Data/Complex.hs
@@ -36,6 +36,7 @@
 
         )  where
 
+import GHC.Base (Applicative (..))
 import GHC.Generics (Generic, Generic1)
 import GHC.Float (Floating(..))
 import Data.Data (Data)
@@ -115,6 +116,7 @@
 -- -----------------------------------------------------------------------------
 -- Instances of Complex
 
+-- | @since 2.01
 instance  (RealFloat a) => Num (Complex a)  where
     {-# SPECIALISE instance Num (Complex Float) #-}
     {-# SPECIALISE instance Num (Complex Double) #-}
@@ -127,6 +129,7 @@
     signum z@(x:+y)     =  x/r :+ y/r  where r = magnitude z
     fromInteger n       =  fromInteger n :+ 0
 
+-- | @since 2.01
 instance  (RealFloat a) => Fractional (Complex a)  where
     {-# SPECIALISE instance Fractional (Complex Float) #-}
     {-# SPECIALISE instance Fractional (Complex Double) #-}
@@ -138,6 +141,7 @@
 
     fromRational a      =  fromRational a :+ 0
 
+-- | @since 2.01
 instance  (RealFloat a) => Floating (Complex a) where
     {-# SPECIALISE instance Floating (Complex Float) #-}
     {-# SPECIALISE instance Floating (Complex Double) #-}
@@ -210,6 +214,7 @@
       | otherwise = exp x - 1
     {-# INLINE expm1 #-}
 
+-- | @since 4.8.0.0
 instance Storable a => Storable (Complex a) where
     sizeOf a       = 2 * sizeOf (realPart a)
     alignment a    = alignment (realPart a)
@@ -223,9 +228,25 @@
                         poke q r
                         pokeElemOff q 1 i
 
+-- | @since 4.9.0.0
 instance Applicative Complex where
   pure a = a :+ a
   f :+ g <*> a :+ b = f a :+ g b
+  liftA2 f (x :+ y) (a :+ b) = f x a :+ f y b
 
+-- | @since 4.9.0.0
 instance Monad Complex where
   a :+ b >>= f = realPart (f a) :+ imagPart (f b)
+
+-- -----------------------------------------------------------------------------
+-- Rules on Complex
+
+{-# RULES
+
+"realToFrac/a->Complex Double"
+  realToFrac = \x -> realToFrac x :+ (0 :: Double)
+
+"realToFrac/a->Complex Float"
+  realToFrac = \x -> realToFrac x :+ (0 :: Float)
+
+  #-}
diff --git a/Data/Data.hs b/Data/Data.hs
--- a/Data/Data.hs
+++ b/Data/Data.hs
@@ -1,9 +1,16 @@
-{-# LANGUAGE Trustworthy #-}
-{-# LANGUAGE RankNTypes, ScopedTypeVariables, PolyKinds, StandaloneDeriving,
-             TypeOperators, GADTs, FlexibleInstances #-}
+{-# LANGUAGE BangPatterns #-}
+{-# LANGUAGE DeriveDataTypeable #-}
 {-# LANGUAGE FlexibleContexts #-}
+{-# LANGUAGE FlexibleInstances #-}
+{-# LANGUAGE GADTs #-}
 {-# LANGUAGE NoImplicitPrelude #-}
-{-# LANGUAGE BangPatterns #-}
+{-# LANGUAGE PolyKinds #-}
+{-# LANGUAGE RankNTypes #-}
+{-# LANGUAGE ScopedTypeVariables #-}
+{-# LANGUAGE StandaloneDeriving #-}
+{-# LANGUAGE Trustworthy #-}
+{-# LANGUAGE TypeInType #-}
+{-# LANGUAGE TypeOperators #-}
 
 -----------------------------------------------------------------------------
 -- |
@@ -108,6 +115,7 @@
 
 ------------------------------------------------------------------------------
 
+import Data.Functor.Const
 import Data.Either
 import Data.Eq
 import Data.Maybe
@@ -118,11 +126,13 @@
 import GHC.Base hiding (Any, IntRep, FloatRep)
 import GHC.List
 import GHC.Num
+import GHC.Natural
 import GHC.Read
 import GHC.Show
 import Text.Read( reads )
 
 -- Imports for the instances
+import Data.Functor.Identity -- So we can give Data instance for Identity
 import Data.Int              -- So we can give Data instance for Int8, ...
 import Data.Type.Coercion
 import Data.Word             -- So we can give Data instance for Word8, ...
@@ -304,24 +314,24 @@
   -- isomorphism pair as injection and projection.
   gmapT :: (forall b. Data b => b -> b) -> a -> a
 
-  -- Use an identity datatype constructor ID (see below)
+  -- Use the Identity datatype constructor
   -- to instantiate the type constructor c in the type of gfoldl,
-  -- and perform injections ID and projections unID accordingly.
+  -- and perform injections Identity and projections runIdentity accordingly.
   --
-  gmapT f x0 = unID (gfoldl k ID x0)
+  gmapT f x0 = runIdentity (gfoldl k Identity x0)
     where
-      k :: Data d => ID (d->b) -> d -> ID b
-      k (ID c) x = ID (c (f x))
+      k :: Data d => Identity (d->b) -> d -> Identity b
+      k (Identity c) x = Identity (c (f x))
 
 
   -- | A generic query with a left-associative binary operator
   gmapQl :: forall r r'. (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> a -> r
-  gmapQl o r f = unCONST . gfoldl k z
+  gmapQl o r f = getConst . gfoldl k z
     where
-      k :: Data d => CONST r (d->b) -> d -> CONST r b
-      k c x = CONST $ (unCONST c) `o` f x
-      z :: g -> CONST r g
-      z _   = CONST r
+      k :: Data d => Const r (d->b) -> d -> Const r b
+      k c x = Const $ (getConst c) `o` f x
+      z :: g -> Const r g
+      z _   = Const r
 
   -- | A generic query with a right-associative binary operator
   gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> a -> r
@@ -417,14 +427,6 @@
              )
 
 
--- | The identity type constructor needed for the definition of gmapT
-newtype ID x = ID { unID :: x }
-
-
--- | The constant type constructor needed for the definition of gmapQl
-newtype CONST c a = CONST { unCONST :: c }
-
-
 -- | Type constructor for adding counters to queries
 data Qi q a = Qi Int (Maybe q)
 
@@ -455,13 +457,13 @@
             => (forall d. Data d => d)
             -> Constr
             -> a
-fromConstrB f = unID . gunfold k z
+fromConstrB f = runIdentity . gunfold k z
  where
-  k :: forall b r. Data b => ID (b -> r) -> ID r
-  k c = ID (unID c f)
+  k :: forall b r. Data b => Identity (b -> r) -> Identity r
+  k c = Identity (runIdentity c f)
 
-  z :: forall r. r -> ID r
-  z = ID
+  z :: forall r. r -> Identity r
+  z = Identity
 
 
 -- | Monadic variation on 'fromConstrB'
@@ -508,11 +510,14 @@
                         , datatype  :: DataType
                         }
 
+-- | @since 4.0.0.0
 instance Show Constr where
  show = constring
 
 
 -- | Equality of constructors
+--
+-- @since 4.0.0.0
 instance Eq Constr where
   c == c' = constrRep c == constrRep c'
 
@@ -682,7 +687,7 @@
 
 ------------------------------------------------------------------------------
 --
---      Convenience funtions: algebraic data types
+--      Convenience functions: algebraic data types
 --
 ------------------------------------------------------------------------------
 
@@ -844,32 +849,15 @@
 --
 ------------------------------------------------------------------------------
 
-
-falseConstr :: Constr
-falseConstr  = mkConstr boolDataType "False" [] Prefix
-trueConstr :: Constr
-trueConstr   = mkConstr boolDataType "True"  [] Prefix
-
-boolDataType :: DataType
-boolDataType = mkDataType "Prelude.Bool" [falseConstr,trueConstr]
-
-instance Data Bool where
-  toConstr False = falseConstr
-  toConstr True  = trueConstr
-  gunfold _ z c  = case constrIndex c of
-                     1 -> z False
-                     2 -> z True
-                     _ -> errorWithoutStackTrace $ "Data.Data.gunfold: Constructor "
-                                  ++ show c
-                                  ++ " is not of type Bool."
-  dataTypeOf _ = boolDataType
-
+-- | @since 4.0.0.0
+deriving instance Data Bool
 
 ------------------------------------------------------------------------------
 
 charType :: DataType
 charType = mkCharType "Prelude.Char"
 
+-- | @since 4.0.0.0
 instance Data Char where
   toConstr x = mkCharConstr charType x
   gunfold _ z c = case constrRep c of
@@ -884,6 +872,7 @@
 floatType :: DataType
 floatType = mkFloatType "Prelude.Float"
 
+-- | @since 4.0.0.0
 instance Data Float where
   toConstr = mkRealConstr floatType
   gunfold _ z c = case constrRep c of
@@ -898,6 +887,7 @@
 doubleType :: DataType
 doubleType = mkFloatType "Prelude.Double"
 
+-- | @since 4.0.0.0
 instance Data Double where
   toConstr = mkRealConstr doubleType
   gunfold _ z c = case constrRep c of
@@ -912,6 +902,7 @@
 intType :: DataType
 intType = mkIntType "Prelude.Int"
 
+-- | @since 4.0.0.0
 instance Data Int where
   toConstr x = mkIntegralConstr intType x
   gunfold _ z c = case constrRep c of
@@ -926,6 +917,7 @@
 integerType :: DataType
 integerType = mkIntType "Prelude.Integer"
 
+-- | @since 4.0.0.0
 instance Data Integer where
   toConstr = mkIntegralConstr integerType
   gunfold _ z c = case constrRep c of
@@ -937,9 +929,27 @@
 
 ------------------------------------------------------------------------------
 
+-- This follows the same style as the other integral 'Data' instances
+-- defined in "Data.Data"
+naturalType :: DataType
+naturalType = mkIntType "Numeric.Natural.Natural"
+
+-- | @since 4.8.0.0
+instance Data Natural where
+  toConstr x = mkIntegralConstr naturalType x
+  gunfold _ z c = case constrRep c of
+                    (IntConstr x) -> z (fromIntegral x)
+                    _ -> errorWithoutStackTrace $ "Data.Data.gunfold: Constructor " ++ show c
+                                 ++ " is not of type Natural"
+  dataTypeOf _ = naturalType
+
+
+------------------------------------------------------------------------------
+
 int8Type :: DataType
 int8Type = mkIntType "Data.Int.Int8"
 
+-- | @since 4.0.0.0
 instance Data Int8 where
   toConstr x = mkIntegralConstr int8Type x
   gunfold _ z c = case constrRep c of
@@ -954,6 +964,7 @@
 int16Type :: DataType
 int16Type = mkIntType "Data.Int.Int16"
 
+-- | @since 4.0.0.0
 instance Data Int16 where
   toConstr x = mkIntegralConstr int16Type x
   gunfold _ z c = case constrRep c of
@@ -968,6 +979,7 @@
 int32Type :: DataType
 int32Type = mkIntType "Data.Int.Int32"
 
+-- | @since 4.0.0.0
 instance Data Int32 where
   toConstr x = mkIntegralConstr int32Type x
   gunfold _ z c = case constrRep c of
@@ -982,6 +994,7 @@
 int64Type :: DataType
 int64Type = mkIntType "Data.Int.Int64"
 
+-- | @since 4.0.0.0
 instance Data Int64 where
   toConstr x = mkIntegralConstr int64Type x
   gunfold _ z c = case constrRep c of
@@ -996,6 +1009,7 @@
 wordType :: DataType
 wordType = mkIntType "Data.Word.Word"
 
+-- | @since 4.0.0.0
 instance Data Word where
   toConstr x = mkIntegralConstr wordType x
   gunfold _ z c = case constrRep c of
@@ -1010,6 +1024,7 @@
 word8Type :: DataType
 word8Type = mkIntType "Data.Word.Word8"
 
+-- | @since 4.0.0.0
 instance Data Word8 where
   toConstr x = mkIntegralConstr word8Type x
   gunfold _ z c = case constrRep c of
@@ -1024,6 +1039,7 @@
 word16Type :: DataType
 word16Type = mkIntType "Data.Word.Word16"
 
+-- | @since 4.0.0.0
 instance Data Word16 where
   toConstr x = mkIntegralConstr word16Type x
   gunfold _ z c = case constrRep c of
@@ -1038,6 +1054,7 @@
 word32Type :: DataType
 word32Type = mkIntType "Data.Word.Word32"
 
+-- | @since 4.0.0.0
 instance Data Word32 where
   toConstr x = mkIntegralConstr word32Type x
   gunfold _ z c = case constrRep c of
@@ -1052,6 +1069,7 @@
 word64Type :: DataType
 word64Type = mkIntType "Data.Word.Word64"
 
+-- | @since 4.0.0.0
 instance Data Word64 where
   toConstr x = mkIntegralConstr word64Type x
   gunfold _ z c = case constrRep c of
@@ -1069,6 +1087,11 @@
 ratioDataType :: DataType
 ratioDataType = mkDataType "GHC.Real.Ratio" [ratioConstr]
 
+-- NB: This Data instance intentionally uses the (%) smart constructor instead
+-- of the internal (:%) constructor to preserve the invariant that a Ratio
+-- value is reduced to normal form. See Trac #10011.
+
+-- | @since 4.0.0.0
 instance (Data a, Integral a) => Data (Ratio a) where
   gfoldl k z (a :% b) = z (%) `k` a `k` b
   toConstr _ = ratioConstr
@@ -1087,6 +1110,7 @@
 listDataType :: DataType
 listDataType = mkDataType "Prelude.[]" [nilConstr,consConstr]
 
+-- | @since 4.0.0.0
 instance Data a => Data [a] where
   gfoldl _ z []     = z []
   gfoldl f z (x:xs) = z (:) `f` x `f` xs
@@ -1113,201 +1137,43 @@
 
 ------------------------------------------------------------------------------
 
-nothingConstr :: Constr
-nothingConstr = mkConstr maybeDataType "Nothing" [] Prefix
-justConstr :: Constr
-justConstr    = mkConstr maybeDataType "Just"    [] Prefix
-
-maybeDataType :: DataType
-maybeDataType = mkDataType "Prelude.Maybe" [nothingConstr,justConstr]
-
-instance Data a => Data (Maybe a) where
-  gfoldl _ z Nothing  = z Nothing
-  gfoldl f z (Just x) = z Just `f` x
-  toConstr Nothing  = nothingConstr
-  toConstr (Just _) = justConstr
-  gunfold k z c = case constrIndex c of
-                    1 -> z Nothing
-                    2 -> k (z Just)
-                    _ -> errorWithoutStackTrace "Data.Data.gunfold(Maybe)"
-  dataTypeOf _ = maybeDataType
-  dataCast1 f  = gcast1 f
-
-
-------------------------------------------------------------------------------
-
-ltConstr :: Constr
-ltConstr         = mkConstr orderingDataType "LT" [] Prefix
-eqConstr :: Constr
-eqConstr         = mkConstr orderingDataType "EQ" [] Prefix
-gtConstr :: Constr
-gtConstr         = mkConstr orderingDataType "GT" [] Prefix
-
-orderingDataType :: DataType
-orderingDataType = mkDataType "Prelude.Ordering" [ltConstr,eqConstr,gtConstr]
-
-instance Data Ordering where
-  gfoldl _ z LT  = z LT
-  gfoldl _ z EQ  = z EQ
-  gfoldl _ z GT  = z GT
-  toConstr LT  = ltConstr
-  toConstr EQ  = eqConstr
-  toConstr GT  = gtConstr
-  gunfold _ z c = case constrIndex c of
-                    1 -> z LT
-                    2 -> z EQ
-                    3 -> z GT
-                    _ -> errorWithoutStackTrace "Data.Data.gunfold(Ordering)"
-  dataTypeOf _ = orderingDataType
-
-
-------------------------------------------------------------------------------
-
-leftConstr :: Constr
-leftConstr     = mkConstr eitherDataType "Left"  [] Prefix
-
-rightConstr :: Constr
-rightConstr    = mkConstr eitherDataType "Right" [] Prefix
-
-eitherDataType :: DataType
-eitherDataType = mkDataType "Prelude.Either" [leftConstr,rightConstr]
-
-instance (Data a, Data b) => Data (Either a b) where
-  gfoldl f z (Left a)   = z Left  `f` a
-  gfoldl f z (Right a)  = z Right `f` a
-  toConstr (Left _)  = leftConstr
-  toConstr (Right _) = rightConstr
-  gunfold k z c = case constrIndex c of
-                    1 -> k (z Left)
-                    2 -> k (z Right)
-                    _ -> errorWithoutStackTrace "Data.Data.gunfold(Either)"
-  dataTypeOf _ = eitherDataType
-  dataCast2 f  = gcast2 f
-
-
-------------------------------------------------------------------------------
-
-tuple0Constr :: Constr
-tuple0Constr = mkConstr tuple0DataType "()" [] Prefix
-
-tuple0DataType :: DataType
-tuple0DataType = mkDataType "Prelude.()" [tuple0Constr]
-
-instance Data () where
-  toConstr ()   = tuple0Constr
-  gunfold _ z c | constrIndex c == 1 = z ()
-  gunfold _ _ _ = errorWithoutStackTrace "Data.Data.gunfold(unit)"
-  dataTypeOf _  = tuple0DataType
-
-
-------------------------------------------------------------------------------
-
-tuple2Constr :: Constr
-tuple2Constr = mkConstr tuple2DataType "(,)" [] Infix
-
-tuple2DataType :: DataType
-tuple2DataType = mkDataType "Prelude.(,)" [tuple2Constr]
-
-instance (Data a, Data b) => Data (a,b) where
-  gfoldl f z (a,b) = z (,) `f` a `f` b
-  toConstr (_,_) = tuple2Constr
-  gunfold k z c | constrIndex c == 1 = k (k (z (,)))
-  gunfold _ _ _ = errorWithoutStackTrace "Data.Data.gunfold(tup2)"
-  dataTypeOf _  = tuple2DataType
-  dataCast2 f   = gcast2 f
-
-
-------------------------------------------------------------------------------
-
-tuple3Constr :: Constr
-tuple3Constr = mkConstr tuple3DataType "(,,)" [] Infix
-
-tuple3DataType :: DataType
-tuple3DataType = mkDataType "Prelude.(,,)" [tuple3Constr]
-
-instance (Data a, Data b, Data c) => Data (a,b,c) where
-  gfoldl f z (a,b,c) = z (,,) `f` a `f` b `f` c
-  toConstr (_,_,_) = tuple3Constr
-  gunfold k z c | constrIndex c == 1 = k (k (k (z (,,))))
-  gunfold _ _ _ = errorWithoutStackTrace "Data.Data.gunfold(tup3)"
-  dataTypeOf _  = tuple3DataType
-
-
-------------------------------------------------------------------------------
-
-tuple4Constr :: Constr
-tuple4Constr = mkConstr tuple4DataType "(,,,)" [] Infix
-
-tuple4DataType :: DataType
-tuple4DataType = mkDataType "Prelude.(,,,)" [tuple4Constr]
-
-instance (Data a, Data b, Data c, Data d)
-         => Data (a,b,c,d) where
-  gfoldl f z (a,b,c,d) = z (,,,) `f` a `f` b `f` c `f` d
-  toConstr (_,_,_,_) = tuple4Constr
-  gunfold k z c = case constrIndex c of
-                    1 -> k (k (k (k (z (,,,)))))
-                    _ -> errorWithoutStackTrace "Data.Data.gunfold(tup4)"
-  dataTypeOf _ = tuple4DataType
-
-
-------------------------------------------------------------------------------
-
-tuple5Constr :: Constr
-tuple5Constr = mkConstr tuple5DataType "(,,,,)" [] Infix
-
-tuple5DataType :: DataType
-tuple5DataType = mkDataType "Prelude.(,,,,)" [tuple5Constr]
-
-instance (Data a, Data b, Data c, Data d, Data e)
-         => Data (a,b,c,d,e) where
-  gfoldl f z (a,b,c,d,e) = z (,,,,) `f` a `f` b `f` c `f` d `f` e
-  toConstr (_,_,_,_,_) = tuple5Constr
-  gunfold k z c = case constrIndex c of
-                    1 -> k (k (k (k (k (z (,,,,))))))
-                    _ -> errorWithoutStackTrace "Data.Data.gunfold(tup5)"
-  dataTypeOf _ = tuple5DataType
-
-
-------------------------------------------------------------------------------
+-- | @since 4.0.0.0
+deriving instance Data a => Data (Maybe a)
 
-tuple6Constr :: Constr
-tuple6Constr = mkConstr tuple6DataType "(,,,,,)" [] Infix
+-- | @since 4.0.0.0
+deriving instance Data Ordering
 
-tuple6DataType :: DataType
-tuple6DataType = mkDataType "Prelude.(,,,,,)" [tuple6Constr]
+-- | @since 4.0.0.0
+deriving instance (Data a, Data b) => Data (Either a b)
 
-instance (Data a, Data b, Data c, Data d, Data e, Data f)
-         => Data (a,b,c,d,e,f) where
-  gfoldl f z (a,b,c,d,e,f') = z (,,,,,) `f` a `f` b `f` c `f` d `f` e `f` f'
-  toConstr (_,_,_,_,_,_) = tuple6Constr
-  gunfold k z c = case constrIndex c of
-                    1 -> k (k (k (k (k (k (z (,,,,,)))))))
-                    _ -> errorWithoutStackTrace "Data.Data.gunfold(tup6)"
-  dataTypeOf _ = tuple6DataType
+-- | @since 4.0.0.0
+deriving instance Data ()
 
+-- | @since 4.0.0.0
+deriving instance (Data a, Data b) => Data (a,b)
 
-------------------------------------------------------------------------------
+-- | @since 4.0.0.0
+deriving instance (Data a, Data b, Data c) => Data (a,b,c)
 
-tuple7Constr :: Constr
-tuple7Constr = mkConstr tuple7DataType "(,,,,,,)" [] Infix
+-- | @since 4.0.0.0
+deriving instance (Data a, Data b, Data c, Data d)
+         => Data (a,b,c,d)
 
-tuple7DataType :: DataType
-tuple7DataType = mkDataType "Prelude.(,,,,,,)" [tuple7Constr]
+-- | @since 4.0.0.0
+deriving instance (Data a, Data b, Data c, Data d, Data e)
+         => Data (a,b,c,d,e)
 
-instance (Data a, Data b, Data c, Data d, Data e, Data f, Data g)
-         => Data (a,b,c,d,e,f,g) where
-  gfoldl f z (a,b,c,d,e,f',g) =
-    z (,,,,,,) `f` a `f` b `f` c `f` d `f` e `f` f' `f` g
-  toConstr  (_,_,_,_,_,_,_) = tuple7Constr
-  gunfold k z c = case constrIndex c of
-                    1 -> k (k (k (k (k (k (k (z (,,,,,,))))))))
-                    _ -> errorWithoutStackTrace "Data.Data.gunfold(tup7)"
-  dataTypeOf _ = tuple7DataType
+-- | @since 4.0.0.0
+deriving instance (Data a, Data b, Data c, Data d, Data e, Data f)
+         => Data (a,b,c,d,e,f)
 
+-- | @since 4.0.0.0
+deriving instance (Data a, Data b, Data c, Data d, Data e, Data f, Data g)
+         => Data (a,b,c,d,e,f,g)
 
 ------------------------------------------------------------------------------
 
+-- | @since 4.8.0.0
 instance Data a => Data (Ptr a) where
   toConstr _   = errorWithoutStackTrace "Data.Data.toConstr(Ptr)"
   gunfold _ _  = errorWithoutStackTrace "Data.Data.gunfold(Ptr)"
@@ -1316,6 +1182,7 @@
 
 ------------------------------------------------------------------------------
 
+-- | @since 4.8.0.0
 instance Data a => Data (ForeignPtr a) where
   toConstr _   = errorWithoutStackTrace "Data.Data.toConstr(ForeignPtr)"
   gunfold _ _  = errorWithoutStackTrace "Data.Data.gunfold(ForeignPtr)"
@@ -1325,6 +1192,7 @@
 ------------------------------------------------------------------------------
 -- The Data instance for Array preserves data abstraction at the cost of
 -- inefficiency. We omit reflection services for the sake of data abstraction.
+-- | @since 4.8.0.0
 instance (Data a, Data b, Ix a) => Data (Array a b)
  where
   gfoldl f z a = z (listArray (bounds a)) `f` (elems a)
@@ -1336,483 +1204,102 @@
 ----------------------------------------------------------------------------
 -- Data instance for Proxy
 
-proxyConstr :: Constr
-proxyConstr = mkConstr proxyDataType "Proxy" [] Prefix
-
-proxyDataType :: DataType
-proxyDataType = mkDataType "Data.Proxy.Proxy" [proxyConstr]
-
-instance (Data t) => Data (Proxy t) where
-  gfoldl _ z Proxy  = z Proxy
-  toConstr Proxy  = proxyConstr
-  gunfold _ z c = case constrIndex c of
-                    1 -> z Proxy
-                    _ -> errorWithoutStackTrace "Data.Data.gunfold(Proxy)"
-  dataTypeOf _ = proxyDataType
-  dataCast1 f  = gcast1 f
-
------------------------------------------------------------------------
--- instance for (:~:)
-
-reflConstr :: Constr
-reflConstr = mkConstr equalityDataType "Refl" [] Prefix
-
-equalityDataType :: DataType
-equalityDataType = mkDataType "Data.Type.Equality.(:~:)" [reflConstr]
-
-instance (a ~ b, Data a) => Data (a :~: b) where
-  gfoldl _ z Refl = z Refl
-  toConstr Refl   = reflConstr
-  gunfold _ z c   = case constrIndex c of
-                      1 -> z Refl
-                      _ -> errorWithoutStackTrace "Data.Data.gunfold(:~:)"
-  dataTypeOf _    = equalityDataType
-  dataCast2 f     = gcast2 f
-
------------------------------------------------------------------------
--- instance for Coercion
-
-coercionConstr :: Constr
-coercionConstr = mkConstr equalityDataType "Coercion" [] Prefix
-
-coercionDataType :: DataType
-coercionDataType = mkDataType "Data.Type.Coercion.Coercion" [coercionConstr]
-
-instance (Coercible a b, Data a, Data b) => Data (Coercion a b) where
-  gfoldl _ z Coercion = z Coercion
-  toConstr Coercion = coercionConstr
-  gunfold _ z c   = case constrIndex c of
-                      1 -> z Coercion
-                      _ -> errorWithoutStackTrace "Data.Data.gunfold(Coercion)"
-  dataTypeOf _    = coercionDataType
-  dataCast2 f     = gcast2 f
-
------------------------------------------------------------------------
--- instance for Data.Version
-
-versionConstr :: Constr
-versionConstr = mkConstr versionDataType "Version" ["versionBranch","versionTags"] Prefix
-
-versionDataType :: DataType
-versionDataType = mkDataType "Data.Version.Version" [versionConstr]
-
-instance Data Version where
-  gfoldl k z (Version bs ts) = z Version `k` bs `k` ts
-  toConstr (Version _ _) = versionConstr
-  gunfold k z c = case constrIndex c of
-                    1 -> k (k (z Version))
-                    _ -> errorWithoutStackTrace "Data.Data.gunfold(Version)"
-  dataTypeOf _  = versionDataType
-
------------------------------------------------------------------------
--- instances for Data.Monoid wrappers
-
-dualConstr :: Constr
-dualConstr = mkConstr dualDataType "Dual" ["getDual"] Prefix
-
-dualDataType :: DataType
-dualDataType = mkDataType "Data.Monoid.Dual" [dualConstr]
-
-instance Data a => Data (Dual a) where
-  gfoldl f z (Dual x) = z Dual `f` x
-  gunfold k z _ = k (z Dual)
-  toConstr (Dual _) = dualConstr
-  dataTypeOf _ = dualDataType
-  dataCast1 f = gcast1 f
-
-allConstr :: Constr
-allConstr = mkConstr allDataType "All" ["getAll"] Prefix
-
-allDataType :: DataType
-allDataType = mkDataType "All" [allConstr]
-
-instance Data All where
-  gfoldl f z (All x) = (z All `f` x)
-  gunfold k z _ = k (z All)
-  toConstr (All _) = allConstr
-  dataTypeOf _ = allDataType
-
-anyConstr :: Constr
-anyConstr = mkConstr anyDataType "Any" ["getAny"] Prefix
-
-anyDataType :: DataType
-anyDataType = mkDataType "Any" [anyConstr]
-
-instance Data Any where
-  gfoldl f z (Any x) = (z Any `f` x)
-  gunfold k z _ = k (z Any)
-  toConstr (Any _) = anyConstr
-  dataTypeOf _ = anyDataType
-
-
-sumConstr :: Constr
-sumConstr = mkConstr sumDataType "Sum" ["getSum"] Prefix
-
-sumDataType :: DataType
-sumDataType = mkDataType "Data.Monoid.Sum" [sumConstr]
-
-instance Data a => Data (Sum a) where
-  gfoldl f z (Sum x) = z Sum `f` x
-  gunfold k z _ = k (z Sum)
-  toConstr (Sum _) = sumConstr
-  dataTypeOf _ = sumDataType
-  dataCast1 f = gcast1 f
-
-
-productConstr :: Constr
-productConstr = mkConstr productDataType "Product" ["getProduct"] Prefix
-
-productDataType :: DataType
-productDataType = mkDataType "Data.Monoid.Product" [productConstr]
-
-instance Data a => Data (Product a) where
-  gfoldl f z (Product x) = z Product `f` x
-  gunfold k z _ = k (z Product)
-  toConstr (Product _) = productConstr
-  dataTypeOf _ = productDataType
-  dataCast1 f = gcast1 f
-
-
-firstConstr :: Constr
-firstConstr = mkConstr firstDataType "First" ["getFirst"] Prefix
-
-firstDataType :: DataType
-firstDataType = mkDataType "Data.Monoid.First" [firstConstr]
-
-instance Data a => Data (First a) where
-  gfoldl f z (First x) = (z First `f` x)
-  gunfold k z _ = k (z First)
-  toConstr (First _) = firstConstr
-  dataTypeOf _ = firstDataType
-  dataCast1 f = gcast1 f
-
-
-lastConstr :: Constr
-lastConstr = mkConstr lastDataType "Last" ["getLast"] Prefix
-
-lastDataType :: DataType
-lastDataType = mkDataType "Data.Monoid.Last" [lastConstr]
-
-instance Data a => Data (Last a) where
-  gfoldl f z (Last x) = (z Last `f` x)
-  gunfold k z _ = k (z Last)
-  toConstr (Last _) = lastConstr
-  dataTypeOf _ = lastDataType
-  dataCast1 f = gcast1 f
-
-
-altConstr :: Constr
-altConstr = mkConstr altDataType "Alt" ["getAlt"] Prefix
-
-altDataType :: DataType
-altDataType = mkDataType "Alt" [altConstr]
-
-instance (Data (f a), Data a, Typeable f) => Data (Alt f a) where
-  gfoldl f z (Alt x) = (z Alt `f` x)
-  gunfold k z _ = k (z Alt)
-  toConstr (Alt _) = altConstr
-  dataTypeOf _ = altDataType
-
------------------------------------------------------------------------
--- instances for GHC.Generics
-
-u1Constr :: Constr
-u1Constr = mkConstr u1DataType "U1" [] Prefix
-
-u1DataType :: DataType
-u1DataType = mkDataType "GHC.Generics.U1" [u1Constr]
-
-instance Data p => Data (U1 p) where
-  gfoldl _ z U1 = z U1
-  toConstr U1 = u1Constr
-  gunfold _ z c = case constrIndex c of
-                    1 -> z U1
-                    _ -> errorWithoutStackTrace "Data.Data.gunfold(U1)"
-  dataTypeOf _  = u1DataType
-  dataCast1 f = gcast1 f
-
------------------------------------------------------------------------
-
-par1Constr :: Constr
-par1Constr = mkConstr par1DataType "Par1" [] Prefix
-
-par1DataType :: DataType
-par1DataType = mkDataType "GHC.Generics.Par1" [par1Constr]
-
-instance Data p => Data (Par1 p) where
-  gfoldl k z (Par1 p) = z Par1 `k` p
-  toConstr (Par1 _) = par1Constr
-  gunfold k z c = case constrIndex c of
-                    1 -> k (z Par1)
-                    _ -> errorWithoutStackTrace "Data.Data.gunfold(Par1)"
-  dataTypeOf _  = par1DataType
-  dataCast1 f = gcast1 f
-
------------------------------------------------------------------------
-
-rec1Constr :: Constr
-rec1Constr = mkConstr rec1DataType "Rec1" [] Prefix
-
-rec1DataType :: DataType
-rec1DataType = mkDataType "GHC.Generics.Rec1" [rec1Constr]
-
-instance (Data (f p), Typeable f, Data p) => Data (Rec1 f p) where
-  gfoldl k z (Rec1 p) = z Rec1 `k` p
-  toConstr (Rec1 _) = rec1Constr
-  gunfold k z c = case constrIndex c of
-                    1 -> k (z Rec1)
-                    _ -> errorWithoutStackTrace "Data.Data.gunfold(Rec1)"
-  dataTypeOf _  = rec1DataType
-  dataCast1 f = gcast1 f
-
------------------------------------------------------------------------
-
-k1Constr :: Constr
-k1Constr = mkConstr k1DataType "K1" [] Prefix
-
-k1DataType :: DataType
-k1DataType = mkDataType "GHC.Generics.K1" [k1Constr]
-
-instance (Typeable i, Data p, Data c) => Data (K1 i c p) where
-  gfoldl k z (K1 p) = z K1 `k` p
-  toConstr (K1 _) = k1Constr
-  gunfold k z c = case constrIndex c of
-                    1 -> k (z K1)
-                    _ -> errorWithoutStackTrace "Data.Data.gunfold(K1)"
-  dataTypeOf _  = k1DataType
-  dataCast1 f = gcast1 f
-
------------------------------------------------------------------------
-
-m1Constr :: Constr
-m1Constr = mkConstr m1DataType "M1" [] Prefix
-
-m1DataType :: DataType
-m1DataType = mkDataType "GHC.Generics.M1" [m1Constr]
-
-instance (Data p, Data (f p), Typeable c, Typeable i, Typeable f)
-    => Data (M1 i c f p) where
-  gfoldl k z (M1 p) = z M1 `k` p
-  toConstr (M1 _) = m1Constr
-  gunfold k z c = case constrIndex c of
-                    1 -> k (z M1)
-                    _ -> errorWithoutStackTrace "Data.Data.gunfold(M1)"
-  dataTypeOf _  = m1DataType
-  dataCast1 f = gcast1 f
-
------------------------------------------------------------------------
-
-sum1DataType :: DataType
-sum1DataType = mkDataType "GHC.Generics.:+:" [l1Constr, r1Constr]
-
-l1Constr :: Constr
-l1Constr = mkConstr sum1DataType "L1" [] Prefix
-
-r1Constr :: Constr
-r1Constr = mkConstr sum1DataType "R1" [] Prefix
-
-instance (Typeable f, Typeable g, Data p, Data (f p), Data (g p))
-    => Data ((f :+: g) p) where
-  gfoldl k z (L1 a) = z L1 `k` a
-  gfoldl k z (R1 a) = z R1 `k` a
-  toConstr L1{} = l1Constr
-  toConstr R1{} = r1Constr
-  gunfold k z c = case constrIndex c of
-                    1 -> k (z L1)
-                    2 -> k (z R1)
-                    _ -> errorWithoutStackTrace "Data.Data.gunfold(:+:)"
-  dataTypeOf _ = sum1DataType
-  dataCast1 f = gcast1 f
-
------------------------------------------------------------------------
+-- | @since 4.7.0.0
+deriving instance (Data t) => Data (Proxy t)
 
-comp1Constr :: Constr
-comp1Constr = mkConstr comp1DataType "Comp1" [] Prefix
+-- | @since 4.7.0.0
+deriving instance (a ~ b, Data a) => Data (a :~: b)
 
-comp1DataType :: DataType
-comp1DataType = mkDataType "GHC.Generics.:.:" [comp1Constr]
+-- | @since 4.10.0.0
+deriving instance (Typeable i, Typeable j, Typeable a, Typeable b,
+                    (a :: i) ~~ (b :: j))
+    => Data (a :~~: b)
 
-instance (Typeable f, Typeable g, Data p, Data (f (g p)))
-    => Data ((f :.: g) p) where
-  gfoldl k z (Comp1 c) = z Comp1 `k` c
-  toConstr (Comp1 _) = m1Constr
-  gunfold k z c = case constrIndex c of
-                    1 -> k (z Comp1)
-                    _ -> errorWithoutStackTrace "Data.Data.gunfold(:.:)"
-  dataTypeOf _ = comp1DataType
-  dataCast1 f = gcast1 f
+-- | @since 4.7.0.0
+deriving instance (Coercible a b, Data a, Data b) => Data (Coercion a b)
 
------------------------------------------------------------------------
+-- | @since 4.9.0.0
+deriving instance Data a => Data (Identity a)
 
-v1DataType :: DataType
-v1DataType = mkDataType "GHC.Generics.V1" []
+-- | @since 4.10.0.0
+deriving instance (Typeable k, Data a, Typeable (b :: k)) => Data (Const a b)
 
-instance Data p => Data (V1 p) where
-  gfoldl _ _ !_ = undefined
-  toConstr !_ = undefined
-  gunfold _ _ _ = errorWithoutStackTrace "Data.Data.gunfold(V1)"
-  dataTypeOf _ = v1DataType
-  dataCast1 f = gcast1 f
+-- | @since 4.7.0.0
+deriving instance Data Version
 
------------------------------------------------------------------------
+----------------------------------------------------------------------------
+-- Data instances for Data.Monoid wrappers
 
-prod1DataType :: DataType
-prod1DataType = mkDataType "GHC.Generics.:*:" [prod1Constr]
+-- | @since 4.8.0.0
+deriving instance Data a => Data (Dual a)
 
-prod1Constr :: Constr
-prod1Constr = mkConstr prod1DataType "Prod1" [] Infix
+-- | @since 4.8.0.0
+deriving instance Data All
 
-instance (Typeable f, Typeable g, Data p, Data (f p), Data (g p))
-    => Data ((f :*: g) p) where
-  gfoldl k z (l :*: r) = z (:*:) `k` l `k` r
-  toConstr _ = prod1Constr
-  gunfold k z c = case constrIndex c of
-                    1 -> k (k (z (:*:)))
-                    _ -> errorWithoutStackTrace "Data.Data.gunfold(:*:)"
-  dataCast1 f = gcast1 f
-  dataTypeOf _ = prod1DataType
+-- | @since 4.8.0.0
+deriving instance Data Any
 
------------------------------------------------------------------------
+-- | @since 4.8.0.0
+deriving instance Data a => Data (Sum a)
 
-prefixConstr :: Constr
-prefixConstr = mkConstr fixityDataType "Prefix" [] Prefix
-infixConstr  :: Constr
-infixConstr  = mkConstr fixityDataType "Infix"  [] Prefix
+-- | @since 4.8.0.0
+deriving instance Data a => Data (Product a)
 
-fixityDataType :: DataType
-fixityDataType = mkDataType "GHC.Generics.Fixity" [prefixConstr,infixConstr]
+-- | @since 4.8.0.0
+deriving instance Data a => Data (First a)
 
-instance Data Generics.Fixity where
-  gfoldl _ z Generics.Prefix      = z Generics.Prefix
-  gfoldl f z (Generics.Infix a i) = z Generics.Infix `f` a `f` i
-  toConstr Generics.Prefix  = prefixConstr
-  toConstr Generics.Infix{} = infixConstr
-  gunfold k z c = case constrIndex c of
-                    1 -> z Generics.Prefix
-                    2 -> k (k (z Generics.Infix))
-                    _ -> errorWithoutStackTrace "Data.Data.gunfold(Fixity)"
-  dataTypeOf _ = fixityDataType
+-- | @since 4.8.0.0
+deriving instance Data a => Data (Last a)
 
------------------------------------------------------------------------
+-- | @since 4.8.0.0
+deriving instance (Data (f a), Data a, Typeable f) => Data (Alt f a)
 
-leftAssociativeConstr :: Constr
-leftAssociativeConstr
-  = mkConstr associativityDataType "LeftAssociative" [] Prefix
-rightAssociativeConstr :: Constr
-rightAssociativeConstr
-  = mkConstr associativityDataType "RightAssociative" [] Prefix
-notAssociativeConstr :: Constr
-notAssociativeConstr
-  = mkConstr associativityDataType "NotAssociative" [] Prefix
+----------------------------------------------------------------------------
+-- Data instances for GHC.Generics representations
 
-associativityDataType :: DataType
-associativityDataType = mkDataType "GHC.Generics.Associativity"
-  [leftAssociativeConstr,rightAssociativeConstr,notAssociativeConstr]
+-- | @since 4.9.0.0
+deriving instance Data p => Data (U1 p)
 
-instance Data Associativity where
-  gfoldl _ z LeftAssociative  = z LeftAssociative
-  gfoldl _ z RightAssociative = z RightAssociative
-  gfoldl _ z NotAssociative   = z NotAssociative
-  toConstr LeftAssociative  = leftAssociativeConstr
-  toConstr RightAssociative = rightAssociativeConstr
-  toConstr NotAssociative   = notAssociativeConstr
-  gunfold _ z c = case constrIndex c of
-                    1 -> z LeftAssociative
-                    2 -> z RightAssociative
-                    3 -> z NotAssociative
-                    _ -> errorWithoutStackTrace
-                           "Data.Data.gunfold(Associativity)"
-  dataTypeOf _ = associativityDataType
+-- | @since 4.9.0.0
+deriving instance Data p => Data (Par1 p)
 
------------------------------------------------------------------------
+-- | @since 4.9.0.0
+deriving instance (Data (f p), Typeable f, Data p) => Data (Rec1 f p)
 
-noSourceUnpackednessConstr :: Constr
-noSourceUnpackednessConstr
-  = mkConstr sourceUnpackednessDataType "NoSourceUnpackedness" [] Prefix
-sourceNoUnpackConstr :: Constr
-sourceNoUnpackConstr
-  = mkConstr sourceUnpackednessDataType "SourceNoUnpack" [] Prefix
-sourceUnpackConstr :: Constr
-sourceUnpackConstr
-  = mkConstr sourceUnpackednessDataType "SourceUnpack" [] Prefix
+-- | @since 4.9.0.0
+deriving instance (Typeable i, Data p, Data c) => Data (K1 i c p)
 
-sourceUnpackednessDataType :: DataType
-sourceUnpackednessDataType = mkDataType "GHC.Generics.SourceUnpackedness"
-  [noSourceUnpackednessConstr,sourceNoUnpackConstr,sourceUnpackConstr]
+-- | @since 4.9.0.0
+deriving instance (Data p, Data (f p), Typeable c, Typeable i, Typeable f)
+    => Data (M1 i c f p)
 
-instance Data SourceUnpackedness where
-  gfoldl _ z NoSourceUnpackedness = z NoSourceUnpackedness
-  gfoldl _ z SourceNoUnpack       = z SourceNoUnpack
-  gfoldl _ z SourceUnpack         = z SourceUnpack
-  toConstr NoSourceUnpackedness = noSourceUnpackednessConstr
-  toConstr SourceNoUnpack       = sourceNoUnpackConstr
-  toConstr SourceUnpack         = sourceUnpackConstr
-  gunfold _ z c = case constrIndex c of
-                    1 -> z NoSourceUnpackedness
-                    2 -> z SourceNoUnpack
-                    3 -> z SourceUnpack
-                    _ -> errorWithoutStackTrace
-                           "Data.Data.gunfold(SourceUnpackedness)"
-  dataTypeOf _ = sourceUnpackednessDataType
+-- | @since 4.9.0.0
+deriving instance (Typeable f, Typeable g, Data p, Data (f p), Data (g p))
+    => Data ((f :+: g) p)
 
------------------------------------------------------------------------
+-- | @since 4.9.0.0
+deriving instance (Typeable (f :: * -> *), Typeable (g :: * -> *),
+          Data p, Data (f (g p)))
+    => Data ((f :.: g) p)
 
-noSourceStrictnessConstr :: Constr
-noSourceStrictnessConstr
-  = mkConstr sourceStrictnessDataType "NoSourceStrictness" [] Prefix
-sourceLazyConstr :: Constr
-sourceLazyConstr
-  = mkConstr sourceStrictnessDataType "SourceLazy" [] Prefix
-sourceStrictConstr :: Constr
-sourceStrictConstr
-  = mkConstr sourceStrictnessDataType "SourceStrict" [] Prefix
+-- | @since 4.9.0.0
+deriving instance Data p => Data (V1 p)
 
-sourceStrictnessDataType :: DataType
-sourceStrictnessDataType = mkDataType "GHC.Generics.SourceStrictness"
-  [noSourceStrictnessConstr,sourceLazyConstr,sourceStrictConstr]
+-- | @since 4.9.0.0
+deriving instance (Typeable f, Typeable g, Data p, Data (f p), Data (g p))
+    => Data ((f :*: g) p)
 
-instance Data SourceStrictness where
-  gfoldl _ z NoSourceStrictness = z NoSourceStrictness
-  gfoldl _ z SourceLazy         = z SourceLazy
-  gfoldl _ z SourceStrict       = z SourceStrict
-  toConstr NoSourceStrictness = noSourceStrictnessConstr
-  toConstr SourceLazy         = sourceLazyConstr
-  toConstr SourceStrict       = sourceStrictConstr
-  gunfold _ z c = case constrIndex c of
-                    1 -> z NoSourceStrictness
-                    2 -> z SourceLazy
-                    3 -> z SourceStrict
-                    _ -> errorWithoutStackTrace
-                           "Data.Data.gunfold(SourceStrictness)"
-  dataTypeOf _ = sourceStrictnessDataType
+-- | @since 4.9.0.0
+deriving instance Data Generics.Fixity
 
------------------------------------------------------------------------
+-- | @since 4.9.0.0
+deriving instance Data Associativity
 
-decidedLazyConstr :: Constr
-decidedLazyConstr
-  = mkConstr decidedStrictnessDataType "DecidedLazy" [] Prefix
-decidedStrictConstr :: Constr
-decidedStrictConstr
-  = mkConstr decidedStrictnessDataType "DecidedStrict" [] Prefix
-decidedUnpackConstr :: Constr
-decidedUnpackConstr
-  = mkConstr decidedStrictnessDataType "DecidedUnpack" [] Prefix
+-- | @since 4.9.0.0
+deriving instance Data SourceUnpackedness
 
-decidedStrictnessDataType :: DataType
-decidedStrictnessDataType = mkDataType "GHC.Generics.DecidedStrictness"
-  [decidedLazyConstr,decidedStrictConstr,decidedUnpackConstr]
+-- | @since 4.9.0.0
+deriving instance Data SourceStrictness
 
-instance Data DecidedStrictness where
-  gfoldl _ z DecidedLazy   = z DecidedLazy
-  gfoldl _ z DecidedStrict = z DecidedStrict
-  gfoldl _ z DecidedUnpack = z DecidedUnpack
-  toConstr DecidedLazy   = decidedLazyConstr
-  toConstr DecidedStrict = decidedStrictConstr
-  toConstr DecidedUnpack = decidedUnpackConstr
-  gunfold _ z c = case constrIndex c of
-                    1 -> z DecidedLazy
-                    2 -> z DecidedStrict
-                    3 -> z DecidedUnpack
-                    _ -> errorWithoutStackTrace
-                           "Data.Data.gunfold(DecidedStrictness)"
-  dataTypeOf _ = decidedStrictnessDataType
+-- | @since 4.9.0.0
+deriving instance Data DecidedStrictness
diff --git a/Data/Dynamic.hs b/Data/Dynamic.hs
--- a/Data/Dynamic.hs
+++ b/Data/Dynamic.hs
@@ -1,51 +1,55 @@
 {-# LANGUAGE Trustworthy #-}
 {-# LANGUAGE NoImplicitPrelude #-}
-{-# LANGUAGE StandaloneDeriving #-}
+{-# LANGUAGE GADTs #-}
+{-# LANGUAGE ExplicitForAll #-}
+{-# LANGUAGE PatternSynonyms #-}
+{-# LANGUAGE ScopedTypeVariables #-}
+{-# LANGUAGE TypeApplications #-}
 
 -----------------------------------------------------------------------------
 -- |
 -- Module      :  Data.Dynamic
 -- Copyright   :  (c) The University of Glasgow 2001
 -- License     :  BSD-style (see the file libraries/base/LICENSE)
--- 
+--
 -- Maintainer  :  libraries@haskell.org
 -- Stability   :  experimental
 -- Portability :  portable
 --
 -- The Dynamic interface provides basic support for dynamic types.
--- 
+--
 -- Operations for injecting values of arbitrary type into
 -- a dynamically typed value, Dynamic, are provided, together
 -- with operations for converting dynamic values into a concrete
 -- (monomorphic) type.
--- 
+--
 -----------------------------------------------------------------------------
 
 module Data.Dynamic
   (
 
-        -- Module Data.Typeable re-exported for convenience
-        module Data.Typeable,
-
         -- * The @Dynamic@ type
-        Dynamic,        -- abstract, instance of: Show, Typeable
+        Dynamic(..),
 
         -- * Converting to and from @Dynamic@
         toDyn,
         fromDyn,
         fromDynamic,
-        
+
         -- * Applying functions of dynamic type
         dynApply,
         dynApp,
-        dynTypeRep
+        dynTypeRep,
 
+        -- * Convenience re-exports
+        Typeable
+
   ) where
 
 
-import Data.Typeable
+import Data.Type.Equality
+import Type.Reflection
 import Data.Maybe
-import Unsafe.Coerce
 
 import GHC.Base
 import GHC.Show
@@ -67,28 +71,30 @@
   'Show'ing a value of type 'Dynamic' returns a pretty-printed representation
   of the object\'s type; useful for debugging.
 -}
-data Dynamic = Dynamic TypeRep Obj
+data Dynamic where
+    Dynamic :: forall a. TypeRep a -> a -> Dynamic
 
+-- | @since 2.01
 instance Show Dynamic where
    -- the instance just prints the type representation.
-   showsPrec _ (Dynamic t _) = 
-          showString "<<" . 
-          showsPrec 0 t   . 
+   showsPrec _ (Dynamic t _) =
+          showString "<<" .
+          showsPrec 0 t   .
           showString ">>"
 
 -- here so that it isn't an orphan:
+-- | @since 4.0.0.0
 instance Exception Dynamic
 
-type Obj = Any
  -- Use GHC's primitive 'Any' type to hold the dynamically typed value.
  --
  -- In GHC's new eval/apply execution model this type must not look
- -- like a data type.  If it did, GHC would use the constructor convention 
- -- when evaluating it, and this will go wrong if the object is really a 
+ -- like a data type.  If it did, GHC would use the constructor convention
+ -- when evaluating it, and this will go wrong if the object is really a
  -- function.  Using Any forces GHC to use
  -- a fallback convention for evaluating it that works for all types.
 
--- | Converts an arbitrary value into an object of type 'Dynamic'.  
+-- | Converts an arbitrary value into an object of type 'Dynamic'.
 --
 -- The type of the object must be an instance of 'Typeable', which
 -- ensures that only monomorphically-typed objects may be converted to
@@ -98,47 +104,48 @@
 -- >    toDyn (id :: Int -> Int)
 --
 toDyn :: Typeable a => a -> Dynamic
-toDyn v = Dynamic (typeOf v) (unsafeCoerce v)
+toDyn v = Dynamic typeRep v
 
 -- | Converts a 'Dynamic' object back into an ordinary Haskell value of
 -- the correct type.  See also 'fromDynamic'.
 fromDyn :: Typeable a
         => Dynamic      -- ^ the dynamically-typed object
-        -> a            -- ^ a default value 
+        -> a            -- ^ a default value
         -> a            -- ^ returns: the value of the first argument, if
                         -- it has the correct type, otherwise the value of
                         -- the second argument.
 fromDyn (Dynamic t v) def
-  | typeOf def == t = unsafeCoerce v
-  | otherwise       = def
+  | Just HRefl <- t `eqTypeRep` typeOf def = v
+  | otherwise                              = def
 
 -- | Converts a 'Dynamic' object back into an ordinary Haskell value of
 -- the correct type.  See also 'fromDyn'.
 fromDynamic
-        :: Typeable a
+        :: forall a. Typeable a
         => Dynamic      -- ^ the dynamically-typed object
         -> Maybe a      -- ^ returns: @'Just' a@, if the dynamically-typed
-                        -- object has the correct type (and @a@ is its value), 
+                        -- object has the correct type (and @a@ is its value),
                         -- or 'Nothing' otherwise.
-fromDynamic (Dynamic t v) =
-  case unsafeCoerce v of 
-    r | t == typeOf r -> Just r
-      | otherwise     -> Nothing
+fromDynamic (Dynamic t v)
+  | Just HRefl <- t `eqTypeRep` rep = Just v
+  | otherwise                       = Nothing
+  where rep = typeRep :: TypeRep a
 
 -- (f::(a->b)) `dynApply` (x::a) = (f a)::b
 dynApply :: Dynamic -> Dynamic -> Maybe Dynamic
-dynApply (Dynamic t1 f) (Dynamic t2 x) =
-  case funResultTy t1 t2 of
-    Just t3 -> Just (Dynamic t3 ((unsafeCoerce f) x))
-    Nothing -> Nothing
+dynApply (Dynamic (Fun ta tr) f) (Dynamic ta' x)
+  | Just HRefl <- ta `eqTypeRep` ta'
+  , Just HRefl <- typeRep @Type `eqTypeRep` typeRepKind tr
+  = Just (Dynamic tr (f x))
+dynApply _ _
+  = Nothing
 
 dynApp :: Dynamic -> Dynamic -> Dynamic
-dynApp f x = case dynApply f x of 
+dynApp f x = case dynApply f x of
              Just r -> r
              Nothing -> errorWithoutStackTrace ("Type error in dynamic application.\n" ++
                                "Can't apply function " ++ show f ++
                                " to argument " ++ show x)
 
-dynTypeRep :: Dynamic -> TypeRep
-dynTypeRep (Dynamic tr _) = tr 
-
+dynTypeRep :: Dynamic -> SomeTypeRep
+dynTypeRep (Dynamic tr _) = SomeTypeRep tr
diff --git a/Data/Either.hs b/Data/Either.hs
--- a/Data/Either.hs
+++ b/Data/Either.hs
@@ -24,6 +24,8 @@
    rights,
    isLeft,
    isRight,
+   fromLeft,
+   fromRight,
    partitionEithers,
  ) where
 
@@ -124,15 +126,18 @@
 data  Either a b  =  Left a | Right b
   deriving (Eq, Ord, Read, Show)
 
+-- | @since 3.0
 instance Functor (Either a) where
     fmap _ (Left x) = Left x
     fmap f (Right y) = Right (f y)
 
+-- | @since 3.0
 instance Applicative (Either e) where
     pure          = Right
     Left  e <*> _ = Left e
     Right f <*> r = fmap f r
 
+-- | @since 4.4.0.0
 instance Monad (Either e) where
     Left  l >>= _ = Left l
     Right r >>= k = k r
@@ -173,6 +178,7 @@
 --
 lefts   :: [Either a b] -> [a]
 lefts x = [a | Left a <- x]
+{-# INLINEABLE lefts #-} -- otherwise doesnt get an unfolding, see #13689
 
 -- | Extracts from a list of 'Either' all the 'Right' elements.
 -- All the 'Right' elements are extracted in order.
@@ -187,6 +193,7 @@
 --
 rights   :: [Either a b] -> [b]
 rights x = [a | Right a <- x]
+{-# INLINEABLE rights #-} -- otherwise doesnt get an unfolding, see #13689
 
 -- | Partitions a list of 'Either' into two lists.
 -- All the 'Left' elements are extracted, in order, to the first
@@ -276,6 +283,40 @@
 isRight :: Either a b -> Bool
 isRight (Left  _) = False
 isRight (Right _) = True
+
+-- | Return the contents of a 'Left'-value or a default value otherwise.
+--
+-- @since 4.10.0.0
+--
+-- ==== __Examples__
+--
+-- Basic usage:
+--
+-- >>> fromLeft 1 (Left 3)
+-- 3
+-- >>> fromLeft 1 (Right "foo")
+-- 1
+--
+fromLeft :: a -> Either a b -> a
+fromLeft _ (Left a) = a
+fromLeft a _        = a
+
+-- | Return the contents of a 'Right'-value or a default value otherwise.
+--
+-- @since 4.10.0.0
+--
+-- ==== __Examples__
+--
+-- Basic usage:
+--
+-- >>> fromRight 1 (Right 3)
+-- 3
+-- >>> fromRight 1 (Left "foo")
+-- 1
+--
+fromRight :: b -> Either a b -> b
+fromRight _ (Right b) = b
+fromRight b _         = b
 
 -- instance for the == Boolean type-level equality operator
 type family EqEither a b where
diff --git a/Data/Fixed.hs b/Data/Fixed.hs
--- a/Data/Fixed.hs
+++ b/Data/Fixed.hs
@@ -66,6 +66,8 @@
 tyFixed = mkDataType "Data.Fixed.Fixed" [conMkFixed]
 conMkFixed :: Constr
 conMkFixed = mkConstr tyFixed "MkFixed" [] Prefix
+
+-- | @since 4.1.0.0
 instance (Typeable a) => Data (Fixed a) where
     gfoldl k z (MkFixed a) = k (z MkFixed) a
     gunfold k z _ = k (z MkFixed)
@@ -81,6 +83,7 @@
 withResolution :: (HasResolution a) => (Integer -> f a) -> f a
 withResolution foo = withType (foo . resolution)
 
+-- | @since 2.01
 instance Enum (Fixed a) where
     succ (MkFixed a) = MkFixed (succ a)
     pred (MkFixed a) = MkFixed (pred a)
@@ -91,6 +94,7 @@
     enumFromTo (MkFixed a) (MkFixed b) = fmap MkFixed (enumFromTo a b)
     enumFromThenTo (MkFixed a) (MkFixed b) (MkFixed c) = fmap MkFixed (enumFromThenTo a b c)
 
+-- | @since 2.01
 instance (HasResolution a) => Num (Fixed a) where
     (MkFixed a) + (MkFixed b) = MkFixed (a + b)
     (MkFixed a) - (MkFixed b) = MkFixed (a - b)
@@ -100,15 +104,18 @@
     signum (MkFixed a) = fromInteger (signum a)
     fromInteger i = withResolution (\res -> MkFixed (i * res))
 
+-- | @since 2.01
 instance (HasResolution a) => Real (Fixed a) where
     toRational fa@(MkFixed a) = (toRational a) / (toRational (resolution fa))
 
+-- | @since 2.01
 instance (HasResolution a) => Fractional (Fixed a) where
     fa@(MkFixed a) / (MkFixed b) = MkFixed (div (a * (resolution fa)) b)
     recip fa@(MkFixed a) = MkFixed (div (res * res) a) where
         res = resolution fa
     fromRational r = withResolution (\res -> MkFixed (floor (r * (toRational res))))
 
+-- | @since 2.01
 instance (HasResolution a) => RealFrac (Fixed a) where
     properFraction a = (i,a - (fromIntegral i)) where
         i = truncate a
@@ -146,9 +153,11 @@
     fracNum = divCeil (d * maxnum) res
     divCeil x y = (x + y - 1) `div` y
 
+-- | @since 2.01
 instance (HasResolution a) => Show (Fixed a) where
     show = showFixed False
 
+-- | @since 4.3.0.0
 instance (HasResolution a) => Read (Fixed a) where
     readPrec     = readNumber convertFixed
     readListPrec = readListPrecDefault
@@ -166,42 +175,56 @@
 convertFixed _ = pfail
 
 data E0
+
+-- | @since 4.1.0.0
 instance HasResolution E0 where
     resolution _ = 1
 -- | resolution of 1, this works the same as Integer
 type Uni = Fixed E0
 
 data E1
+
+-- | @since 4.1.0.0
 instance HasResolution E1 where
     resolution _ = 10
 -- | resolution of 10^-1 = .1
 type Deci = Fixed E1
 
 data E2
+
+-- | @since 4.1.0.0
 instance HasResolution E2 where
     resolution _ = 100
 -- | resolution of 10^-2 = .01, useful for many monetary currencies
 type Centi = Fixed E2
 
 data E3
+
+-- | @since 4.1.0.0
 instance HasResolution E3 where
     resolution _ = 1000
 -- | resolution of 10^-3 = .001
 type Milli = Fixed E3
 
 data E6
+
+-- | @since 2.01
 instance HasResolution E6 where
     resolution _ = 1000000
 -- | resolution of 10^-6 = .000001
 type Micro = Fixed E6
 
 data E9
+
+-- | @since 4.1.0.0
 instance HasResolution E9 where
     resolution _ = 1000000000
 -- | resolution of 10^-9 = .000000001
 type Nano = Fixed E9
 
 data E12
+
+-- | @since 2.01
 instance HasResolution E12 where
     resolution _ = 1000000000000
 -- | resolution of 10^-12 = .000000000001
diff --git a/Data/Foldable.hs b/Data/Foldable.hs
--- a/Data/Foldable.hs
+++ b/Data/Foldable.hs
@@ -21,23 +21,22 @@
 -----------------------------------------------------------------------------
 
 module Data.Foldable (
-    -- * Folds
     Foldable(..),
-    -- ** Special biased folds
+    -- * Special biased folds
     foldrM,
     foldlM,
-    -- ** Folding actions
-    -- *** Applicative actions
+    -- * Folding actions
+    -- ** Applicative actions
     traverse_,
     for_,
     sequenceA_,
     asum,
-    -- *** Monadic actions
+    -- ** Monadic actions
     mapM_,
     forM_,
     sequence_,
     msum,
-    -- ** Specialized folds
+    -- * Specialized folds
     concat,
     concatMap,
     and,
@@ -46,7 +45,7 @@
     all,
     maximumBy,
     minimumBy,
-    -- ** Searches
+    -- * Searches
     notElem,
     find
     ) where
@@ -54,6 +53,7 @@
 import Data.Bool
 import Data.Either
 import Data.Eq
+import Data.Functor.Utils (Max(..), Min(..), (#.))
 import qualified GHC.List as List
 import Data.Maybe
 import Data.Monoid
@@ -268,13 +268,17 @@
 
 -- instances for Prelude types
 
+-- | @since 2.01
 instance Foldable Maybe where
+    foldMap = maybe mempty
+
     foldr _ z Nothing = z
     foldr f z (Just x) = f x z
 
     foldl _ z Nothing = z
     foldl f z (Just x) = f z x
 
+-- | @since 2.01
 instance Foldable [] where
     elem    = List.elem
     foldl   = List.foldl
@@ -290,6 +294,7 @@
     sum     = List.sum
     toList  = id
 
+-- | @since 4.7.0.0
 instance Foldable (Either a) where
     foldMap _ (Left _) = mempty
     foldMap f (Right y) = f y
@@ -302,11 +307,13 @@
 
     null             = isLeft
 
+-- | @since 4.7.0.0
 instance Foldable ((,) a) where
     foldMap f (_, y) = f y
 
     foldr f z (_, y) = f y z
 
+-- | @since 4.8.0.0
 instance Foldable (Array i) where
     foldr = foldrElems
     foldl = foldlElems
@@ -318,6 +325,7 @@
     length = numElements
     null a = numElements a == 0
 
+-- | @since 4.7.0.0
 instance Foldable Proxy where
     foldMap _ _ = mempty
     {-# INLINE foldMap #-}
@@ -335,6 +343,7 @@
     sum _      = 0
     product _  = 1
 
+-- | @since 4.8.0.0
 instance Foldable Dual where
     foldMap            = coerce
 
@@ -353,6 +362,7 @@
     sum                = getDual
     toList (Dual x)    = [x]
 
+-- | @since 4.8.0.0
 instance Foldable Sum where
     foldMap            = coerce
 
@@ -371,6 +381,7 @@
     sum                = getSum
     toList (Sum x)     = [x]
 
+-- | @since 4.8.0.0
 instance Foldable Product where
     foldMap               = coerce
 
@@ -389,42 +400,16 @@
     sum                   = getProduct
     toList (Product x)    = [x]
 
+-- | @since 4.8.0.0
 instance Foldable First where
     foldMap f = foldMap f . getFirst
 
+-- | @since 4.8.0.0
 instance Foldable Last where
     foldMap f = foldMap f . getLast
 
--- We don't export Max and Min because, as Edward Kmett pointed out to me,
--- there are two reasonable ways to define them. One way is to use Maybe, as we
--- do here; the other way is to impose a Bounded constraint on the Monoid
--- instance. We may eventually want to add both versions, but we don't want to
--- trample on anyone's toes by imposing Max = MaxMaybe.
-
-newtype Max a = Max {getMax :: Maybe a}
-newtype Min a = Min {getMin :: Maybe a}
-
-instance Ord a => Monoid (Max a) where
-  mempty = Max Nothing
-
-  {-# INLINE mappend #-}
-  m `mappend` Max Nothing = m
-  Max Nothing `mappend` n = n
-  (Max m@(Just x)) `mappend` (Max n@(Just y))
-    | x >= y    = Max m
-    | otherwise = Max n
-
-instance Ord a => Monoid (Min a) where
-  mempty = Min Nothing
-
-  {-# INLINE mappend #-}
-  m `mappend` Min Nothing = m
-  Min Nothing `mappend` n = n
-  (Min m@(Just x)) `mappend` (Min n@(Just y))
-    | x <= y    = Min m
-    | otherwise = Min n
-
 -- Instances for GHC.Generics
+-- | @since 4.9.0.0
 instance Foldable U1 where
     foldMap _ _ = mempty
     {-# INLINE foldMap #-}
@@ -566,16 +551,20 @@
 
 -- | The largest element of a non-empty structure with respect to the
 -- given comparison function.
+
+-- See Note [maximumBy/minimumBy space usage]
 maximumBy :: Foldable t => (a -> a -> Ordering) -> t a -> a
-maximumBy cmp = foldr1 max'
+maximumBy cmp = foldl1 max'
   where max' x y = case cmp x y of
                         GT -> x
                         _  -> y
 
 -- | The least element of a non-empty structure with respect to the
 -- given comparison function.
+
+-- See Note [maximumBy/minimumBy space usage]
 minimumBy :: Foldable t => (a -> a -> Ordering) -> t a -> a
-minimumBy cmp = foldr1 min'
+minimumBy cmp = foldl1 min'
   where min' x y = case cmp x y of
                         GT -> y
                         _  -> x
@@ -590,34 +579,24 @@
 find :: Foldable t => (a -> Bool) -> t a -> Maybe a
 find p = getFirst . foldMap (\ x -> First (if p x then Just x else Nothing))
 
--- See Note [Function coercion]
-(#.) :: Coercible b c => (b -> c) -> (a -> b) -> (a -> c)
-(#.) _f = coerce
-{-# INLINE (#.) #-}
-
 {-
-Note [Function coercion]
-~~~~~~~~~~~~~~~~~~~~~~~~
-
-Several functions here use (#.) instead of (.) to avoid potential efficiency
-problems relating to #7542. The problem, in a nutshell:
-
-If N is a newtype constructor, then N x will always have the same
-representation as x (something similar applies for a newtype deconstructor).
-However, if f is a function,
-
-N . f = \x -> N (f x)
-
-This looks almost the same as f, but the eta expansion lifts it--the lhs could
-be _|_, but the rhs never is. This can lead to very inefficient code.  Thus we
-steal a technique from Shachaf and Edward Kmett and adapt it to the current
-(rather clean) setting. Instead of using  N . f,  we use  N .## f, which is
-just
-
-coerce f `asTypeOf` (N . f)
+Note [maximumBy/minimumBy space usage]
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+When the type signatures of maximumBy and minimumBy were generalized to work
+over any Foldable instance (instead of just lists), they were defined using
+foldr1. This was problematic for space usage, as the semantics of maximumBy
+and minimumBy essentially require that they examine every element of the
+data structure. Using foldr1 to examine every element results in space usage
+proportional to the size of the data structure. For the common case of lists,
+this could be particularly bad (see Trac #10830).
 
-That is, we just *pretend* that f has the right type, and thanks to the safety
-of coerce, the type checker guarantees that nothing really goes wrong. We still
-have to be a bit careful, though: remember that #. completely ignores the
-*value* of its left operand.
+For the common case of lists, switching the implementations of maximumBy and
+minimumBy to foldl1 solves the issue, as GHC's strictness analysis can then
+make these functions only use O(1) stack space. It is perhaps not the optimal
+way to fix this problem, as there are other conceivable data structures
+(besides lists) which might benefit from specialized implementations for
+maximumBy and minimumBy (see
+https://ghc.haskell.org/trac/ghc/ticket/10830#comment:26 for a further
+discussion). But using foldl1 is at least always better than using foldr1, so
+GHC has chosen to adopt that approach for now.
 -}
diff --git a/Data/Functor.hs b/Data/Functor.hs
--- a/Data/Functor.hs
+++ b/Data/Functor.hs
@@ -27,7 +27,7 @@
 
 -- $setup
 -- Allow the use of Prelude in doctests.
--- >>> import Prelude
+-- >>> import Prelude hiding ((<$>))
 
 infixl 4 <$>
 
diff --git a/Data/Functor/Classes.hs b/Data/Functor/Classes.hs
--- a/Data/Functor/Classes.hs
+++ b/Data/Functor/Classes.hs
@@ -26,7 +26,9 @@
 --
 -- > instance (Eq1 f, Eq a) => Eq (T f a) where (==) = eq1
 -- > instance (Ord1 f, Ord a) => Ord (T f a) where compare = compare1
--- > instance (Read1 f, Read a) => Read (T f a) where readsPrec = readsPrec1
+-- > instance (Read1 f, Read a) => Read (T f a) where
+-- >   readPrec     = readPrec1
+-- >   readListPrec = readListPrecDefault
 -- > instance (Show1 f, Show a) => Show (T f a) where showsPrec = showsPrec1
 --
 -- @since 4.9.0.0
@@ -37,18 +39,20 @@
     -- ** For unary constructors
     Eq1(..), eq1,
     Ord1(..), compare1,
-    Read1(..), readsPrec1,
+    Read1(..), readsPrec1, readPrec1,
+    liftReadListDefault, liftReadListPrecDefault,
     Show1(..), showsPrec1,
     -- ** For binary constructors
     Eq2(..), eq2,
     Ord2(..), compare2,
-    Read2(..), readsPrec2,
+    Read2(..), readsPrec2, readPrec2,
+    liftReadList2Default, liftReadListPrec2Default,
     Show2(..), showsPrec2,
     -- * Helper functions
     -- $example
-    readsData,
-    readsUnaryWith,
-    readsBinaryWith,
+    readsData, readData,
+    readsUnaryWith, readUnaryWith,
+    readsBinaryWith, readBinaryWith,
     showsUnaryWith,
     showsBinaryWith,
     -- ** Obsolete helpers
@@ -60,13 +64,22 @@
     showsBinary1,
   ) where
 
-import Control.Applicative (Const(Const))
+import Control.Applicative (Alternative((<|>)), Const(Const))
+
 import Data.Functor.Identity (Identity(Identity))
 import Data.Proxy (Proxy(Proxy))
 import Data.Monoid (mappend)
+
+import GHC.Read (expectP, list, paren)
+
+import Text.ParserCombinators.ReadPrec (ReadPrec, readPrec_to_S, readS_to_Prec)
+import Text.Read (Read(..), parens, prec, step)
+import Text.Read.Lex (Lexeme(..))
 import Text.Show (showListWith)
 
 -- | Lifting of the 'Eq' class to unary type constructors.
+--
+-- @since 4.9.0.0
 class Eq1 f where
     -- | Lift an equality test through the type constructor.
     --
@@ -74,13 +87,19 @@
     -- but the more general type ensures that the implementation uses
     -- it to compare elements of the first container with elements of
     -- the second.
+    --
+    -- @since 4.9.0.0
     liftEq :: (a -> b -> Bool) -> f a -> f b -> Bool
 
 -- | Lift the standard @('==')@ function through the type constructor.
+--
+-- @since 4.9.0.0
 eq1 :: (Eq1 f, Eq a) => f a -> f a -> Bool
 eq1 = liftEq (==)
 
 -- | Lifting of the 'Ord' class to unary type constructors.
+--
+-- @since 4.9.0.0
 class (Eq1 f) => Ord1 f where
     -- | Lift a 'compare' function through the type constructor.
     --
@@ -88,45 +107,112 @@
     -- but the more general type ensures that the implementation uses
     -- it to compare elements of the first container with elements of
     -- the second.
+    --
+    -- @since 4.9.0.0
     liftCompare :: (a -> b -> Ordering) -> f a -> f b -> Ordering
 
 -- | Lift the standard 'compare' function through the type constructor.
+--
+-- @since 4.9.0.0
 compare1 :: (Ord1 f, Ord a) => f a -> f a -> Ordering
 compare1 = liftCompare compare
 
 -- | Lifting of the 'Read' class to unary type constructors.
+--
+-- Both 'liftReadsPrec' and 'liftReadPrec' exist to match the interface
+-- provided in the 'Read' type class, but it is recommended to implement
+-- 'Read1' instances using 'liftReadPrec' as opposed to 'liftReadsPrec', since
+-- the former is more efficient than the latter. For example:
+--
+-- @
+-- instance 'Read1' T where
+--   'liftReadPrec'     = ...
+--   'liftReadListPrec' = 'liftReadListPrecDefault'
+-- @
+--
+-- For more information, refer to the documentation for the 'Read' class.
+--
+-- @since 4.9.0.0
 class Read1 f where
+    {-# MINIMAL liftReadsPrec | liftReadPrec #-}
+
     -- | 'readsPrec' function for an application of the type constructor
     -- based on 'readsPrec' and 'readList' functions for the argument type.
+    --
+    -- @since 4.9.0.0
     liftReadsPrec :: (Int -> ReadS a) -> ReadS [a] -> Int -> ReadS (f a)
+    liftReadsPrec rp rl = readPrec_to_S $
+        liftReadPrec (readS_to_Prec rp) (readS_to_Prec (const rl))
 
     -- | 'readList' function for an application of the type constructor
     -- based on 'readsPrec' and 'readList' functions for the argument type.
     -- The default implementation using standard list syntax is correct
     -- for most types.
+    --
+    -- @since 4.9.0.0
     liftReadList :: (Int -> ReadS a) -> ReadS [a] -> ReadS [f a]
-    liftReadList rp rl = readListWith (liftReadsPrec rp rl 0)
+    liftReadList rp rl = readPrec_to_S
+        (list $ liftReadPrec (readS_to_Prec rp) (readS_to_Prec (const rl))) 0
 
--- | Read a list (using square brackets and commas), given a function
--- for reading elements.
-readListWith :: ReadS a -> ReadS [a]
-readListWith rp =
-    readParen False (\r -> [pr | ("[",s) <- lex r, pr <- readl s])
-  where
-    readl s = [([],t) | ("]",t) <- lex s] ++
-        [(x:xs,u) | (x,t) <- rp s, (xs,u) <- readl' t]
-    readl' s = [([],t) | ("]",t) <- lex s] ++
-        [(x:xs,v) | (",",t) <- lex s, (x,u) <- rp t, (xs,v) <- readl' u]
+    -- | 'readPrec' function for an application of the type constructor
+    -- based on 'readPrec' and 'readListPrec' functions for the argument type.
+    --
+    -- @since 4.10.0.0
+    liftReadPrec :: ReadPrec a -> ReadPrec [a] -> ReadPrec (f a)
+    liftReadPrec rp rl = readS_to_Prec $
+        liftReadsPrec (readPrec_to_S rp) (readPrec_to_S rl 0)
 
+    -- | 'readListPrec' function for an application of the type constructor
+    -- based on 'readPrec' and 'readListPrec' functions for the argument type.
+    --
+    -- The default definition uses 'liftReadList'. Instances that define
+    -- 'liftReadPrec' should also define 'liftReadListPrec' as
+    -- 'liftReadListPrecDefault'.
+    --
+    -- @since 4.10.0.0
+    liftReadListPrec :: ReadPrec a -> ReadPrec [a] -> ReadPrec [f a]
+    liftReadListPrec rp rl = readS_to_Prec $ \_ ->
+        liftReadList (readPrec_to_S rp) (readPrec_to_S rl 0)
+
 -- | Lift the standard 'readsPrec' and 'readList' functions through the
 -- type constructor.
+--
+-- @since 4.9.0.0
 readsPrec1 :: (Read1 f, Read a) => Int -> ReadS (f a)
 readsPrec1 = liftReadsPrec readsPrec readList
 
+-- | Lift the standard 'readPrec' and 'readListPrec' functions through the
+-- type constructor.
+--
+-- @since 4.10.0.0
+readPrec1 :: (Read1 f, Read a) => ReadPrec (f a)
+readPrec1 = liftReadPrec readPrec readListPrec
+
+-- | A possible replacement definition for the 'liftReadList' method.
+-- This is only needed for 'Read1' instances where 'liftReadListPrec' isn't
+-- defined as 'liftReadListPrecDefault'.
+--
+-- @since 4.10.0.0
+liftReadListDefault :: Read1 f => (Int -> ReadS a) -> ReadS [a] -> ReadS [f a]
+liftReadListDefault rp rl = readPrec_to_S
+    (liftReadListPrec (readS_to_Prec rp) (readS_to_Prec (const rl))) 0
+
+-- | A possible replacement definition for the 'liftReadListPrec' method,
+-- defined using 'liftReadPrec'.
+--
+-- @since 4.10.0.0
+liftReadListPrecDefault :: Read1 f => ReadPrec a -> ReadPrec [a]
+                        -> ReadPrec [f a]
+liftReadListPrecDefault rp rl = list (liftReadPrec rp rl)
+
 -- | Lifting of the 'Show' class to unary type constructors.
+--
+-- @since 4.9.0.0
 class Show1 f where
     -- | 'showsPrec' function for an application of the type constructor
     -- based on 'showsPrec' and 'showList' functions for the argument type.
+    --
+    -- @since 4.9.0.0
     liftShowsPrec :: (Int -> a -> ShowS) -> ([a] -> ShowS) ->
         Int -> f a -> ShowS
 
@@ -134,16 +220,22 @@
     -- based on 'showsPrec' and 'showList' functions for the argument type.
     -- The default implementation using standard list syntax is correct
     -- for most types.
+    --
+    -- @since 4.9.0.0
     liftShowList :: (Int -> a -> ShowS) -> ([a] -> ShowS) ->
         [f a] -> ShowS
     liftShowList sp sl = showListWith (liftShowsPrec sp sl 0)
 
 -- | Lift the standard 'showsPrec' and 'showList' functions through the
 -- type constructor.
+--
+-- @since 4.9.0.0
 showsPrec1 :: (Show1 f, Show a) => Int -> f a -> ShowS
 showsPrec1 = liftShowsPrec showsPrec showList
 
 -- | Lifting of the 'Eq' class to binary type constructors.
+--
+-- @since 4.9.0.0
 class Eq2 f where
     -- | Lift equality tests through the type constructor.
     --
@@ -151,13 +243,19 @@
     -- but the more general type ensures that the implementation uses
     -- them to compare elements of the first container with elements of
     -- the second.
+    --
+    -- @since 4.9.0.0
     liftEq2 :: (a -> b -> Bool) -> (c -> d -> Bool) -> f a c -> f b d -> Bool
 
 -- | Lift the standard @('==')@ function through the type constructor.
+--
+-- @since 4.9.0.0
 eq2 :: (Eq2 f, Eq a, Eq b) => f a b -> f a b -> Bool
 eq2 = liftEq2 (==) (==)
 
 -- | Lifting of the 'Ord' class to binary type constructors.
+--
+-- @since 4.9.0.0
 class (Eq2 f) => Ord2 f where
     -- | Lift 'compare' functions through the type constructor.
     --
@@ -165,37 +263,120 @@
     -- but the more general type ensures that the implementation uses
     -- them to compare elements of the first container with elements of
     -- the second.
+    --
+    -- @since 4.9.0.0
     liftCompare2 :: (a -> b -> Ordering) -> (c -> d -> Ordering) ->
         f a c -> f b d -> Ordering
 
 -- | Lift the standard 'compare' function through the type constructor.
+--
+-- @since 4.9.0.0
 compare2 :: (Ord2 f, Ord a, Ord b) => f a b -> f a b -> Ordering
 compare2 = liftCompare2 compare compare
 
 -- | Lifting of the 'Read' class to binary type constructors.
+--
+-- Both 'liftReadsPrec2' and 'liftReadPrec2' exist to match the interface
+-- provided in the 'Read' type class, but it is recommended to implement
+-- 'Read2' instances using 'liftReadPrec2' as opposed to 'liftReadsPrec2',
+-- since the former is more efficient than the latter. For example:
+--
+-- @
+-- instance 'Read2' T where
+--   'liftReadPrec2'     = ...
+--   'liftReadListPrec2' = 'liftReadListPrec2Default'
+-- @
+--
+-- For more information, refer to the documentation for the 'Read' class.
+-- @since 4.9.0.0
 class Read2 f where
+    {-# MINIMAL liftReadsPrec2 | liftReadPrec2 #-}
+
     -- | 'readsPrec' function for an application of the type constructor
     -- based on 'readsPrec' and 'readList' functions for the argument types.
+    --
+    -- @since 4.9.0.0
     liftReadsPrec2 :: (Int -> ReadS a) -> ReadS [a] ->
         (Int -> ReadS b) -> ReadS [b] -> Int -> ReadS (f a b)
+    liftReadsPrec2 rp1 rl1 rp2 rl2 = readPrec_to_S $
+        liftReadPrec2 (readS_to_Prec rp1) (readS_to_Prec (const rl1))
+                      (readS_to_Prec rp2) (readS_to_Prec (const rl2))
 
     -- | 'readList' function for an application of the type constructor
     -- based on 'readsPrec' and 'readList' functions for the argument types.
     -- The default implementation using standard list syntax is correct
     -- for most types.
+    --
+    -- @since 4.9.0.0
     liftReadList2 :: (Int -> ReadS a) -> ReadS [a] ->
         (Int -> ReadS b) -> ReadS [b] -> ReadS [f a b]
-    liftReadList2 rp1 rl1 rp2 rl2 =
-        readListWith (liftReadsPrec2 rp1 rl1 rp2 rl2 0)
+    liftReadList2 rp1 rl1 rp2 rl2 = readPrec_to_S
+       (list $ liftReadPrec2 (readS_to_Prec rp1) (readS_to_Prec (const rl1))
+                             (readS_to_Prec rp2) (readS_to_Prec (const rl2))) 0
 
+    -- | 'readPrec' function for an application of the type constructor
+    -- based on 'readPrec' and 'readListPrec' functions for the argument types.
+    --
+    -- @since 4.10.0.0
+    liftReadPrec2 :: ReadPrec a -> ReadPrec [a] ->
+        ReadPrec b -> ReadPrec [b] -> ReadPrec (f a b)
+    liftReadPrec2 rp1 rl1 rp2 rl2 = readS_to_Prec $
+        liftReadsPrec2 (readPrec_to_S rp1) (readPrec_to_S rl1 0)
+                       (readPrec_to_S rp2) (readPrec_to_S rl2 0)
+
+    -- | 'readListPrec' function for an application of the type constructor
+    -- based on 'readPrec' and 'readListPrec' functions for the argument types.
+    --
+    -- The default definition uses 'liftReadList2'. Instances that define
+    -- 'liftReadPrec2' should also define 'liftReadListPrec2' as
+    -- 'liftReadListPrec2Default'.
+    --
+    -- @since 4.10.0.0
+    liftReadListPrec2 :: ReadPrec a -> ReadPrec [a] ->
+        ReadPrec b -> ReadPrec [b] -> ReadPrec [f a b]
+    liftReadListPrec2 rp1 rl1 rp2 rl2 = readS_to_Prec $ \_ ->
+        liftReadList2 (readPrec_to_S rp1) (readPrec_to_S rl1 0)
+                      (readPrec_to_S rp2) (readPrec_to_S rl2 0)
+
 -- | Lift the standard 'readsPrec' function through the type constructor.
+--
+-- @since 4.9.0.0
 readsPrec2 :: (Read2 f, Read a, Read b) => Int -> ReadS (f a b)
 readsPrec2 = liftReadsPrec2 readsPrec readList readsPrec readList
 
+-- | Lift the standard 'readPrec' function through the type constructor.
+--
+-- @since 4.10.0.0
+readPrec2 :: (Read2 f, Read a, Read b) => ReadPrec (f a b)
+readPrec2 = liftReadPrec2 readPrec readListPrec readPrec readListPrec
+
+-- | A possible replacement definition for the 'liftReadList2' method.
+-- This is only needed for 'Read2' instances where 'liftReadListPrec2' isn't
+-- defined as 'liftReadListPrec2Default'.
+--
+-- @since 4.10.0.0
+liftReadList2Default :: Read2 f => (Int -> ReadS a) -> ReadS [a] ->
+    (Int -> ReadS b) -> ReadS [b] ->ReadS [f a b]
+liftReadList2Default rp1 rl1 rp2 rl2 = readPrec_to_S
+    (liftReadListPrec2 (readS_to_Prec rp1) (readS_to_Prec (const rl1))
+                       (readS_to_Prec rp2) (readS_to_Prec (const rl2))) 0
+
+-- | A possible replacement definition for the 'liftReadListPrec2' method,
+-- defined using 'liftReadPrec2'.
+--
+-- @since 4.10.0.0
+liftReadListPrec2Default :: Read2 f => ReadPrec a -> ReadPrec [a] ->
+    ReadPrec b -> ReadPrec [b] -> ReadPrec [f a b]
+liftReadListPrec2Default rp1 rl1 rp2 rl2 = list (liftReadPrec2 rp1 rl1 rp2 rl2)
+
 -- | Lifting of the 'Show' class to binary type constructors.
+--
+-- @since 4.9.0.0
 class Show2 f where
     -- | 'showsPrec' function for an application of the type constructor
     -- based on 'showsPrec' and 'showList' functions for the argument types.
+    --
+    -- @since 4.9.0.0
     liftShowsPrec2 :: (Int -> a -> ShowS) -> ([a] -> ShowS) ->
         (Int -> b -> ShowS) -> ([b] -> ShowS) -> Int -> f a b -> ShowS
 
@@ -203,155 +384,220 @@
     -- based on 'showsPrec' and 'showList' functions for the argument types.
     -- The default implementation using standard list syntax is correct
     -- for most types.
+    --
+    -- @since 4.9.0.0
     liftShowList2 :: (Int -> a -> ShowS) -> ([a] -> ShowS) ->
         (Int -> b -> ShowS) -> ([b] -> ShowS) -> [f a b] -> ShowS
     liftShowList2 sp1 sl1 sp2 sl2 =
         showListWith (liftShowsPrec2 sp1 sl1 sp2 sl2 0)
 
 -- | Lift the standard 'showsPrec' function through the type constructor.
+--
+-- @since 4.9.0.0
 showsPrec2 :: (Show2 f, Show a, Show b) => Int -> f a b -> ShowS
 showsPrec2 = liftShowsPrec2 showsPrec showList showsPrec showList
 
 -- Instances for Prelude type constructors
 
+-- | @since 4.9.0.0
 instance Eq1 Maybe where
     liftEq _ Nothing Nothing = True
     liftEq _ Nothing (Just _) = False
     liftEq _ (Just _) Nothing = False
     liftEq eq (Just x) (Just y) = eq x y
 
+-- | @since 4.9.0.0
 instance Ord1 Maybe where
     liftCompare _ Nothing Nothing = EQ
     liftCompare _ Nothing (Just _) = LT
     liftCompare _ (Just _) Nothing = GT
     liftCompare comp (Just x) (Just y) = comp x y
 
+-- | @since 4.9.0.0
 instance Read1 Maybe where
-    liftReadsPrec rp _ d =
-         readParen False (\ r -> [(Nothing,s) | ("Nothing",s) <- lex r])
-         `mappend`
-         readsData (readsUnaryWith rp "Just" Just) d
+    liftReadPrec rp _ =
+        parens (expectP (Ident "Nothing") *> pure Nothing)
+        <|>
+        readData (readUnaryWith rp "Just" Just)
 
+    liftReadListPrec = liftReadListPrecDefault
+    liftReadList     = liftReadListDefault
+
+-- | @since 4.9.0.0
 instance Show1 Maybe where
     liftShowsPrec _ _ _ Nothing = showString "Nothing"
     liftShowsPrec sp _ d (Just x) = showsUnaryWith sp "Just" d x
 
+-- | @since 4.9.0.0
 instance Eq1 [] where
     liftEq _ [] [] = True
     liftEq _ [] (_:_) = False
     liftEq _ (_:_) [] = False
     liftEq eq (x:xs) (y:ys) = eq x y && liftEq eq xs ys
 
+-- | @since 4.9.0.0
 instance Ord1 [] where
     liftCompare _ [] [] = EQ
     liftCompare _ [] (_:_) = LT
     liftCompare _ (_:_) [] = GT
     liftCompare comp (x:xs) (y:ys) = comp x y `mappend` liftCompare comp xs ys
 
+-- | @since 4.9.0.0
 instance Read1 [] where
-    liftReadsPrec _ rl _ = rl
+    liftReadPrec _ rl = rl
+    liftReadListPrec  = liftReadListPrecDefault
+    liftReadList      = liftReadListDefault
 
+-- | @since 4.9.0.0
 instance Show1 [] where
     liftShowsPrec _ sl _ = sl
 
+-- | @since 4.9.0.0
 instance Eq2 (,) where
     liftEq2 e1 e2 (x1, y1) (x2, y2) = e1 x1 x2 && e2 y1 y2
 
+-- | @since 4.9.0.0
 instance Ord2 (,) where
     liftCompare2 comp1 comp2 (x1, y1) (x2, y2) =
         comp1 x1 x2 `mappend` comp2 y1 y2
 
+-- | @since 4.9.0.0
 instance Read2 (,) where
-    liftReadsPrec2 rp1 _ rp2 _ _ = readParen False $ \ r ->
-        [((x,y), w) | ("(",s) <- lex r,
-                      (x,t)   <- rp1 0 s,
-                      (",",u) <- lex t,
-                      (y,v)   <- rp2 0 u,
-                      (")",w) <- lex v]
+    liftReadPrec2 rp1 _ rp2 _ = parens $ paren $ do
+        x <- rp1
+        expectP (Punc ",")
+        y <- rp2
+        return (x,y)
 
+    liftReadListPrec2 = liftReadListPrec2Default
+    liftReadList2     = liftReadList2Default
+
+-- | @since 4.9.0.0
 instance Show2 (,) where
     liftShowsPrec2 sp1 _ sp2 _ _ (x, y) =
         showChar '(' . sp1 0 x . showChar ',' . sp2 0 y . showChar ')'
 
+-- | @since 4.9.0.0
 instance (Eq a) => Eq1 ((,) a) where
     liftEq = liftEq2 (==)
 
+-- | @since 4.9.0.0
 instance (Ord a) => Ord1 ((,) a) where
     liftCompare = liftCompare2 compare
 
+-- | @since 4.9.0.0
 instance (Read a) => Read1 ((,) a) where
-    liftReadsPrec = liftReadsPrec2 readsPrec readList
+    liftReadPrec = liftReadPrec2 readPrec readListPrec
 
+    liftReadListPrec = liftReadListPrecDefault
+    liftReadList     = liftReadListDefault
+
+-- | @since 4.9.0.0
 instance (Show a) => Show1 ((,) a) where
     liftShowsPrec = liftShowsPrec2 showsPrec showList
 
+-- | @since 4.9.0.0
 instance Eq2 Either where
     liftEq2 e1 _ (Left x) (Left y) = e1 x y
     liftEq2 _ _ (Left _) (Right _) = False
     liftEq2 _ _ (Right _) (Left _) = False
     liftEq2 _ e2 (Right x) (Right y) = e2 x y
 
+-- | @since 4.9.0.0
 instance Ord2 Either where
     liftCompare2 comp1 _ (Left x) (Left y) = comp1 x y
     liftCompare2 _ _ (Left _) (Right _) = LT
     liftCompare2 _ _ (Right _) (Left _) = GT
     liftCompare2 _ comp2 (Right x) (Right y) = comp2 x y
 
+-- | @since 4.9.0.0
 instance Read2 Either where
-    liftReadsPrec2 rp1 _ rp2 _ = readsData $
-         readsUnaryWith rp1 "Left" Left `mappend`
-         readsUnaryWith rp2 "Right" Right
+    liftReadPrec2 rp1 _ rp2 _ = readData $
+         readUnaryWith rp1 "Left" Left <|>
+         readUnaryWith rp2 "Right" Right
 
+    liftReadListPrec2 = liftReadListPrec2Default
+    liftReadList2     = liftReadList2Default
+
+-- | @since 4.9.0.0
 instance Show2 Either where
     liftShowsPrec2 sp1 _ _ _ d (Left x) = showsUnaryWith sp1 "Left" d x
     liftShowsPrec2 _ _ sp2 _ d (Right x) = showsUnaryWith sp2 "Right" d x
 
+-- | @since 4.9.0.0
 instance (Eq a) => Eq1 (Either a) where
     liftEq = liftEq2 (==)
 
+-- | @since 4.9.0.0
 instance (Ord a) => Ord1 (Either a) where
     liftCompare = liftCompare2 compare
 
+-- | @since 4.9.0.0
 instance (Read a) => Read1 (Either a) where
-    liftReadsPrec = liftReadsPrec2 readsPrec readList
+    liftReadPrec = liftReadPrec2 readPrec readListPrec
 
+    liftReadListPrec = liftReadListPrecDefault
+    liftReadList     = liftReadListDefault
+
+-- | @since 4.9.0.0
 instance (Show a) => Show1 (Either a) where
     liftShowsPrec = liftShowsPrec2 showsPrec showList
 
 -- Instances for other functors defined in the base package
 
+-- | @since 4.9.0.0
 instance Eq1 Identity where
     liftEq eq (Identity x) (Identity y) = eq x y
 
+-- | @since 4.9.0.0
 instance Ord1 Identity where
     liftCompare comp (Identity x) (Identity y) = comp x y
 
+-- | @since 4.9.0.0
 instance Read1 Identity where
-    liftReadsPrec rp _ = readsData $
-         readsUnaryWith rp "Identity" Identity
+    liftReadPrec rp _ = readData $
+         readUnaryWith rp "Identity" Identity
 
+    liftReadListPrec = liftReadListPrecDefault
+    liftReadList     = liftReadListDefault
+
+-- | @since 4.9.0.0
 instance Show1 Identity where
     liftShowsPrec sp _ d (Identity x) = showsUnaryWith sp "Identity" d x
 
+-- | @since 4.9.0.0
 instance Eq2 Const where
     liftEq2 eq _ (Const x) (Const y) = eq x y
 
+-- | @since 4.9.0.0
 instance Ord2 Const where
     liftCompare2 comp _ (Const x) (Const y) = comp x y
 
+-- | @since 4.9.0.0
 instance Read2 Const where
-    liftReadsPrec2 rp _ _ _ = readsData $
-         readsUnaryWith rp "Const" Const
+    liftReadPrec2 rp _ _ _ = readData $
+         readUnaryWith rp "Const" Const
 
+    liftReadListPrec2 = liftReadListPrec2Default
+    liftReadList2     = liftReadList2Default
+
+-- | @since 4.9.0.0
 instance Show2 Const where
     liftShowsPrec2 sp _ _ _ d (Const x) = showsUnaryWith sp "Const" d x
 
+-- | @since 4.9.0.0
 instance (Eq a) => Eq1 (Const a) where
     liftEq = liftEq2 (==)
+-- | @since 4.9.0.0
 instance (Ord a) => Ord1 (Const a) where
     liftCompare = liftCompare2 compare
+-- | @since 4.9.0.0
 instance (Read a) => Read1 (Const a) where
-    liftReadsPrec = liftReadsPrec2 readsPrec readList
+    liftReadPrec = liftReadPrec2 readPrec readListPrec
+
+    liftReadListPrec = liftReadListPrecDefault
+    liftReadList     = liftReadListDefault
+-- | @since 4.9.0.0
 instance (Show a) => Show1 (Const a) where
     liftShowsPrec = liftShowsPrec2 showsPrec showList
 
@@ -371,9 +617,11 @@
 
 -- | @since 4.9.0.0
 instance Read1 Proxy where
-  liftReadsPrec _ _ d =
-    readParen (d > 10) (\r -> [(Proxy, s) | ("Proxy",s) <- lex r ])
+  liftReadPrec _ _ = parens (expectP (Ident "Proxy") *> pure Proxy)
 
+  liftReadListPrec = liftReadListPrecDefault
+  liftReadList     = liftReadListDefault
+
 -- Building blocks
 
 -- | @'readsData' p d@ is a parser for datatypes where each alternative
@@ -381,27 +629,68 @@
 -- passes it to @p@.  Parsers for various constructors can be constructed
 -- with 'readsUnary', 'readsUnary1' and 'readsBinary1', and combined with
 -- @mappend@ from the @Monoid@ class.
+--
+-- @since 4.9.0.0
 readsData :: (String -> ReadS a) -> Int -> ReadS a
 readsData reader d =
     readParen (d > 10) $ \ r -> [res | (kw,s) <- lex r, res <- reader kw s]
 
+-- | @'readData' p@ is a parser for datatypes where each alternative
+-- begins with a data constructor.  It parses the constructor and
+-- passes it to @p@.  Parsers for various constructors can be constructed
+-- with 'readUnaryWith' and 'readBinaryWith', and combined with
+-- '(<|>)' from the 'Alternative' class.
+--
+-- @since 4.10.0.0
+readData :: ReadPrec a -> ReadPrec a
+readData reader = parens $ prec 10 reader
+
 -- | @'readsUnaryWith' rp n c n'@ matches the name of a unary data constructor
 -- and then parses its argument using @rp@.
+--
+-- @since 4.9.0.0
 readsUnaryWith :: (Int -> ReadS a) -> String -> (a -> t) -> String -> ReadS t
 readsUnaryWith rp name cons kw s =
     [(cons x,t) | kw == name, (x,t) <- rp 11 s]
 
+-- | @'readUnaryWith' rp n c'@ matches the name of a unary data constructor
+-- and then parses its argument using @rp@.
+--
+-- @since 4.10.0.0
+readUnaryWith :: ReadPrec a -> String -> (a -> t) -> ReadPrec t
+readUnaryWith rp name cons = do
+    expectP $ Ident name
+    x <- step rp
+    return $ cons x
+
 -- | @'readsBinaryWith' rp1 rp2 n c n'@ matches the name of a binary
 -- data constructor and then parses its arguments using @rp1@ and @rp2@
 -- respectively.
+--
+-- @since 4.9.0.0
 readsBinaryWith :: (Int -> ReadS a) -> (Int -> ReadS b) ->
     String -> (a -> b -> t) -> String -> ReadS t
 readsBinaryWith rp1 rp2 name cons kw s =
     [(cons x y,u) | kw == name, (x,t) <- rp1 11 s, (y,u) <- rp2 11 t]
 
+-- | @'readBinaryWith' rp1 rp2 n c'@ matches the name of a binary
+-- data constructor and then parses its arguments using @rp1@ and @rp2@
+-- respectively.
+--
+-- @since 4.10.0.0
+readBinaryWith :: ReadPrec a -> ReadPrec b ->
+    String -> (a -> b -> t) -> ReadPrec t
+readBinaryWith rp1 rp2 name cons = do
+    expectP $ Ident name
+    x <- step rp1
+    y <- step rp2
+    return $ cons x y
+
 -- | @'showsUnaryWith' sp n d x@ produces the string representation of a
 -- unary data constructor with name @n@ and argument @x@, in precedence
 -- context @d@.
+--
+-- @since 4.9.0.0
 showsUnaryWith :: (Int -> a -> ShowS) -> String -> Int -> a -> ShowS
 showsUnaryWith sp name d x = showParen (d > 10) $
     showString name . showChar ' ' . sp 11 x
@@ -409,6 +698,8 @@
 -- | @'showsBinaryWith' sp1 sp2 n d x y@ produces the string
 -- representation of a binary data constructor with name @n@ and arguments
 -- @x@ and @y@, in precedence context @d@.
+--
+-- @since 4.9.0.0
 showsBinaryWith :: (Int -> a -> ShowS) -> (Int -> b -> ShowS) ->
     String -> Int -> a -> b -> ShowS
 showsBinaryWith sp1 sp2 name d x y = showParen (d > 10) $
@@ -418,6 +709,8 @@
 
 -- | @'readsUnary' n c n'@ matches the name of a unary data constructor
 -- and then parses its argument using 'readsPrec'.
+--
+-- @since 4.9.0.0
 {-# DEPRECATED readsUnary "Use readsUnaryWith to define liftReadsPrec" #-}
 readsUnary :: (Read a) => String -> (a -> t) -> String -> ReadS t
 readsUnary name cons kw s =
@@ -425,6 +718,8 @@
 
 -- | @'readsUnary1' n c n'@ matches the name of a unary data constructor
 -- and then parses its argument using 'readsPrec1'.
+--
+-- @since 4.9.0.0
 {-# DEPRECATED readsUnary1 "Use readsUnaryWith to define liftReadsPrec" #-}
 readsUnary1 :: (Read1 f, Read a) => String -> (f a -> t) -> String -> ReadS t
 readsUnary1 name cons kw s =
@@ -432,6 +727,8 @@
 
 -- | @'readsBinary1' n c n'@ matches the name of a binary data constructor
 -- and then parses its arguments using 'readsPrec1'.
+--
+-- @since 4.9.0.0
 {-# DEPRECATED readsBinary1 "Use readsBinaryWith to define liftReadsPrec" #-}
 readsBinary1 :: (Read1 f, Read1 g, Read a) =>
     String -> (f a -> g a -> t) -> String -> ReadS t
@@ -441,6 +738,8 @@
 
 -- | @'showsUnary' n d x@ produces the string representation of a unary data
 -- constructor with name @n@ and argument @x@, in precedence context @d@.
+--
+-- @since 4.9.0.0
 {-# DEPRECATED showsUnary "Use showsUnaryWith to define liftShowsPrec" #-}
 showsUnary :: (Show a) => String -> Int -> a -> ShowS
 showsUnary name d x = showParen (d > 10) $
@@ -448,6 +747,8 @@
 
 -- | @'showsUnary1' n d x@ produces the string representation of a unary data
 -- constructor with name @n@ and argument @x@, in precedence context @d@.
+--
+-- @since 4.9.0.0
 {-# DEPRECATED showsUnary1 "Use showsUnaryWith to define liftShowsPrec" #-}
 showsUnary1 :: (Show1 f, Show a) => String -> Int -> f a -> ShowS
 showsUnary1 name d x = showParen (d > 10) $
@@ -456,6 +757,8 @@
 -- | @'showsBinary1' n d x y@ produces the string representation of a binary
 -- data constructor with name @n@ and arguments @x@ and @y@, in precedence
 -- context @d@.
+--
+-- @since 4.9.0.0
 {-# DEPRECATED showsBinary1 "Use showsBinaryWith to define liftShowsPrec" #-}
 showsBinary1 :: (Show1 f, Show1 g, Show a) =>
     String -> Int -> f a -> g a -> ShowS
@@ -472,10 +775,11 @@
 a standard 'Read1' instance may be defined as
 
 > instance (Read1 f) => Read1 (T f) where
->     liftReadsPrec rp rl = readsData $
->         readsUnaryWith rp "Zero" Zero `mappend`
->         readsUnaryWith (liftReadsPrec rp rl) "One" One `mappend`
->         readsBinaryWith rp (liftReadsPrec rp rl) "Two" Two
+>     liftReadPrec rp rl = readData $
+>         readUnaryWith rp "Zero" Zero <|>
+>         readUnaryWith (liftReadPrec rp rl) "One" One <|>
+>         readBinaryWith rp (liftReadPrec rp rl) "Two" Two
+>     liftReadListPrec = liftReadListPrecDefault
 
 and the corresponding 'Show1' instance as
 
diff --git a/Data/Functor/Compose.hs b/Data/Functor/Compose.hs
--- a/Data/Functor/Compose.hs
+++ b/Data/Functor/Compose.hs
@@ -1,7 +1,8 @@
+{-# LANGUAGE ScopedTypeVariables #-}
 {-# LANGUAGE DeriveDataTypeable #-}
 {-# LANGUAGE DeriveGeneric #-}
 {-# LANGUAGE PolyKinds #-}
-{-# LANGUAGE Safe #-}
+{-# LANGUAGE Trustworthy #-}
 -----------------------------------------------------------------------------
 -- |
 -- Module      :  Data.Functor.Compose
@@ -24,10 +25,12 @@
 import Data.Functor.Classes
 
 import Control.Applicative
+import Data.Coerce (coerce)
 import Data.Data (Data)
 import Data.Foldable (Foldable(foldMap))
 import Data.Traversable (Traversable(traverse))
 import GHC.Generics (Generic, Generic1)
+import Text.Read (Read(..), readListDefault, readListPrecDefault)
 
 infixr 9 `Compose`
 
@@ -39,20 +42,27 @@
 
 -- Instances of lifted Prelude classes
 
+-- | @since 4.9.0.0
 instance (Eq1 f, Eq1 g) => Eq1 (Compose f g) where
     liftEq eq (Compose x) (Compose y) = liftEq (liftEq eq) x y
 
+-- | @since 4.9.0.0
 instance (Ord1 f, Ord1 g) => Ord1 (Compose f g) where
     liftCompare comp (Compose x) (Compose y) =
         liftCompare (liftCompare comp) x y
 
+-- | @since 4.9.0.0
 instance (Read1 f, Read1 g) => Read1 (Compose f g) where
-    liftReadsPrec rp rl = readsData $
-        readsUnaryWith (liftReadsPrec rp' rl') "Compose" Compose
+    liftReadPrec rp rl = readData $
+        readUnaryWith (liftReadPrec rp' rl') "Compose" Compose
       where
-        rp' = liftReadsPrec rp rl
-        rl' = liftReadList rp rl
+        rp' = liftReadPrec     rp rl
+        rl' = liftReadListPrec rp rl
 
+    liftReadListPrec = liftReadListPrecDefault
+    liftReadList     = liftReadListDefault
+
+-- | @since 4.9.0.0
 instance (Show1 f, Show1 g) => Show1 (Compose f g) where
     liftShowsPrec sp sl d (Compose x) =
         showsUnaryWith (liftShowsPrec sp' sl') "Compose" d x
@@ -62,33 +72,48 @@
 
 -- Instances of Prelude classes
 
+-- | @since 4.9.0.0
 instance (Eq1 f, Eq1 g, Eq a) => Eq (Compose f g a) where
     (==) = eq1
 
+-- | @since 4.9.0.0
 instance (Ord1 f, Ord1 g, Ord a) => Ord (Compose f g a) where
     compare = compare1
 
+-- | @since 4.9.0.0
 instance (Read1 f, Read1 g, Read a) => Read (Compose f g a) where
-    readsPrec = readsPrec1
+    readPrec = readPrec1
 
+    readListPrec = readListPrecDefault
+    readList     = readListDefault
+
+-- | @since 4.9.0.0
 instance (Show1 f, Show1 g, Show a) => Show (Compose f g a) where
     showsPrec = showsPrec1
 
 -- Functor instances
 
+-- | @since 4.9.0.0
 instance (Functor f, Functor g) => Functor (Compose f g) where
     fmap f (Compose x) = Compose (fmap (fmap f) x)
 
+-- | @since 4.9.0.0
 instance (Foldable f, Foldable g) => Foldable (Compose f g) where
     foldMap f (Compose t) = foldMap (foldMap f) t
 
+-- | @since 4.9.0.0
 instance (Traversable f, Traversable g) => Traversable (Compose f g) where
     traverse f (Compose t) = Compose <$> traverse (traverse f) t
 
+-- | @since 4.9.0.0
 instance (Applicative f, Applicative g) => Applicative (Compose f g) where
     pure x = Compose (pure (pure x))
-    Compose f <*> Compose x = Compose ((<*>) <$> f <*> x)
+    Compose f <*> Compose x = Compose (liftA2 (<*>) f x)
+    liftA2 f (Compose x) (Compose y) =
+      Compose (liftA2 (liftA2 f) x y)
 
+-- | @since 4.9.0.0
 instance (Alternative f, Applicative g) => Alternative (Compose f g) where
     empty = Compose empty
-    Compose x <|> Compose y = Compose (x <|> y)
+    (<|>) = coerce ((<|>) :: f (g a) -> f (g a) -> f (g a))
+      :: forall a . Compose f g a -> Compose f g a -> Compose f g a
diff --git a/Data/Functor/Const.hs b/Data/Functor/Const.hs
--- a/Data/Functor/Const.hs
+++ b/Data/Functor/Const.hs
@@ -43,24 +43,32 @@
 
 -- | This instance would be equivalent to the derived instances of the
 -- 'Const' newtype if the 'runConst' field were removed
+--
+-- @since 4.8.0.0
 instance Read a => Read (Const a b) where
     readsPrec d = readParen (d > 10)
         $ \r -> [(Const x,t) | ("Const", s) <- lex r, (x, t) <- readsPrec 11 s]
 
 -- | This instance would be equivalent to the derived instances of the
 -- 'Const' newtype if the 'runConst' field were removed
+--
+-- @since 4.8.0.0
 instance Show a => Show (Const a b) where
     showsPrec d (Const x) = showParen (d > 10) $
                             showString "Const " . showsPrec 11 x
 
+-- | @since 4.7.0.0
 instance Foldable (Const m) where
     foldMap _ _ = mempty
 
+-- | @since 2.01
 instance Functor (Const m) where
     fmap _ (Const v) = Const v
 
+-- | @since 2.0.1
 instance Monoid m => Applicative (Const m) where
     pure _ = Const mempty
+    liftA2 _ (Const x) (Const y) = Const (x `mappend` y)
     (<*>) = coerce (mappend :: m -> m -> m)
 -- This is pretty much the same as
 -- Const f <*> Const v = Const (f `mappend` v)
diff --git a/Data/Functor/Identity.hs b/Data/Functor/Identity.hs
--- a/Data/Functor/Identity.hs
+++ b/Data/Functor/Identity.hs
@@ -2,6 +2,7 @@
 {-# LANGUAGE DeriveGeneric #-}
 {-# LANGUAGE DeriveTraversable #-}
 {-# LANGUAGE GeneralizedNewtypeDeriving #-}
+{-# LANGUAGE NoImplicitPrelude #-}
 {-# LANGUAGE Trustworthy #-}
 
 -----------------------------------------------------------------------------
@@ -35,33 +36,43 @@
   ) where
 
 import Control.Monad.Fix
-import Control.Monad.Zip
 import Data.Bits (Bits, FiniteBits)
 import Data.Coerce
-import Data.Data (Data)
 import Data.Foldable
-import Data.Ix (Ix)
-import Data.Semigroup (Semigroup)
-import Data.String (IsString)
+import Data.Functor.Utils ((#.))
 import Foreign.Storable (Storable)
+import GHC.Arr (Ix)
+import GHC.Base ( Applicative(..), Eq(..), Functor(..), Monad(..)
+                , Monoid, Ord(..), ($), (.) )
+import GHC.Enum (Bounded, Enum)
+import GHC.Float (Floating, RealFloat)
 import GHC.Generics (Generic, Generic1)
+import GHC.Num (Num)
+import GHC.Read (Read(..), lex, readParen)
+import GHC.Real (Fractional, Integral, Real, RealFrac)
+import GHC.Show (Show(..), showParen, showString)
+import GHC.Types (Bool(..))
 
 -- | Identity functor and monad. (a non-strict monad)
 --
 -- @since 4.8.0.0
 newtype Identity a = Identity { runIdentity :: a }
-    deriving ( Bits, Bounded, Data, Enum, Eq, FiniteBits, Floating, Fractional
-             , Generic, Generic1, Integral, IsString, Ix, Monoid, Num, Ord
-             , Real, RealFrac, RealFloat , Semigroup, Storable, Traversable)
+    deriving ( Bits, Bounded, Enum, Eq, FiniteBits, Floating, Fractional
+             , Generic, Generic1, Integral, Ix, Monoid, Num, Ord
+             , Real, RealFrac, RealFloat, Storable)
 
 -- | This instance would be equivalent to the derived instances of the
 -- 'Identity' newtype if the 'runIdentity' field were removed
+--
+-- @since 4.8.0.0
 instance (Read a) => Read (Identity a) where
     readsPrec d = readParen (d > 10) $ \ r ->
         [(Identity x,t) | ("Identity",s) <- lex r, (x,t) <- readsPrec 11 s]
 
 -- | This instance would be equivalent to the derived instances of the
 -- 'Identity' newtype if the 'runIdentity' field were removed
+--
+-- @since 4.8.0.0
 instance (Show a) => Show (Identity a) where
     showsPrec d (Identity x) = showParen (d > 10) $
         showString "Identity " . showsPrec 11 x
@@ -69,6 +80,7 @@
 -- ---------------------------------------------------------------------------
 -- Identity instances for Functor and Monad
 
+-- | @since 4.8.0.0
 instance Foldable Identity where
     foldMap                = coerce
 
@@ -87,25 +99,20 @@
     sum                    = runIdentity
     toList (Identity x)    = [x]
 
+-- | @since 4.8.0.0
 instance Functor Identity where
     fmap     = coerce
 
+-- | @since 4.8.0.0
 instance Applicative Identity where
     pure     = Identity
     (<*>)    = coerce
+    liftA2   = coerce
 
+-- | @since 4.8.0.0
 instance Monad Identity where
     m >>= k  = k (runIdentity m)
 
+-- | @since 4.8.0.0
 instance MonadFix Identity where
     mfix f   = Identity (fix (runIdentity . f))
-
-instance MonadZip Identity where
-    mzipWith = coerce
-    munzip   = coerce
-
--- | Internal (non-exported) 'Coercible' helper for 'elem'
---
--- See Note [Function coercion] in "Data.Foldable" for more details.
-(#.) :: Coercible b c => (b -> c) -> (a -> b) -> a -> c
-(#.) _f = coerce
diff --git a/Data/Functor/Product.hs b/Data/Functor/Product.hs
--- a/Data/Functor/Product.hs
+++ b/Data/Functor/Product.hs
@@ -31,67 +31,95 @@
 import Data.Monoid (mappend)
 import Data.Traversable (Traversable(traverse))
 import GHC.Generics (Generic, Generic1)
+import Text.Read (Read(..), readListDefault, readListPrecDefault)
 
 -- | Lifted product of functors.
 data Product f g a = Pair (f a) (g a)
   deriving (Data, Generic, Generic1)
 
+-- | @since 4.9.0.0
 instance (Eq1 f, Eq1 g) => Eq1 (Product f g) where
     liftEq eq (Pair x1 y1) (Pair x2 y2) = liftEq eq x1 x2 && liftEq eq y1 y2
 
+-- | @since 4.9.0.0
 instance (Ord1 f, Ord1 g) => Ord1 (Product f g) where
     liftCompare comp (Pair x1 y1) (Pair x2 y2) =
         liftCompare comp x1 x2 `mappend` liftCompare comp y1 y2
 
+-- | @since 4.9.0.0
 instance (Read1 f, Read1 g) => Read1 (Product f g) where
-    liftReadsPrec rp rl = readsData $
-        readsBinaryWith (liftReadsPrec rp rl) (liftReadsPrec rp rl) "Pair" Pair
+    liftReadPrec rp rl = readData $
+        readBinaryWith (liftReadPrec rp rl) (liftReadPrec rp rl) "Pair" Pair
 
+    liftReadListPrec = liftReadListPrecDefault
+    liftReadList     = liftReadListDefault
+
+-- | @since 4.9.0.0
 instance (Show1 f, Show1 g) => Show1 (Product f g) where
     liftShowsPrec sp sl d (Pair x y) =
         showsBinaryWith (liftShowsPrec sp sl) (liftShowsPrec sp sl) "Pair" d x y
 
+-- | @since 4.9.0.0
 instance (Eq1 f, Eq1 g, Eq a) => Eq (Product f g a)
     where (==) = eq1
+
+-- | @since 4.9.0.0
 instance (Ord1 f, Ord1 g, Ord a) => Ord (Product f g a) where
     compare = compare1
+
+-- | @since 4.9.0.0
 instance (Read1 f, Read1 g, Read a) => Read (Product f g a) where
-    readsPrec = readsPrec1
+    readPrec = readPrec1
+
+    readListPrec = readListPrecDefault
+    readList     = readListDefault
+
+-- | @since 4.9.0.0
 instance (Show1 f, Show1 g, Show a) => Show (Product f g a) where
     showsPrec = showsPrec1
 
+-- | @since 4.9.0.0
 instance (Functor f, Functor g) => Functor (Product f g) where
     fmap f (Pair x y) = Pair (fmap f x) (fmap f y)
 
+-- | @since 4.9.0.0
 instance (Foldable f, Foldable g) => Foldable (Product f g) where
     foldMap f (Pair x y) = foldMap f x `mappend` foldMap f y
 
+-- | @since 4.9.0.0
 instance (Traversable f, Traversable g) => Traversable (Product f g) where
-    traverse f (Pair x y) = Pair <$> traverse f x <*> traverse f y
+    traverse f (Pair x y) = liftA2 Pair (traverse f x) (traverse f y)
 
+-- | @since 4.9.0.0
 instance (Applicative f, Applicative g) => Applicative (Product f g) where
     pure x = Pair (pure x) (pure x)
     Pair f g <*> Pair x y = Pair (f <*> x) (g <*> y)
+    liftA2 f (Pair a b) (Pair x y) = Pair (liftA2 f a x) (liftA2 f b y)
 
+-- | @since 4.9.0.0
 instance (Alternative f, Alternative g) => Alternative (Product f g) where
     empty = Pair empty empty
     Pair x1 y1 <|> Pair x2 y2 = Pair (x1 <|> x2) (y1 <|> y2)
 
+-- | @since 4.9.0.0
 instance (Monad f, Monad g) => Monad (Product f g) where
     Pair m n >>= f = Pair (m >>= fstP . f) (n >>= sndP . f)
       where
         fstP (Pair a _) = a
         sndP (Pair _ b) = b
 
+-- | @since 4.9.0.0
 instance (MonadPlus f, MonadPlus g) => MonadPlus (Product f g) where
     mzero = Pair mzero mzero
     Pair x1 y1 `mplus` Pair x2 y2 = Pair (x1 `mplus` x2) (y1 `mplus` y2)
 
+-- | @since 4.9.0.0
 instance (MonadFix f, MonadFix g) => MonadFix (Product f g) where
     mfix f = Pair (mfix (fstP . f)) (mfix (sndP . f))
       where
         fstP (Pair a _) = a
         sndP (Pair _ b) = b
 
+-- | @since 4.9.0.0
 instance (MonadZip f, MonadZip g) => MonadZip (Product f g) where
     mzipWith f (Pair x1 y1) (Pair x2 y2) = Pair (mzipWith f x1 x2) (mzipWith f y1 y2)
diff --git a/Data/Functor/Sum.hs b/Data/Functor/Sum.hs
--- a/Data/Functor/Sum.hs
+++ b/Data/Functor/Sum.hs
@@ -21,57 +21,75 @@
     Sum(..),
   ) where
 
+import Control.Applicative ((<|>))
 import Data.Data (Data)
 import Data.Foldable (Foldable(foldMap))
 import Data.Functor.Classes
-import Data.Monoid (mappend)
 import Data.Traversable (Traversable(traverse))
 import GHC.Generics (Generic, Generic1)
+import Text.Read (Read(..), readListDefault, readListPrecDefault)
 
 -- | Lifted sum of functors.
 data Sum f g a = InL (f a) | InR (g a)
   deriving (Data, Generic, Generic1)
 
+-- | @since 4.9.0.0
 instance (Eq1 f, Eq1 g) => Eq1 (Sum f g) where
     liftEq eq (InL x1) (InL x2) = liftEq eq x1 x2
     liftEq _ (InL _) (InR _) = False
     liftEq _ (InR _) (InL _) = False
     liftEq eq (InR y1) (InR y2) = liftEq eq y1 y2
 
+-- | @since 4.9.0.0
 instance (Ord1 f, Ord1 g) => Ord1 (Sum f g) where
     liftCompare comp (InL x1) (InL x2) = liftCompare comp x1 x2
     liftCompare _ (InL _) (InR _) = LT
     liftCompare _ (InR _) (InL _) = GT
     liftCompare comp (InR y1) (InR y2) = liftCompare comp y1 y2
 
+-- | @since 4.9.0.0
 instance (Read1 f, Read1 g) => Read1 (Sum f g) where
-    liftReadsPrec rp rl = readsData $
-        readsUnaryWith (liftReadsPrec rp rl) "InL" InL `mappend`
-        readsUnaryWith (liftReadsPrec rp rl) "InR" InR
+    liftReadPrec rp rl = readData $
+        readUnaryWith (liftReadPrec rp rl) "InL" InL <|>
+        readUnaryWith (liftReadPrec rp rl) "InR" InR
 
+    liftReadListPrec = liftReadListPrecDefault
+    liftReadList     = liftReadListDefault
+
+-- | @since 4.9.0.0
 instance (Show1 f, Show1 g) => Show1 (Sum f g) where
     liftShowsPrec sp sl d (InL x) =
         showsUnaryWith (liftShowsPrec sp sl) "InL" d x
     liftShowsPrec sp sl d (InR y) =
         showsUnaryWith (liftShowsPrec sp sl) "InR" d y
 
+-- | @since 4.9.0.0
 instance (Eq1 f, Eq1 g, Eq a) => Eq (Sum f g a) where
     (==) = eq1
+-- | @since 4.9.0.0
 instance (Ord1 f, Ord1 g, Ord a) => Ord (Sum f g a) where
     compare = compare1
+-- | @since 4.9.0.0
 instance (Read1 f, Read1 g, Read a) => Read (Sum f g a) where
-    readsPrec = readsPrec1
+    readPrec = readPrec1
+
+    readListPrec = readListPrecDefault
+    readList     = readListDefault
+-- | @since 4.9.0.0
 instance (Show1 f, Show1 g, Show a) => Show (Sum f g a) where
     showsPrec = showsPrec1
 
+-- | @since 4.9.0.0
 instance (Functor f, Functor g) => Functor (Sum f g) where
     fmap f (InL x) = InL (fmap f x)
     fmap f (InR y) = InR (fmap f y)
 
+-- | @since 4.9.0.0
 instance (Foldable f, Foldable g) => Foldable (Sum f g) where
     foldMap f (InL x) = foldMap f x
     foldMap f (InR y) = foldMap f y
 
+-- | @since 4.9.0.0
 instance (Traversable f, Traversable g) => Traversable (Sum f g) where
     traverse f (InL x) = InL <$> traverse f x
     traverse f (InR y) = InR <$> traverse f y
diff --git a/Data/Functor/Utils.hs b/Data/Functor/Utils.hs
new file mode 100644
--- /dev/null
+++ b/Data/Functor/Utils.hs
@@ -0,0 +1,115 @@
+{-# LANGUAGE Trustworthy #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+
+-----------------------------------------------------------------------------
+-- This is a non-exposed internal module.
+--
+-- This code contains utility function and data structures that are used
+-- to improve the efficiency of several instances in the Data.* namespace.
+-----------------------------------------------------------------------------
+module Data.Functor.Utils where
+
+import Data.Coerce (Coercible, coerce)
+import GHC.Base ( Applicative(..), Functor(..), Maybe(..), Monoid(..), Ord(..)
+                , ($), otherwise )
+
+-- We don't expose Max and Min because, as Edward Kmett pointed out to me,
+-- there are two reasonable ways to define them. One way is to use Maybe, as we
+-- do here; the other way is to impose a Bounded constraint on the Monoid
+-- instance. We may eventually want to add both versions, but we don't want to
+-- trample on anyone's toes by imposing Max = MaxMaybe.
+
+newtype Max a = Max {getMax :: Maybe a}
+newtype Min a = Min {getMin :: Maybe a}
+
+-- | @since 4.8.0.0
+instance Ord a => Monoid (Max a) where
+  mempty = Max Nothing
+
+  {-# INLINE mappend #-}
+  m `mappend` Max Nothing = m
+  Max Nothing `mappend` n = n
+  (Max m@(Just x)) `mappend` (Max n@(Just y))
+    | x >= y    = Max m
+    | otherwise = Max n
+
+-- | @since 4.8.0.0
+instance Ord a => Monoid (Min a) where
+  mempty = Min Nothing
+
+  {-# INLINE mappend #-}
+  m `mappend` Min Nothing = m
+  Min Nothing `mappend` n = n
+  (Min m@(Just x)) `mappend` (Min n@(Just y))
+    | x <= y    = Min m
+    | otherwise = Min n
+
+-- left-to-right state transformer
+newtype StateL s a = StateL { runStateL :: s -> (s, a) }
+
+-- | @since 4.0
+instance Functor (StateL s) where
+    fmap f (StateL k) = StateL $ \ s -> let (s', v) = k s in (s', f v)
+
+-- | @since 4.0
+instance Applicative (StateL s) where
+    pure x = StateL (\ s -> (s, x))
+    StateL kf <*> StateL kv = StateL $ \ s ->
+        let (s', f) = kf s
+            (s'', v) = kv s'
+        in (s'', f v)
+    liftA2 f (StateL kx) (StateL ky) = StateL $ \s ->
+        let (s', x) = kx s
+            (s'', y) = ky s'
+        in (s'', f x y)
+
+-- right-to-left state transformer
+newtype StateR s a = StateR { runStateR :: s -> (s, a) }
+
+-- | @since 4.0
+instance Functor (StateR s) where
+    fmap f (StateR k) = StateR $ \ s -> let (s', v) = k s in (s', f v)
+
+-- | @since 4.0
+instance Applicative (StateR s) where
+    pure x = StateR (\ s -> (s, x))
+    StateR kf <*> StateR kv = StateR $ \ s ->
+        let (s', v) = kv s
+            (s'', f) = kf s'
+        in (s'', f v)
+    liftA2 f (StateR kx) (StateR ky) = StateR $ \ s ->
+        let (s', y) = ky s
+            (s'', x) = kx s'
+        in (s'', f x y)
+
+-- See Note [Function coercion]
+(#.) :: Coercible b c => (b -> c) -> (a -> b) -> (a -> c)
+(#.) _f = coerce
+{-# INLINE (#.) #-}
+
+{-
+Note [Function coercion]
+~~~~~~~~~~~~~~~~~~~~~~~
+
+Several functions here use (#.) instead of (.) to avoid potential efficiency
+problems relating to #7542. The problem, in a nutshell:
+
+If N is a newtype constructor, then N x will always have the same
+representation as x (something similar applies for a newtype deconstructor).
+However, if f is a function,
+
+N . f = \x -> N (f x)
+
+This looks almost the same as f, but the eta expansion lifts it--the lhs could
+be _|_, but the rhs never is. This can lead to very inefficient code.  Thus we
+steal a technique from Shachaf and Edward Kmett and adapt it to the current
+(rather clean) setting. Instead of using  N . f,  we use  N #. f, which is
+just
+
+coerce f `asTypeOf` (N . f)
+
+That is, we just *pretend* that f has the right type, and thanks to the safety
+of coerce, the type checker guarantees that nothing really goes wrong. We still
+have to be a bit careful, though: remember that #. completely ignores the
+*value* of its left operand.
+-}
diff --git a/Data/List/NonEmpty.hs b/Data/List/NonEmpty.hs
--- a/Data/List/NonEmpty.hs
+++ b/Data/List/NonEmpty.hs
@@ -101,15 +101,17 @@
                                       unzip, zip, zipWith, (!!))
 import qualified Prelude
 
-import           Control.Applicative (Alternative, many)
-import           Control.Monad       (ap)
+import           Control.Applicative (Applicative (..), Alternative (many))
+import           Control.Monad       (ap, liftM2)
 import           Control.Monad.Fix
 import           Control.Monad.Zip   (MonadZip(..))
 import           Data.Data           (Data)
 import           Data.Foldable       hiding (length, toList)
 import qualified Data.Foldable       as Foldable
 import           Data.Function       (on)
+import           Data.Functor.Classes (Eq1(..), Ord1(..), Read1(..), Show1(..))
 import qualified Data.List           as List
+import           Data.Monoid         ((<>))
 import           Data.Ord            (comparing)
 import qualified GHC.Exts            as Exts (IsList(..))
 import           GHC.Generics        (Generic, Generic1)
@@ -122,15 +124,39 @@
 data NonEmpty a = a :| [a]
   deriving ( Eq, Ord, Show, Read, Data, Generic, Generic1 )
 
+-- | @since 4.10.0.0
+instance Eq1 NonEmpty where
+  liftEq eq (a :| as) (b :| bs) = eq a b && liftEq eq as bs
+
+-- | @since 4.10.0.0
+instance Ord1 NonEmpty where
+  liftCompare cmp (a :| as) (b :| bs) = cmp a b <> liftCompare cmp as bs
+
+-- | @since 4.10.0.0
+instance Read1 NonEmpty where
+  liftReadsPrec rdP rdL p s = readParen (p > 5) (\s' -> do
+    (a, s'') <- rdP 6 s'
+    (":|", s''') <- lex s''
+    (as, s'''') <- rdL s'''
+    return (a :| as, s'''')) s
+
+-- | @since 4.10.0.0
+instance Show1 NonEmpty where
+  liftShowsPrec shwP shwL p (a :| as) = showParen (p > 5) $
+    shwP 6 a . showString " :| " . shwL as
+
+-- | @since 4.9.0.0
 instance Exts.IsList (NonEmpty a) where
   type Item (NonEmpty a) = a
   fromList               = fromList
   toList                 = toList
 
+-- | @since 4.9.0.0
 instance MonadFix NonEmpty where
   mfix f = case fix (f . head) of
              ~(x :| _) -> x :| mfix (tail . f)
 
+-- | @since 4.9.0.0
 instance MonadZip NonEmpty where
   mzip     = zip
   mzipWith = zipWith
@@ -154,6 +180,8 @@
 unfold f a = case f a of
   (b, Nothing) -> b :| []
   (b, Just c)  -> b <| unfold f c
+{-# DEPRECATED unfold "Use unfoldr" #-}
+-- Deprecated in 8.2.1, remove in 8.4
 
 -- | 'nonEmpty' efficiently turns a normal list into a 'NonEmpty' stream,
 -- producing 'Nothing' if the input is empty.
@@ -175,28 +203,36 @@
     go c = case f c of
       (d, me) -> d : maybe [] go me
 
+-- | @since 4.9.0.0
 instance Functor NonEmpty where
   fmap f ~(a :| as) = f a :| fmap f as
   b <$ ~(_ :| as)   = b   :| (b <$ as)
 
+-- | @since 4.9.0.0
 instance Applicative NonEmpty where
   pure a = a :| []
   (<*>) = ap
+  liftA2 = liftM2
 
+-- | @since 4.9.0.0
 instance Monad NonEmpty where
   ~(a :| as) >>= f = b :| (bs ++ bs')
     where b :| bs = f a
           bs' = as >>= toList . f
 
+-- | @since 4.9.0.0
 instance Traversable NonEmpty where
-  traverse f ~(a :| as) = (:|) <$> f a <*> traverse f as
+  traverse f ~(a :| as) = liftA2 (:|) (f a) (traverse f as)
 
+-- | @since 4.9.0.0
 instance Foldable NonEmpty where
   foldr f z ~(a :| as) = f a (foldr f z as)
   foldl f z ~(a :| as) = foldl f (f z a) as
   foldl1 f ~(a :| as) = foldl f a as
   foldMap f ~(a :| as) = f a `mappend` foldMap f as
   fold ~(m :| ms) = m `mappend` fold ms
+  length = length
+  toList = toList
 
 -- | Extract the first element of the stream.
 head :: NonEmpty a -> a
@@ -266,7 +302,7 @@
 
 -- | @'some1' x@ sequences @x@ one or more times.
 some1 :: Alternative f => f a -> f (NonEmpty a)
-some1 x = (:|) <$> x <*> many x
+some1 x = liftA2 (:|) x (many x)
 
 -- | 'scanl' is similar to 'foldl', but returns a stream of successive
 -- reduced values from the left:
@@ -458,7 +494,7 @@
 unzip xs = (fst <$> xs, snd <$> xs)
 
 -- | The 'nub' function removes duplicate elements from a list. In
--- particular, it keeps only the first occurence of each element.
+-- particular, it keeps only the first occurrence of each element.
 -- (The name 'nub' means \'essence\'.)
 -- It is a special case of 'nubBy', which allows the programmer to
 -- supply their own inequality test.
@@ -476,8 +512,8 @@
 -- > transpose . transpose /= id
 transpose :: NonEmpty (NonEmpty a) -> NonEmpty (NonEmpty a)
 transpose = fmap fromList
-          . fromList . List.transpose . Foldable.toList
-          . fmap Foldable.toList
+          . fromList . List.transpose . toList
+          . fmap toList
 
 -- | 'sortBy' for 'NonEmpty', behaves the same as 'Data.List.sortBy'
 sortBy :: (a -> a -> Ordering) -> NonEmpty a -> NonEmpty a
diff --git a/Data/Maybe.hs b/Data/Maybe.hs
--- a/Data/Maybe.hs
+++ b/Data/Maybe.hs
@@ -293,7 +293,7 @@
 "mapMaybeList" [1]  forall f. foldr (mapMaybeFB (:) f) [] = mapMaybe f
   #-}
 
-{-# NOINLINE [0] mapMaybeFB #-}
+{-# INLINE [0] mapMaybeFB #-} -- See Note [Inline FB functions] in GHC.List
 mapMaybeFB :: (b -> r -> r) -> (a -> Maybe b) -> a -> r -> r
 mapMaybeFB cons f x next = case f x of
   Nothing -> next
diff --git a/Data/Monoid.hs b/Data/Monoid.hs
--- a/Data/Monoid.hs
+++ b/Data/Monoid.hs
@@ -70,17 +70,21 @@
 newtype Dual a = Dual { getDual :: a }
         deriving (Eq, Ord, Read, Show, Bounded, Generic, Generic1)
 
+-- | @since 2.01
 instance Monoid a => Monoid (Dual a) where
         mempty = Dual mempty
         Dual x `mappend` Dual y = Dual (y `mappend` x)
 
+-- | @since 4.8.0.0
 instance Functor Dual where
     fmap     = coerce
 
+-- | @since 4.8.0.0
 instance Applicative Dual where
     pure     = Dual
     (<*>)    = coerce
 
+-- | @since 4.8.0.0
 instance Monad Dual where
     m >>= k  = k (getDual m)
 
@@ -88,6 +92,7 @@
 newtype Endo a = Endo { appEndo :: a -> a }
                deriving (Generic)
 
+-- | @since 2.01
 instance Monoid (Endo a) where
         mempty = Endo id
         Endo f `mappend` Endo g = Endo (f . g)
@@ -96,6 +101,7 @@
 newtype All = All { getAll :: Bool }
         deriving (Eq, Ord, Read, Show, Bounded, Generic)
 
+-- | @since 2.01
 instance Monoid All where
         mempty = All True
         All x `mappend` All y = All (x && y)
@@ -104,6 +110,7 @@
 newtype Any = Any { getAny :: Bool }
         deriving (Eq, Ord, Read, Show, Bounded, Generic)
 
+-- | @since 2.01
 instance Monoid Any where
         mempty = Any False
         Any x `mappend` Any y = Any (x || y)
@@ -112,18 +119,22 @@
 newtype Sum a = Sum { getSum :: a }
         deriving (Eq, Ord, Read, Show, Bounded, Generic, Generic1, Num)
 
+-- | @since 2.01
 instance Num a => Monoid (Sum a) where
         mempty = Sum 0
         mappend = coerce ((+) :: a -> a -> a)
 --        Sum x `mappend` Sum y = Sum (x + y)
 
+-- | @since 4.8.0.0
 instance Functor Sum where
     fmap     = coerce
 
+-- | @since 4.8.0.0
 instance Applicative Sum where
     pure     = Sum
     (<*>)    = coerce
 
+-- | @since 4.8.0.0
 instance Monad Sum where
     m >>= k  = k (getSum m)
 
@@ -131,18 +142,22 @@
 newtype Product a = Product { getProduct :: a }
         deriving (Eq, Ord, Read, Show, Bounded, Generic, Generic1, Num)
 
+-- | @since 2.01
 instance Num a => Monoid (Product a) where
         mempty = Product 1
         mappend = coerce ((*) :: a -> a -> a)
 --        Product x `mappend` Product y = Product (x * y)
 
+-- | @since 4.8.0.0
 instance Functor Product where
     fmap     = coerce
 
+-- | @since 4.8.0.0
 instance Applicative Product where
     pure     = Product
     (<*>)    = coerce
 
+-- | @since 4.8.0.0
 instance Monad Product where
     m >>= k  = k (getProduct m)
 
@@ -186,6 +201,7 @@
         deriving (Eq, Ord, Read, Show, Generic, Generic1,
                   Functor, Applicative, Monad)
 
+-- | @since 2.01
 instance Monoid (First a) where
         mempty = First Nothing
         First Nothing `mappend` r = r
@@ -199,6 +215,7 @@
         deriving (Eq, Ord, Read, Show, Generic, Generic1,
                   Functor, Applicative, Monad)
 
+-- | @since 2.01
 instance Monoid (Last a) where
         mempty = Last Nothing
         l `mappend` Last Nothing = l
@@ -211,6 +228,7 @@
   deriving (Generic, Generic1, Read, Show, Eq, Ord, Num, Enum,
             Monad, MonadPlus, Applicative, Alternative, Functor)
 
+-- | @since 4.8.0.0
 instance Alternative f => Monoid (Alt f a) where
         mempty = Alt empty
         mappend = coerce ((<|>) :: f a -> f a -> f a)
diff --git a/Data/OldList.hs b/Data/OldList.hs
--- a/Data/OldList.hs
+++ b/Data/OldList.hs
@@ -815,6 +815,9 @@
 -- | The 'sort' function implements a stable sorting algorithm.
 -- It is a special case of 'sortBy', which allows the programmer to supply
 -- their own comparison function.
+--
+-- Elements are arranged from from lowest to highest, keeping duplicates in
+-- the order they appeared in the input.
 sort :: (Ord a) => [a] -> [a]
 
 -- | The 'sortBy' function is the non-overloaded version of 'sort'.
@@ -978,6 +981,9 @@
 -- input list.  This is called the decorate-sort-undecorate paradigm, or
 -- Schwartzian transform.
 --
+-- Elements are arranged from from lowest to highest, keeping duplicates in
+-- the order they appeared in the input.
+--
 -- @since 4.8.0.0
 sortOn :: Ord b => (a -> b) -> [a] -> [a]
 sortOn f =
@@ -1098,7 +1104,7 @@
 "wordsList" [1] wordsFB (:) [] = words
  #-}
 wordsFB :: ([Char] -> b -> b) -> b -> String -> b
-{-# NOINLINE [0] wordsFB #-}
+{-# INLINE [0] wordsFB #-} -- See Note [Inline FB functions] in GHC.List
 wordsFB c n = go
   where
     go s = case dropWhile isSpace s of
diff --git a/Data/Ord.hs b/Data/Ord.hs
--- a/Data/Ord.hs
+++ b/Data/Ord.hs
@@ -48,5 +48,6 @@
 -- @since 4.6.0.0
 newtype Down a = Down a deriving (Eq, Show, Read)
 
+-- | @since 4.6.0.0
 instance Ord a => Ord (Down a) where
     compare (Down x) (Down y) = y `compare` x
diff --git a/Data/Proxy.hs b/Data/Proxy.hs
--- a/Data/Proxy.hs
+++ b/Data/Proxy.hs
@@ -29,7 +29,7 @@
 import GHC.Arr
 
 -- | A concrete, poly-kinded proxy type
-data Proxy t = Proxy
+data Proxy t = Proxy deriving Bounded
 
 -- | A concrete, promotable proxy type, for use at the kind level
 -- There are no instances for this because it is intended at the kind level only
@@ -39,18 +39,23 @@
 -- interchangeably, so all of these instances are hand-written to be
 -- lazy in Proxy arguments.
 
+-- | @since 4.7.0.0
 instance Eq (Proxy s) where
   _ == _ = True
 
+-- | @since 4.7.0.0
 instance Ord (Proxy s) where
   compare _ _ = EQ
 
+-- | @since 4.7.0.0
 instance Show (Proxy s) where
   showsPrec _ _ = showString "Proxy"
 
+-- | @since 4.7.0.0
 instance Read (Proxy s) where
   readsPrec d = readParen (d > 10) (\r -> [(Proxy, s) | ("Proxy",s) <- lex r ])
 
+-- | @since 4.7.0.0
 instance Enum (Proxy s) where
     succ _               = errorWithoutStackTrace "Proxy.succ"
     pred _               = errorWithoutStackTrace "Proxy.pred"
@@ -62,6 +67,7 @@
     enumFromThenTo _ _ _ = [Proxy]
     enumFromTo _ _       = [Proxy]
 
+-- | @since 4.7.0.0
 instance Ix (Proxy s) where
     range _           = [Proxy]
     index _ _         = 0
@@ -70,41 +76,43 @@
     unsafeIndex _ _   = 0
     unsafeRangeSize _ = 1
 
-instance Bounded (Proxy s) where
-    minBound = Proxy
-    maxBound = Proxy
-
+-- | @since 4.7.0.0
 instance Monoid (Proxy s) where
     mempty = Proxy
     mappend _ _ = Proxy
     mconcat _ = Proxy
 
+-- | @since 4.7.0.0
 instance Functor Proxy where
     fmap _ _ = Proxy
     {-# INLINE fmap #-}
 
+-- | @since 4.7.0.0
 instance Applicative Proxy where
     pure _ = Proxy
     {-# INLINE pure #-}
     _ <*> _ = Proxy
     {-# INLINE (<*>) #-}
 
+-- | @since 4.9.0.0
 instance Alternative Proxy where
     empty = Proxy
     {-# INLINE empty #-}
     _ <|> _ = Proxy
     {-# INLINE (<|>) #-}
 
+-- | @since 4.7.0.0
 instance Monad Proxy where
     _ >>= _ = Proxy
     {-# INLINE (>>=) #-}
 
+-- | @since 4.9.0.0
 instance MonadPlus Proxy
 
 -- | 'asProxyTypeOf' is a type-restricted version of 'const'.
 -- It is usually used as an infix operator, and its typing forces its first
 -- argument (which is usually overloaded) to have the same type as the tag
 -- of the second.
-asProxyTypeOf :: a -> Proxy a -> a
+asProxyTypeOf :: a -> proxy a -> a
 asProxyTypeOf = const
 {-# INLINE asProxyTypeOf #-}
diff --git a/Data/Semigroup.hs b/Data/Semigroup.hs
--- a/Data/Semigroup.hs
+++ b/Data/Semigroup.hs
@@ -1,11 +1,13 @@
-{-# LANGUAGE DefaultSignatures   #-}
-{-# LANGUAGE DeriveDataTypeable  #-}
-{-# LANGUAGE DeriveGeneric       #-}
-{-# LANGUAGE FlexibleContexts    #-}
-{-# LANGUAGE PolyKinds           #-}
-{-# LANGUAGE ScopedTypeVariables #-}
-{-# LANGUAGE Trustworthy         #-}
-{-# LANGUAGE TypeOperators       #-}
+{-# LANGUAGE CPP                        #-}
+{-# LANGUAGE DefaultSignatures          #-}
+{-# LANGUAGE DeriveDataTypeable         #-}
+{-# LANGUAGE DeriveGeneric              #-}
+{-# LANGUAGE FlexibleContexts           #-}
+{-# LANGUAGE GeneralizedNewtypeDeriving #-}
+{-# LANGUAGE PolyKinds                  #-}
+{-# LANGUAGE ScopedTypeVariables        #-}
+{-# LANGUAGE Trustworthy                #-}
+{-# LANGUAGE TypeOperators              #-}
 
 -----------------------------------------------------------------------------
 -- |
@@ -70,15 +72,21 @@
 import           Control.Applicative
 import           Control.Monad
 import           Control.Monad.Fix
+import           Data.Bifoldable
 import           Data.Bifunctor
+import           Data.Bitraversable
 import           Data.Coerce
 import           Data.Data
+import           Data.Functor.Identity
 import           Data.List.NonEmpty
 import           Data.Monoid         (All (..), Any (..), Dual (..), Endo (..),
                                       Product (..), Sum (..))
 import           Data.Monoid         (Alt (..))
 import qualified Data.Monoid         as Monoid
 import           Data.Void
+#ifndef mingw32_HOST_OS
+import           GHC.Event           (Event, Lifetime)
+#endif
 import           GHC.Generics
 
 infixr 6 <>
@@ -142,15 +150,18 @@
 cycle1 :: Semigroup m => m -> m
 cycle1 xs = xs' where xs' = xs <> xs'
 
+-- | @since 4.9.0.0
 instance Semigroup () where
   _ <> _ = ()
   sconcat _ = ()
   stimes _ _ = ()
 
+-- | @since 4.9.0.0
 instance Semigroup b => Semigroup (a -> b) where
   f <> g = \a -> f a <> g a
   stimes n f e = stimes n (f e)
 
+-- | @since 4.9.0.0
 instance Semigroup [a] where
   (<>) = (++)
   stimes n x
@@ -160,6 +171,7 @@
       rep 0 = []
       rep i = x ++ rep (i - 1)
 
+-- | @since 4.9.0.0
 instance Semigroup a => Semigroup (Maybe a) where
   Nothing <> b       = b
   a       <> Nothing = a
@@ -170,57 +182,69 @@
     EQ -> Nothing
     GT -> Just (stimes n a)
 
+-- | @since 4.9.0.0
 instance Semigroup (Either a b) where
   Left _ <> b = b
   a      <> _ = a
   stimes = stimesIdempotent
 
+-- | @since 4.9.0.0
 instance (Semigroup a, Semigroup b) => Semigroup (a, b) where
   (a,b) <> (a',b') = (a<>a',b<>b')
   stimes n (a,b) = (stimes n a, stimes n b)
 
+-- | @since 4.9.0.0
 instance (Semigroup a, Semigroup b, Semigroup c) => Semigroup (a, b, c) where
   (a,b,c) <> (a',b',c') = (a<>a',b<>b',c<>c')
   stimes n (a,b,c) = (stimes n a, stimes n b, stimes n c)
 
+-- | @since 4.9.0.0
 instance (Semigroup a, Semigroup b, Semigroup c, Semigroup d)
          => Semigroup (a, b, c, d) where
   (a,b,c,d) <> (a',b',c',d') = (a<>a',b<>b',c<>c',d<>d')
   stimes n (a,b,c,d) = (stimes n a, stimes n b, stimes n c, stimes n d)
 
+-- | @since 4.9.0.0
 instance (Semigroup a, Semigroup b, Semigroup c, Semigroup d, Semigroup e)
          => Semigroup (a, b, c, d, e) where
   (a,b,c,d,e) <> (a',b',c',d',e') = (a<>a',b<>b',c<>c',d<>d',e<>e')
   stimes n (a,b,c,d,e) =
       (stimes n a, stimes n b, stimes n c, stimes n d, stimes n e)
 
+-- | @since 4.9.0.0
 instance Semigroup Ordering where
   LT <> _ = LT
   EQ <> y = y
   GT <> _ = GT
   stimes = stimesIdempotentMonoid
 
+-- | @since 4.9.0.0
 instance Semigroup a => Semigroup (Dual a) where
   Dual a <> Dual b = Dual (b <> a)
   stimes n (Dual a) = Dual (stimes n a)
 
+-- | @since 4.9.0.0
 instance Semigroup (Endo a) where
   (<>) = coerce ((.) :: (a -> a) -> (a -> a) -> (a -> a))
   stimes = stimesMonoid
 
+-- | @since 4.9.0.0
 instance Semigroup All where
   (<>) = coerce (&&)
   stimes = stimesIdempotentMonoid
 
+-- | @since 4.9.0.0
 instance Semigroup Any where
   (<>) = coerce (||)
   stimes = stimesIdempotentMonoid
 
 
+-- | @since 4.9.0.0
 instance Num a => Semigroup (Sum a) where
   (<>) = coerce ((+) :: a -> a -> a)
   stimes n (Sum a) = Sum (fromIntegral n * a)
 
+-- | @since 4.9.0.0
 instance Num a => Semigroup (Product a) where
   (<>) = coerce ((*) :: a -> a -> a)
   stimes n (Product a) = Product (a ^ n)
@@ -263,39 +287,47 @@
   | n <= 0 = errorWithoutStackTrace "stimesIdempotent: positive multiplier expected"
   | otherwise = x
 
+-- | @since 4.9.0.0
+instance Semigroup a => Semigroup (Identity a) where
+  (<>) = coerce ((<>) :: a -> a -> a)
+  stimes n (Identity a) = Identity (stimes n a)
+
+-- | @since 4.9.0.0
 instance Semigroup a => Semigroup (Const a b) where
   (<>) = coerce ((<>) :: a -> a -> a)
   stimes n (Const a) = Const (stimes n a)
 
+-- | @since 4.9.0.0
 instance Semigroup (Monoid.First a) where
   Monoid.First Nothing <> b = b
   a                    <> _ = a
   stimes = stimesIdempotentMonoid
 
+-- | @since 4.9.0.0
 instance Semigroup (Monoid.Last a) where
   a <> Monoid.Last Nothing = a
   _ <> b                   = b
   stimes = stimesIdempotentMonoid
 
+-- | @since 4.9.0.0
 instance Alternative f => Semigroup (Alt f a) where
   (<>) = coerce ((<|>) :: f a -> f a -> f a)
   stimes = stimesMonoid
 
+-- | @since 4.9.0.0
 instance Semigroup Void where
   a <> _ = a
   stimes = stimesIdempotent
 
+-- | @since 4.9.0.0
 instance Semigroup (NonEmpty a) where
   (a :| as) <> ~(b :| bs) = a :| (as ++ b : bs)
 
 
 newtype Min a = Min { getMin :: a }
-  deriving (Eq, Ord, Show, Read, Data, Typeable, Generic, Generic1)
-
-instance Bounded a => Bounded (Min a) where
-  minBound = Min minBound
-  maxBound = Min maxBound
+  deriving (Bounded, Eq, Ord, Show, Read, Data, Generic, Generic1)
 
+-- | @since 4.9.0.0
 instance Enum a => Enum (Min a) where
   succ (Min a) = Min (succ a)
   pred (Min a) = Min (pred a)
@@ -307,36 +339,46 @@
   enumFromThenTo (Min a) (Min b) (Min c) = Min <$> enumFromThenTo a b c
 
 
+-- | @since 4.9.0.0
 instance Ord a => Semigroup (Min a) where
   (<>) = coerce (min :: a -> a -> a)
   stimes = stimesIdempotent
 
+-- | @since 4.9.0.0
 instance (Ord a, Bounded a) => Monoid (Min a) where
   mempty = maxBound
   mappend = (<>)
 
+-- | @since 4.9.0.0
 instance Functor Min where
   fmap f (Min x) = Min (f x)
 
+-- | @since 4.9.0.0
 instance Foldable Min where
   foldMap f (Min a) = f a
 
+-- | @since 4.9.0.0
 instance Traversable Min where
   traverse f (Min a) = Min <$> f a
 
+-- | @since 4.9.0.0
 instance Applicative Min where
   pure = Min
   a <* _ = a
   _ *> a = a
-  Min f <*> Min x = Min (f x)
+  (<*>) = coerce
+  liftA2 = coerce
 
+-- | @since 4.9.0.0
 instance Monad Min where
   (>>) = (*>)
   Min a >>= f = f a
 
+-- | @since 4.9.0.0
 instance MonadFix Min where
   mfix f = fix (f . getMin)
 
+-- | @since 4.9.0.0
 instance Num a => Num (Min a) where
   (Min a) + (Min b) = Min (a + b)
   (Min a) * (Min b) = Min (a * b)
@@ -347,12 +389,9 @@
   fromInteger    = Min . fromInteger
 
 newtype Max a = Max { getMax :: a }
-  deriving (Eq, Ord, Show, Read, Data, Typeable, Generic, Generic1)
-
-instance Bounded a => Bounded (Max a) where
-  minBound = Max minBound
-  maxBound = Max maxBound
+  deriving (Bounded, Eq, Ord, Show, Read, Data, Generic, Generic1)
 
+-- | @since 4.9.0.0
 instance Enum a => Enum (Max a) where
   succ (Max a) = Max (succ a)
   pred (Max a) = Max (pred a)
@@ -363,36 +402,46 @@
   enumFromTo (Max a) (Max b) = Max <$> enumFromTo a b
   enumFromThenTo (Max a) (Max b) (Max c) = Max <$> enumFromThenTo a b c
 
+-- | @since 4.9.0.0
 instance Ord a => Semigroup (Max a) where
   (<>) = coerce (max :: a -> a -> a)
   stimes = stimesIdempotent
 
+-- | @since 4.9.0.0
 instance (Ord a, Bounded a) => Monoid (Max a) where
   mempty = minBound
   mappend = (<>)
 
+-- | @since 4.9.0.0
 instance Functor Max where
   fmap f (Max x) = Max (f x)
 
+-- | @since 4.9.0.0
 instance Foldable Max where
   foldMap f (Max a) = f a
 
+-- | @since 4.9.0.0
 instance Traversable Max where
   traverse f (Max a) = Max <$> f a
 
+-- | @since 4.9.0.0
 instance Applicative Max where
   pure = Max
   a <* _ = a
   _ *> a = a
-  Max f <*> Max x = Max (f x)
+  (<*>) = coerce
+  liftA2 = coerce
 
+-- | @since 4.9.0.0
 instance Monad Max where
   (>>) = (*>)
   Max a >>= f = f a
 
+-- | @since 4.9.0.0
 instance MonadFix Max where
   mfix f = fix (f . getMax)
 
+-- | @since 4.9.0.0
 instance Num a => Num (Max a) where
   (Max a) + (Max b) = Max (a + b)
   (Max a) * (Max b) = Max (a * b)
@@ -405,23 +454,28 @@
 -- | 'Arg' isn't itself a 'Semigroup' in its own right, but it can be
 -- placed inside 'Min' and 'Max' to compute an arg min or arg max.
 data Arg a b = Arg a b deriving
-  (Show, Read, Data, Typeable, Generic, Generic1)
+  (Show, Read, Data, Generic, Generic1)
 
 type ArgMin a b = Min (Arg a b)
 type ArgMax a b = Max (Arg a b)
 
+-- | @since 4.9.0.0
 instance Functor (Arg a) where
   fmap f (Arg x a) = Arg x (f a)
 
+-- | @since 4.9.0.0
 instance Foldable (Arg a) where
   foldMap f (Arg _ a) = f a
 
+-- | @since 4.9.0.0
 instance Traversable (Arg a) where
   traverse f (Arg x a) = Arg x <$> f a
 
+-- | @since 4.9.0.0
 instance Eq a => Eq (Arg a b) where
   Arg a _ == Arg b _ = a == b
 
+-- | @since 4.9.0.0
 instance Ord a => Ord (Arg a b) where
   Arg a _ `compare` Arg b _ = compare a b
   min x@(Arg a _) y@(Arg b _)
@@ -431,18 +485,24 @@
     | a >= b    = x
     | otherwise = y
 
+-- | @since 4.9.0.0
 instance Bifunctor Arg where
   bimap f g (Arg a b) = Arg (f a) (g b)
 
+-- | @since 4.10.0.0
+instance Bifoldable Arg where
+  bifoldMap f g (Arg a b) = f a `mappend` g b
+
+-- | @since 4.10.0.0
+instance Bitraversable Arg where
+  bitraverse f g (Arg a b) = Arg <$> f a <*> g b
+
 -- | Use @'Option' ('First' a)@ to get the behavior of
 -- 'Data.Monoid.First' from "Data.Monoid".
 newtype First a = First { getFirst :: a } deriving
-  (Eq, Ord, Show, Read, Data, Typeable, Generic, Generic1)
-
-instance Bounded a => Bounded (First a) where
-  minBound = First minBound
-  maxBound = First maxBound
+  (Bounded, Eq, Ord, Show, Read, Data, Generic, Generic1)
 
+-- | @since 4.9.0.0
 instance Enum a => Enum (First a) where
   succ (First a) = First (succ a)
   pred (First a) = First (pred a)
@@ -453,41 +513,46 @@
   enumFromTo (First a) (First b) = First <$> enumFromTo a b
   enumFromThenTo (First a) (First b) (First c) = First <$> enumFromThenTo a b c
 
+-- | @since 4.9.0.0
 instance Semigroup (First a) where
   a <> _ = a
   stimes = stimesIdempotent
 
+-- | @since 4.9.0.0
 instance Functor First where
   fmap f (First x) = First (f x)
 
+-- | @since 4.9.0.0
 instance Foldable First where
   foldMap f (First a) = f a
 
+-- | @since 4.9.0.0
 instance Traversable First where
   traverse f (First a) = First <$> f a
 
+-- | @since 4.9.0.0
 instance Applicative First where
   pure x = First x
   a <* _ = a
   _ *> a = a
-  First f <*> First x = First (f x)
+  (<*>) = coerce
+  liftA2 = coerce
 
+-- | @since 4.9.0.0
 instance Monad First where
   (>>) = (*>)
   First a >>= f = f a
 
+-- | @since 4.9.0.0
 instance MonadFix First where
   mfix f = fix (f . getFirst)
 
 -- | Use @'Option' ('Last' a)@ to get the behavior of
 -- 'Data.Monoid.Last' from "Data.Monoid"
 newtype Last a = Last { getLast :: a } deriving
-  (Eq, Ord, Show, Read, Data, Typeable, Generic, Generic1)
-
-instance Bounded a => Bounded (Last a) where
-  minBound = Last minBound
-  maxBound = Last maxBound
+  (Bounded, Eq, Ord, Show, Read, Data, Generic, Generic1)
 
+-- | @since 4.9.0.0
 instance Enum a => Enum (Last a) where
   succ (Last a) = Last (succ a)
   pred (Last a) = Last (pred a)
@@ -498,48 +563,55 @@
   enumFromTo (Last a) (Last b) = Last <$> enumFromTo a b
   enumFromThenTo (Last a) (Last b) (Last c) = Last <$> enumFromThenTo a b c
 
+-- | @since 4.9.0.0
 instance Semigroup (Last a) where
   _ <> b = b
   stimes = stimesIdempotent
 
+-- | @since 4.9.0.0
 instance Functor Last where
   fmap f (Last x) = Last (f x)
   a <$ _ = Last a
 
+-- | @since 4.9.0.0
 instance Foldable Last where
   foldMap f (Last a) = f a
 
+-- | @since 4.9.0.0
 instance Traversable Last where
   traverse f (Last a) = Last <$> f a
 
+-- | @since 4.9.0.0
 instance Applicative Last where
   pure = Last
   a <* _ = a
   _ *> a = a
-  Last f <*> Last x = Last (f x)
+  (<*>) = coerce
+  liftA2 = coerce
 
+-- | @since 4.9.0.0
 instance Monad Last where
   (>>) = (*>)
   Last a >>= f = f a
 
+-- | @since 4.9.0.0
 instance MonadFix Last where
   mfix f = fix (f . getLast)
 
 -- | Provide a Semigroup for an arbitrary Monoid.
 newtype WrappedMonoid m = WrapMonoid { unwrapMonoid :: m }
-  deriving (Eq, Ord, Show, Read, Data, Typeable, Generic, Generic1)
+  deriving (Bounded, Eq, Ord, Show, Read, Data, Generic, Generic1)
 
+-- | @since 4.9.0.0
 instance Monoid m => Semigroup (WrappedMonoid m) where
   (<>) = coerce (mappend :: m -> m -> m)
 
+-- | @since 4.9.0.0
 instance Monoid m => Monoid (WrappedMonoid m) where
   mempty = WrapMonoid mempty
   mappend = (<>)
 
-instance Bounded a => Bounded (WrappedMonoid a) where
-  minBound = WrapMonoid minBound
-  maxBound = WrapMonoid maxBound
-
+-- | @since 4.9.0.0
 instance Enum a => Enum (WrappedMonoid a) where
   succ (WrapMonoid a) = WrapMonoid (succ a)
   pred (WrapMonoid a) = WrapMonoid (pred a)
@@ -570,39 +642,46 @@
 -- Ideally, this type would not exist at all and we would just fix the
 -- 'Monoid' instance of 'Maybe'
 newtype Option a = Option { getOption :: Maybe a }
-  deriving (Eq, Ord, Show, Read, Data, Typeable, Generic, Generic1)
+  deriving (Eq, Ord, Show, Read, Data, Generic, Generic1)
 
+-- | @since 4.9.0.0
 instance Functor Option where
   fmap f (Option a) = Option (fmap f a)
 
+-- | @since 4.9.0.0
 instance Applicative Option where
   pure a = Option (Just a)
   Option a <*> Option b = Option (a <*> b)
+  liftA2 f (Option x) (Option y) = Option (liftA2 f x y)
 
   Option Nothing  *>  _ = Option Nothing
   _               *>  b = b
 
+-- | @since 4.9.0.0
 instance Monad Option where
   Option (Just a) >>= k = k a
   _               >>= _ = Option Nothing
   (>>) = (*>)
 
+-- | @since 4.9.0.0
 instance Alternative Option where
   empty = Option Nothing
   Option Nothing <|> b = b
   a <|> _ = a
 
-instance MonadPlus Option where
-  mzero = Option Nothing
-  mplus = (<|>)
+-- | @since 4.9.0.0
+instance MonadPlus Option
 
+-- | @since 4.9.0.0
 instance MonadFix Option where
   mfix f = Option (mfix (getOption . f))
 
+-- | @since 4.9.0.0
 instance Foldable Option where
   foldMap f (Option (Just m)) = f m
   foldMap _ (Option Nothing)  = mempty
 
+-- | @since 4.9.0.0
 instance Traversable Option where
   traverse f (Option (Just a)) = Option . Just <$> f a
   traverse _ (Option Nothing)  = pure (Option Nothing)
@@ -611,6 +690,7 @@
 option :: b -> (a -> b) -> Option a -> b
 option n j (Option m) = maybe n j m
 
+-- | @since 4.9.0.0
 instance Semigroup a => Semigroup (Option a) where
   (<>) = coerce ((<>) :: Maybe a -> Maybe a -> Maybe a)
 
@@ -620,6 +700,7 @@
     EQ -> Option Nothing
     GT -> Option (Just (stimes n a))
 
+-- | @since 4.9.0.0
 instance Semigroup a => Monoid (Option a) where
   mempty = Option Nothing
   mappend = (<>)
@@ -628,7 +709,24 @@
 diff :: Semigroup m => m -> Endo m
 diff = Endo . (<>)
 
+-- | @since 4.9.0.0
 instance Semigroup (Proxy s) where
   _ <> _ = Proxy
   sconcat _ = Proxy
   stimes _ _ = Proxy
+
+-- | @since 4.10.0.0
+instance Semigroup a => Semigroup (IO a) where
+    (<>) = liftA2 (<>)
+
+#ifndef mingw32_HOST_OS
+-- | @since 4.10.0.0
+instance Semigroup Event where
+    (<>) = mappend
+    stimes = stimesMonoid
+
+-- | @since 4.10.0.0
+instance Semigroup Lifetime where
+    (<>) = mappend
+    stimes = stimesMonoid
+#endif
diff --git a/Data/String.hs b/Data/String.hs
--- a/Data/String.hs
+++ b/Data/String.hs
@@ -1,5 +1,8 @@
+{-# LANGUAGE FlexibleInstances #-}
+{-# LANGUAGE GeneralizedNewtypeDeriving #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE StandaloneDeriving #-}
 {-# LANGUAGE Trustworthy #-}
-{-# LANGUAGE NoImplicitPrelude, FlexibleInstances #-}
 {-# LANGUAGE TypeFamilies #-}
 
 -----------------------------------------------------------------------------
@@ -29,6 +32,7 @@
 
 import GHC.Base
 import Data.Functor.Const (Const (Const))
+import Data.Functor.Identity (Identity (Identity))
 import Data.List (lines, words, unlines, unwords)
 
 -- | Class for string-like datastructures; used by the overloaded string
@@ -75,9 +79,13 @@
 ensure the good behavior of the above example remains in the future.
 -}
 
+-- | @(a ~ Char)@ context was introduced in @4.9.0.0@
+--
+-- @since 2.01
 instance (a ~ Char) => IsString [a] where
          -- See Note [IsString String]
     fromString xs = xs
 
-instance IsString a => IsString (Const a b) where
-    fromString = Const . fromString
+-- | @since 4.9.0.0
+deriving instance IsString a => IsString (Const a b)
+deriving instance IsString a => IsString (Identity a)
diff --git a/Data/Traversable.hs b/Data/Traversable.hs
--- a/Data/Traversable.hs
+++ b/Data/Traversable.hs
@@ -1,6 +1,7 @@
 {-# LANGUAGE DeriveTraversable #-}
 {-# LANGUAGE FlexibleInstances #-}
 {-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE ScopedTypeVariables #-}
 {-# LANGUAGE StandaloneDeriving #-}
 {-# LANGUAGE Trustworthy #-}
 {-# LANGUAGE TypeOperators #-}
@@ -53,9 +54,12 @@
 -- It is convenient to use 'Const' here but this means we must
 -- define a few instances here which really belong in Control.Applicative
 import Control.Applicative ( Const(..), ZipList(..) )
+import Data.Coerce
 import Data.Either ( Either(..) )
 import Data.Foldable ( Foldable )
 import Data.Functor
+import Data.Functor.Identity ( Identity(..) )
+import Data.Functor.Utils ( StateL(..), StateR(..) )
 import Data.Monoid ( Dual(..), Sum(..), Product(..), First(..), Last(..) )
 import Data.Proxy ( Proxy(..) )
 
@@ -155,47 +159,98 @@
     -- from left to right, and collect the results. For a version that ignores
     -- the results see 'Data.Foldable.traverse_'.
     traverse :: Applicative f => (a -> f b) -> t a -> f (t b)
+    {-# INLINE traverse #-}  -- See Note [Inline default methods]
     traverse f = sequenceA . fmap f
 
     -- | Evaluate each action in the structure from left to right, and
     -- and collect the results. For a version that ignores the results
     -- see 'Data.Foldable.sequenceA_'.
     sequenceA :: Applicative f => t (f a) -> f (t a)
+    {-# INLINE sequenceA #-}  -- See Note [Inline default methods]
     sequenceA = traverse id
 
     -- | Map each element of a structure to a monadic action, evaluate
     -- these actions from left to right, and collect the results. For
     -- a version that ignores the results see 'Data.Foldable.mapM_'.
     mapM :: Monad m => (a -> m b) -> t a -> m (t b)
+    {-# INLINE mapM #-}  -- See Note [Inline default methods]
     mapM = traverse
 
     -- | Evaluate each monadic action in the structure from left to
     -- right, and collect the results. For a version that ignores the
     -- results see 'Data.Foldable.sequence_'.
     sequence :: Monad m => t (m a) -> m (t a)
+    {-# INLINE sequence #-}  -- See Note [Inline default methods]
     sequence = sequenceA
 
+{- Note [Inline default methods]
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+Consider
+
+   class ... => Traversable t where
+       ...
+       mapM :: Monad m => (a -> m b) -> t a -> m (t b)
+       mapM = traverse   -- Default method
+
+   instance Traversable [] where
+       {-# INLINE traverse #-}
+       traverse = ...code for traverse on lists ...
+
+This gives rise to a list-instance of mapM looking like this
+
+  $fTraversable[]_$ctaverse = ...code for traverse on lists...
+       {-# INLINE $fTraversable[]_$ctaverse #-}
+  $fTraversable[]_$cmapM    = $fTraversable[]_$ctraverse
+
+Now the $ctraverse obediently inlines into the RHS of $cmapM, /but/
+that's all!  We get
+
+  $fTraversable[]_$cmapM = ...code for traverse on lists...
+
+with NO INLINE pragma!  This happens even though 'traverse' had an
+INLINE pragma because the author knew it should be inlined pretty
+vigorously.
+
+Indeed, it turned out that the rhs of $cmapM was just too big to
+inline, so all uses of mapM on lists used a terribly inefficient
+dictionary-passing style, because of its 'Monad m =>' type.  Disaster!
+
+Solution: add an INLINE pragma on the default method:
+
+   class ... => Traversable t where
+       ...
+       mapM :: Monad m => (a -> m b) -> t a -> m (t b)
+       {-# INLINE mapM #-}     -- VERY IMPORTANT!
+       mapM = traverse
+-}
+
 -- instances for Prelude types
 
+-- | @since 2.01
 instance Traversable Maybe where
     traverse _ Nothing = pure Nothing
     traverse f (Just x) = Just <$> f x
 
+-- | @since 2.01
 instance Traversable [] where
     {-# INLINE traverse #-} -- so that traverse can fuse
     traverse f = List.foldr cons_f (pure [])
-      where cons_f x ys = (:) <$> f x <*> ys
+      where cons_f x ys = liftA2 (:) (f x) ys
 
+-- | @since 4.7.0.0
 instance Traversable (Either a) where
     traverse _ (Left x) = pure (Left x)
     traverse f (Right y) = Right <$> f y
 
+-- | @since 4.7.0.0
 instance Traversable ((,) a) where
     traverse f (x, y) = (,) x <$> f y
 
+-- | @since 2.01
 instance Ix i => Traversable (Array i) where
     traverse f arr = listArray (bounds arr) `fmap` traverse f (elems arr)
 
+-- | @since 4.7.0.0
 instance Traversable Proxy where
     traverse _ _ = pure Proxy
     {-# INLINE traverse #-}
@@ -206,28 +261,38 @@
     sequence _ = pure Proxy
     {-# INLINE sequence #-}
 
+-- | @since 4.7.0.0
 instance Traversable (Const m) where
     traverse _ (Const m) = pure $ Const m
 
+-- | @since 4.8.0.0
 instance Traversable Dual where
     traverse f (Dual x) = Dual <$> f x
 
+-- | @since 4.8.0.0
 instance Traversable Sum where
     traverse f (Sum x) = Sum <$> f x
 
+-- | @since 4.8.0.0
 instance Traversable Product where
     traverse f (Product x) = Product <$> f x
 
+-- | @since 4.8.0.0
 instance Traversable First where
     traverse f (First x) = First <$> traverse f x
 
+-- | @since 4.8.0.0
 instance Traversable Last where
     traverse f (Last x) = Last <$> traverse f x
 
+-- | @since 4.9.0.0
 instance Traversable ZipList where
     traverse f (ZipList x) = ZipList <$> traverse f x
 
+deriving instance Traversable Identity
+
 -- Instances for GHC.Generics
+-- | @since 4.9.0.0
 instance Traversable U1 where
     traverse _ _ = pure U1
     {-# INLINE traverse #-}
@@ -267,19 +332,6 @@
 {-# INLINE forM #-}
 forM = flip mapM
 
--- left-to-right state transformer
-newtype StateL s a = StateL { runStateL :: s -> (s, a) }
-
-instance Functor (StateL s) where
-    fmap f (StateL k) = StateL $ \ s -> let (s', v) = k s in (s', f v)
-
-instance Applicative (StateL s) where
-    pure x = StateL (\ s -> (s, x))
-    StateL kf <*> StateL kv = StateL $ \ s ->
-        let (s', f) = kf s
-            (s'', v) = kv s'
-        in (s'', f v)
-
 -- |The 'mapAccumL' function behaves like a combination of 'fmap'
 -- and 'foldl'; it applies a function to each element of a structure,
 -- passing an accumulating parameter from left to right, and returning
@@ -287,19 +339,6 @@
 mapAccumL :: Traversable t => (a -> b -> (a, c)) -> a -> t b -> (a, t c)
 mapAccumL f s t = runStateL (traverse (StateL . flip f) t) s
 
--- right-to-left state transformer
-newtype StateR s a = StateR { runStateR :: s -> (s, a) }
-
-instance Functor (StateR s) where
-    fmap f (StateR k) = StateR $ \ s -> let (s', v) = k s in (s', f v)
-
-instance Applicative (StateR s) where
-    pure x = StateR (\ s -> (s, x))
-    StateR kf <*> StateR kv = StateR $ \ s ->
-        let (s', v) = kv s
-            (s'', f) = kf s'
-        in (s'', f v)
-
 -- |The 'mapAccumR' function behaves like a combination of 'fmap'
 -- and 'foldr'; it applies a function to each element of a structure,
 -- passing an accumulating parameter from right to left, and returning
@@ -311,23 +350,24 @@
 --   instance, provided that 'traverse' is defined. (Using
 --   `fmapDefault` with a `Traversable` instance defined only by
 --   'sequenceA' will result in infinite recursion.)
-fmapDefault :: Traversable t => (a -> b) -> t a -> t b
+--
+-- @
+-- 'fmapDefault' f ≡ 'runIdentity' . 'traverse' ('Identity' . f)
+-- @
+fmapDefault :: forall t a b . Traversable t
+            => (a -> b) -> t a -> t b
 {-# INLINE fmapDefault #-}
-fmapDefault f = getId . traverse (Id . f)
+-- See Note [Function coercion] in Data.Functor.Utils.
+fmapDefault = coerce (traverse :: (a -> Identity b) -> t a -> Identity (t b))
 
 -- | This function may be used as a value for `Data.Foldable.foldMap`
 -- in a `Foldable` instance.
-foldMapDefault :: (Traversable t, Monoid m) => (a -> m) -> t a -> m
-foldMapDefault f = getConst . traverse (Const . f)
-
--- local instances
-
-newtype Id a = Id { getId :: a }
-
-instance Functor Id where
-    fmap f (Id x) = Id (f x)
-
-instance Applicative Id where
-    pure = Id
-    Id f <*> Id x = Id (f x)
-
+--
+-- @
+-- 'foldMapDefault' f ≡ 'getConst' . 'traverse' ('Const' . f)
+-- @
+foldMapDefault :: forall t m a . (Traversable t, Monoid m)
+               => (a -> m) -> t a -> m
+{-# INLINE foldMapDefault #-}
+-- See Note [Function coercion] in Data.Functor.Utils.
+foldMapDefault = coerce (traverse :: (a -> Const m ()) -> t a -> Const m (t ()))
diff --git a/Data/Tuple.hs b/Data/Tuple.hs
--- a/Data/Tuple.hs
+++ b/Data/Tuple.hs
@@ -11,7 +11,7 @@
 -- Stability   :  experimental
 -- Portability :  portable
 --
--- The tuple data types, and associated functions.
+-- Functions associated with the tuple data types.
 --
 -----------------------------------------------------------------------------
 
diff --git a/Data/Type/Bool.hs b/Data/Type/Bool.hs
--- a/Data/Type/Bool.hs
+++ b/Data/Type/Bool.hs
@@ -1,6 +1,5 @@
-{-# LANGUAGE Safe #-}
-{-# LANGUAGE TypeFamilies, TypeOperators, DataKinds, NoImplicitPrelude,
-             PolyKinds #-}
+{-# LANGUAGE TypeFamilyDependencies, Safe, PolyKinds #-}
+{-# LANGUAGE TypeFamilies, TypeOperators, DataKinds, NoImplicitPrelude #-}
 
 -----------------------------------------------------------------------------
 -- |
@@ -49,7 +48,9 @@
   a      || a      = a
 infixr 2 ||
 
--- | Type-level "not"
-type family Not a where
+-- | Type-level "not". An injective type family since @4.10.0.0@.
+--
+-- @since 4.7.0.0
+type family Not a = res | res -> a where
   Not 'False = 'True
   Not 'True  = 'False
diff --git a/Data/Type/Coercion.hs b/Data/Type/Coercion.hs
--- a/Data/Type/Coercion.hs
+++ b/Data/Type/Coercion.hs
@@ -7,6 +7,7 @@
 {-# LANGUAGE StandaloneDeriving  #-}
 {-# LANGUAGE NoImplicitPrelude   #-}
 {-# LANGUAGE PolyKinds           #-}
+{-# LANGUAGE RankNTypes          #-}
 
 -----------------------------------------------------------------------------
 -- |
@@ -25,6 +26,7 @@
 module Data.Type.Coercion
   ( Coercion(..)
   , coerceWith
+  , gcoerceWith
   , sym
   , trans
   , repr
@@ -56,6 +58,12 @@
 coerceWith :: Coercion a b -> a -> b
 coerceWith Coercion x = coerce x
 
+-- | Generalized form of type-safe cast using representational equality
+--
+-- @since 4.10.0.0
+gcoerceWith :: Coercion a b -> (Coercible a b => r) -> r
+gcoerceWith Coercion x = x
+
 -- | Symmetry of representational equality
 sym :: Coercion a b -> Coercion b a
 sym Coercion = Coercion
@@ -72,18 +80,19 @@
 deriving instance Show (Coercion a b)
 deriving instance Ord  (Coercion a b)
 
+-- | @since 4.7.0.0
 instance Coercible a b => Read (Coercion a b) where
   readsPrec d = readParen (d > 10) (\r -> [(Coercion, s) | ("Coercion",s) <- lex r ])
 
+-- | @since 4.7.0.0
 instance Coercible a b => Enum (Coercion a b) where
   toEnum 0 = Coercion
   toEnum _ = errorWithoutStackTrace "Data.Type.Coercion.toEnum: bad argument"
 
   fromEnum Coercion = 0
 
-instance Coercible a b => Bounded (Coercion a b) where
-  minBound = Coercion
-  maxBound = Coercion
+-- | @since 4.7.0.0
+deriving instance Coercible a b => Bounded (Coercion a b)
 
 -- | This class contains types where you can learn the equality of two types
 -- from information contained in /terms/. Typically, only singleton types should
@@ -92,8 +101,14 @@
   -- | Conditionally prove the representational equality of @a@ and @b@.
   testCoercion :: f a -> f b -> Maybe (Coercion a b)
 
+-- | @since 4.7.0.0
 instance TestCoercion ((Eq.:~:) a) where
   testCoercion Eq.Refl Eq.Refl = Just Coercion
 
+-- | @since 4.10.0.0
+instance TestCoercion ((Eq.:~~:) a) where
+  testCoercion Eq.HRefl Eq.HRefl = Just Coercion
+
+-- | @since 4.7.0.0
 instance TestCoercion (Coercion a) where
   testCoercion Coercion Coercion = Just Coercion
diff --git a/Data/Type/Equality.hs b/Data/Type/Equality.hs
--- a/Data/Type/Equality.hs
+++ b/Data/Type/Equality.hs
@@ -34,6 +34,7 @@
 module Data.Type.Equality (
   -- * The equality types
   (:~:)(..), type (~~),
+  (:~~:)(..),
 
   -- * Working with equality
   sym, trans, castWith, gcastWith, apply, inner, outer,
@@ -55,7 +56,7 @@
 -- | Lifted, homogeneous equality. By lifted, we mean that it can be
 -- bogus (deferred type error). By homogeneous, the two types @a@
 -- and @b@ must have the same kind.
-class a ~~ b => (a :: k) ~ (b :: k) | a -> b, b -> a
+class a ~~ b => (a :: k) ~ (b :: k)
   -- See Note [The equality types story] in TysPrim
   -- NB: All this class does is to wrap its superclass, which is
   --     the "real", inhomogeneous equality; this is needed when
@@ -63,6 +64,11 @@
   -- NB: Not exported, as (~) is magical syntax. That's also why there's
   -- no fixity.
 
+  -- It's tempting to put functional dependencies on (~), but it's not
+  -- necessary because the functional-dependency coverage check looks
+  -- through superclasses, and (~#) is handled in that check.
+
+-- | @since 4.9.0.0
 instance {-# INCOHERENT #-} a ~~ b => a ~ b
   -- See Note [The equality types story] in TysPrim
   -- If we have a Wanted (t1 ~ t2), we want to immediately
@@ -71,7 +77,7 @@
   -- INCOHERENT because we want to use this instance eagerly, even when
   -- the tyvars are partially unknown.
 
-infix 4 :~:
+infix 4 :~:, :~~:
 
 -- | Propositional equality. If @a :~: b@ is inhabited by some terminating
 -- value, then the type @a@ is the same as the type @b@. To use this equality
@@ -106,7 +112,7 @@
 apply :: (f :~: g) -> (a :~: b) -> (f a :~: g b)
 apply Refl Refl = Refl
 
--- | Extract equality of the arguments from an equality of a applied types
+-- | Extract equality of the arguments from an equality of applied types
 inner :: (f a :~: g b) -> (a :~: b)
 inner Refl = Refl
 
@@ -118,19 +124,48 @@
 deriving instance Show (a :~: b)
 deriving instance Ord  (a :~: b)
 
+-- | @since 4.7.0.0
 instance a ~ b => Read (a :~: b) where
   readsPrec d = readParen (d > 10) (\r -> [(Refl, s) | ("Refl",s) <- lex r ])
 
+-- | @since 4.7.0.0
 instance a ~ b => Enum (a :~: b) where
   toEnum 0 = Refl
   toEnum _ = errorWithoutStackTrace "Data.Type.Equality.toEnum: bad argument"
 
   fromEnum Refl = 0
 
-instance a ~ b => Bounded (a :~: b) where
-  minBound = Refl
-  maxBound = Refl
+-- | @since 4.7.0.0
+deriving instance a ~ b => Bounded (a :~: b)
 
+-- | Kind heterogeneous propositional equality. Like '(:~:)', @a :~~: b@ is
+-- inhabited by a terminating value if and only if @a@ is the same type as @b@.
+--
+-- @since 4.10.0.0
+data (a :: k1) :~~: (b :: k2) where
+   HRefl :: a :~~: a
+
+-- | @since 4.10.0.0
+deriving instance Eq   (a :~~: b)
+-- | @since 4.10.0.0
+deriving instance Show (a :~~: b)
+-- | @since 4.10.0.0
+deriving instance Ord  (a :~~: b)
+
+-- | @since 4.10.0.0
+instance a ~~ b => Read (a :~~: b) where
+  readsPrec d = readParen (d > 10) (\r -> [(HRefl, s) | ("HRefl",s) <- lex r ])
+
+-- | @since 4.10.0.0
+instance a ~~ b => Enum (a :~~: b) where
+  toEnum 0 = HRefl
+  toEnum _ = errorWithoutStackTrace "Data.Type.Equality.toEnum: bad argument"
+
+  fromEnum HRefl = 0
+
+-- | @since 4.10.0.0
+deriving instance a ~~ b => Bounded (a :~~: b)
+
 -- | This class contains types where you can learn the equality of two types
 -- from information contained in /terms/. Typically, only singleton types should
 -- inhabit this class.
@@ -138,8 +173,13 @@
   -- | Conditionally prove the equality of @a@ and @b@.
   testEquality :: f a -> f b -> Maybe (a :~: b)
 
+-- | @since 4.7.0.0
 instance TestEquality ((:~:) a) where
   testEquality Refl Refl = Just Refl
+
+-- | @since 4.10.0.0
+instance TestEquality ((:~~:) a) where
+  testEquality HRefl HRefl = Just Refl
 
 -- | A type family to compute Boolean equality. Instances are provided
 -- only for /open/ kinds, such as @*@ and function kinds. Instances are
diff --git a/Data/Typeable.hs b/Data/Typeable.hs
--- a/Data/Typeable.hs
+++ b/Data/Typeable.hs
@@ -3,6 +3,8 @@
 {-# LANGUAGE NoImplicitPrelude #-}
 {-# LANGUAGE PolyKinds #-}
 {-# LANGUAGE ScopedTypeVariables #-}
+{-# LANGUAGE ConstraintKinds #-}
+{-# LANGUAGE PatternSynonyms #-}
 {-# LANGUAGE TypeOperators #-}
 
 -----------------------------------------------------------------------------
@@ -10,7 +12,7 @@
 -- Module      :  Data.Typeable
 -- Copyright   :  (c) The University of Glasgow, CWI 2001--2004
 -- License     :  BSD-style (see the file libraries/base/LICENSE)
--- 
+--
 -- Maintainer  :  libraries@haskell.org
 -- Stability   :  experimental
 -- Portability :  portable
@@ -26,6 +28,11 @@
 --
 -- == Compatibility Notes
 --
+-- Since GHC 8.2, GHC has supported type-indexed type representations.
+-- "Data.Typeable" provides type representations which are qualified over this
+-- index, providing an interface very similar to the "Typeable" notion seen in
+-- previous releases. For the type-indexed interface, see "Type.Reflection".
+--
 -- Since GHC 7.8, 'Typeable' is poly-kinded. The changes required for this might
 -- break some old programs involving 'Typeable'. More details on this, including
 -- how to fix your code, can be found on the
@@ -34,86 +41,102 @@
 -----------------------------------------------------------------------------
 
 module Data.Typeable
-  (
-        -- * The Typeable class
-        Typeable,
-        typeRep,
-
-        -- * Propositional equality
-        (:~:)(Refl),
+    ( -- * The Typeable class
+      Typeable
+    , typeOf
+    , typeRep
 
-        -- * For backwards compatibility
-        typeOf, typeOf1, typeOf2, typeOf3, typeOf4, typeOf5, typeOf6, typeOf7,
-        Typeable1, Typeable2, Typeable3, Typeable4, Typeable5, Typeable6,
-        Typeable7,
+      -- * Propositional equality
+    , (:~:)(Refl)
+    , (:~~:)(HRefl)
 
-        -- * Type-safe cast
-        cast,
-        eqT,
-        gcast,                  -- a generalisation of cast
+      -- * Type-safe cast
+    , cast
+    , eqT
+    , gcast                -- a generalisation of cast
 
-        -- * Generalized casts for higher-order kinds
-        gcast1,                 -- :: ... => c (t a) -> Maybe (c (t' a))
-        gcast2,                 -- :: ... => c (t a b) -> Maybe (c (t' a b))
+      -- * Generalized casts for higher-order kinds
+    , gcast1               -- :: ... => c (t a) -> Maybe (c (t' a))
+    , gcast2               -- :: ... => c (t a b) -> Maybe (c (t' a b))
 
-        -- * A canonical proxy type
-        Proxy (..),
+      -- * A canonical proxy type
+    , Proxy (..)
 
-        -- * Type representations
-        TypeRep,        -- abstract, instance of: Eq, Show, Typeable
-        typeRepFingerprint,
-        rnfTypeRep,
-        showsTypeRep,
+      -- * Type representations
+    , TypeRep
+    , rnfTypeRep
+    , showsTypeRep
+    , mkFunTy
 
-        TyCon,          -- abstract, instance of: Eq, Show, Typeable
-                        -- For now don't export Module, to avoid name clashes
-        tyConFingerprint,
-        tyConString,
-        tyConPackage,
-        tyConModule,
-        tyConName,
-        rnfTyCon,
+      -- * Observing type representations
+    , funResultTy
+    , splitTyConApp
+    , typeRepArgs
+    , typeRepTyCon
+    , typeRepFingerprint
 
-        -- * Construction of type representations
-        -- mkTyCon,        -- :: String  -> TyCon
-        mkTyCon3,       -- :: String  -> String -> String -> TyCon
-        mkTyConApp,     -- :: TyCon   -> [TypeRep] -> TypeRep
-        mkAppTy,        -- :: TypeRep -> TypeRep   -> TypeRep
-        mkFunTy,        -- :: TypeRep -> TypeRep   -> TypeRep
+      -- * Type constructors
+    , I.TyCon          -- abstract, instance of: Eq, Show, Typeable
+                       -- For now don't export Module to avoid name clashes
+    , I.tyConPackage
+    , I.tyConModule
+    , I.tyConName
+    , I.rnfTyCon
+    , I.tyConFingerprint
 
-        -- * Observation of type representations
-        splitTyConApp,  -- :: TypeRep -> (TyCon, [TypeRep])
-        funResultTy,    -- :: TypeRep -> TypeRep   -> Maybe TypeRep
-        typeRepTyCon,   -- :: TypeRep -> TyCon
-        typeRepArgs,    -- :: TypeRep -> [TypeRep]
-  ) where
+      -- * For backwards compatibility
+    , typeOf1, typeOf2, typeOf3, typeOf4, typeOf5, typeOf6, typeOf7
+    , Typeable1, Typeable2, Typeable3, Typeable4
+    , Typeable5, Typeable6, Typeable7
+    ) where
 
-import Data.Typeable.Internal
+import qualified Data.Typeable.Internal as I
+import Data.Typeable.Internal (Typeable)
 import Data.Type.Equality
 
-import Unsafe.Coerce
 import Data.Maybe
+import Data.Proxy
+import GHC.Fingerprint.Type
+import GHC.Show
 import GHC.Base
 
--------------------------------------------------------------
---
---              Type-safe cast
+-- | A quantified type representation.
+type TypeRep = I.SomeTypeRep
+
+-- | Observe a type representation for the type of a value.
+typeOf :: forall a. Typeable a => a -> TypeRep
+typeOf _ = I.someTypeRep (Proxy :: Proxy a)
+
+-- | Takes a value of type @a@ and returns a concrete representation
+-- of that type.
 --
--------------------------------------------------------------
+-- @since 4.7.0.0
+typeRep :: forall proxy a. Typeable a => proxy a -> TypeRep
+typeRep = I.someTypeRep
 
+-- | Show a type representation
+showsTypeRep :: TypeRep -> ShowS
+showsTypeRep = shows
+
 -- | The type-safe cast operation
 cast :: forall a b. (Typeable a, Typeable b) => a -> Maybe b
-cast x = if typeRep (Proxy :: Proxy a) == typeRep (Proxy :: Proxy b)
-           then Just $ unsafeCoerce x
-           else Nothing
+cast x
+  | Just HRefl <- ta `I.eqTypeRep` tb = Just x
+  | otherwise                         = Nothing
+  where
+    ta = I.typeRep :: I.TypeRep a
+    tb = I.typeRep :: I.TypeRep b
 
 -- | Extract a witness of equality of two types
 --
 -- @since 4.7.0.0
 eqT :: forall a b. (Typeable a, Typeable b) => Maybe (a :~: b)
-eqT = if typeRep (Proxy :: Proxy a) == typeRep (Proxy :: Proxy b)
-      then Just $ unsafeCoerce Refl
-      else Nothing
+eqT
+  | Just HRefl <- ta `I.eqTypeRep` tb = Just Refl
+  | otherwise                         = Nothing
+  where
+    ta = I.typeRep :: I.TypeRep a
+    tb = I.typeRep :: I.TypeRep b
 
 -- | A flexible variation parameterised in a type constructor
 gcast :: forall a b c. (Typeable a, Typeable b) => c a -> Maybe (c b)
@@ -121,11 +144,100 @@
 
 -- | Cast over @k1 -> k2@
 gcast1 :: forall c t t' a. (Typeable t, Typeable t')
-       => c (t a) -> Maybe (c (t' a)) 
+       => c (t a) -> Maybe (c (t' a))
 gcast1 x = fmap (\Refl -> x) (eqT :: Maybe (t :~: t'))
 
 -- | Cast over @k1 -> k2 -> k3@
 gcast2 :: forall c t t' a b. (Typeable t, Typeable t')
-       => c (t a b) -> Maybe (c (t' a b)) 
+       => c (t a b) -> Maybe (c (t' a b))
 gcast2 x = fmap (\Refl -> x) (eqT :: Maybe (t :~: t'))
 
+-- | Applies a type to a function type. Returns: @Just u@ if the first argument
+-- represents a function of type @t -> u@ and the second argument represents a
+-- function of type @t@. Otherwise, returns @Nothing@.
+funResultTy :: TypeRep -> TypeRep -> Maybe TypeRep
+funResultTy (I.SomeTypeRep f) (I.SomeTypeRep x)
+  | Just HRefl <- (I.typeRep :: I.TypeRep Type) `I.eqTypeRep` I.typeRepKind f
+  , I.Fun arg res <- f
+  , Just HRefl <- arg `I.eqTypeRep` x
+  = Just (I.SomeTypeRep res)
+  | otherwise = Nothing
+
+-- | Build a function type.
+mkFunTy :: TypeRep -> TypeRep -> TypeRep
+mkFunTy (I.SomeTypeRep arg) (I.SomeTypeRep res)
+  | Just HRefl <- I.typeRepKind arg `I.eqTypeRep` liftedTy
+  , Just HRefl <- I.typeRepKind res `I.eqTypeRep` liftedTy
+  = I.SomeTypeRep (I.Fun arg res)
+  | otherwise
+  = error $ "mkFunTy: Attempted to construct function type from non-lifted "++
+            "type: arg="++show arg++", res="++show res
+  where liftedTy = I.typeRep :: I.TypeRep Type
+
+-- | Splits a type constructor application. Note that if the type constructor is
+-- polymorphic, this will not return the kinds that were used.
+splitTyConApp :: TypeRep -> (TyCon, [TypeRep])
+splitTyConApp (I.SomeTypeRep x) = I.splitApps x
+
+-- | Observe the argument types of a type representation
+typeRepArgs :: TypeRep -> [TypeRep]
+typeRepArgs ty = case splitTyConApp ty of (_, args) -> args
+
+-- | Observe the type constructor of a quantified type representation.
+typeRepTyCon :: TypeRep -> TyCon
+typeRepTyCon = I.someTypeRepTyCon
+
+-- | Takes a value of type @a@ and returns a concrete representation
+-- of that type.
+--
+-- @since 4.7.0.0
+typeRepFingerprint :: TypeRep -> Fingerprint
+typeRepFingerprint = I.someTypeRepFingerprint
+
+-- | Force a 'TypeRep' to normal form.
+rnfTypeRep :: TypeRep -> ()
+rnfTypeRep = I.rnfSomeTypeRep
+
+
+-- Keeping backwards-compatibility
+typeOf1 :: forall t (a :: *). Typeable t => t a -> TypeRep
+typeOf1 _ = I.someTypeRep (Proxy :: Proxy t)
+
+typeOf2 :: forall t (a :: *) (b :: *). Typeable t => t a b -> TypeRep
+typeOf2 _ = I.someTypeRep (Proxy :: Proxy t)
+
+typeOf3 :: forall t (a :: *) (b :: *) (c :: *). Typeable t
+        => t a b c -> TypeRep
+typeOf3 _ = I.someTypeRep (Proxy :: Proxy t)
+
+typeOf4 :: forall t (a :: *) (b :: *) (c :: *) (d :: *). Typeable t
+        => t a b c d -> TypeRep
+typeOf4 _ = I.someTypeRep (Proxy :: Proxy t)
+
+typeOf5 :: forall t (a :: *) (b :: *) (c :: *) (d :: *) (e :: *). Typeable t
+        => t a b c d e -> TypeRep
+typeOf5 _ = I.someTypeRep (Proxy :: Proxy t)
+
+typeOf6 :: forall t (a :: *) (b :: *) (c :: *) (d :: *) (e :: *) (f :: *).
+                Typeable t => t a b c d e f -> TypeRep
+typeOf6 _ = I.someTypeRep (Proxy :: Proxy t)
+
+typeOf7 :: forall t (a :: *) (b :: *) (c :: *) (d :: *) (e :: *) (f :: *)
+                (g :: *). Typeable t => t a b c d e f g -> TypeRep
+typeOf7 _ = I.someTypeRep (Proxy :: Proxy t)
+
+type Typeable1 (a :: * -> *)                               = Typeable a
+type Typeable2 (a :: * -> * -> *)                          = Typeable a
+type Typeable3 (a :: * -> * -> * -> *)                     = Typeable a
+type Typeable4 (a :: * -> * -> * -> * -> *)                = Typeable a
+type Typeable5 (a :: * -> * -> * -> * -> * -> *)           = Typeable a
+type Typeable6 (a :: * -> * -> * -> * -> * -> * -> *)      = Typeable a
+type Typeable7 (a :: * -> * -> * -> * -> * -> * -> * -> *) = Typeable a
+
+{-# DEPRECATED Typeable1 "renamed to 'Typeable'" #-} -- deprecated in 7.8
+{-# DEPRECATED Typeable2 "renamed to 'Typeable'" #-} -- deprecated in 7.8
+{-# DEPRECATED Typeable3 "renamed to 'Typeable'" #-} -- deprecated in 7.8
+{-# DEPRECATED Typeable4 "renamed to 'Typeable'" #-} -- deprecated in 7.8
+{-# DEPRECATED Typeable5 "renamed to 'Typeable'" #-} -- deprecated in 7.8
+{-# DEPRECATED Typeable6 "renamed to 'Typeable'" #-} -- deprecated in 7.8
+{-# DEPRECATED Typeable7 "renamed to 'Typeable'" #-} -- deprecated in 7.8
diff --git a/Data/Typeable/Internal.hs b/Data/Typeable/Internal.hs
--- a/Data/Typeable/Internal.hs
+++ b/Data/Typeable/Internal.hs
@@ -1,9 +1,16 @@
+{-# LANGUAGE AllowAmbiguousTypes #-}
 {-# LANGUAGE Trustworthy #-}
+{-# LANGUAGE TypeInType #-}
+{-# LANGUAGE ViewPatterns #-}
+{-# LANGUAGE TypeOperators #-}
 {-# LANGUAGE BangPatterns #-}
+{-# LANGUAGE RankNTypes #-}
+{-# LANGUAGE PatternSynonyms #-}
 {-# LANGUAGE CPP #-}
 {-# LANGUAGE ConstraintKinds #-}
 {-# LANGUAGE DataKinds #-}
 {-# LANGUAGE FlexibleInstances #-}
+{-# LANGUAGE GADTs #-}
 {-# LANGUAGE MagicHash #-}
 {-# LANGUAGE NoImplicitPrelude #-}
 {-# LANGUAGE PolyKinds #-}
@@ -25,49 +32,59 @@
 -----------------------------------------------------------------------------
 
 module Data.Typeable.Internal (
-    Proxy (..),
     Fingerprint(..),
 
     -- * Typeable class
-    typeOf, typeOf1, typeOf2, typeOf3, typeOf4, typeOf5, typeOf6, typeOf7,
-    Typeable1, Typeable2, Typeable3, Typeable4, Typeable5, Typeable6, Typeable7,
+    Typeable(..),
+    withTypeable,
 
     -- * Module
     Module,  -- Abstract
-    moduleName, modulePackage,
+    moduleName, modulePackage, rnfModule,
 
     -- * TyCon
     TyCon,   -- Abstract
-    tyConPackage, tyConModule, tyConName, tyConString, tyConFingerprint,
-    mkTyCon3, mkTyCon3#,
+    tyConPackage, tyConModule, tyConName, tyConKindArgs, tyConKindRep,
+    tyConFingerprint,
+    KindRep(.., KindRepTypeLit), TypeLitSort(..),
     rnfTyCon,
 
     -- * TypeRep
-    TypeRep(..), KindRep,
+    TypeRep,
+    pattern App, pattern Con, pattern Con', pattern Fun,
     typeRep,
-    mkTyConApp,
-    mkPolyTyConApp,
-    mkAppTy,
+    typeOf,
     typeRepTyCon,
-    Typeable(..),
-    mkFunTy,
-    splitTyConApp,
-    splitPolyTyConApp,
-    funResultTy,
-    typeRepArgs,
     typeRepFingerprint,
     rnfTypeRep,
-    showsTypeRep,
-    typeRepKinds,
-    typeSymbolTypeRep, typeNatTypeRep
+    eqTypeRep,
+    typeRepKind,
+    splitApps,
+
+    -- * SomeTypeRep
+    SomeTypeRep(..),
+    someTypeRep,
+    someTypeRepTyCon,
+    someTypeRepFingerprint,
+    rnfSomeTypeRep,
+
+    -- * Construction
+    -- | These are for internal use only
+    mkTrCon, mkTrApp, mkTrFun,
+    mkTyCon, mkTyCon#,
+    typeSymbolTypeRep, typeNatTypeRep,
   ) where
 
 import GHC.Base
-import GHC.Types (TYPE)
+import qualified GHC.Arr as A
+import GHC.Types ( TYPE )
+import Data.Type.Equality
+import GHC.List ( splitAt, foldl' )
 import GHC.Word
 import GHC.Show
-import Data.Proxy
-import GHC.TypeLits( KnownNat, KnownSymbol, natVal', symbolVal' )
+import GHC.TypeLits ( KnownSymbol, symbolVal' )
+import GHC.TypeNats ( KnownNat, natVal' )
+import Unsafe.Coerce ( unsafeCoerce )
 
 import GHC.Fingerprint.Type
 import {-# SOURCE #-} GHC.Fingerprint
@@ -91,58 +108,27 @@
 moduleName (Module _ m) = trNameString m
 
 tyConPackage :: TyCon -> String
-tyConPackage (TyCon _ _ m _) = modulePackage m
+tyConPackage (TyCon _ _ m _ _ _) = modulePackage m
 
 tyConModule :: TyCon -> String
-tyConModule (TyCon _ _ m _) = moduleName m
+tyConModule (TyCon _ _ m _ _ _) = moduleName m
 
 tyConName :: TyCon -> String
-tyConName (TyCon _ _ _ n) = trNameString n
+tyConName (TyCon _ _ _ n _ _) = trNameString n
 
 trNameString :: TrName -> String
-trNameString (TrNameS s) = unpackCString# s
+trNameString (TrNameS s) = unpackCStringUtf8# s
 trNameString (TrNameD s) = s
 
--- | Observe string encoding of a type representation
-{-# DEPRECATED tyConString "renamed to 'tyConName'; 'tyConModule' and 'tyConPackage' are also available." #-}
--- deprecated in 7.4
-tyConString :: TyCon   -> String
-tyConString = tyConName
-
 tyConFingerprint :: TyCon -> Fingerprint
-tyConFingerprint (TyCon hi lo _ _)
+tyConFingerprint (TyCon hi lo _ _ _ _)
   = Fingerprint (W64# hi) (W64# lo)
 
-mkTyCon3# :: Addr#       -- ^ package name
-          -> Addr#       -- ^ module name
-          -> Addr#       -- ^ the name of the type constructor
-          -> TyCon       -- ^ A unique 'TyCon' object
-mkTyCon3# pkg modl name
-  | Fingerprint (W64# hi) (W64# lo) <- fingerprint
-  = TyCon hi lo (Module (TrNameS pkg) (TrNameS modl)) (TrNameS name)
-  where
-    fingerprint :: Fingerprint
-    fingerprint = fingerprintString (unpackCString# pkg
-                                    ++ (' ': unpackCString# modl)
-                                    ++ (' ' : unpackCString# name))
-
-mkTyCon3 :: String       -- ^ package name
-         -> String       -- ^ module name
-         -> String       -- ^ the name of the type constructor
-         -> TyCon        -- ^ A unique 'TyCon' object
--- Used when the strings are dynamically allocated,
--- eg from binary deserialisation
-mkTyCon3 pkg modl name
-  | Fingerprint (W64# hi) (W64# lo) <- fingerprint
-  = TyCon hi lo (Module (TrNameD pkg) (TrNameD modl)) (TrNameD name)
-  where
-    fingerprint :: Fingerprint
-    fingerprint = fingerprintString (pkg ++ (' ':modl) ++ (' ':name))
+tyConKindArgs :: TyCon -> Int
+tyConKindArgs (TyCon _ _ _ _ n _) = I# n
 
-isTupleTyCon :: TyCon -> Bool
-isTupleTyCon tc
-  | ('(':',':_) <- tyConName tc = True
-  | otherwise                   = False
+tyConKindRep :: TyCon -> KindRep
+tyConKindRep (TyCon _ _ _ _ _ k) = k
 
 -- | Helper to fully evaluate 'TyCon' for use as @NFData(rnf)@ implementation
 --
@@ -154,14 +140,30 @@
 rnfTrName (TrNameS _) = ()
 rnfTrName (TrNameD n) = rnfString n
 
-rnfTyCon :: TyCon -> ()
-rnfTyCon (TyCon _ _ m n) = rnfModule m `seq` rnfTrName n
+rnfKindRep :: KindRep -> ()
+rnfKindRep (KindRepTyConApp tc args) = rnfTyCon tc `seq` rnfList rnfKindRep args
+rnfKindRep (KindRepVar _)   = ()
+rnfKindRep (KindRepApp a b) = rnfKindRep a `seq` rnfKindRep b
+rnfKindRep (KindRepFun a b) = rnfKindRep a `seq` rnfKindRep b
+rnfKindRep (KindRepTYPE rr) = rnfRuntimeRep rr
+rnfKindRep (KindRepTypeLitS _ _) = ()
+rnfKindRep (KindRepTypeLitD _ t) = rnfString t
 
+rnfRuntimeRep :: RuntimeRep -> ()
+rnfRuntimeRep (VecRep !_ !_) = ()
+rnfRuntimeRep !_             = ()
+
+rnfList :: (a -> ()) -> [a] -> ()
+rnfList _     []     = ()
+rnfList force (x:xs) = force x `seq` rnfList force xs
+
 rnfString :: [Char] -> ()
-rnfString [] = ()
-rnfString (c:cs) = c `seq` rnfString cs
+rnfString = rnfList (`seq` ())
 
+rnfTyCon :: TyCon -> ()
+rnfTyCon (TyCon _ _ m n _ k) = rnfModule m `seq` rnfTrName n `seq` rnfKindRep k
 
+
 {- *********************************************************************
 *                                                                      *
                 The TypeRep type
@@ -170,117 +172,281 @@
 
 -- | A concrete representation of a (monomorphic) type.
 -- 'TypeRep' supports reasonably efficient equality.
-data TypeRep = TypeRep {-# UNPACK #-} !Fingerprint TyCon [KindRep] [TypeRep]
-     -- NB: For now I've made this lazy so that it's easy to
-     -- optimise code that constructs and deconstructs TypeReps
-     -- perf/should_run/T9203 is a good example
-     -- Also note that mkAppTy does discards the fingerprint,
-     -- so it's a waste to compute it
-
-type KindRep = TypeRep
+data TypeRep (a :: k) where
+    TrTyCon :: {-# UNPACK #-} !Fingerprint -> !TyCon -> [SomeTypeRep]
+            -> TypeRep (a :: k)
+    TrApp   :: forall k1 k2 (a :: k1 -> k2) (b :: k1).
+               {-# UNPACK #-} !Fingerprint
+            -> TypeRep (a :: k1 -> k2)
+            -> TypeRep (b :: k1)
+            -> TypeRep (a b)
+    TrFun   :: forall (r1 :: RuntimeRep) (r2 :: RuntimeRep)
+                      (a :: TYPE r1) (b :: TYPE r2).
+               {-# UNPACK #-} !Fingerprint
+            -> TypeRep a
+            -> TypeRep b
+            -> TypeRep (a -> b)
 
 -- Compare keys for equality
-instance Eq TypeRep where
-  TypeRep x _ _ _ == TypeRep y _ _ _ = x == y
 
-instance Ord TypeRep where
-  TypeRep x _ _ _ <= TypeRep y _ _ _ = x <= y
+-- | @since 2.01
+instance Eq (TypeRep a) where
+  _ == _  = True
+  {-# INLINABLE (==) #-}
 
+instance TestEquality TypeRep where
+  a `testEquality` b
+    | Just HRefl <- eqTypeRep a b
+    = Just Refl
+    | otherwise
+    = Nothing
+  {-# INLINEABLE testEquality #-}
+
+-- | @since 4.4.0.0
+instance Ord (TypeRep a) where
+  compare _ _ = EQ
+  {-# INLINABLE compare #-}
+
+-- | A non-indexed type representation.
+data SomeTypeRep where
+    SomeTypeRep :: forall k (a :: k). !(TypeRep a) -> SomeTypeRep
+
+instance Eq SomeTypeRep where
+  SomeTypeRep a == SomeTypeRep b =
+      case a `eqTypeRep` b of
+          Just _  -> True
+          Nothing -> False
+
+instance Ord SomeTypeRep where
+  SomeTypeRep a `compare` SomeTypeRep b =
+    typeRepFingerprint a `compare` typeRepFingerprint b
+
+pattern Fun :: forall k (fun :: k). ()
+            => forall (r1 :: RuntimeRep) (r2 :: RuntimeRep)
+                      (arg :: TYPE r1) (res :: TYPE r2).
+               (k ~ Type, fun ~~ (arg -> res))
+            => TypeRep arg
+            -> TypeRep res
+            -> TypeRep fun
+pattern Fun arg res <- TrFun _ arg res
+  where Fun arg res = mkTrFun arg res
+
 -- | Observe the 'Fingerprint' of a type representation
 --
 -- @since 4.8.0.0
-typeRepFingerprint :: TypeRep -> Fingerprint
-typeRepFingerprint (TypeRep fpr _ _ _) = fpr
+typeRepFingerprint :: TypeRep a -> Fingerprint
+typeRepFingerprint (TrTyCon fpr _ _) = fpr
+typeRepFingerprint (TrApp fpr _ _) = fpr
+typeRepFingerprint (TrFun fpr _ _) = fpr
 
--- | Applies a kind-polymorphic type constructor to a sequence of kinds and
--- types
-mkPolyTyConApp :: TyCon -> [KindRep] -> [TypeRep] -> TypeRep
-{-# INLINE mkPolyTyConApp #-}
-mkPolyTyConApp tc kinds types
-  = TypeRep (fingerprintFingerprints sub_fps) tc kinds types
+-- | Construct a representation for a type constructor
+-- applied at a monomorphic kind.
+--
+-- Note that this is unsafe as it allows you to construct
+-- ill-kinded types.
+mkTrCon :: forall k (a :: k). TyCon -> [SomeTypeRep] -> TypeRep a
+mkTrCon tc kind_vars = TrTyCon fpr tc kind_vars
   where
-    !kt_fps = typeRepFingerprints kinds types
-    sub_fps = tyConFingerprint tc : kt_fps
+    fpr_tc  = tyConFingerprint tc
+    fpr_kvs = map someTypeRepFingerprint kind_vars
+    fpr     = fingerprintFingerprints (fpr_tc:fpr_kvs)
 
-typeRepFingerprints :: [KindRep] -> [TypeRep] -> [Fingerprint]
--- Builds no thunks
-typeRepFingerprints kinds types
-  = go1 [] kinds
+-- | Construct a representation for a type application.
+--
+-- Note that this is known-key to the compiler, which uses it in desugar
+-- 'Typeable' evidence.
+mkTrApp :: forall k1 k2 (a :: k1 -> k2) (b :: k1).
+           TypeRep (a :: k1 -> k2)
+        -> TypeRep (b :: k1)
+        -> TypeRep (a b)
+mkTrApp a b = TrApp fpr a b
   where
-    go1 acc []     = go2 acc types
-    go1 acc (k:ks) = let !fp = typeRepFingerprint k
-                     in go1 (fp:acc) ks
-    go2 acc []     = acc
-    go2 acc (t:ts) = let !fp = typeRepFingerprint t
-                     in go2 (fp:acc) ts
-
--- | Applies a kind-monomorphic type constructor to a sequence of types
-mkTyConApp  :: TyCon -> [TypeRep] -> TypeRep
-mkTyConApp tc = mkPolyTyConApp tc []
-
--- | A special case of 'mkTyConApp', which applies the function
--- type constructor to a pair of types.
-mkFunTy  :: TypeRep -> TypeRep -> TypeRep
-mkFunTy f a = mkTyConApp tcFun [f,a]
+    fpr_a = typeRepFingerprint a
+    fpr_b = typeRepFingerprint b
+    fpr   = fingerprintFingerprints [fpr_a, fpr_b]
 
--- | Splits a type constructor application.
--- Note that if the type constructor is polymorphic, this will
--- not return the kinds that were used.
--- See 'splitPolyTyConApp' if you need all parts.
-splitTyConApp :: TypeRep -> (TyCon,[TypeRep])
-splitTyConApp (TypeRep _ tc _ trs) = (tc,trs)
+-- | Pattern match on a type application
+pattern App :: forall k2 (t :: k2). ()
+            => forall k1 (a :: k1 -> k2) (b :: k1). (t ~ a b)
+            => TypeRep a -> TypeRep b -> TypeRep t
+pattern App f x <- TrApp _ f x
+  where App f x = mkTrApp f x
 
--- | Split a type constructor application
-splitPolyTyConApp :: TypeRep -> (TyCon,[KindRep],[TypeRep])
-splitPolyTyConApp (TypeRep _ tc ks trs) = (tc,ks,trs)
+-- | Use a 'TypeRep' as 'Typeable' evidence.
+withTypeable :: forall a r. TypeRep a -> (Typeable a => r) -> r
+withTypeable rep k = unsafeCoerce k' rep
+  where k' :: Gift a r
+        k' = Gift k
 
--- | Applies a type to a function type.  Returns: @'Just' u@ if the
--- first argument represents a function of type @t -> u@ and the
--- second argument represents a function of type @t@.  Otherwise,
--- returns 'Nothing'.
-funResultTy :: TypeRep -> TypeRep -> Maybe TypeRep
-funResultTy trFun trArg
-  = case splitTyConApp trFun of
-      (tc, [t1,t2]) | tc == tcFun && t1 == trArg -> Just t2
-      _ -> Nothing
+-- | A helper to satisfy the type checker in 'withTypeable'.
+newtype Gift a r = Gift (Typeable a => r)
 
-tyConOf :: Typeable a => Proxy a -> TyCon
-tyConOf = typeRepTyCon . typeRep
+-- | Pattern match on a type constructor
+pattern Con :: forall k (a :: k). TyCon -> TypeRep a
+pattern Con con <- TrTyCon _ con _
 
-tcFun :: TyCon
-tcFun = tyConOf (Proxy :: Proxy (Int -> Int))
+-- | Pattern match on a type constructor including its instantiated kind
+-- variables.
+pattern Con' :: forall k (a :: k). TyCon -> [SomeTypeRep] -> TypeRep a
+pattern Con' con ks <- TrTyCon _ con ks
 
--- | Adds a TypeRep argument to a TypeRep.
-mkAppTy :: TypeRep -> TypeRep -> TypeRep
-{-# INLINE mkAppTy #-}
-mkAppTy (TypeRep _ tc ks trs) arg_tr = mkPolyTyConApp tc ks (trs ++ [arg_tr])
-   -- Notice that we call mkTyConApp to construct the fingerprint from tc and
-   -- the arg fingerprints.  Simply combining the current fingerprint with
-   -- the new one won't give the same answer, but of course we want to
-   -- ensure that a TypeRep of the same shape has the same fingerprint!
-   -- See Trac #5962
+{-# COMPLETE Fun, App, Con  #-}
+{-# COMPLETE Fun, App, Con' #-}
 
 ----------------- Observation ---------------------
 
+-- | Observe the type constructor of a quantified type representation.
+someTypeRepTyCon :: SomeTypeRep -> TyCon
+someTypeRepTyCon (SomeTypeRep t) = typeRepTyCon t
+
 -- | Observe the type constructor of a type representation
-typeRepTyCon :: TypeRep -> TyCon
-typeRepTyCon (TypeRep _ tc _ _) = tc
+typeRepTyCon :: TypeRep a -> TyCon
+typeRepTyCon (TrTyCon _ tc _) = tc
+typeRepTyCon (TrApp _ a _)    = typeRepTyCon a
+typeRepTyCon (TrFun _ _ _)    = typeRepTyCon $ typeRep @(->)
 
--- | Observe the argument types of a type representation
-typeRepArgs :: TypeRep -> [TypeRep]
-typeRepArgs (TypeRep _ _ _ tys) = tys
+-- | Type equality
+--
+-- @since 4.10
+eqTypeRep :: forall k1 k2 (a :: k1) (b :: k2).
+             TypeRep a -> TypeRep b -> Maybe (a :~~: b)
+eqTypeRep a b
+  | typeRepFingerprint a == typeRepFingerprint b = Just (unsafeCoerce HRefl)
+  | otherwise                                    = Nothing
 
--- | Observe the argument kinds of a type representation
-typeRepKinds :: TypeRep -> [KindRep]
-typeRepKinds (TypeRep _ _ ks _) = ks
 
+-------------------------------------------------------------
+--
+--      Computing kinds
+--
+-------------------------------------------------------------
 
-{- *********************************************************************
-*                                                                      *
-                The Typeable class
-*                                                                      *
-********************************************************************* -}
+-- | Observe the kind of a type.
+typeRepKind :: TypeRep (a :: k) -> TypeRep k
+typeRepKind (TrTyCon _ tc args)
+  = unsafeCoerceRep $ tyConKind tc args
+typeRepKind (TrApp _ f _)
+  | Fun _ res <- typeRepKind f
+  = res
+  | otherwise
+  = error ("Ill-kinded type application: " ++ show (typeRepKind f))
+typeRepKind (TrFun _ _ _) = typeRep @Type
 
+tyConKind :: TyCon -> [SomeTypeRep] -> SomeTypeRep
+tyConKind (TyCon _ _ _ _ nKindVars# kindRep) kindVars =
+    let kindVarsArr :: A.Array KindBndr SomeTypeRep
+        kindVarsArr = A.listArray (0, I# (nKindVars# -# 1#)) kindVars
+    in instantiateKindRep kindVarsArr kindRep
+
+instantiateKindRep :: A.Array KindBndr SomeTypeRep -> KindRep -> SomeTypeRep
+instantiateKindRep vars = go
+  where
+    go :: KindRep -> SomeTypeRep
+    go (KindRepTyConApp tc args)
+      = let n_kind_args = tyConKindArgs tc
+            (kind_args, ty_args) = splitAt n_kind_args args
+            -- First instantiate tycon kind arguments
+            tycon_app = SomeTypeRep $ mkTrCon tc (map go kind_args)
+            -- Then apply remaining type arguments
+            applyTy :: SomeTypeRep -> KindRep -> SomeTypeRep
+            applyTy (SomeTypeRep acc) ty
+              | SomeTypeRep ty' <- go ty
+              = SomeTypeRep $ mkTrApp (unsafeCoerce acc) (unsafeCoerce ty')
+        in foldl' applyTy tycon_app ty_args
+    go (KindRepVar var)
+      = vars A.! var
+    go (KindRepApp f a)
+      = SomeTypeRep $ App (unsafeCoerceRep $ go f) (unsafeCoerceRep $ go a)
+    go (KindRepFun a b)
+      = SomeTypeRep $ Fun (unsafeCoerceRep $ go a) (unsafeCoerceRep $ go b)
+    go (KindRepTYPE r) = unkindedTypeRep $ tYPE `kApp` runtimeRepTypeRep r
+    go (KindRepTypeLitS sort s)
+      = mkTypeLitFromString sort (unpackCStringUtf8# s)
+    go (KindRepTypeLitD sort s)
+      = mkTypeLitFromString sort s
+
+    tYPE = kindedTypeRep @(RuntimeRep -> Type) @TYPE
+
+unsafeCoerceRep :: SomeTypeRep -> TypeRep a
+unsafeCoerceRep (SomeTypeRep r) = unsafeCoerce r
+
+unkindedTypeRep :: SomeKindedTypeRep k -> SomeTypeRep
+unkindedTypeRep (SomeKindedTypeRep x) = SomeTypeRep x
+
+data SomeKindedTypeRep k where
+    SomeKindedTypeRep :: forall (a :: k). TypeRep a
+                      -> SomeKindedTypeRep k
+
+kApp :: SomeKindedTypeRep (k -> k')
+     -> SomeKindedTypeRep k
+     -> SomeKindedTypeRep k'
+kApp (SomeKindedTypeRep f) (SomeKindedTypeRep a) =
+    SomeKindedTypeRep (App f a)
+
+kindedTypeRep :: forall (a :: k). Typeable a => SomeKindedTypeRep k
+kindedTypeRep = SomeKindedTypeRep (typeRep @a)
+
+buildList :: forall k. Typeable k
+          => [SomeKindedTypeRep k]
+          -> SomeKindedTypeRep [k]
+buildList = foldr cons nil
+  where
+    nil = kindedTypeRep @[k] @'[]
+    cons x rest = SomeKindedTypeRep (typeRep @'(:)) `kApp` x `kApp` rest
+
+runtimeRepTypeRep :: RuntimeRep -> SomeKindedTypeRep RuntimeRep
+runtimeRepTypeRep r =
+    case r of
+      LiftedRep   -> rep @'LiftedRep
+      UnliftedRep -> rep @'UnliftedRep
+      VecRep c e  -> kindedTypeRep @_ @'VecRep
+                     `kApp` vecCountTypeRep c
+                     `kApp` vecElemTypeRep e
+      TupleRep rs -> kindedTypeRep @_ @'TupleRep
+                     `kApp` buildList (map runtimeRepTypeRep rs)
+      SumRep rs   -> kindedTypeRep @_ @'SumRep
+                     `kApp` buildList (map runtimeRepTypeRep rs)
+      IntRep      -> rep @'IntRep
+      WordRep     -> rep @'WordRep
+      Int64Rep    -> rep @'Int64Rep
+      Word64Rep   -> rep @'Word64Rep
+      AddrRep     -> rep @'AddrRep
+      FloatRep    -> rep @'FloatRep
+      DoubleRep   -> rep @'DoubleRep
+  where
+    rep :: forall (a :: RuntimeRep). Typeable a => SomeKindedTypeRep RuntimeRep
+    rep = kindedTypeRep @RuntimeRep @a
+
+vecCountTypeRep :: VecCount -> SomeKindedTypeRep VecCount
+vecCountTypeRep c =
+    case c of
+      Vec2  -> rep @'Vec2
+      Vec4  -> rep @'Vec4
+      Vec8  -> rep @'Vec8
+      Vec16 -> rep @'Vec16
+      Vec32 -> rep @'Vec32
+      Vec64 -> rep @'Vec64
+  where
+    rep :: forall (a :: VecCount). Typeable a => SomeKindedTypeRep VecCount
+    rep = kindedTypeRep @VecCount @a
+
+vecElemTypeRep :: VecElem -> SomeKindedTypeRep VecElem
+vecElemTypeRep e =
+    case e of
+      Int8ElemRep     -> rep @'Int8ElemRep
+      Int16ElemRep    -> rep @'Int16ElemRep
+      Int32ElemRep    -> rep @'Int32ElemRep
+      Int64ElemRep    -> rep @'Int64ElemRep
+      Word8ElemRep    -> rep @'Word8ElemRep
+      Word16ElemRep   -> rep @'Word16ElemRep
+      Word32ElemRep   -> rep @'Word32ElemRep
+      Word64ElemRep   -> rep @'Word64ElemRep
+      FloatElemRep    -> rep @'FloatElemRep
+      DoubleElemRep   -> rep @'DoubleElemRep
+  where
+    rep :: forall (a :: VecElem). Typeable a => SomeKindedTypeRep VecElem
+    rep = kindedTypeRep @VecElem @a
+
 -------------------------------------------------------------
 --
 --      The Typeable class and friends
@@ -289,118 +455,104 @@
 
 -- | The class 'Typeable' allows a concrete representation of a type to
 -- be calculated.
-class Typeable a where
-  typeRep# :: Proxy# a -> TypeRep
+class Typeable (a :: k) where
+  typeRep# :: TypeRep a
 
+typeRep :: Typeable a => TypeRep a
+typeRep = typeRep#
+
+typeOf :: Typeable a => a -> TypeRep a
+typeOf _ = typeRep
+
 -- | Takes a value of type @a@ and returns a concrete representation
 -- of that type.
 --
 -- @since 4.7.0.0
-typeRep :: forall proxy a. Typeable a => proxy a -> TypeRep
-typeRep _ = typeRep# (proxy# :: Proxy# a)
+someTypeRep :: forall proxy a. Typeable a => proxy a -> SomeTypeRep
+someTypeRep _ = SomeTypeRep (typeRep :: TypeRep a)
 {-# INLINE typeRep #-}
 
--- Keeping backwards-compatibility
-typeOf :: forall a. Typeable a => a -> TypeRep
-typeOf _ = typeRep (Proxy :: Proxy a)
+someTypeRepFingerprint :: SomeTypeRep -> Fingerprint
+someTypeRepFingerprint (SomeTypeRep t) = typeRepFingerprint t
 
-typeOf1 :: forall t (a :: *). Typeable t => t a -> TypeRep
-typeOf1 _ = typeRep (Proxy :: Proxy t)
+----------------- Showing TypeReps --------------------
 
-typeOf2 :: forall t (a :: *) (b :: *). Typeable t => t a b -> TypeRep
-typeOf2 _ = typeRep (Proxy :: Proxy t)
+-- This follows roughly the precedence structure described in Note [Precedence
+-- in types].
+instance Show (TypeRep (a :: k)) where
+    showsPrec = showTypeable
 
-typeOf3 :: forall t (a :: *) (b :: *) (c :: *). Typeable t
-        => t a b c -> TypeRep
-typeOf3 _ = typeRep (Proxy :: Proxy t)
 
-typeOf4 :: forall t (a :: *) (b :: *) (c :: *) (d :: *). Typeable t
-        => t a b c d -> TypeRep
-typeOf4 _ = typeRep (Proxy :: Proxy t)
-
-typeOf5 :: forall t (a :: *) (b :: *) (c :: *) (d :: *) (e :: *). Typeable t
-        => t a b c d e -> TypeRep
-typeOf5 _ = typeRep (Proxy :: Proxy t)
-
-typeOf6 :: forall t (a :: *) (b :: *) (c :: *) (d :: *) (e :: *) (f :: *).
-                Typeable t => t a b c d e f -> TypeRep
-typeOf6 _ = typeRep (Proxy :: Proxy t)
-
-typeOf7 :: forall t (a :: *) (b :: *) (c :: *) (d :: *) (e :: *) (f :: *)
-                (g :: *). Typeable t => t a b c d e f g -> TypeRep
-typeOf7 _ = typeRep (Proxy :: Proxy t)
-
-type Typeable1 (a :: * -> *)                               = Typeable a
-type Typeable2 (a :: * -> * -> *)                          = Typeable a
-type Typeable3 (a :: * -> * -> * -> *)                     = Typeable a
-type Typeable4 (a :: * -> * -> * -> * -> *)                = Typeable a
-type Typeable5 (a :: * -> * -> * -> * -> * -> *)           = Typeable a
-type Typeable6 (a :: * -> * -> * -> * -> * -> * -> *)      = Typeable a
-type Typeable7 (a :: * -> * -> * -> * -> * -> * -> * -> *) = Typeable a
-
-{-# DEPRECATED Typeable1 "renamed to 'Typeable'" #-} -- deprecated in 7.8
-{-# DEPRECATED Typeable2 "renamed to 'Typeable'" #-} -- deprecated in 7.8
-{-# DEPRECATED Typeable3 "renamed to 'Typeable'" #-} -- deprecated in 7.8
-{-# DEPRECATED Typeable4 "renamed to 'Typeable'" #-} -- deprecated in 7.8
-{-# DEPRECATED Typeable5 "renamed to 'Typeable'" #-} -- deprecated in 7.8
-{-# DEPRECATED Typeable6 "renamed to 'Typeable'" #-} -- deprecated in 7.8
-{-# DEPRECATED Typeable7 "renamed to 'Typeable'" #-} -- deprecated in 7.8
-
+showTypeable :: Int -> TypeRep (a :: k) -> ShowS
+showTypeable _ rep
+  | Just HRefl <- rep `eqTypeRep` (typeRep :: TypeRep Type) =
+    showChar '*'
+  | isListTyCon tc, [ty] <- tys =
+    showChar '[' . shows ty . showChar ']'
+  | isTupleTyCon tc =
+    showChar '(' . showArgs (showChar ',') tys . showChar ')'
+  where (tc, tys) = splitApps rep
+showTypeable p (TrTyCon _ tycon [])
+  = showsPrec p tycon
+showTypeable p (TrTyCon _ tycon args)
+  = showParen (p > 9) $
+    showsPrec p tycon .
+    showChar ' ' .
+    showArgs (showChar ' ') args
+showTypeable p (TrFun _ x r)
+  = showParen (p > 8) $
+    showsPrec 9 x . showString " -> " . showsPrec 8 r
+showTypeable p (TrApp _ f x)
+  = showParen (p > 9) $
+    showsPrec 8 f .
+    showChar ' ' .
+    showsPrec 10 x
 
------------------ Showing TypeReps --------------------
+-- | @since 4.10.0.0
+instance Show SomeTypeRep where
+  showsPrec p (SomeTypeRep ty) = showsPrec p ty
 
-instance Show TypeRep where
-  showsPrec p (TypeRep _ tycon kinds tys) =
-    case tys of
-      [] -> showsPrec p tycon
-      [x]
-        | tycon == tcList -> showChar '[' . shows x . showChar ']'
-        where
-          tcList = tyConOf @[] Proxy
-      [TypeRep _ ptrRepCon _ []]
-        | tycon == tcTYPE && ptrRepCon == tc'PtrRepLifted
-          -> showChar '*'
-        | tycon == tcTYPE && ptrRepCon == tc'PtrRepUnlifted
-          -> showChar '#'
-        where
-          tcTYPE            = tyConOf @TYPE            Proxy
-          tc'PtrRepLifted   = tyConOf @'PtrRepLifted   Proxy
-          tc'PtrRepUnlifted = tyConOf @'PtrRepUnlifted Proxy
-      [a,r] | tycon == tcFun  -> showParen (p > 8) $
-                                 showsPrec 9 a .
-                                 showString " -> " .
-                                 showsPrec 8 r
-      xs | isTupleTyCon tycon -> showTuple xs
-         | otherwise         ->
-            showParen (p > 9) $
-            showsPrec p tycon .
-            showChar ' '      .
-            showArgs (showChar ' ') (kinds ++ tys)
+splitApps :: TypeRep a -> (TyCon, [SomeTypeRep])
+splitApps = go []
+  where
+    go :: [SomeTypeRep] -> TypeRep a -> (TyCon, [SomeTypeRep])
+    go xs (TrTyCon _ tc _) = (tc, xs)
+    go xs (TrApp _ f x)    = go (SomeTypeRep x : xs) f
+    go [] (TrFun _ a b)    = (funTyCon, [SomeTypeRep a, SomeTypeRep b])
+    go _  (TrFun _ _ _)    =
+        errorWithoutStackTrace "Data.Typeable.Internal.splitApps: Impossible"
 
-showsTypeRep :: TypeRep -> ShowS
-showsTypeRep = shows
+funTyCon :: TyCon
+funTyCon = typeRepTyCon (typeRep @(->))
 
--- | Helper to fully evaluate 'TypeRep' for use as @NFData(rnf)@ implementation
---
--- @since 4.8.0.0
-rnfTypeRep :: TypeRep -> ()
-rnfTypeRep (TypeRep _ tyc krs tyrs) = rnfTyCon tyc `seq` go krs `seq` go tyrs
-  where
-    go [] = ()
-    go (x:xs) = rnfTypeRep x `seq` go xs
+isListTyCon :: TyCon -> Bool
+isListTyCon tc = tc == typeRepTyCon (typeRep :: TypeRep [Int])
 
--- Some (Show.TypeRep) helpers:
+isTupleTyCon :: TyCon -> Bool
+isTupleTyCon tc
+  | ('(':',':_) <- tyConName tc = True
+  | otherwise                   = False
 
 showArgs :: Show a => ShowS -> [a] -> ShowS
 showArgs _   []     = id
 showArgs _   [a]    = showsPrec 10 a
 showArgs sep (a:as) = showsPrec 10 a . sep . showArgs sep as
 
-showTuple :: [TypeRep] -> ShowS
-showTuple args = showChar '('
-               . showArgs (showChar ',') args
-               . showChar ')'
+-- | Helper to fully evaluate 'TypeRep' for use as @NFData(rnf)@ implementation
+--
+-- @since 4.8.0.0
+rnfTypeRep :: TypeRep a -> ()
+rnfTypeRep (TrTyCon _ tyc _) = rnfTyCon tyc
+rnfTypeRep (TrApp _ f x)     = rnfTypeRep f `seq` rnfTypeRep x
+rnfTypeRep (TrFun _ x y)     = rnfTypeRep x `seq` rnfTypeRep y
 
+-- | Helper to fully evaluate 'SomeTypeRep' for use as @NFData(rnf)@
+-- implementation
+--
+-- @since 4.10.0.0
+rnfSomeTypeRep :: SomeTypeRep -> ()
+rnfSomeTypeRep (SomeTypeRep r) = rnfTypeRep r
+
 {- *********************************************************
 *                                                          *
 *       TyCon/TypeRep definitions for type literals        *
@@ -408,18 +560,102 @@
 *                                                          *
 ********************************************************* -}
 
+pattern KindRepTypeLit :: TypeLitSort -> String -> KindRep
+pattern KindRepTypeLit sort t <- (getKindRepTypeLit -> Just (sort, t))
+  where
+    KindRepTypeLit sort t = KindRepTypeLitD sort t
 
-mkTypeLitTyCon :: String -> TyCon
-mkTypeLitTyCon name = mkTyCon3 "base" "GHC.TypeLits" name
+{-# COMPLETE KindRepTyConApp, KindRepVar, KindRepApp, KindRepFun,
+             KindRepTYPE, KindRepTypeLit #-}
 
+getKindRepTypeLit :: KindRep -> Maybe (TypeLitSort, String)
+getKindRepTypeLit (KindRepTypeLitS sort t) = Just (sort, unpackCStringUtf8# t)
+getKindRepTypeLit (KindRepTypeLitD sort t) = Just (sort, t)
+getKindRepTypeLit _                        = Nothing
+
+-- | Exquisitely unsafe.
+mkTyCon# :: Addr#       -- ^ package name
+         -> Addr#       -- ^ module name
+         -> Addr#       -- ^ the name of the type constructor
+         -> Int#        -- ^ number of kind variables
+         -> KindRep     -- ^ kind representation
+         -> TyCon       -- ^ A unique 'TyCon' object
+mkTyCon# pkg modl name n_kinds kind_rep
+  | Fingerprint (W64# hi) (W64# lo) <- fingerprint
+  = TyCon hi lo mod (TrNameS name) n_kinds kind_rep
+  where
+    mod = Module (TrNameS pkg) (TrNameS modl)
+    fingerprint :: Fingerprint
+    fingerprint = mkTyConFingerprint (unpackCStringUtf8# pkg)
+                                     (unpackCStringUtf8# modl)
+                                     (unpackCStringUtf8# name)
+
+-- it is extremely important that this fingerprint computation
+-- remains in sync with that in TcTypeable to ensure that type
+-- equality is correct.
+
+-- | Exquisitely unsafe.
+mkTyCon :: String       -- ^ package name
+        -> String       -- ^ module name
+        -> String       -- ^ the name of the type constructor
+        -> Int         -- ^ number of kind variables
+        -> KindRep     -- ^ kind representation
+        -> TyCon        -- ^ A unique 'TyCon' object
+-- Used when the strings are dynamically allocated,
+-- eg from binary deserialisation
+mkTyCon pkg modl name (I# n_kinds) kind_rep
+  | Fingerprint (W64# hi) (W64# lo) <- fingerprint
+  = TyCon hi lo mod (TrNameD name) n_kinds kind_rep
+  where
+    mod = Module (TrNameD pkg) (TrNameD modl)
+    fingerprint :: Fingerprint
+    fingerprint = mkTyConFingerprint pkg modl name
+
+-- This must match the computation done in TcTypeable.mkTyConRepTyConRHS.
+mkTyConFingerprint :: String -- ^ package name
+                   -> String -- ^ module name
+                   -> String -- ^ tycon name
+                   -> Fingerprint
+mkTyConFingerprint pkg_name mod_name tycon_name =
+        fingerprintFingerprints
+        [ fingerprintString pkg_name
+        , fingerprintString mod_name
+        , fingerprintString tycon_name
+        ]
+
+mkTypeLitTyCon :: String -> TyCon -> TyCon
+mkTypeLitTyCon name kind_tycon
+  = mkTyCon "base" "GHC.TypeLits" name 0 kind
+  where kind = KindRepTyConApp kind_tycon []
+
 -- | Used to make `'Typeable' instance for things of kind Nat
-typeNatTypeRep :: KnownNat a => Proxy# a -> TypeRep
-typeNatTypeRep p = typeLitTypeRep (show (natVal' p))
+typeNatTypeRep :: KnownNat a => Proxy# a -> TypeRep a
+typeNatTypeRep p = typeLitTypeRep (show (natVal' p)) tcNat
 
 -- | Used to make `'Typeable' instance for things of kind Symbol
-typeSymbolTypeRep :: KnownSymbol a => Proxy# a -> TypeRep
-typeSymbolTypeRep p = typeLitTypeRep (show (symbolVal' p))
+typeSymbolTypeRep :: KnownSymbol a => Proxy# a -> TypeRep a
+typeSymbolTypeRep p = typeLitTypeRep (show (symbolVal' p)) tcSymbol
 
+mkTypeLitFromString :: TypeLitSort -> String -> SomeTypeRep
+mkTypeLitFromString TypeLitSymbol s =
+    SomeTypeRep $ (typeLitTypeRep s tcSymbol :: TypeRep Symbol)
+mkTypeLitFromString TypeLitNat s =
+    SomeTypeRep $ (typeLitTypeRep s tcSymbol :: TypeRep Nat)
+
+tcSymbol :: TyCon
+tcSymbol = typeRepTyCon (typeRep @Symbol)
+
+tcNat :: TyCon
+tcNat = typeRepTyCon (typeRep @Nat)
+
 -- | An internal function, to make representations for type literals.
-typeLitTypeRep :: String -> TypeRep
-typeLitTypeRep nm = mkTyConApp (mkTypeLitTyCon nm) []
+typeLitTypeRep :: forall (a :: k). (Typeable k) => String -> TyCon -> TypeRep a
+typeLitTypeRep nm kind_tycon = mkTrCon (mkTypeLitTyCon nm kind_tycon) []
+
+-- | For compiler use.
+mkTrFun :: forall (r1 :: RuntimeRep) (r2 :: RuntimeRep)
+                  (a :: TYPE r1) (b :: TYPE r2).
+           TypeRep a -> TypeRep b -> TypeRep ((a -> b) :: Type)
+mkTrFun arg res = TrFun fpr arg res
+  where fpr = fingerprintFingerprints [ typeRepFingerprint arg
+                                      , typeRepFingerprint res]
diff --git a/Data/Version.hs b/Data/Version.hs
--- a/Data/Version.hs
+++ b/Data/Version.hs
@@ -98,11 +98,13 @@
 {-# DEPRECATED versionTags "See GHC ticket #2496" #-}
 -- TODO. Remove all references to versionTags in GHC 8.0 release.
 
+-- | @since 2.01
 instance Eq Version where
   v1 == v2  =  versionBranch v1 == versionBranch v2
                 && sort (versionTags v1) == sort (versionTags v2)
                 -- tags may be in any order
 
+-- | @since 2.01
 instance Ord Version where
   v1 `compare` v2 = versionBranch v1 `compare` versionBranch v2
 
diff --git a/Data/Void.hs b/Data/Void.hs
--- a/Data/Void.hs
+++ b/Data/Void.hs
@@ -36,26 +36,32 @@
 
 deriving instance Data Void
 
+-- | @since 4.8.0.0
 instance Eq Void where
     _ == _ = True
 
+-- | @since 4.8.0.0
 instance Ord Void where
     compare _ _ = EQ
 
 -- | Reading a 'Void' value is always a parse error, considering
 -- 'Void' as a data type with no constructors.
+-- | @since 4.8.0.0
 instance Read Void where
     readsPrec _ _ = []
 
+-- | @since 4.8.0.0
 instance Show Void where
     showsPrec _ = absurd
 
+-- | @since 4.8.0.0
 instance Ix Void where
     range _     = []
     index _     = absurd
     inRange _   = absurd
     rangeSize _ = 0
 
+-- | @since 4.8.0.0
 instance Exception Void
 
 -- | Since 'Void' values logically don't exist, this witnesses the
diff --git a/Foreign/C/Error.hs b/Foreign/C/Error.hs
--- a/Foreign/C/Error.hs
+++ b/Foreign/C/Error.hs
@@ -111,6 +111,7 @@
 
 newtype Errno = Errno CInt
 
+-- | @since 2.01
 instance Eq Errno where
   errno1@(Errno no1) == errno2@(Errno no2)
     | isValidErrno errno1 && isValidErrno errno2 = no1 == no2
diff --git a/Foreign/C/Types.hs b/Foreign/C/Types.hs
--- a/Foreign/C/Types.hs
+++ b/Foreign/C/Types.hs
@@ -1,6 +1,10 @@
+{-# LANGUAGE CPP #-}
+{-# LANGUAGE DerivingStrategies #-}
+{-# LANGUAGE GeneralizedNewtypeDeriving #-}
+{-# LANGUAGE MagicHash #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE StandaloneDeriving #-}
 {-# LANGUAGE Trustworthy #-}
-{-# LANGUAGE CPP, NoImplicitPrelude, MagicHash, GeneralizedNewtypeDeriving,
-             StandaloneDeriving #-}
 {-# OPTIONS_GHC -Wno-unused-binds #-}
 -- XXX -Wno-unused-binds stops us warning about unused constructors,
 -- but really we should just remove them if we don't want them
@@ -10,7 +14,7 @@
 -- Module      :  Foreign.C.Types
 -- Copyright   :  (c) The FFI task force 2001
 -- License     :  BSD-style (see the file libraries/base/LICENSE)
--- 
+--
 -- Maintainer  :  ffi@haskell.org
 -- Stability   :  provisional
 -- Portability :  portable
@@ -40,7 +44,7 @@
         , CShort(..),   CUShort(..),  CInt(..),      CUInt(..)
         , CLong(..),    CULong(..)
         , CPtrdiff(..), CSize(..),    CWchar(..),    CSigAtomic(..)
-        , CLLong(..),   CULLong(..)
+        , CLLong(..),   CULLong(..), CBool(..)
         , CIntPtr(..),  CUIntPtr(..), CIntMax(..),   CUIntMax(..)
 
           -- ** Numeric types
@@ -69,6 +73,10 @@
         -- XXX GHC doesn't support CLDouble yet
         -- , CLDouble(..)
 
+          -- See Note [Exporting constructors of marshallable foreign types]
+          -- in Foreign.Ptr for why the constructors for these newtypes are
+          -- exported.
+
           -- ** Other types
 
           -- Instances of: Eq and Storable
@@ -118,6 +126,11 @@
 -- | Haskell type representing the C @unsigned long long@ type.
 INTEGRAL_TYPE(CULLong,HTYPE_UNSIGNED_LONG_LONG)
 
+-- | Haskell type representing the C @bool@ type.
+--
+-- @since 4.10.0.0
+INTEGRAL_TYPE_WITH_CTYPE(CBool,bool,HTYPE_BOOL)
+
 {-# RULES
 "fromIntegral/a->CChar"   fromIntegral = \x -> CChar   (fromIntegral x)
 "fromIntegral/a->CSChar"  fromIntegral = \x -> CSChar  (fromIntegral x)
@@ -142,6 +155,7 @@
 "fromIntegral/CULong->a"  fromIntegral = \(CULong  x) -> fromIntegral x
 "fromIntegral/CLLong->a"  fromIntegral = \(CLLong  x) -> fromIntegral x
 "fromIntegral/CULLong->a" fromIntegral = \(CULLong x) -> fromIntegral x
+"fromIntegral/CBool->a"   fromIntegral = \(CBool   x) -> fromIntegral x
  #-}
 
 -- | Haskell type representing the C @float@ type.
@@ -190,6 +204,7 @@
 -- | Haskell type representing the C @useconds_t@ type.
 --
 -- @since 4.4.0.0
+
 ARITHMETIC_TYPE(CUSeconds,HTYPE_USECONDS_T)
 -- | Haskell type representing the C @suseconds_t@ type.
 --
diff --git a/Foreign/Concurrent.hs b/Foreign/Concurrent.hs
--- a/Foreign/Concurrent.hs
+++ b/Foreign/Concurrent.hs
@@ -35,17 +35,38 @@
 import qualified GHC.ForeignPtr
 
 newForeignPtr :: Ptr a -> IO () -> IO (ForeignPtr a)
--- ^Turns a plain memory reference into a foreign object by associating
--- a finalizer - given by the monadic operation - with the reference.
--- The finalizer will be executed after the last reference to the
--- foreign object is dropped.  There is no guarantee of promptness, and
+--
+-- ^Turns a plain memory reference into a foreign object by
+-- associating a finalizer - given by the monadic operation - with the
+-- reference.  The storage manager will start the finalizer, in a
+-- separate thread, some time after the last reference to the
+-- @ForeignPtr@ is dropped.  There is no guarantee of promptness, and
 -- in fact there is no guarantee that the finalizer will eventually
 -- run at all.
+--
+-- Note that references from a finalizer do not necessarily prevent
+-- another object from being finalized.  If A's finalizer refers to B
+-- (perhaps using 'touchForeignPtr', then the only guarantee is that
+-- B's finalizer will never be started before A's.  If both A and B
+-- are unreachable, then both finalizers will start together.  See
+-- 'touchForeignPtr' for more on finalizer ordering.
+--
 newForeignPtr = GHC.ForeignPtr.newConcForeignPtr
 
 addForeignPtrFinalizer :: ForeignPtr a -> IO () -> IO ()
--- ^This function adds a finalizer to the given 'ForeignPtr'.
--- The finalizer will run after the last reference to the foreign object
--- is dropped, but /before/ all previously registered finalizers for the
--- same object.
+-- ^This function adds a finalizer to the given @ForeignPtr@.  The
+-- finalizer will run /before/ all other finalizers for the same
+-- object which have already been registered.
+--
+-- This is a variant of @Foreign.ForeignPtr.addForeignPtrFinalizer@,
+-- where the finalizer is an arbitrary @IO@ action.  When it is
+-- invoked, the finalizer will run in a new thread.
+--
+-- NB. Be very careful with these finalizers.  One common trap is that
+-- if a finalizer references another finalized value, it does not
+-- prevent that value from being finalized.  In particular, 'Handle's
+-- are finalized objects, so a finalizer should not refer to a 'Handle'
+-- (including @stdout@, @stdin@ or @stderr@).
+--
 addForeignPtrFinalizer = GHC.ForeignPtr.addForeignPtrConcFinalizer
+
diff --git a/Foreign/ForeignPtr.hs b/Foreign/ForeignPtr.hs
--- a/Foreign/ForeignPtr.hs
+++ b/Foreign/ForeignPtr.hs
@@ -35,6 +35,7 @@
         -- ** Low-level operations
         , touchForeignPtr
         , castForeignPtr
+        , plusForeignPtr
 
         -- ** Allocating managed memory
         , mallocForeignPtr
diff --git a/Foreign/ForeignPtr/Imp.hs b/Foreign/ForeignPtr/Imp.hs
--- a/Foreign/ForeignPtr/Imp.hs
+++ b/Foreign/ForeignPtr/Imp.hs
@@ -38,6 +38,7 @@
         , unsafeForeignPtrToPtr
         , touchForeignPtr
         , castForeignPtr
+        , plusForeignPtr
 
         -- ** Allocating managed memory
         , mallocForeignPtr
diff --git a/Foreign/Marshal/Alloc.hs b/Foreign/Marshal/Alloc.hs
--- a/Foreign/Marshal/Alloc.hs
+++ b/Foreign/Marshal/Alloc.hs
@@ -198,7 +198,7 @@
 free  = _free
 
 
--- auxilliary routines
+-- auxiliary routines
 -- -------------------
 
 -- asserts that the pointer returned from the action in the second argument is
diff --git a/Foreign/Marshal/Utils.hs b/Foreign/Marshal/Utils.hs
--- a/Foreign/Marshal/Utils.hs
+++ b/Foreign/Marshal/Utils.hs
@@ -177,7 +177,7 @@
   _ <- memset dest (fromIntegral char) (fromIntegral size)
   return ()
 
--- auxilliary routines
+-- auxiliary routines
 -- -------------------
 
 -- |Basic C routines needed for memory copying
diff --git a/Foreign/Ptr.hs b/Foreign/Ptr.hs
--- a/Foreign/Ptr.hs
+++ b/Foreign/Ptr.hs
@@ -1,13 +1,17 @@
+{-# LANGUAGE CPP #-}
+{-# LANGUAGE DerivingStrategies #-}
+{-# LANGUAGE GeneralizedNewtypeDeriving #-}
+{-# LANGUAGE MagicHash #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE StandaloneDeriving #-}
 {-# LANGUAGE Trustworthy #-}
-{-# LANGUAGE CPP, NoImplicitPrelude, MagicHash, GeneralizedNewtypeDeriving,
-             StandaloneDeriving #-}
 
 -----------------------------------------------------------------------------
 -- |
 -- Module      :  Foreign.Ptr
 -- Copyright   :  (c) The FFI task force 2001
 -- License     :  BSD-style (see the file libraries/base/LICENSE)
--- 
+--
 -- Maintainer  :  ffi@haskell.org
 -- Stability   :  provisional
 -- Portability :  portable
@@ -41,12 +45,15 @@
     -- Free the function pointer created by foreign export dynamic.
 
     -- * Integral types with lossless conversion to and from pointers
-    IntPtr,
+    IntPtr(..),
     ptrToIntPtr,
     intPtrToPtr,
-    WordPtr,
+    WordPtr(..),
     ptrToWordPtr,
     wordPtrToPtr
+
+    -- See Note [Exporting constructors of marshallable foreign types]
+    -- for why the constructors for IntPtr and WordPtr are exported.
  ) where
 
 import GHC.Ptr
@@ -97,3 +104,21 @@
 -- | casts an @IntPtr@ to a @Ptr@
 intPtrToPtr :: IntPtr -> Ptr a
 intPtrToPtr (IntPtr (I# i#)) = Ptr (int2Addr# i#)
+
+{-
+Note [Exporting constructors of marshallable foreign types]
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+One might expect that IntPtr, WordPtr, and the other newtypes in the
+Foreign.C.Types and System.Posix.Types modules to be abstract, but this is not
+the case in GHC (see Trac #5229 and #11983). In fact, we deliberately export
+the constructors for these datatypes in order to satisfy a requirement of the
+Haskell 2010 Report (§ 8.4.2) that if a newtype is used in a foreign
+declaration, then its constructor must be visible.
+
+This requirement was motivated by the fact that using a type in a foreign
+declaration necessarily exposes some information about the type to the user,
+so being able to use abstract types in a foreign declaration breaks their
+abstraction (see Trac #3008). As a result, the constructors of all FFI-related
+newtypes in base must be exported in order to be useful for FFI programming,
+even at the cost of exposing their underlying, architecture-dependent types.
+-}
diff --git a/Foreign/Storable.hs b/Foreign/Storable.hs
--- a/Foreign/Storable.hs
+++ b/Foreign/Storable.hs
@@ -145,6 +145,7 @@
    peek ptr = peekElemOff ptr 0
    poke ptr = pokeElemOff ptr 0
 
+-- | @since 4.9.0.0
 instance Storable () where
   sizeOf _ = 0
   alignment _ = 1
@@ -153,6 +154,7 @@
 
 -- System-dependent, but rather obvious instances
 
+-- | @since 2.01
 instance Storable Bool where
    sizeOf _          = sizeOf (undefined::HTYPE_INT)
    alignment _       = alignment (undefined::HTYPE_INT)
@@ -166,54 +168,71 @@
     peekElemOff = read;                         \
     pokeElemOff = write }
 
+-- | @since 2.01
 STORABLE(Char,SIZEOF_INT32,ALIGNMENT_INT32,
          readWideCharOffPtr,writeWideCharOffPtr)
 
+-- | @since 2.01
 STORABLE(Int,SIZEOF_HSINT,ALIGNMENT_HSINT,
          readIntOffPtr,writeIntOffPtr)
 
+-- | @since 2.01
 STORABLE(Word,SIZEOF_HSWORD,ALIGNMENT_HSWORD,
          readWordOffPtr,writeWordOffPtr)
 
+-- | @since 2.01
 STORABLE((Ptr a),SIZEOF_HSPTR,ALIGNMENT_HSPTR,
          readPtrOffPtr,writePtrOffPtr)
 
+-- | @since 2.01
 STORABLE((FunPtr a),SIZEOF_HSFUNPTR,ALIGNMENT_HSFUNPTR,
          readFunPtrOffPtr,writeFunPtrOffPtr)
 
+-- | @since 2.01
 STORABLE((StablePtr a),SIZEOF_HSSTABLEPTR,ALIGNMENT_HSSTABLEPTR,
          readStablePtrOffPtr,writeStablePtrOffPtr)
 
+-- | @since 2.01
 STORABLE(Float,SIZEOF_HSFLOAT,ALIGNMENT_HSFLOAT,
          readFloatOffPtr,writeFloatOffPtr)
 
+-- | @since 2.01
 STORABLE(Double,SIZEOF_HSDOUBLE,ALIGNMENT_HSDOUBLE,
          readDoubleOffPtr,writeDoubleOffPtr)
 
+-- | @since 2.01
 STORABLE(Word8,SIZEOF_WORD8,ALIGNMENT_WORD8,
          readWord8OffPtr,writeWord8OffPtr)
 
+-- | @since 2.01
 STORABLE(Word16,SIZEOF_WORD16,ALIGNMENT_WORD16,
          readWord16OffPtr,writeWord16OffPtr)
 
+-- | @since 2.01
 STORABLE(Word32,SIZEOF_WORD32,ALIGNMENT_WORD32,
          readWord32OffPtr,writeWord32OffPtr)
 
+-- | @since 2.01
 STORABLE(Word64,SIZEOF_WORD64,ALIGNMENT_WORD64,
          readWord64OffPtr,writeWord64OffPtr)
 
+-- | @since 2.01
 STORABLE(Int8,SIZEOF_INT8,ALIGNMENT_INT8,
          readInt8OffPtr,writeInt8OffPtr)
 
+-- | @since 2.01
 STORABLE(Int16,SIZEOF_INT16,ALIGNMENT_INT16,
          readInt16OffPtr,writeInt16OffPtr)
 
+-- | @since 2.01
 STORABLE(Int32,SIZEOF_INT32,ALIGNMENT_INT32,
          readInt32OffPtr,writeInt32OffPtr)
 
+-- | @since 2.01
 STORABLE(Int64,SIZEOF_INT64,ALIGNMENT_INT64,
          readInt64OffPtr,writeInt64OffPtr)
 
+-- | @since 4.8.0.0
 instance (Storable a, Integral a) => Storable (Ratio a) where
     sizeOf _    = 2 * sizeOf (undefined :: a)
     alignment _ = alignment (undefined :: a )
@@ -228,6 +247,7 @@
                         pokeElemOff q 1 i
 
 -- XXX: here to avoid orphan instance in GHC.Fingerprint
+-- | @since 4.4.0.0
 instance Storable Fingerprint where
   sizeOf _ = 16
   alignment _ = 8
diff --git a/GHC/Arr.hs b/GHC/Arr.hs
--- a/GHC/Arr.hs
+++ b/GHC/Arr.hs
@@ -182,6 +182,7 @@
 hopelessIndexError = errorWithoutStackTrace "Error in array index"
 
 ----------------------------------------------------------------------
+-- | @since 2.01
 instance  Ix Char  where
     {-# INLINE range #-}
     range (m,n) = [m..n]
@@ -197,6 +198,7 @@
     inRange (m,n) i     =  m <= i && i <= n
 
 ----------------------------------------------------------------------
+-- | @since 2.01
 instance  Ix Int  where
     {-# INLINE range #-}
         -- The INLINE stops the build in the RHS from getting inlined,
@@ -214,12 +216,14 @@
     {-# INLINE inRange #-}
     inRange (I# m,I# n) (I# i) =  isTrue# (m <=# i) && isTrue# (i <=# n)
 
+-- | @since 4.6.0.0
 instance Ix Word where
     range (m,n)         = [m..n]
     unsafeIndex (m,_) i = fromIntegral (i - m)
     inRange (m,n) i     = m <= i && i <= n
 
 ----------------------------------------------------------------------
+-- | @since 2.01
 instance  Ix Integer  where
     {-# INLINE range #-}
     range (m,n) = [m..n]
@@ -235,6 +239,7 @@
     inRange (m,n) i     =  m <= i && i <= n
 
 ----------------------------------------------------------------------
+-- | @since 2.01
 instance Ix Bool where -- as derived
     {-# INLINE range #-}
     range (m,n) = [m..n]
@@ -250,6 +255,7 @@
     inRange (l,u) i = fromEnum i >= fromEnum l && fromEnum i <= fromEnum u
 
 ----------------------------------------------------------------------
+-- | @since 2.01
 instance Ix Ordering where -- as derived
     {-# INLINE range #-}
     range (m,n) = [m..n]
@@ -265,6 +271,7 @@
     inRange (l,u) i = fromEnum i >= fromEnum l && fromEnum i <= fromEnum u
 
 ----------------------------------------------------------------------
+-- | @since 2.01
 instance Ix () where
     {-# INLINE range #-}
     range   ((), ())    = [()]
@@ -277,6 +284,7 @@
     index b i = unsafeIndex b i
 
 ----------------------------------------------------------------------
+-- | @since 2.01
 instance (Ix a, Ix b) => Ix (a, b) where -- as derived
     {-# SPECIALISE instance Ix (Int,Int) #-}
 
@@ -295,6 +303,7 @@
     -- Default method for index
 
 ----------------------------------------------------------------------
+-- | @since 2.01
 instance  (Ix a1, Ix a2, Ix a3) => Ix (a1,a2,a3)  where
     {-# SPECIALISE instance Ix (Int,Int,Int) #-}
 
@@ -315,6 +324,7 @@
     -- Default method for index
 
 ----------------------------------------------------------------------
+-- | @since 2.01
 instance  (Ix a1, Ix a2, Ix a3, Ix a4) => Ix (a1,a2,a3,a4)  where
     range ((l1,l2,l3,l4),(u1,u2,u3,u4)) =
       [(i1,i2,i3,i4) | i1 <- range (l1,u1),
@@ -333,7 +343,7 @@
       inRange (l3,u3) i3 && inRange (l4,u4) i4
 
     -- Default method for index
-
+-- | @since 2.01
 instance  (Ix a1, Ix a2, Ix a3, Ix a4, Ix a5) => Ix (a1,a2,a3,a4,a5)  where
     range ((l1,l2,l3,l4,l5),(u1,u2,u3,u4,u5)) =
       [(i1,i2,i3,i4,i5) | i1 <- range (l1,u1),
@@ -390,6 +400,7 @@
 type role STArray nominal nominal representational
 
 -- Just pointer equality on mutable arrays:
+-- | @since 2.01
 instance Eq (STArray s i e) where
     STArray _ _ _ arr1# == STArray _ _ _ arr2# =
         isTrue# (sameMutableArray# arr1# arr2#)
@@ -788,15 +799,19 @@
 ----------------------------------------------------------------------
 -- Array instances
 
+-- | @since 2.01
 instance Functor (Array i) where
     fmap = amap
 
+-- | @since 2.01
 instance (Ix i, Eq e) => Eq (Array i e) where
     (==) = eqArray
 
+-- | @since 2.01
 instance (Ix i, Ord e) => Ord (Array i e) where
     compare = cmpArray
 
+-- | @since 2.01
 instance (Ix a, Show a, Show b) => Show (Array a b) where
     showsPrec p a =
         showParen (p > appPrec) $
diff --git a/GHC/Base.hs b/GHC/Base.hs
--- a/GHC/Base.hs
+++ b/GHC/Base.hs
@@ -50,7 +50,7 @@
 GHC.Real        Classes: Real, Integral, Fractional, RealFrac
                          plus instances for Int, Integer
                 Types:  Ratio, Rational
-                        plus intances for classes so far
+                        plus instances for classes so far
 
                 Rational is needed here because it is mentioned in the signature
                 of 'toRational' in class Real
@@ -237,6 +237,7 @@
 
         mconcat = foldr mappend mempty
 
+-- | @since 2.01
 instance Monoid [a] where
         {-# INLINE mempty #-}
         mempty  = []
@@ -260,37 +261,43 @@
 We mark them INLINE because the inliner is not generally too keen to inline
 build forms such as the ones these desugar to without our insistence.  Defining
 these using list comprehensions instead of foldr has an additional potential
-benefit, as described in compiler/deSugar/DsListComp.lhs: if optimizations
+benefit, as described in compiler/deSugar/DsListComp.hs: if optimizations
 needed to make foldr/build forms efficient are turned off, we'll get reasonably
 efficient translations anyway.
 -}
 
+-- | @since 2.01
 instance Monoid b => Monoid (a -> b) where
         mempty _ = mempty
         mappend f g x = f x `mappend` g x
 
+-- | @since 2.01
 instance Monoid () where
         -- Should it be strict?
         mempty        = ()
         _ `mappend` _ = ()
         mconcat _     = ()
 
+-- | @since 2.01
 instance (Monoid a, Monoid b) => Monoid (a,b) where
         mempty = (mempty, mempty)
         (a1,b1) `mappend` (a2,b2) =
                 (a1 `mappend` a2, b1 `mappend` b2)
 
+-- | @since 2.01
 instance (Monoid a, Monoid b, Monoid c) => Monoid (a,b,c) where
         mempty = (mempty, mempty, mempty)
         (a1,b1,c1) `mappend` (a2,b2,c2) =
                 (a1 `mappend` a2, b1 `mappend` b2, c1 `mappend` c2)
 
+-- | @since 2.01
 instance (Monoid a, Monoid b, Monoid c, Monoid d) => Monoid (a,b,c,d) where
         mempty = (mempty, mempty, mempty, mempty)
         (a1,b1,c1,d1) `mappend` (a2,b2,c2,d2) =
                 (a1 `mappend` a2, b1 `mappend` b2,
                  c1 `mappend` c2, d1 `mappend` d2)
 
+-- | @since 2.01
 instance (Monoid a, Monoid b, Monoid c, Monoid d, Monoid e) =>
                 Monoid (a,b,c,d,e) where
         mempty = (mempty, mempty, mempty, mempty, mempty)
@@ -299,6 +306,7 @@
                  d1 `mappend` d2, e1 `mappend` e2)
 
 -- lexicographical ordering
+-- | @since 2.01
 instance Monoid Ordering where
         mempty         = EQ
         LT `mappend` _ = LT
@@ -309,21 +317,34 @@
 -- <http://en.wikipedia.org/wiki/Monoid>: \"Any semigroup @S@ may be
 -- turned into a monoid simply by adjoining an element @e@ not in @S@
 -- and defining @e*e = e@ and @e*s = s = s*e@ for all @s ∈ S@.\" Since
--- there is no \"Semigroup\" typeclass providing just 'mappend', we
--- use 'Monoid' instead.
+-- there used to be no \"Semigroup\" typeclass providing just 'mappend',
+-- we use 'Monoid' instead.
+--
+-- @since 2.01
 instance Monoid a => Monoid (Maybe a) where
   mempty = Nothing
   Nothing `mappend` m = m
   m `mappend` Nothing = m
   Just m1 `mappend` Just m2 = Just (m1 `mappend` m2)
 
+-- | For tuples, the 'Monoid' constraint on @a@ determines
+-- how the first values merge.
+-- For example, 'String's concatenate:
+--
+-- > ("hello ", (+15)) <*> ("world!", 2002)
+-- > ("hello world!",2017)
+--
+-- @since 2.01
 instance Monoid a => Applicative ((,) a) where
     pure x = (mempty, x)
     (u, f) <*> (v, x) = (u `mappend` v, f x)
+    liftA2 f (u, x) (v, y) = (u `mappend` v, f x y)
 
+-- | @since 4.9.0.0
 instance Monoid a => Monad ((,) a) where
     (u, a) >>= k = case k a of (v, b) -> (u `mappend` v, b)
 
+-- | @since 4.9.0.0
 instance Monoid a => Monoid (IO a) where
     mempty = pure mempty
     mappend = liftA2 mappend
@@ -351,11 +372,17 @@
 --
 -- * embed pure expressions ('pure'), and
 --
--- * sequence computations and combine their results ('<*>').
+-- * sequence computations and combine their results ('<*>' and 'liftA2').
 --
--- A minimal complete definition must include implementations of these
--- functions satisfying the following laws:
+-- A minimal complete definition must include implementations of 'pure'
+-- and of either '<*>' or 'liftA2'. If it defines both, then they must behave
+-- the same as their default definitions:
 --
+--      @('<*>') = 'liftA2' 'id'@
+--      @'liftA2' f x y = f '<$>' x '<*>' y@
+--
+-- Further, any definition must satisfy the following:
+--
 -- [/identity/]
 --
 --      @'pure' 'id' '<*>' v = v@
@@ -372,17 +399,28 @@
 --
 --      @u '<*>' 'pure' y = 'pure' ('$' y) '<*>' u@
 --
+--
 -- The other methods have the following default definitions, which may
 -- be overridden with equivalent specialized implementations:
 --
---   * @u '*>' v = 'pure' ('const' 'id') '<*>' u '<*>' v@
+--   * @u '*>' v = ('id' '<$' u) '<*>' v@
 --
---   * @u '<*' v = 'pure' 'const' '<*>' u '<*>' v@
+--   * @u '<*' v = 'liftA2' 'const' u v@
 --
 -- As a consequence of these laws, the 'Functor' instance for @f@ will satisfy
 --
 --   * @'fmap' f x = 'pure' f '<*>' x@
 --
+--
+-- It may be useful to note that supposing
+--
+--      @forall x y. p (q x y) = f x . g y@
+--
+-- it follows from the above that
+--
+--      @'liftA2' p ('liftA2' q u v) = 'liftA2' f u . 'liftA2' g v@
+--
+--
 -- If @f@ is also a 'Monad', it should satisfy
 --
 --   * @'pure' = 'return'@
@@ -392,17 +430,37 @@
 -- (which implies that 'pure' and '<*>' satisfy the applicative functor laws).
 
 class Functor f => Applicative f where
+    {-# MINIMAL pure, ((<*>) | liftA2) #-}
     -- | Lift a value.
     pure :: a -> f a
 
     -- | Sequential application.
+    --
+    -- A few functors support an implementation of '<*>' that is more
+    -- efficient than the default one.
     (<*>) :: f (a -> b) -> f a -> f b
+    (<*>) = liftA2 id
 
+    -- | Lift a binary function to actions.
+    --
+    -- Some functors support an implementation of 'liftA2' that is more
+    -- efficient than the default one. In particular, if 'fmap' is an
+    -- expensive operation, it is likely better to use 'liftA2' than to
+    -- 'fmap' over the structure and then use '<*>'.
+    liftA2 :: (a -> b -> c) -> f a -> f b -> f c
+    liftA2 f x = (<*>) (fmap f x)
+
     -- | Sequence actions, discarding the value of the first argument.
     (*>) :: f a -> f b -> f b
     a1 *> a2 = (id <$ a1) <*> a2
-    -- This is essentially the same as liftA2 (const id), but if the
-    -- Functor instance has an optimized (<$), we want to use that instead.
+    -- This is essentially the same as liftA2 (flip const), but if the
+    -- Functor instance has an optimized (<$), it may be better to use
+    -- that instead. Before liftA2 became a method, this definition
+    -- was strictly better, but now it depends on the functor. For a
+    -- functor supporting a sharing-enhancing (<$), this definition
+    -- may reduce allocation by preventing a1 from ever being fully
+    -- realized. In an implementation with a boring (<$) but an optimizing
+    -- liftA2, it would likely be better to define (*>) using liftA2.
 
     -- | Sequence actions, discarding the value of the second argument.
     (<*) :: f a -> f b -> f a
@@ -410,7 +468,8 @@
 
 -- | A variant of '<*>' with the arguments reversed.
 (<**>) :: Applicative f => f a -> f (a -> b) -> f b
-(<**>) = liftA2 (flip ($))
+(<**>) = liftA2 (\a f -> f a)
+-- Don't use $ here, see the note at the top of the page
 
 -- | Lift a function to actions.
 -- This function may be used as a value for `fmap` in a `Functor` instance.
@@ -419,22 +478,15 @@
 -- Caution: since this may be used for `fmap`, we can't use the obvious
 -- definition of liftA = fmap.
 
--- | Lift a binary function to actions.
-liftA2 :: Applicative f => (a -> b -> c) -> f a -> f b -> f c
-liftA2 f a b = fmap f a <*> b
-
 -- | Lift a ternary function to actions.
 liftA3 :: Applicative f => (a -> b -> c -> d) -> f a -> f b -> f c -> f d
-liftA3 f a b c = fmap f a <*> b <*> c
+liftA3 f a b c = liftA2 f a b <*> c
 
 
-{-# INLINEABLE liftA #-}
+{-# INLINABLE liftA #-}
 {-# SPECIALISE liftA :: (a1->r) -> IO a1 -> IO r #-}
 {-# SPECIALISE liftA :: (a1->r) -> Maybe a1 -> Maybe r #-}
-{-# INLINEABLE liftA2 #-}
-{-# SPECIALISE liftA2 :: (a1->a2->r) -> IO a1 -> IO a2 -> IO r #-}
-{-# SPECIALISE liftA2 :: (a1->a2->r) -> Maybe a1 -> Maybe a2 -> Maybe r #-}
-{-# INLINEABLE liftA3 #-}
+{-# INLINABLE liftA3 #-}
 {-# SPECIALISE liftA3 :: (a1->a2->a3->r) -> IO a1 -> IO a2 -> IO a3 -> IO r #-}
 {-# SPECIALISE liftA3 :: (a1->a2->a3->r) ->
                                 Maybe a1 -> Maybe a2 -> Maybe a3 -> Maybe r #-}
@@ -534,7 +586,7 @@
 -- will output the string @Debugging@ if the Boolean value @debug@
 -- is 'True', and otherwise do nothing.
 when      :: (Applicative f) => Bool -> f () -> f ()
-{-# INLINEABLE when #-}
+{-# INLINABLE when #-}
 {-# SPECIALISE when :: Bool -> IO () -> IO () #-}
 {-# SPECIALISE when :: Bool -> Maybe () -> Maybe () #-}
 when p s  = if p then s else pure ()
@@ -582,6 +634,8 @@
 --
 liftM2  :: (Monad m) => (a1 -> a2 -> r) -> m a1 -> m a2 -> m r
 liftM2 f m1 m2          = do { x1 <- m1; x2 <- m2; return (f x1 x2) }
+-- Caution: since this may be used for `liftA2`, we can't use the obvious
+-- definition of liftM2 = liftA2.
 
 -- | Promote a function to a monad, scanning the monadic arguments from
 -- left to right (cf. 'liftM2').
@@ -598,19 +652,19 @@
 liftM5  :: (Monad m) => (a1 -> a2 -> a3 -> a4 -> a5 -> r) -> m a1 -> m a2 -> m a3 -> m a4 -> m a5 -> m r
 liftM5 f m1 m2 m3 m4 m5 = do { x1 <- m1; x2 <- m2; x3 <- m3; x4 <- m4; x5 <- m5; return (f x1 x2 x3 x4 x5) }
 
-{-# INLINEABLE liftM #-}
+{-# INLINABLE liftM #-}
 {-# SPECIALISE liftM :: (a1->r) -> IO a1 -> IO r #-}
 {-# SPECIALISE liftM :: (a1->r) -> Maybe a1 -> Maybe r #-}
-{-# INLINEABLE liftM2 #-}
+{-# INLINABLE liftM2 #-}
 {-# SPECIALISE liftM2 :: (a1->a2->r) -> IO a1 -> IO a2 -> IO r #-}
 {-# SPECIALISE liftM2 :: (a1->a2->r) -> Maybe a1 -> Maybe a2 -> Maybe r #-}
-{-# INLINEABLE liftM3 #-}
+{-# INLINABLE liftM3 #-}
 {-# SPECIALISE liftM3 :: (a1->a2->a3->r) -> IO a1 -> IO a2 -> IO a3 -> IO r #-}
 {-# SPECIALISE liftM3 :: (a1->a2->a3->r) -> Maybe a1 -> Maybe a2 -> Maybe a3 -> Maybe r #-}
-{-# INLINEABLE liftM4 #-}
+{-# INLINABLE liftM4 #-}
 {-# SPECIALISE liftM4 :: (a1->a2->a3->a4->r) -> IO a1 -> IO a2 -> IO a3 -> IO a4 -> IO r #-}
 {-# SPECIALISE liftM4 :: (a1->a2->a3->a4->r) -> Maybe a1 -> Maybe a2 -> Maybe a3 -> Maybe a4 -> Maybe r #-}
-{-# INLINEABLE liftM5 #-}
+{-# INLINABLE liftM5 #-}
 {-# SPECIALISE liftM5 :: (a1->a2->a3->a4->a5->r) -> IO a1 -> IO a2 -> IO a3 -> IO a4 -> IO a5 -> IO r #-}
 {-# SPECIALISE liftM5 :: (a1->a2->a3->a4->a5->r) -> Maybe a1 -> Maybe a2 -> Maybe a3 -> Maybe a4 -> Maybe a5 -> Maybe r #-}
 
@@ -629,39 +683,49 @@
 ap m1 m2          = do { x1 <- m1; x2 <- m2; return (x1 x2) }
 -- Since many Applicative instances define (<*>) = ap, we
 -- cannot define ap = (<*>)
-{-# INLINEABLE ap #-}
+{-# INLINABLE ap #-}
 {-# SPECIALISE ap :: IO (a -> b) -> IO a -> IO b #-}
 {-# SPECIALISE ap :: Maybe (a -> b) -> Maybe a -> Maybe b #-}
 
 -- instances for Prelude types
 
+-- | @since 2.01
 instance Functor ((->) r) where
     fmap = (.)
 
+-- | @since 2.01
 instance Applicative ((->) a) where
     pure = const
     (<*>) f g x = f x (g x)
+    liftA2 q f g x = q (f x) (g x)
 
+-- | @since 2.01
 instance Monad ((->) r) where
     f >>= k = \ r -> k (f r) r
 
+-- | @since 2.01
 instance Functor ((,) a) where
     fmap f (x,y) = (x, f y)
 
-
+-- | @since 2.01
 instance  Functor Maybe  where
     fmap _ Nothing       = Nothing
     fmap f (Just a)      = Just (f a)
 
+-- | @since 2.01
 instance Applicative Maybe where
     pure = Just
 
     Just f  <*> m       = fmap f m
     Nothing <*> _m      = Nothing
 
+    liftA2 f (Just x) (Just y) = Just (f x y)
+    liftA2 _ _ _ = Nothing
+
     Just _m1 *> m2      = m2
     Nothing  *> _m2     = Nothing
 
+-- | @since 2.01
 instance  Monad Maybe  where
     (Just x) >>= k      = k x
     Nothing  >>= _      = Nothing
@@ -694,16 +758,17 @@
     some v = some_v
       where
         many_v = some_v <|> pure []
-        some_v = (fmap (:) v) <*> many_v
+        some_v = liftA2 (:) v many_v
 
     -- | Zero or more.
     many :: f a -> f [a]
     many v = many_v
       where
         many_v = some_v <|> pure []
-        some_v = (fmap (:) v) <*> many_v
+        some_v = liftA2 (:) v many_v
 
 
+-- | @since 2.01
 instance Alternative Maybe where
     empty = Nothing
     Nothing <|> r = r
@@ -726,25 +791,31 @@
    mplus :: m a -> m a -> m a
    mplus = (<|>)
 
+-- | @since 2.01
 instance MonadPlus Maybe
 
 ----------------------------------------------
 -- The list type
 
+-- | @since 2.01
 instance Functor [] where
     {-# INLINE fmap #-}
     fmap = map
 
 -- See Note: [List comprehensions and inlining]
+-- | @since 2.01
 instance Applicative [] where
     {-# INLINE pure #-}
     pure x    = [x]
     {-# INLINE (<*>) #-}
     fs <*> xs = [f x | f <- fs, x <- xs]
+    {-# INLINE liftA2 #-}
+    liftA2 f xs ys = [f x y | x <- xs, y <- ys]
     {-# INLINE (*>) #-}
     xs *> ys  = [y | _ <- xs, y <- ys]
 
 -- See Note: [List comprehensions and inlining]
+-- | @since 2.01
 instance Monad []  where
     {-# INLINE (>>=) #-}
     xs >>= f             = [y | x <- xs, y <- f x]
@@ -753,10 +824,12 @@
     {-# INLINE fail #-}
     fail _              = []
 
+-- | @since 2.01
 instance Alternative [] where
     empty = []
     (<|>) = (++)
 
+-- | @since 2.01
 instance MonadPlus []
 
 {-
@@ -875,7 +948,7 @@
 
 -- Note eta expanded
 mapFB ::  (elt -> lst -> lst) -> (a -> elt) -> a -> lst -> lst
-{-# INLINE [0] mapFB #-}
+{-# INLINE [0] mapFB #-} -- See Note [Inline FB functions] in GHC.List
 mapFB c f = \x ys -> c (f x) ys
 
 -- The rules for map work like this.
@@ -891,15 +964,18 @@
 -- (along with build's unfolding) else we'd get an infinite loop
 -- in the rules.  Hence the activation control below.
 --
--- The "mapFB" rule optimises compositions of map.
---
 -- This same pattern is followed by many other functions:
 -- e.g. append, filter, iterate, repeat, etc.
+--
+-- The "mapFB" rule optimises compositions of map and
+-- the "mapFB/id" rule get rids of 'map id' calls.
+-- (Any similarity to the Functor laws for [] is expected.)
 
 {-# RULES
 "map"       [~1] forall f xs.   map f xs                = build (\c n -> foldr (mapFB c f) n xs)
 "mapList"   [1]  forall f.      foldr (mapFB (:) f) []  = map f
 "mapFB"     forall c f g.       mapFB (mapFB c f) g     = mapFB c (f.g)
+"mapFB/id"  forall c.           mapFB c (\x -> x)       = c
   #-}
 
 -- See Breitner, Eisenberg, Peyton Jones, and Weirich, "Safe Zero-cost
@@ -964,8 +1040,8 @@
 eqString _        _        = False
 
 {-# RULES "eqString" (==) = eqString #-}
--- eqString also has a BuiltInRule in PrelRules.lhs:
---      eqString (unpackCString# (Lit s1)) (unpackCString# (Lit s2) = s1==s2
+-- eqString also has a BuiltInRule in PrelRules.hs:
+--      eqString (unpackCString# (Lit s1)) (unpackCString# (Lit s2)) = s1==s2
 
 
 ----------------------------------------------
@@ -1011,7 +1087,7 @@
 
 --      SLPJ: in 5.04 etc 'assert' is in GHC.Prim,
 --      but from Template Haskell onwards it's simply
---      defined here in Base.lhs
+--      defined here in Base.hs
 assert :: Bool -> a -> a
 assert _pred r = r
 
@@ -1022,7 +1098,6 @@
 breakpointCond _ r = r
 
 data Opaque = forall a. O a
-
 -- | @const x@ is a unary function which evaluates to @x@ for all inputs.
 --
 -- For instance,
@@ -1080,16 +1155,21 @@
 -- Functor/Applicative/Monad instances for IO
 ----------------------------------------------
 
+-- | @since 2.01
 instance  Functor IO where
    fmap f x = x >>= (pure . f)
 
+-- | @since 2.01
 instance Applicative IO where
     {-# INLINE pure #-}
     {-# INLINE (*>) #-}
-    pure   = returnIO
-    m *> k = m >>= \ _ -> k
-    (<*>)  = ap
+    {-# INLINE liftA2 #-}
+    pure  = returnIO
+    (*>)  = thenIO
+    (<*>) = ap
+    liftA2 = liftM2
 
+-- | @since 2.01
 instance  Monad IO  where
     {-# INLINE (>>)   #-}
     {-# INLINE (>>=)  #-}
@@ -1097,10 +1177,12 @@
     (>>=)     = bindIO
     fail s    = failIO s
 
+-- | @since 4.9.0.0
 instance Alternative IO where
     empty = failIO "mzero"
     (<|>) = mplusIO
 
+-- | @since 4.9.0.0
 instance MonadPlus IO
 
 returnIO :: a -> IO a
@@ -1218,7 +1300,7 @@
 "unpack-list"  [1]  forall a   . unpackFoldrCString# a (:) [] = unpackCString# a
 "unpack-append"     forall a n . unpackFoldrCString# a (:) n  = unpackAppendCString# a n
 
--- There's a built-in rule (in PrelRules.lhs) for
+-- There's a built-in rule (in PrelRules.hs) for
 --      unpackFoldr "foo" c (unpackFoldr "baz" c n)  =  unpackFoldr "foobaz" c n
 
   #-}
diff --git a/GHC/Conc.hs b/GHC/Conc.hs
--- a/GHC/Conc.hs
+++ b/GHC/Conc.hs
@@ -50,6 +50,8 @@
         , threadStatus
         , threadCapability
 
+        , newStablePtrPrimMVar, PrimMVar
+
         -- * Waiting
         , threadDelay
         , registerDelay
@@ -108,7 +110,7 @@
         , setUncaughtExceptionHandler
         , getUncaughtExceptionHandler
 
-        , reportError, reportStackOverflow
+        , reportError, reportStackOverflow, reportHeapOverflow
         ) where
 
 import GHC.Conc.IO
diff --git a/GHC/Conc/IO.hs b/GHC/Conc/IO.hs
--- a/GHC/Conc/IO.hs
+++ b/GHC/Conc/IO.hs
@@ -119,18 +119,18 @@
 -- is an IO action that can be used to deregister interest
 -- in the file descriptor.
 threadWaitReadSTM :: Fd -> IO (Sync.STM (), IO ())
-threadWaitReadSTM fd 
+threadWaitReadSTM fd
 #ifndef mingw32_HOST_OS
   | threaded  = Event.threadWaitReadSTM fd
 #endif
   | otherwise = do
       m <- Sync.newTVarIO False
-      _ <- Sync.forkIO $ do
+      t <- Sync.forkIO $ do
         threadWaitRead fd
         Sync.atomically $ Sync.writeTVar m True
       let waitAction = do b <- Sync.readTVar m
                           if b then return () else retry
-      let killAction = return ()
+      let killAction = Sync.killThread t
       return (waitAction, killAction)
 
 -- | Returns an STM action that can be used to wait until data
@@ -138,18 +138,18 @@
 -- is an IO action that can be used to deregister interest
 -- in the file descriptor.
 threadWaitWriteSTM :: Fd -> IO (Sync.STM (), IO ())
-threadWaitWriteSTM fd 
+threadWaitWriteSTM fd
 #ifndef mingw32_HOST_OS
   | threaded  = Event.threadWaitWriteSTM fd
 #endif
   | otherwise = do
       m <- Sync.newTVarIO False
-      _ <- Sync.forkIO $ do
+      t <- Sync.forkIO $ do
         threadWaitWrite fd
         Sync.atomically $ Sync.writeTVar m True
       let waitAction = do b <- Sync.readTVar m
                           if b then return () else retry
-      let killAction = return ()
+      let killAction = Sync.killThread t
       return (waitAction, killAction)
 
 -- | Close a file descriptor in a concurrency-safe way (GHC only).  If
diff --git a/GHC/Conc/Sync.hs b/GHC/Conc/Sync.hs
--- a/GHC/Conc/Sync.hs
+++ b/GHC/Conc/Sync.hs
@@ -59,6 +59,8 @@
         , threadStatus
         , threadCapability
 
+        , newStablePtrPrimMVar, PrimMVar
+
         -- * Allocation counter and quota
         , setAllocationCounter
         , getAllocationCounter
@@ -89,7 +91,7 @@
         , setUncaughtExceptionHandler
         , getUncaughtExceptionHandler
 
-        , reportError, reportStackOverflow
+        , reportError, reportStackOverflow, reportHeapOverflow
 
         , sharedCAF
         ) where
@@ -97,11 +99,7 @@
 import Foreign
 import Foreign.C
 
-#ifndef mingw32_HOST_OS
-import Data.Dynamic
-#else
 import Data.Typeable
-#endif
 import Data.Maybe
 
 import GHC.Base
@@ -117,6 +115,7 @@
 import GHC.Ptr
 import GHC.Real         ( fromIntegral )
 import GHC.Show         ( Show(..), showString )
+import GHC.Stable       ( StablePtr(..) )
 import GHC.Weak
 
 infixr 0 `par`, `pseq`
@@ -145,6 +144,7 @@
 
 -}
 
+-- | @since 4.2.0.0
 instance Show ThreadId where
    showsPrec d t =
         showString "ThreadId " .
@@ -165,12 +165,14 @@
       0  -> EQ
       _  -> GT -- must be 1
 
+-- | @since 4.2.0.0
 instance Eq ThreadId where
    t1 == t2 =
       case t1 `cmpThread` t2 of
          EQ -> True
          _  -> False
 
+-- | @since 4.2.0.0
 instance Ord ThreadId where
    compare = cmpThread
 
@@ -278,7 +280,9 @@
 forkIO action = IO $ \ s ->
    case (fork# action_plus s) of (# s1, tid #) -> (# s1, ThreadId tid #)
  where
-  action_plus = catchException action childHandler
+  -- We must use 'catch' rather than 'catchException' because the action
+  -- could be bottom. #13330
+  action_plus = catch action childHandler
 
 -- | Like 'forkIO', but the child thread is passed a function that can
 -- be used to unmask asynchronous exceptions.  This function is
@@ -326,7 +330,9 @@
 forkOn (I# cpu) action = IO $ \ s ->
    case (forkOn# cpu action_plus s) of (# s1, tid #) -> (# s1, ThreadId tid #)
  where
-  action_plus = catchException action childHandler
+  -- We must use 'catch' rather than 'catchException' because the action
+  -- could be bottom. #13330
+  action_plus = catch action childHandler
 
 -- | Like 'forkIOWithUnmask', but the child thread is pinned to the
 -- given CPU, as with 'forkOn'.
@@ -373,7 +379,9 @@
 @since 4.5.0.0
 -}
 setNumCapabilities :: Int -> IO ()
-setNumCapabilities i = c_setNumCapabilities (fromIntegral i)
+setNumCapabilities i
+  | i <= 0    = fail $ "setNumCapabilities: Capability count ("++show i++") must be positive"
+  | otherwise = c_setNumCapabilities (fromIntegral i)
 
 foreign import ccall safe "setNumCapabilities"
   c_setNumCapabilities :: CUInt -> IO ()
@@ -394,7 +402,11 @@
 foreign import ccall "&enabled_capabilities" enabled_capabilities :: Ptr CInt
 
 childHandler :: SomeException -> IO ()
-childHandler err = catchException (real_handler err) childHandler
+childHandler err = catch (real_handler err) childHandler
+  -- We must use catch here rather than catchException. If the
+  -- raised exception throws an (imprecise) exception, then real_handler err
+  -- will do so as well. If we use catchException here, then we could miss
+  -- that exception.
 
 real_handler :: SomeException -> IO ()
 real_handler se
@@ -612,6 +624,17 @@
       (# s1, w #) -> (# s1, Weak w #)
 
 
+data PrimMVar
+
+-- | Make a StablePtr that can be passed to the C function
+-- @hs_try_putmvar()@.  The RTS wants a 'StablePtr' to the underlying
+-- 'MVar#', but a 'StablePtr#' can only refer to lifted types, so we
+-- have to cheat by coercing.
+newStablePtrPrimMVar :: MVar () -> IO (StablePtr PrimMVar)
+newStablePtrPrimMVar (MVar m) = IO $ \s0 ->
+  case makeStablePtr# (unsafeCoerce# m :: PrimMVar) s0 of
+    (# s1, sp #) -> (# s1, StablePtr sp #)
+
 -----------------------------------------------------------------------------
 -- Transactional heap operations
 -----------------------------------------------------------------------------
@@ -625,16 +648,21 @@
 unSTM :: STM a -> (State# RealWorld -> (# State# RealWorld, a #))
 unSTM (STM a) = a
 
+-- | @since 4.3.0.0
 instance  Functor STM where
    fmap f x = x >>= (pure . f)
 
+-- | @since 4.8.0.0
 instance Applicative STM where
   {-# INLINE pure #-}
   {-# INLINE (*>) #-}
+  {-# INLINE liftA2 #-}
   pure x = returnSTM x
   (<*>) = ap
+  liftA2 = liftM2
   m *> k = thenSTM m k
 
+-- | @since 4.3.0.0
 instance  Monad STM  where
     {-# INLINE (>>=)  #-}
     m >>= k     = bindSTM m k
@@ -655,13 +683,13 @@
 returnSTM :: a -> STM a
 returnSTM x = STM (\s -> (# s, x #))
 
+-- | @since 4.8.0.0
 instance Alternative STM where
   empty = retry
   (<|>) = orElse
 
-instance MonadPlus STM where
-  mzero = empty
-  mplus = (<|>)
+-- | @since 4.3.0.0
+instance MonadPlus STM
 
 -- | Unsafely performs IO in the STM monad.  Beware: this is a highly
 -- dangerous thing to do.
@@ -771,6 +799,7 @@
 -- |Shared memory locations that support atomic memory transactions.
 data TVar a = TVar (TVar# RealWorld a)
 
+-- | @since 4.8.0.0
 instance Eq (TVar a) where
         (TVar tvar1#) == (TVar tvar2#) = isTrue# (sameTVar# tvar1# tvar2#)
 
@@ -835,7 +864,7 @@
 -- Thread waiting
 -----------------------------------------------------------------------------
 
--- Machinery needed to ensureb that we only have one copy of certain
+-- Machinery needed to ensure that we only have one copy of certain
 -- CAFs in this module even when the base package is present twice, as
 -- it is when base is dynamically loaded into GHCi.  The RTS keeps
 -- track of the single true value of the CAF, so even when the CAFs in
@@ -856,7 +885,7 @@
 reportStackOverflow :: IO ()
 reportStackOverflow = do
      ThreadId tid <- myThreadId
-     callStackOverflowHook tid
+     c_reportStackOverflow tid
 
 reportError :: SomeException -> IO ()
 reportError ex = do
@@ -865,8 +894,11 @@
 
 -- SUP: Are the hooks allowed to re-enter Haskell land?  If so, remove
 -- the unsafe below.
-foreign import ccall unsafe "stackOverflow"
-        callStackOverflowHook :: ThreadId# -> IO ()
+foreign import ccall unsafe "reportStackOverflow"
+        c_reportStackOverflow :: ThreadId# -> IO ()
+
+foreign import ccall unsafe "reportHeapOverflow"
+        reportHeapOverflow :: IO ()
 
 {-# NOINLINE uncaughtExceptionHandler #-}
 uncaughtExceptionHandler :: IORef (SomeException -> IO ())
diff --git a/GHC/ConsoleHandler.hs b/GHC/ConsoleHandler.hs
--- a/GHC/ConsoleHandler.hs
+++ b/GHC/ConsoleHandler.hs
@@ -7,7 +7,7 @@
 -- Module      :  GHC.ConsoleHandler
 -- Copyright   :  (c) The University of Glasgow
 -- License     :  see libraries/base/LICENSE
--- 
+--
 -- Maintainer  :  cvs-ghc@haskell.org
 -- Stability   :  internal
 -- Portability :  non-portable (GHC extensions)
@@ -15,7 +15,7 @@
 -- NB. the contents of this module are only available on Windows.
 --
 -- Installing Win32 console handlers.
--- 
+--
 -----------------------------------------------------------------------------
 
 module GHC.ConsoleHandler
@@ -137,9 +137,9 @@
 
    no_handler = errorWithoutStackTrace "win32ConsoleHandler"
 
-foreign import ccall "rtsSupportsBoundThreads" threaded :: Bool
+foreign import ccall unsafe "rtsSupportsBoundThreads" threaded :: Bool
 
-foreign import ccall unsafe "RtsExternal.h rts_InstallConsoleEvent" 
+foreign import ccall unsafe "RtsExternal.h rts_InstallConsoleEvent"
   rts_installHandler :: CInt -> Ptr (StablePtr (CInt -> IO ())) -> IO CInt
 foreign import ccall unsafe "RtsExternal.h rts_ConsoleHandlerDone"
   rts_ConsoleHandlerDone :: CInt -> IO ()
diff --git a/GHC/Enum.hs b/GHC/Enum.hs
--- a/GHC/Enum.hs
+++ b/GHC/Enum.hs
@@ -1,5 +1,9 @@
+{-# LANGUAGE BangPatterns #-}
+{-# LANGUAGE CPP #-}
+{-# LANGUAGE MagicHash #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE StandaloneDeriving #-}
 {-# LANGUAGE Trustworthy #-}
-{-# LANGUAGE CPP, NoImplicitPrelude, BangPatterns, MagicHash #-}
 {-# OPTIONS_HADDOCK hide #-}
 
 -----------------------------------------------------------------------------
@@ -150,10 +154,10 @@
 -- Tuples
 ------------------------------------------------------------------------
 
-instance Bounded () where
-    minBound = ()
-    maxBound = ()
+-- | @since 2.01
+deriving instance Bounded ()
 
+-- | @since 2.01
 instance Enum () where
     succ _      = errorWithoutStackTrace "Prelude.Enum.().succ: bad argument"
     pred _      = errorWithoutStackTrace "Prelude.Enum.().pred: bad argument"
@@ -168,102 +172,71 @@
     enumFromThenTo () () () = let many = ():many in many
 
 -- Report requires instances up to 15
-instance (Bounded a, Bounded b) => Bounded (a,b) where
-   minBound = (minBound, minBound)
-   maxBound = (maxBound, maxBound)
-
-instance (Bounded a, Bounded b, Bounded c) => Bounded (a,b,c) where
-   minBound = (minBound, minBound, minBound)
-   maxBound = (maxBound, maxBound, maxBound)
-
-instance (Bounded a, Bounded b, Bounded c, Bounded d) => Bounded (a,b,c,d) where
-   minBound = (minBound, minBound, minBound, minBound)
-   maxBound = (maxBound, maxBound, maxBound, maxBound)
-
-instance (Bounded a, Bounded b, Bounded c, Bounded d, Bounded e) => Bounded (a,b,c,d,e) where
-   minBound = (minBound, minBound, minBound, minBound, minBound)
-   maxBound = (maxBound, maxBound, maxBound, maxBound, maxBound)
-
-instance (Bounded a, Bounded b, Bounded c, Bounded d, Bounded e, Bounded f)
-        => Bounded (a,b,c,d,e,f) where
-   minBound = (minBound, minBound, minBound, minBound, minBound, minBound)
-   maxBound = (maxBound, maxBound, maxBound, maxBound, maxBound, maxBound)
-
-instance (Bounded a, Bounded b, Bounded c, Bounded d, Bounded e, Bounded f, Bounded g)
-        => Bounded (a,b,c,d,e,f,g) where
-   minBound = (minBound, minBound, minBound, minBound, minBound, minBound, minBound)
-   maxBound = (maxBound, maxBound, maxBound, maxBound, maxBound, maxBound, maxBound)
-
-instance (Bounded a, Bounded b, Bounded c, Bounded d, Bounded e, Bounded f, Bounded g,
-          Bounded h)
-        => Bounded (a,b,c,d,e,f,g,h) where
-   minBound = (minBound, minBound, minBound, minBound, minBound, minBound, minBound, minBound)
-   maxBound = (maxBound, maxBound, maxBound, maxBound, maxBound, maxBound, maxBound, maxBound)
-
-instance (Bounded a, Bounded b, Bounded c, Bounded d, Bounded e, Bounded f, Bounded g,
-          Bounded h, Bounded i)
-        => Bounded (a,b,c,d,e,f,g,h,i) where
-   minBound = (minBound, minBound, minBound, minBound, minBound, minBound, minBound, minBound,
-               minBound)
-   maxBound = (maxBound, maxBound, maxBound, maxBound, maxBound, maxBound, maxBound, maxBound,
-               maxBound)
-
-instance (Bounded a, Bounded b, Bounded c, Bounded d, Bounded e, Bounded f, Bounded g,
-          Bounded h, Bounded i, Bounded j)
-        => Bounded (a,b,c,d,e,f,g,h,i,j) where
-   minBound = (minBound, minBound, minBound, minBound, minBound, minBound, minBound, minBound,
-               minBound, minBound)
-   maxBound = (maxBound, maxBound, maxBound, maxBound, maxBound, maxBound, maxBound, maxBound,
-               maxBound, maxBound)
-
-instance (Bounded a, Bounded b, Bounded c, Bounded d, Bounded e, Bounded f, Bounded g,
-          Bounded h, Bounded i, Bounded j, Bounded k)
-        => Bounded (a,b,c,d,e,f,g,h,i,j,k) where
-   minBound = (minBound, minBound, minBound, minBound, minBound, minBound, minBound, minBound,
-               minBound, minBound, minBound)
-   maxBound = (maxBound, maxBound, maxBound, maxBound, maxBound, maxBound, maxBound, maxBound,
-               maxBound, maxBound, maxBound)
-
-instance (Bounded a, Bounded b, Bounded c, Bounded d, Bounded e, Bounded f, Bounded g,
-          Bounded h, Bounded i, Bounded j, Bounded k, Bounded l)
-        => Bounded (a,b,c,d,e,f,g,h,i,j,k,l) where
-   minBound = (minBound, minBound, minBound, minBound, minBound, minBound, minBound, minBound,
-               minBound, minBound, minBound, minBound)
-   maxBound = (maxBound, maxBound, maxBound, maxBound, maxBound, maxBound, maxBound, maxBound,
-               maxBound, maxBound, maxBound, maxBound)
-
-instance (Bounded a, Bounded b, Bounded c, Bounded d, Bounded e, Bounded f, Bounded g,
-          Bounded h, Bounded i, Bounded j, Bounded k, Bounded l, Bounded m)
-        => Bounded (a,b,c,d,e,f,g,h,i,j,k,l,m) where
-   minBound = (minBound, minBound, minBound, minBound, minBound, minBound, minBound, minBound,
-               minBound, minBound, minBound, minBound, minBound)
-   maxBound = (maxBound, maxBound, maxBound, maxBound, maxBound, maxBound, maxBound, maxBound,
-               maxBound, maxBound, maxBound, maxBound, maxBound)
-
-instance (Bounded a, Bounded b, Bounded c, Bounded d, Bounded e, Bounded f, Bounded g,
-          Bounded h, Bounded i, Bounded j, Bounded k, Bounded l, Bounded m, Bounded n)
-        => Bounded (a,b,c,d,e,f,g,h,i,j,k,l,m,n) where
-   minBound = (minBound, minBound, minBound, minBound, minBound, minBound, minBound, minBound,
-               minBound, minBound, minBound, minBound, minBound, minBound)
-   maxBound = (maxBound, maxBound, maxBound, maxBound, maxBound, maxBound, maxBound, maxBound,
-               maxBound, maxBound, maxBound, maxBound, maxBound, maxBound)
-
-instance (Bounded a, Bounded b, Bounded c, Bounded d, Bounded e, Bounded f, Bounded g,
-          Bounded h, Bounded i, Bounded j, Bounded k, Bounded l, Bounded m, Bounded n, Bounded o)
-        => Bounded (a,b,c,d,e,f,g,h,i,j,k,l,m,n,o) where
-   minBound = (minBound, minBound, minBound, minBound, minBound, minBound, minBound, minBound,
-               minBound, minBound, minBound, minBound, minBound, minBound, minBound)
-   maxBound = (maxBound, maxBound, maxBound, maxBound, maxBound, maxBound, maxBound, maxBound,
-               maxBound, maxBound, maxBound, maxBound, maxBound, maxBound, maxBound)
+-- | @since 2.01
+deriving instance (Bounded a, Bounded b)
+        => Bounded (a,b)
+-- | @since 2.01
+deriving instance (Bounded a, Bounded b, Bounded c)
+        => Bounded (a,b,c)
+-- | @since 2.01
+deriving instance (Bounded a, Bounded b, Bounded c, Bounded d)
+        => Bounded (a,b,c,d)
+-- | @since 2.01
+deriving instance (Bounded a, Bounded b, Bounded c, Bounded d, Bounded e)
+        => Bounded (a,b,c,d,e)
+-- | @since 2.01
+deriving instance (Bounded a, Bounded b, Bounded c, Bounded d, Bounded e,
+          Bounded f)
+        => Bounded (a,b,c,d,e,f)
+-- | @since 2.01
+deriving instance (Bounded a, Bounded b, Bounded c, Bounded d, Bounded e,
+          Bounded f, Bounded g)
+        => Bounded (a,b,c,d,e,f,g)
+-- | @since 2.01
+deriving instance (Bounded a, Bounded b, Bounded c, Bounded d, Bounded e,
+          Bounded f, Bounded g, Bounded h)
+        => Bounded (a,b,c,d,e,f,g,h)
+-- | @since 2.01
+deriving instance (Bounded a, Bounded b, Bounded c, Bounded d, Bounded e,
+          Bounded f, Bounded g, Bounded h, Bounded i)
+        => Bounded (a,b,c,d,e,f,g,h,i)
+-- | @since 2.01
+deriving instance (Bounded a, Bounded b, Bounded c, Bounded d, Bounded e,
+          Bounded f, Bounded g, Bounded h, Bounded i, Bounded j)
+        => Bounded (a,b,c,d,e,f,g,h,i,j)
+-- | @since 2.01
+deriving instance (Bounded a, Bounded b, Bounded c, Bounded d, Bounded e,
+          Bounded f, Bounded g, Bounded h, Bounded i, Bounded j, Bounded k)
+        => Bounded (a,b,c,d,e,f,g,h,i,j,k)
+-- | @since 2.01
+deriving instance (Bounded a, Bounded b, Bounded c, Bounded d, Bounded e,
+          Bounded f, Bounded g, Bounded h, Bounded i, Bounded j, Bounded k,
+          Bounded l)
+        => Bounded (a,b,c,d,e,f,g,h,i,j,k,l)
+-- | @since 2.01
+deriving instance (Bounded a, Bounded b, Bounded c, Bounded d, Bounded e,
+          Bounded f, Bounded g, Bounded h, Bounded i, Bounded j, Bounded k,
+          Bounded l, Bounded m)
+        => Bounded (a,b,c,d,e,f,g,h,i,j,k,l,m)
+-- | @since 2.01
+deriving instance (Bounded a, Bounded b, Bounded c, Bounded d, Bounded e,
+          Bounded f, Bounded g, Bounded h, Bounded i, Bounded j, Bounded k,
+          Bounded l, Bounded m, Bounded n)
+        => Bounded (a,b,c,d,e,f,g,h,i,j,k,l,m,n)
+-- | @since 2.01
+deriving instance (Bounded a, Bounded b, Bounded c, Bounded d, Bounded e,
+          Bounded f, Bounded g, Bounded h, Bounded i, Bounded j, Bounded k,
+          Bounded l, Bounded m, Bounded n, Bounded o)
+        => Bounded (a,b,c,d,e,f,g,h,i,j,k,l,m,n,o)
 
 ------------------------------------------------------------------------
 -- Bool
 ------------------------------------------------------------------------
 
-instance Bounded Bool where
-  minBound = False
-  maxBound = True
+-- | @since 2.01
+deriving instance Bounded Bool
 
+-- | @since 2.01
 instance Enum Bool where
   succ False = True
   succ True  = errorWithoutStackTrace "Prelude.Enum.Bool.succ: bad argument"
@@ -286,10 +259,9 @@
 -- Ordering
 ------------------------------------------------------------------------
 
-instance Bounded Ordering where
-  minBound = LT
-  maxBound = GT
-
+-- | @since 2.01
+deriving instance Bounded Ordering
+-- | @since 2.01
 instance Enum Ordering where
   succ LT = EQ
   succ EQ = GT
@@ -316,10 +288,12 @@
 -- Char
 ------------------------------------------------------------------------
 
+-- | @since 2.01
 instance  Bounded Char  where
     minBound =  '\0'
     maxBound =  '\x10FFFF'
 
+-- | @since 2.01
 instance  Enum Char  where
     succ (C# c#)
        | isTrue# (ord# c# /=# 0x10FFFF#) = C# (chr# (ord# c# +# 1#))
@@ -357,7 +331,7 @@
 
 -- We can do better than for Ints because we don't
 -- have hassles about arithmetic overflow at maxBound
-{-# INLINE [0] eftCharFB #-}
+{-# INLINE [0] eftCharFB #-} -- See Note [Inline FB functions] in GHC.List
 eftCharFB :: (Char -> a -> a) -> a -> Int# -> Int# -> a
 eftCharFB c n x0 y = go x0
                  where
@@ -371,7 +345,7 @@
 
 
 -- For enumFromThenTo we give up on inlining
-{-# NOINLINE [0] efdCharFB #-}
+{-# INLINE [0] efdCharFB #-} -- See Note [Inline FB functions] in GHC.List
 efdCharFB :: (Char -> a -> a) -> a -> Int# -> Int# -> a
 efdCharFB c n x1 x2
   | isTrue# (delta >=# 0#) = go_up_char_fb c n x1 delta 0x10FFFF#
@@ -387,7 +361,7 @@
   where
     !delta = x2 -# x1
 
-{-# NOINLINE [0] efdtCharFB #-}
+{-# INLINE [0] efdtCharFB #-} -- See Note [Inline FB functions] in GHC.List
 efdtCharFB :: (Char -> a -> a) -> a -> Int# -> Int# -> Int# -> a
 efdtCharFB c n x1 x2 lim
   | isTrue# (delta >=# 0#) = go_up_char_fb c n x1 delta lim
@@ -443,10 +417,12 @@
         (c) remember that Int is bounded, so [1..] terminates at maxInt
 -}
 
+-- | @since 2.01
 instance  Bounded Int where
     minBound =  minInt
     maxBound =  maxInt
 
+-- | @since 2.01
 instance  Enum Int  where
     succ x
        | x == maxBound  = errorWithoutStackTrace "Prelude.Enum.succ{Int}: tried to take `succ' of maxBound"
@@ -500,7 +476,7 @@
                                then []
                                else go (x +# 1#)
 
-{-# INLINE [0] eftIntFB #-}
+{-# INLINE [0] eftIntFB #-} -- See Note [Inline FB functions] in GHC.List
 eftIntFB :: (Int -> r -> r) -> r -> Int# -> Int# -> r
 eftIntFB c n x0 y | isTrue# (x0 ># y) = n
                   | otherwise         = go x0
@@ -538,7 +514,7 @@
  | isTrue# (x2 >=# x1) = efdtIntUp x1 x2 y
  | otherwise           = efdtIntDn x1 x2 y
 
-{-# INLINE [0] efdtIntFB #-}
+{-# INLINE [0] efdtIntFB #-} -- See Note [Inline FB functions] in GHC.List
 efdtIntFB :: (Int -> r -> r) -> r -> Int# -> Int# -> Int# -> r
 efdtIntFB c n x1 x2 y
  | isTrue# (x2 >=# x1) = efdtIntUpFB c n x1 x2 y
@@ -560,6 +536,7 @@
                in I# x1 : go_up x2
 
 -- Requires x2 >= x1
+{-# INLINE [0] efdtIntUpFB #-} -- See Note [Inline FB functions] in GHC.List
 efdtIntUpFB :: (Int -> r -> r) -> r -> Int# -> Int# -> Int# -> r
 efdtIntUpFB c n x1 x2 y    -- Be careful about overflow!
  | isTrue# (y <# x2) = if isTrue# (y <# x1) then n else I# x1 `c` n
@@ -590,6 +567,7 @@
    in I# x1 : go_dn x2
 
 -- Requires x2 <= x1
+{-# INLINE [0] efdtIntDnFB #-} -- See Note [Inline FB functions] in GHC.List
 efdtIntDnFB :: (Int -> r -> r) -> r -> Int# -> Int# -> Int# -> r
 efdtIntDnFB c n x1 x2 y    -- Be careful about underflow!
  | isTrue# (y ># x2) = if isTrue# (y ># x1) then n else I# x1 `c` n
@@ -609,6 +587,7 @@
 -- Word
 ------------------------------------------------------------------------
 
+-- | @since 2.01
 instance Bounded Word where
     minBound = 0
 
@@ -622,6 +601,7 @@
 #error Unhandled value for WORD_SIZE_IN_BITS
 #endif
 
+-- | @since 2.01
 instance Enum Word where
     succ x
         | x /= maxBound = x + 1
@@ -677,7 +657,7 @@
                                 then []
                                 else go (x `plusWord#` 1##)
 
-{-# INLINE [0] eftWordFB #-}
+{-# INLINE [0] eftWordFB #-} -- See Note [Inline FB functions] in GHC.List
 eftWordFB :: (Word -> r -> r) -> r -> Word# -> Word# -> r
 eftWordFB c n x0 y | isTrue# (x0 `gtWord#` y) = n
                    | otherwise                = go x0
@@ -715,7 +695,7 @@
  | isTrue# (x2 `geWord#` x1) = efdtWordUp x1 x2 y
  | otherwise                 = efdtWordDn x1 x2 y
 
-{-# INLINE [0] efdtWordFB #-}
+{-# INLINE [0] efdtWordFB #-} -- See Note [Inline FB functions] in GHC.List
 efdtWordFB :: (Word -> r -> r) -> r -> Word# -> Word# -> Word# -> r
 efdtWordFB c n x1 x2 y
  | isTrue# (x2 `geWord#` x1) = efdtWordUpFB c n x1 x2 y
@@ -737,6 +717,7 @@
                in W# x1 : go_up x2
 
 -- Requires x2 >= x1
+{-# INLINE [0] efdtWordUpFB #-} -- See Note [Inline FB functions] in GHC.List
 efdtWordUpFB :: (Word -> r -> r) -> r -> Word# -> Word# -> Word# -> r
 efdtWordUpFB c n x1 x2 y    -- Be careful about overflow!
  | isTrue# (y `ltWord#` x2) = if isTrue# (y `ltWord#` x1) then n else W# x1 `c` n
@@ -767,6 +748,7 @@
    in W# x1 : go_dn x2
 
 -- Requires x2 <= x1
+{-# INLINE [0] efdtWordDnFB #-} -- See Note [Inline FB functions] in GHC.List
 efdtWordDnFB :: (Word -> r -> r) -> r -> Word# -> Word# -> Word# -> r
 efdtWordDnFB c n x1 x2 y    -- Be careful about underflow!
  | isTrue# (y `gtWord#` x2) = if isTrue# (y `gtWord#` x1) then n else W# x1 `c` n
@@ -785,6 +767,7 @@
 -- Integer
 ------------------------------------------------------------------------
 
+-- | @since 2.01
 instance  Enum Integer  where
     succ x               = x + 1
     pred x               = x - 1
@@ -826,7 +809,8 @@
 the special case varies more from the general case, due to the issue of overflows.
 -}
 
-{-# NOINLINE [0] enumDeltaIntegerFB #-}
+{-# INLINE [0] enumDeltaIntegerFB #-}
+-- See Note [Inline FB functions] in GHC.List
 enumDeltaIntegerFB :: (Integer -> b -> b) -> Integer -> Integer -> b
 enumDeltaIntegerFB c x0 d = go x0
   where go x = x `seq` (x `c` go (x+d))
@@ -838,7 +822,8 @@
 --     head (drop 1000000 [1 .. ]
 -- works
 
-{-# NOINLINE [0] enumDeltaToIntegerFB #-}
+{-# INLINE [0] enumDeltaToIntegerFB #-}
+-- See Note [Inline FB functions] in GHC.List
 -- Don't inline this until RULE "enumDeltaToInteger" has had a chance to fire
 enumDeltaToIntegerFB :: (Integer -> a -> a) -> a
                      -> Integer -> Integer -> Integer -> a
@@ -846,7 +831,8 @@
   | delta >= 0 = up_fb c n x delta lim
   | otherwise  = dn_fb c n x delta lim
 
-{-# NOINLINE [0] enumDeltaToInteger1FB #-}
+{-# INLINE [0] enumDeltaToInteger1FB #-}
+-- See Note [Inline FB functions] in GHC.List
 -- Don't inline this until RULE "enumDeltaToInteger" has had a chance to fire
 enumDeltaToInteger1FB :: (Integer -> a -> a) -> a
                       -> Integer -> Integer -> a
@@ -890,3 +876,15 @@
                     where
                         go x | x < lim   = []
                              | otherwise = x : go (x+delta)
+
+-- Instances from GHC.Types
+
+-- | @since 4.10.0.0
+deriving instance Bounded VecCount
+-- | @since 4.10.0.0
+deriving instance Enum VecCount
+
+-- | @since 4.10.0.0
+deriving instance Bounded VecElem
+-- | @since 4.10.0.0
+deriving instance Enum VecElem
diff --git a/GHC/Event/Control.hs b/GHC/Event/Control.hs
--- a/GHC/Event/Control.hs
+++ b/GHC/Event/Control.hs
@@ -30,11 +30,12 @@
 
 import Foreign.ForeignPtr (ForeignPtr)
 import GHC.Base
+import GHC.IORef
 import GHC.Conc.Signal (Signal)
 import GHC.Real (fromIntegral)
 import GHC.Show (Show)
 import GHC.Word (Word8)
-import Foreign.C.Error (throwErrnoIfMinus1_)
+import Foreign.C.Error (throwErrnoIfMinus1_, throwErrno, getErrno)
 import Foreign.C.Types (CInt(..), CSize(..))
 import Foreign.ForeignPtr (mallocForeignPtrBytes, withForeignPtr)
 import Foreign.Marshal (alloca, allocaBytes)
@@ -46,10 +47,10 @@
 import System.Posix.Types (Fd)
 
 #if defined(HAVE_EVENTFD)
-import Foreign.C.Error (throwErrnoIfMinus1)
+import Foreign.C.Error (throwErrnoIfMinus1, eBADF)
 import Foreign.C.Types (CULLong(..))
 #else
-import Foreign.C.Error (eAGAIN, eWOULDBLOCK, getErrno, throwErrno)
+import Foreign.C.Error (eAGAIN, eWOULDBLOCK)
 #endif
 
 data ControlMessage = CMsgWakeup
@@ -69,7 +70,9 @@
     , wakeupWriteFd  :: {-# UNPACK #-} !Fd
 #endif
     , didRegisterWakeupFd :: !Bool
-    } deriving (Show)
+      -- | Have this Control's fds been cleaned up?
+    , controlIsDead  :: !(IORef Bool)
+    }
 
 #if defined(HAVE_EVENTFD)
 wakeupReadFd :: Control -> Fd
@@ -101,6 +104,7 @@
   (wake_rd, wake_wr) <- createPipe
   when shouldRegister $ c_setIOManagerWakeupFd wake_wr
 #endif
+  isDead <- newIORef False
   return W { controlReadFd  = fromIntegral ctrl_rd
            , controlWriteFd = fromIntegral ctrl_wr
 #if defined(HAVE_EVENTFD)
@@ -110,6 +114,7 @@
            , wakeupWriteFd  = fromIntegral wake_wr
 #endif
            , didRegisterWakeupFd = shouldRegister
+           , controlIsDead  = isDead
            }
 
 -- | Close the control structure used by the IO manager thread.
@@ -119,6 +124,7 @@
 -- file after it has been closed.
 closeControl :: Control -> IO ()
 closeControl w = do
+  atomicModifyIORef (controlIsDead w) (\_ -> (True, ()))
   _ <- c_close . fromIntegral . controlReadFd $ w
   _ <- c_close . fromIntegral . controlWriteFd $ w
   when (didRegisterWakeupFd w) $ c_setIOManagerWakeupFd (-1)
@@ -172,9 +178,21 @@
 
 sendWakeup :: Control -> IO ()
 #if defined(HAVE_EVENTFD)
-sendWakeup c =
-  throwErrnoIfMinus1_ "sendWakeup" $
-  c_eventfd_write (fromIntegral (controlEventFd c)) 1
+sendWakeup c = do
+  n <- c_eventfd_write (fromIntegral (controlEventFd c)) 1
+  case n of
+    0     -> return ()
+    _     -> do errno <- getErrno
+                -- Check that Control is still alive if we failed, since it's
+                -- possible that someone cleaned up the fds behind our backs and
+                -- consequently eventfd_write failed with EBADF. If it is dead
+                -- then just swallow the error since we are shutting down
+                -- anyways. Otherwise we will see failures during shutdown from
+                -- setnumcapabilities001 (#12038)
+                isDead <- readIORef (controlIsDead c)
+                if isDead && errno == eBADF
+                  then return ()
+                  else throwErrno "sendWakeup"
 #else
 sendWakeup c = do
   n <- sendMessage (wakeupWriteFd c) CMsgWakeup
diff --git a/GHC/Event/EPoll.hsc b/GHC/Event/EPoll.hsc
--- a/GHC/Event/EPoll.hsc
+++ b/GHC/Event/EPoll.hsc
@@ -136,6 +136,7 @@
     , eventFd    :: Fd
     } deriving (Show)
 
+-- | @since 4.3.1.0
 instance Storable Event where
     sizeOf    _ = #size struct epoll_event
     alignment _ = alignment (undefined :: CInt)
diff --git a/GHC/Event/Internal.hs b/GHC/Event/Internal.hs
--- a/GHC/Event/Internal.hs
+++ b/GHC/Event/Internal.hs
@@ -62,6 +62,7 @@
 eventIs :: Event -> Event -> Bool
 eventIs (Event a) (Event b) = a .&. b /= 0
 
+-- | @since 4.3.1.0
 instance Show Event where
     show e = '[' : (intercalate "," . filter (not . null) $
                     [evtRead `so` "evtRead",
@@ -70,6 +71,7 @@
         where ev `so` disp | e `eventIs` ev = disp
                            | otherwise      = ""
 
+-- | @since 4.3.1.0
 instance Monoid Event where
     mempty  = evtNothing
     mappend = evtCombine
@@ -97,7 +99,9 @@
 elSupremum _       _       = MultiShot
 {-# INLINE elSupremum #-}
 
--- | @mappend@ == @elSupremum@
+-- | @mappend@ takes the longer of two lifetimes.
+--
+-- @since 4.8.0.0
 instance Monoid Lifetime where
     mempty = OneShot
     mappend = elSupremum
@@ -109,6 +113,7 @@
 newtype EventLifetime = EL Int
                       deriving (Show, Eq)
 
+-- | @since 4.8.0.0
 instance Monoid EventLifetime where
     mempty = EL 0
     EL a `mappend` EL b = EL (a .|. b)
diff --git a/GHC/Event/KQueue.hsc b/GHC/Event/KQueue.hsc
--- a/GHC/Event/KQueue.hsc
+++ b/GHC/Event/KQueue.hsc
@@ -27,6 +27,7 @@
 #else
 
 import Data.Bits (Bits(..), FiniteBits(..))
+import Data.Int
 import Data.Word (Word16, Word32)
 import Foreign.C.Error (throwErrnoIfMinus1, eINTR, eINVAL,
                         eNOTSUP, getErrno, throwErrno)
@@ -142,6 +143,7 @@
 event :: Fd -> Filter -> Flag -> FFlag -> Event
 event fd filt flag fflag = KEvent (fromIntegral fd) filt flag fflag 0 nullPtr
 
+-- | @since 4.3.1.0
 instance Storable Event where
     sizeOf _ = #size struct kevent
     alignment _ = alignment (undefined :: CInt)
@@ -185,10 +187,10 @@
  , flagOneshot = EV_ONESHOT
  }
 
-#if SIZEOF_KEV_FILTER == 4 /*kevent.filter: uint32_t or uint16_t. */
-newtype Filter = Filter Word32
+#if SIZEOF_KEV_FILTER == 4 /*kevent.filter: int32_t or int16_t. */
+newtype Filter = Filter Int32
 #else
-newtype Filter = Filter Word16
+newtype Filter = Filter Int16
 #endif
     deriving (Bits, FiniteBits, Eq, Num, Show, Storable)
 
@@ -202,6 +204,7 @@
     , tv_nsec :: {-# UNPACK #-} !CLong
     }
 
+-- | @since 4.3.1.0
 instance Storable TimeSpec where
     sizeOf _ = #size struct timespec
     alignment _ = alignment (undefined :: CInt)
diff --git a/GHC/Event/PSQ.hs b/GHC/Event/PSQ.hs
--- a/GHC/Event/PSQ.hs
+++ b/GHC/Event/PSQ.hs
@@ -89,6 +89,7 @@
     ) where
 
 import GHC.Base hiding (empty)
+import GHC.Float () -- for Show Double instance
 import GHC.Num (Num(..))
 import GHC.Show (Show(showsPrec))
 import GHC.Event.Unique (Unique)
@@ -479,6 +480,7 @@
 seqToList :: Sequ a -> [a]
 seqToList (Sequ x) = x []
 
+-- | @since 4.3.1.0
 instance Show a => Show (Sequ a) where
     showsPrec d a = showsPrec d (seqToList a)
 
diff --git a/GHC/Event/Poll.hsc b/GHC/Event/Poll.hsc
--- a/GHC/Event/Poll.hsc
+++ b/GHC/Event/Poll.hsc
@@ -187,6 +187,7 @@
             | e .&. evt /= 0 = to
             | otherwise      = mempty
 
+-- | @since 4.3.1.0
 instance Storable PollFd where
     sizeOf _    = #size struct pollfd
     alignment _ = alignment (undefined :: CInt)
diff --git a/GHC/Event/Unique.hs b/GHC/Event/Unique.hs
--- a/GHC/Event/Unique.hs
+++ b/GHC/Event/Unique.hs
@@ -1,5 +1,6 @@
 {-# LANGUAGE Trustworthy #-}
-{-# LANGUAGE BangPatterns, GeneralizedNewtypeDeriving, NoImplicitPrelude #-}
+{-# LANGUAGE BangPatterns, CPP, GeneralizedNewtypeDeriving, MagicHash,
+  NoImplicitPrelude, UnboxedTuples #-}
 
 module GHC.Event.Unique
     (
@@ -9,35 +10,30 @@
     , newUnique
     ) where
 
-import Data.Int (Int64)
 import GHC.Base
-import GHC.Conc.Sync (TVar, atomically, newTVarIO, readTVar, writeTVar)
-import GHC.Num (Num(..))
-import GHC.Show (Show(..))
+import GHC.Num(Num)
+import GHC.Show(Show(..))
 
--- We used to use IORefs here, but Simon switched us to STM when we
--- found that our use of atomicModifyIORef was subject to a severe RTS
--- performance problem when used in a tight loop from multiple
--- threads: http://ghc.haskell.org/trac/ghc/ticket/3838
---
--- There seems to be no performance cost to using a TVar instead.
+#include "MachDeps.h"
 
-newtype UniqueSource = US (TVar Int64)
+data UniqueSource = US (MutableByteArray# RealWorld)
 
-newtype Unique = Unique { asInt64 :: Int64 }
+newtype Unique = Unique { asInt :: Int }
     deriving (Eq, Ord, Num)
 
+-- | @since 4.3.1.0
 instance Show Unique where
-    show = show . asInt64
+    show = show . asInt
 
 newSource :: IO UniqueSource
-newSource = US `fmap` newTVarIO 0
+newSource = IO $ \s ->
+  case newByteArray# size s of
+    (# s', mba #) -> (# s', US mba #)
+  where
+    !(I# size) = SIZEOF_HSINT
 
 newUnique :: UniqueSource -> IO Unique
-newUnique (US ref) = atomically $ do
-  u <- readTVar ref
-  let !u' = u+1
-  writeTVar ref u'
-  return $ Unique u'
+newUnique (US mba) = IO $ \s ->
+  case fetchAddIntArray# mba 0# 1# s of
+    (# s', a #) -> (# s', Unique (I# a) #)
 {-# INLINE newUnique #-}
-
diff --git a/GHC/Exception.hs b/GHC/Exception.hs
--- a/GHC/Exception.hs
+++ b/GHC/Exception.hs
@@ -26,6 +26,7 @@
        , throw
        , SomeException(..), ErrorCall(..,ErrorCall), ArithException(..)
        , divZeroException, overflowException, ratioZeroDenomException
+       , underflowException
        , errorCallException, errorCallWithCallStackException
          -- re-export CallStack and SrcLoc from GHC.Types
        , CallStack, fromCallSiteList, getCallStack, prettyCallStack
@@ -50,6 +51,7 @@
 -}
 data SomeException = forall e . Exception e => SomeException e
 
+-- | @since 3.0
 instance Show SomeException where
     showsPrec p (SomeException e) = showsPrec p e
 
@@ -59,7 +61,7 @@
 type directly below the root:
 
 > data MyException = ThisException | ThatException
->     deriving (Show, Typeable)
+>     deriving Show
 >
 > instance Exception MyException
 
@@ -79,7 +81,6 @@
 > -- Make the root exception type for all the exceptions in a compiler
 >
 > data SomeCompilerException = forall e . Exception e => SomeCompilerException e
->     deriving Typeable
 >
 > instance Show SomeCompilerException where
 >     show (SomeCompilerException e) = show e
@@ -98,7 +99,6 @@
 > -- Make a subhierarchy for exceptions in the frontend of the compiler
 >
 > data SomeFrontendException = forall e . Exception e => SomeFrontendException e
->     deriving Typeable
 >
 > instance Show SomeFrontendException where
 >     show (SomeFrontendException e) = show e
@@ -119,7 +119,7 @@
 > -- Make an exception type for a particular frontend compiler exception
 >
 > data MismatchedParentheses = MismatchedParentheses
->     deriving (Typeable, Show)
+>     deriving Show
 >
 > instance Exception MismatchedParentheses where
 >     toException   = frontendExceptionToException
@@ -156,6 +156,7 @@
     displayException :: e -> String
     displayException = show
 
+-- | @since 3.0
 instance Exception SomeException where
     toException se = se
     fromException = Just
@@ -175,8 +176,12 @@
 pattern ErrorCall err <- ErrorCallWithLocation err _ where
   ErrorCall err = ErrorCallWithLocation err ""
 
+{-# COMPLETE ErrorCall #-}
+
+-- | @since 4.0.0.0
 instance Exception ErrorCall
 
+-- | @since 4.0.0.0
 instance Show ErrorCall where
   showsPrec _ (ErrorCallWithLocation err "") = showString err
   showsPrec _ (ErrorCallWithLocation err loc) = showString (err ++ '\n' : loc)
@@ -236,13 +241,16 @@
   | RatioZeroDenominator -- ^ @since 4.6.0.0
   deriving (Eq, Ord)
 
-divZeroException, overflowException, ratioZeroDenomException  :: SomeException
+divZeroException, overflowException, ratioZeroDenomException, underflowException  :: SomeException
 divZeroException        = toException DivideByZero
 overflowException       = toException Overflow
 ratioZeroDenomException = toException RatioZeroDenominator
+underflowException      = toException Underflow
 
+-- | @since 4.0.0.0
 instance Exception ArithException
 
+-- | @since 4.0.0.0
 instance Show ArithException where
   showsPrec _ Overflow        = showString "arithmetic overflow"
   showsPrec _ Underflow       = showString "arithmetic underflow"
diff --git a/GHC/Exception.hs-boot b/GHC/Exception.hs-boot
--- a/GHC/Exception.hs-boot
+++ b/GHC/Exception.hs-boot
@@ -26,13 +26,15 @@
 
 module GHC.Exception ( SomeException, errorCallException,
                        errorCallWithCallStackException,
-                       divZeroException, overflowException, ratioZeroDenomException
+                       divZeroException, overflowException, ratioZeroDenomException,
+                       underflowException
     ) where
 import GHC.Types ( Char )
 import GHC.Stack.Types ( CallStack )
 
 data SomeException
 divZeroException, overflowException, ratioZeroDenomException  :: SomeException
+underflowException :: SomeException
 
 errorCallException :: [Char] -> SomeException
 errorCallWithCallStackException :: [Char] -> CallStack -> SomeException
diff --git a/GHC/ExecutionStack/Internal.hsc b/GHC/ExecutionStack/Internal.hsc
--- a/GHC/ExecutionStack/Internal.hsc
+++ b/GHC/ExecutionStack/Internal.hsc
@@ -49,7 +49,7 @@
                      , sourceColumn :: Int
                      }
 
--- | Location information about an addresss from a backtrace.
+-- | Location information about an address from a backtrace.
 data Location = Location { objectName   :: String
                          , functionName :: String
                          , srcLoc       :: Maybe SrcLoc
diff --git a/GHC/Exts.hs b/GHC/Exts.hs
--- a/GHC/Exts.hs
+++ b/GHC/Exts.hs
@@ -44,8 +44,11 @@
         breakpoint, breakpointCond,
 
         -- * Ids with special behaviour
-        lazy, inline,
+        lazy, inline, oneShot,
 
+        -- * Running 'RealWorld' state transformers
+        runRW#,
+
         -- * Safe coercions
         --
         -- | These are available from the /Trustworthy/ module "Data.Coerce" as well
@@ -74,6 +77,9 @@
         -- * The Constraint kind
         Constraint,
 
+        -- * The Any type
+        Any,
+
         -- * Overloaded lists
         IsList(..)
        ) where
@@ -118,6 +124,7 @@
 groupWith :: Ord b => (a -> b) -> [a] -> [[a]]
 groupWith f xs = build (\c n -> groupByFB c n (\x y -> f x == f y) (sortWith f xs))
 
+{-# INLINE [0] groupByFB #-} -- See Note [Inline FB functions] in GHC.List
 groupByFB :: ([a] -> lst -> lst) -> lst -> (a -> a -> Bool) -> [a] -> lst
 groupByFB c n eq xs0 = groupByFBCore xs0
   where groupByFBCore [] = n
@@ -181,6 +188,7 @@
   --   It should satisfy fromList . toList = id.
   toList :: l -> [Item l]
 
+-- | @since 4.7.0.0
 instance IsList [a] where
   type (Item [a]) = a
   fromList = id
diff --git a/GHC/Fingerprint.hs b/GHC/Fingerprint.hs
--- a/GHC/Fingerprint.hs
+++ b/GHC/Fingerprint.hs
@@ -56,7 +56,6 @@
       c_MD5Final pdigest pctxt
       peek (castPtr pdigest :: Ptr Fingerprint)
 
--- This is duplicated in compiler/utils/Fingerprint.hsc
 fingerprintString :: String -> Fingerprint
 fingerprintString str = unsafeDupablePerformIO $
   withArrayLen word8s $ \len p ->
diff --git a/GHC/Fingerprint/Type.hs b/GHC/Fingerprint/Type.hs
--- a/GHC/Fingerprint/Type.hs
+++ b/GHC/Fingerprint/Type.hs
@@ -24,6 +24,7 @@
 data Fingerprint = Fingerprint {-# UNPACK #-} !Word64 {-# UNPACK #-} !Word64
   deriving (Eq, Ord)
 
+-- | @since 4.7.0.0
 instance Show Fingerprint where
   show (Fingerprint w1 w2) = hex16 w1 ++ hex16 w2
     where
diff --git a/GHC/Float.hs b/GHC/Float.hs
--- a/GHC/Float.hs
+++ b/GHC/Float.hs
@@ -239,14 +239,13 @@
 -- Float
 ------------------------------------------------------------------------
 
+-- | @since 2.01
 instance  Num Float  where
     (+)         x y     =  plusFloat x y
     (-)         x y     =  minusFloat x y
     negate      x       =  negateFloat x
     (*)         x y     =  timesFloat x y
-    abs x    | x == 0    = 0 -- handles (-0.0)
-             | x >  0    = x
-             | otherwise = negateFloat x
+    abs         x       =  fabsFloat x
     signum x | x > 0     = 1
              | x < 0     = negateFloat 1
              | otherwise = x -- handles 0.0, (-0.0), and NaN
@@ -254,6 +253,7 @@
     {-# INLINE fromInteger #-}
     fromInteger i = F# (floatFromInteger i)
 
+-- | @since 2.01
 instance  Real Float  where
     toRational (F# x#)  =
         case decodeFloat_Int# x# of
@@ -266,6 +266,7 @@
             | otherwise                                         ->
                     smallInteger m# :% shiftLInteger 1 (negateInt# e#)
 
+-- | @since 2.01
 instance  Fractional Float  where
     (/) x y             =  divideFloat x y
     {-# INLINE fromRational #-}
@@ -299,6 +300,7 @@
 "ceiling/Float->Int"                ceiling = ceilingFloatInt
 "round/Float->Int"                  round = roundFloatInt
   #-}
+-- | @since 2.01
 instance  RealFrac Float  where
 
         -- ceiling, floor, and truncate are all small
@@ -342,6 +344,7 @@
     floor x     = case properFraction x of
                     (n,r) -> if r < 0.0 then n - 1 else n
 
+-- | @since 2.01
 instance  Floating Float  where
     pi                  =  3.141592653589793238
     exp x               =  expFloat x
@@ -376,6 +379,7 @@
       | otherwise = a
     {-# INLINE log1pexp #-}
 
+-- | @since 2.01
 instance  RealFloat Float  where
     floatRadix _        =  FLT_RADIX        -- from float.h
     floatDigits _       =  FLT_MANT_DIG     -- ditto
@@ -406,6 +410,7 @@
     isNegativeZero x = 0 /= isFloatNegativeZero x
     isIEEE _         = True
 
+-- | @since 2.01
 instance  Show Float  where
     showsPrec   x = showSignedFloat showFloat x
     showList = showList__ (showsPrec 0)
@@ -414,14 +419,13 @@
 -- Double
 ------------------------------------------------------------------------
 
+-- | @since 2.01
 instance  Num Double  where
     (+)         x y     =  plusDouble x y
     (-)         x y     =  minusDouble x y
     negate      x       =  negateDouble x
     (*)         x y     =  timesDouble x y
-    abs x    | x == 0    = 0 -- handles (-0.0)
-             | x >  0    = x
-             | otherwise = negateDouble x
+    abs         x       =  fabsDouble x
     signum x | x > 0     = 1
              | x < 0     = negateDouble 1
              | otherwise = x -- handles 0.0, (-0.0), and NaN
@@ -431,6 +435,7 @@
     fromInteger i = D# (doubleFromInteger i)
 
 
+-- | @since 2.01
 instance  Real Double  where
     toRational (D# x#)  =
         case decodeDoubleInteger x# of
@@ -443,6 +448,7 @@
             | otherwise                                            ->
                 m :% shiftLInteger 1 (negateInt# e#)
 
+-- | @since 2.01
 instance  Fractional Double  where
     (/) x y             =  divideDouble x y
     {-# INLINE fromRational #-}
@@ -463,6 +469,7 @@
         minEx       = DBL_MIN_EXP
         mantDigs    = DBL_MANT_DIG
 
+-- | @since 2.01
 instance  Floating Double  where
     pi                  =  3.141592653589793238
     exp x               =  expDouble x
@@ -510,6 +517,7 @@
 "ceiling/Double->Int"               ceiling = ceilingDoubleInt
 "round/Double->Int"                 round = roundDoubleInt
   #-}
+-- | @since 2.01
 instance  RealFrac Double  where
 
         -- ceiling, floor, and truncate are all small
@@ -546,6 +554,7 @@
     floor x     = case properFraction x of
                     (n,r) -> if r < 0.0 then n - 1 else n
 
+-- | @since 2.01
 instance  RealFloat Double  where
     floatRadix _        =  FLT_RADIX        -- from float.h
     floatDigits _       =  DBL_MANT_DIG     -- ditto
@@ -577,6 +586,7 @@
     isNegativeZero x    = 0 /= isDoubleNegativeZero x
     isIEEE _            = True
 
+-- | @since 2.01
 instance  Show Double  where
     showsPrec   x = showSignedFloat showFloat x
     showList = showList__ (showsPrec 0)
@@ -601,6 +611,7 @@
 for these (@numericEnumFromTo@ and @numericEnumFromThenTo@ below.)
 -}
 
+-- | @since 2.01
 instance  Enum Float  where
     succ x         = x + 1
     pred x         = x - 1
@@ -611,6 +622,7 @@
     enumFromThen   = numericEnumFromThen
     enumFromThenTo = numericEnumFromThenTo
 
+-- | @since 2.01
 instance  Enum Double  where
     succ x         = x + 1
     pred x         = x - 1
@@ -1071,13 +1083,14 @@
 ltFloat     (F# x) (F# y) = isTrue# (ltFloat# x y)
 leFloat     (F# x) (F# y) = isTrue# (leFloat# x y)
 
-expFloat, logFloat, sqrtFloat :: Float -> Float
+expFloat, logFloat, sqrtFloat, fabsFloat :: Float -> Float
 sinFloat, cosFloat, tanFloat  :: Float -> Float
 asinFloat, acosFloat, atanFloat  :: Float -> Float
 sinhFloat, coshFloat, tanhFloat  :: Float -> Float
 expFloat    (F# x) = F# (expFloat# x)
 logFloat    (F# x) = F# (logFloat# x)
 sqrtFloat   (F# x) = F# (sqrtFloat# x)
+fabsFloat   (F# x) = F# (fabsFloat# x)
 sinFloat    (F# x) = F# (sinFloat# x)
 cosFloat    (F# x) = F# (cosFloat# x)
 tanFloat    (F# x) = F# (tanFloat# x)
@@ -1115,13 +1128,14 @@
 float2Double :: Float -> Double
 float2Double (F# x) = D# (float2Double# x)
 
-expDouble, logDouble, sqrtDouble :: Double -> Double
+expDouble, logDouble, sqrtDouble, fabsDouble :: Double -> Double
 sinDouble, cosDouble, tanDouble  :: Double -> Double
 asinDouble, acosDouble, atanDouble  :: Double -> Double
 sinhDouble, coshDouble, tanhDouble  :: Double -> Double
 expDouble    (D# x) = D# (expDouble# x)
 logDouble    (D# x) = D# (logDouble# x)
 sqrtDouble   (D# x) = D# (sqrtDouble# x)
+fabsDouble   (D# x) = D# (fabsDouble# x)
 sinDouble    (D# x) = D# (sinDouble# x)
 cosDouble    (D# x) = D# (cosDouble# x)
 tanDouble    (D# x) = D# (tanDouble# x)
diff --git a/GHC/Foreign.hs b/GHC/Foreign.hs
--- a/GHC/Foreign.hs
+++ b/GHC/Foreign.hs
@@ -1,5 +1,7 @@
 {-# LANGUAGE Trustworthy #-}
 {-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE ScopedTypeVariables #-}
+{-# LANGUAGE BangPatterns #-}
 
 -----------------------------------------------------------------------------
 -- |
@@ -159,7 +161,23 @@
 -- whether or not a character is encodable will, in general, depend on the
 -- context in which it occurs.
 charIsRepresentable :: TextEncoding -> Char -> IO Bool
-charIsRepresentable enc c = withCString enc [c] (fmap (== [c]) . peekCString enc) `catchException` (\e -> let _ = e :: IOException in return False)
+-- We force enc explicitly because `catch` is lazy in its
+-- first argument. We would probably like to force c as well,
+-- but unfortunately worker/wrapper produces very bad code for
+-- that.
+--
+-- TODO If this function is performance-critical, it would probably
+-- pay to use a single-character specialization of withCString. That
+-- would allow worker/wrapper to actually eliminate Char boxes, and
+-- would also get rid of the completely unnecessary cons allocation.
+charIsRepresentable !enc c =
+  withCString enc [c]
+              (\cstr -> do str <- peekCString enc cstr
+                           case str of
+                             [ch] | ch == c -> pure True
+                             _ -> pure False)
+    `catch`
+       \(_ :: IOException) -> pure False
 
 -- auxiliary definitions
 -- ----------------------
diff --git a/GHC/ForeignPtr.hs b/GHC/ForeignPtr.hs
--- a/GHC/ForeignPtr.hs
+++ b/GHC/ForeignPtr.hs
@@ -39,6 +39,7 @@
         touchForeignPtr,
         unsafeForeignPtrToPtr,
         castForeignPtr,
+        plusForeignPtr,
         newConcForeignPtr,
         addForeignPtrConcFinalizer,
         finalizeForeignPtr
@@ -70,12 +71,14 @@
 -- class 'Storable'.
 --
 data ForeignPtr a = ForeignPtr Addr# ForeignPtrContents
-        -- we cache the Addr# in the ForeignPtr object, but attach
-        -- the finalizer to the IORef (or the MutableByteArray# in
-        -- the case of a MallocPtr).  The aim of the representation
-        -- is to make withForeignPtr efficient; in fact, withForeignPtr
-        -- should be just as efficient as unpacking a Ptr, and multiple
-        -- withForeignPtrs can share an unpacked ForeignPtr.  Note
+        -- The Addr# in the ForeignPtr object is intentionally stored
+        -- separately from the finalizer. The primary aim of the
+        -- representation is to make withForeignPtr efficient; in fact,
+        -- withForeignPtr should be just as efficient as unpacking a
+        -- Ptr, and multiple withForeignPtrs can share an unpacked
+        -- ForeignPtr. As a secondary benefit, this representation
+        -- allows pointers to subregions within the same overall block
+        -- to share the same finalizer (see 'plusForeignPtr'). Note
         -- that touchForeignPtr only has to touch the ForeignPtrContents
         -- object, because that ensures that whatever the finalizer is
         -- attached to is kept alive.
@@ -90,12 +93,15 @@
   | MallocPtr      (MutableByteArray# RealWorld) !(IORef Finalizers)
   | PlainPtr       (MutableByteArray# RealWorld)
 
+-- | @since 2.01
 instance Eq (ForeignPtr a) where
     p == q  =  unsafeForeignPtrToPtr p == unsafeForeignPtrToPtr q
 
+-- | @since 2.01
 instance Ord (ForeignPtr a) where
     compare p q  =  compare (unsafeForeignPtrToPtr p) (unsafeForeignPtrToPtr q)
 
+-- | @since 2.01
 instance Show (ForeignPtr a) where
     showsPrec p f = showsPrec p (unsafeForeignPtrToPtr f)
 
@@ -429,7 +435,21 @@
 castForeignPtr :: ForeignPtr a -> ForeignPtr b
 -- ^This function casts a 'ForeignPtr'
 -- parameterised by one type into another type.
-castForeignPtr f = unsafeCoerce# f
+castForeignPtr = coerce
+
+plusForeignPtr :: ForeignPtr a -> Int -> ForeignPtr b
+-- ^Advances the given address by the given offset in bytes.
+--
+-- The new 'ForeignPtr' shares the finalizer of the original,
+-- equivalent from a finalization standpoint to just creating another
+-- reference to the original. That is, the finalizer will not be
+-- called before the new 'ForeignPtr' is unreachable, nor will it be
+-- called an additional time due to this call, and the finalizer will
+-- be called with the same address that it would have had this call
+-- not happened, *not* the new address.
+--
+-- @since 4.10.0.0
+plusForeignPtr (ForeignPtr addr c) (I# d) = ForeignPtr (plusAddr# addr d) c
 
 -- | Causes the finalizers associated with a foreign pointer to be run
 -- immediately.
diff --git a/GHC/GHCi.hs b/GHC/GHCi.hs
--- a/GHC/GHCi.hs
+++ b/GHC/GHCi.hs
@@ -28,22 +28,27 @@
 class (Monad m) => GHCiSandboxIO m where
     ghciStepIO :: m a -> IO a
 
+-- | @since 4.4.0.0
 instance GHCiSandboxIO IO where
     ghciStepIO = id
 
 -- | A monad that doesn't allow any IO.
 newtype NoIO a = NoIO { noio :: IO a }
 
+-- | @since 4.8.0.0
 instance Functor NoIO where
   fmap f (NoIO a) = NoIO (fmap f a)
 
+-- | @since 4.8.0.0
 instance Applicative NoIO where
   pure a = NoIO (pure a)
   (<*>) = ap
 
+-- | @since 4.4.0.0
 instance Monad NoIO where
     (>>=) k f = NoIO (noio k >>= noio . f)
 
+-- | @since 4.4.0.0
 instance GHCiSandboxIO NoIO where
     ghciStepIO = noio
 
diff --git a/GHC/Generics.hs b/GHC/Generics.hs
--- a/GHC/Generics.hs
+++ b/GHC/Generics.hs
@@ -1,6 +1,7 @@
 {-# LANGUAGE CPP                    #-}
 {-# LANGUAGE DataKinds              #-}
 {-# LANGUAGE DeriveFunctor          #-}
+{-# LANGUAGE GeneralizedNewtypeDeriving #-}
 {-# LANGUAGE DeriveGeneric          #-}
 {-# LANGUAGE FlexibleContexts       #-}
 {-# LANGUAGE FlexibleInstances      #-}
@@ -13,6 +14,7 @@
 {-# LANGUAGE StandaloneDeriving     #-}
 {-# LANGUAGE Trustworthy            #-}
 {-# LANGUAGE TypeFamilies           #-}
+{-# LANGUAGE TypeInType             #-}
 {-# LANGUAGE TypeOperators          #-}
 {-# LANGUAGE TypeSynonymInstances   #-}
 {-# LANGUAGE UndecidableInstances   #-}
@@ -75,10 +77,10 @@
 --   type 'Rep' (Tree a) =
 --     'D1' ('MetaData \"Tree\" \"Main\" \"package-name\" 'False)
 --       ('C1' ('MetaCons \"Leaf\" 'PrefixI 'False)
---          ('S1' '(MetaSel 'Nothing
---                           'NoSourceUnpackedness
---                           'NoSourceStrictness
---                           'DecidedLazy)
+--          ('S1' ('MetaSel 'Nothing
+--                          'NoSourceUnpackedness
+--                          'NoSourceStrictness
+--                          'DecidedLazy)
 --                 ('Rec0' a))
 --        ':+:'
 --        'C1' ('MetaCons \"Node\" 'PrefixI 'False)
@@ -475,7 +477,9 @@
 --
 -- Like 'Generic', there is a class 'Generic1' that defines a
 -- representation 'Rep1' and conversion functions 'from1' and 'to1',
--- only that 'Generic1' ranges over types of kind @* -> *@.
+-- only that 'Generic1' ranges over types of kind @* -> *@. (More generally,
+-- it can range over types of kind @k -> *@, for any kind @k@, if the
+-- @PolyKinds@ extension is enabled. More on this later.)
 -- The 'Generic1' class is also derivable.
 --
 -- The representation 'Rep1' is ever so slightly different from 'Rep'.
@@ -512,7 +516,7 @@
 --                          'DecidedLazy)
 --                ('Rec1' Tree)))
 --   ...
---  @
+-- @
 --
 -- The representation reuses 'D1', 'C1', 'S1' (and thereby 'M1') as well
 -- as ':+:' and ':*:' from 'Rep'. (This reusability is the reason that we
@@ -552,7 +556,7 @@
 -- yields
 --
 -- @
--- class 'Rep1' WithInt where
+-- instance 'Generic1' WithInt where
 --   type 'Rep1' WithInt =
 --     'D1' ('MetaData \"WithInt\" \"Main\" \"package-name\" 'False)
 --       ('C1' ('MetaCons \"WithInt\" 'PrefixI 'False)
@@ -579,7 +583,7 @@
 -- yields
 --
 -- @
--- class 'Rep1' Rose where
+-- instance 'Generic1' Rose where
 --   type 'Rep1' Rose =
 --     'D1' ('MetaData \"Rose\" \"Main\" \"package-name\" 'False)
 --       ('C1' ('MetaCons \"Fork\" 'PrefixI 'False)
@@ -602,6 +606,22 @@
 -- newtype (':.:') f g p = 'Comp1' { 'unComp1' :: f (g p) }
 -- @
 
+-- *** Representation of @k -> *@ types
+--
+-- |
+--
+-- The 'Generic1' class can be generalized to range over types of kind
+-- @k -> *@, for any kind @k@. To do so, derive a 'Generic1' instance with the
+-- @PolyKinds@ extension enabled. For example, the declaration
+--
+-- @
+-- data Proxy (a :: k) = Proxy deriving 'Generic1'
+-- @
+--
+-- yields a slightly different instance depending on whether @PolyKinds@ is
+-- enabled. If compiled without @PolyKinds@, then @'Rep1' Proxy :: * -> *@, but
+-- if compiled with @PolyKinds@, then @'Rep1' Proxy :: k -> *@.
+
 -- *** Representation of unlifted types
 --
 -- |
@@ -609,8 +629,8 @@
 -- If one were to attempt to derive a Generic instance for a datatype with an
 -- unlifted argument (for example, 'Int#'), one might expect the occurrence of
 -- the 'Int#' argument to be marked with @'Rec0' 'Int#'@. This won't work,
--- though, since 'Int#' is of kind @#@ and 'Rec0' expects a type of kind @*@.
--- In fact, polymorphism over unlifted types is disallowed completely.
+-- though, since 'Int#' is of an unlifted kind, and 'Rec0' expects a type of
+-- kind @*@.
 --
 -- One solution would be to represent an occurrence of 'Int#' with 'Rec0 Int'
 -- instead. With this approach, however, the programmer has no way of knowing
@@ -711,14 +731,14 @@
 -- Needed for instances
 import GHC.Arr     ( Ix )
 import GHC.Base    ( Alternative(..), Applicative(..), Functor(..)
-                   , Monad(..), MonadPlus(..), String )
+                   , Monad(..), MonadPlus(..), String, coerce )
 import GHC.Classes ( Eq(..), Ord(..) )
 import GHC.Enum    ( Bounded, Enum )
 import GHC.Read    ( Read(..), lex, readParen )
 import GHC.Show    ( Show(..), showString )
 
 -- Needed for metadata
-import Data.Proxy   ( Proxy(..), KProxy(..) )
+import Data.Proxy   ( Proxy(..) )
 import GHC.TypeLits ( Nat, Symbol, KnownSymbol, KnownNat, symbolVal, natVal )
 
 --------------------------------------------------------------------------------
@@ -726,7 +746,7 @@
 --------------------------------------------------------------------------------
 
 -- | Void: used for datatypes without constructors
-data V1 (p :: *)
+data V1 (p :: k)
   deriving (Functor, Generic, Generic1)
 
 deriving instance Eq   (V1 p)
@@ -735,169 +755,222 @@
 deriving instance Show (V1 p)
 
 -- | Unit: used for constructors without arguments
-data U1 (p :: *) = U1
+data U1 (p :: k) = U1
   deriving (Generic, Generic1)
 
+-- | @since 4.9.0.0
 instance Eq (U1 p) where
   _ == _ = True
 
+-- | @since 4.9.0.0
 instance Ord (U1 p) where
   compare _ _ = EQ
 
+-- | @since 4.9.0.0
 instance Read (U1 p) where
   readsPrec d = readParen (d > 10) (\r -> [(U1, s) | ("U1",s) <- lex r ])
 
+-- | @since 4.9.0.0
 instance Show (U1 p) where
   showsPrec _ _ = showString "U1"
 
+-- | @since 4.9.0.0
 instance Functor U1 where
   fmap _ _ = U1
 
+-- | @since 4.9.0.0
 instance Applicative U1 where
   pure _ = U1
   _ <*> _ = U1
+  liftA2 _ _ _ = U1
 
+-- | @since 4.9.0.0
 instance Alternative U1 where
   empty = U1
   _ <|> _ = U1
 
+-- | @since 4.9.0.0
 instance Monad U1 where
   _ >>= _ = U1
 
+-- | @since 4.9.0.0
 instance MonadPlus U1
 
 -- | Used for marking occurrences of the parameter
 newtype Par1 p = Par1 { unPar1 :: p }
   deriving (Eq, Ord, Read, Show, Functor, Generic, Generic1)
 
+-- | @since 4.9.0.0
 instance Applicative Par1 where
-  pure a = Par1 a
-  Par1 f <*> Par1 x = Par1 (f x)
+  pure = Par1
+  (<*>) = coerce
+  liftA2 = coerce
 
+-- | @since 4.9.0.0
 instance Monad Par1 where
   Par1 x >>= f = f x
 
--- | Recursive calls of kind * -> *
-newtype Rec1 f (p :: *) = Rec1 { unRec1 :: f p }
+-- | Recursive calls of kind @* -> *@ (or kind @k -> *@, when @PolyKinds@
+-- is enabled)
+newtype Rec1 (f :: k -> *) (p :: k) = Rec1 { unRec1 :: f p }
   deriving (Eq, Ord, Read, Show, Functor, Generic, Generic1)
 
-instance Applicative f => Applicative (Rec1 f) where
-  pure a = Rec1 (pure a)
-  Rec1 f <*> Rec1 x = Rec1 (f <*> x)
+-- | @since 4.9.0.0
+deriving instance Applicative f => Applicative (Rec1 f)
 
-instance Alternative f => Alternative (Rec1 f) where
-  empty = Rec1 empty
-  Rec1 l <|> Rec1 r = Rec1 (l <|> r)
+-- | @since 4.9.0.0
+deriving instance Alternative f => Alternative (Rec1 f)
 
+-- | @since 4.9.0.0
 instance Monad f => Monad (Rec1 f) where
   Rec1 x >>= f = Rec1 (x >>= \a -> unRec1 (f a))
 
-instance MonadPlus f => MonadPlus (Rec1 f)
+-- | @since 4.9.0.0
+deriving instance MonadPlus f => MonadPlus (Rec1 f)
 
--- | Constants, additional parameters and recursion of kind *
-newtype K1 (i :: *) c (p :: *) = K1 { unK1 :: c }
+-- | Constants, additional parameters and recursion of kind @*@
+newtype K1 (i :: *) c (p :: k) = K1 { unK1 :: c }
   deriving (Eq, Ord, Read, Show, Functor, Generic, Generic1)
 
-instance Applicative f => Applicative (M1 i c f) where
-  pure a = M1 (pure a)
-  M1 f <*> M1 x = M1 (f <*> x)
+-- | @since 4.9.0.0
+deriving instance Applicative f => Applicative (M1 i c f)
 
-instance Alternative f => Alternative (M1 i c f) where
-  empty = M1 empty
-  M1 l <|> M1 r = M1 (l <|> r)
+-- | @since 4.9.0.0
+deriving instance Alternative f => Alternative (M1 i c f)
 
-instance Monad f => Monad (M1 i c f) where
-  M1 x >>= f = M1 (x >>= \a -> unM1 (f a))
+-- | @since 4.9.0.0
+deriving instance Monad f => Monad (M1 i c f)
 
-instance MonadPlus f => MonadPlus (M1 i c f)
+-- | @since 4.9.0.0
+deriving instance MonadPlus f => MonadPlus (M1 i c f)
 
 -- | Meta-information (constructor names, etc.)
-newtype M1 (i :: *) (c :: Meta) f (p :: *) = M1 { unM1 :: f p }
+newtype M1 (i :: *) (c :: Meta) (f :: k -> *) (p :: k) = M1 { unM1 :: f p }
   deriving (Eq, Ord, Read, Show, Functor, Generic, Generic1)
 
 -- | Sums: encode choice between constructors
 infixr 5 :+:
-data (:+:) f g (p :: *) = L1 (f p) | R1 (g p)
+data (:+:) (f :: k -> *) (g :: k -> *) (p :: k) = L1 (f p) | R1 (g p)
   deriving (Eq, Ord, Read, Show, Functor, Generic, Generic1)
 
 -- | Products: encode multiple arguments to constructors
 infixr 6 :*:
-data (:*:) f g (p :: *) = f p :*: g p
+data (:*:) (f :: k -> *) (g :: k -> *) (p :: k) = f p :*: g p
   deriving (Eq, Ord, Read, Show, Functor, Generic, Generic1)
 
+-- | @since 4.9.0.0
 instance (Applicative f, Applicative g) => Applicative (f :*: g) where
   pure a = pure a :*: pure a
   (f :*: g) <*> (x :*: y) = (f <*> x) :*: (g <*> y)
+  liftA2 f (a :*: b) (x :*: y) = liftA2 f a x :*: liftA2 f b y
 
+-- | @since 4.9.0.0
 instance (Alternative f, Alternative g) => Alternative (f :*: g) where
   empty = empty :*: empty
   (x1 :*: y1) <|> (x2 :*: y2) = (x1 <|> x2) :*: (y1 <|> y2)
 
+-- | @since 4.9.0.0
 instance (Monad f, Monad g) => Monad (f :*: g) where
   (m :*: n) >>= f = (m >>= \a -> fstP (f a)) :*: (n >>= \a -> sndP (f a))
     where
       fstP (a :*: _) = a
       sndP (_ :*: b) = b
 
+-- | @since 4.9.0.0
 instance (MonadPlus f, MonadPlus g) => MonadPlus (f :*: g)
 
 -- | Composition of functors
 infixr 7 :.:
-newtype (:.:) f (g :: * -> *) (p :: *) = Comp1 { unComp1 :: f (g p) }
+newtype (:.:) (f :: k2 -> *) (g :: k1 -> k2) (p :: k1) =
+    Comp1 { unComp1 :: f (g p) }
   deriving (Eq, Ord, Read, Show, Functor, Generic, Generic1)
 
+-- | @since 4.9.0.0
 instance (Applicative f, Applicative g) => Applicative (f :.: g) where
   pure x = Comp1 (pure (pure x))
-  Comp1 f <*> Comp1 x = Comp1 (fmap (<*>) f <*> x)
+  Comp1 f <*> Comp1 x = Comp1 (liftA2 (<*>) f x)
+  liftA2 f (Comp1 x) (Comp1 y) = Comp1 (liftA2 (liftA2 f) x y)
 
+-- | @since 4.9.0.0
 instance (Alternative f, Applicative g) => Alternative (f :.: g) where
   empty = Comp1 empty
-  Comp1 x <|> Comp1 y = Comp1 (x <|> y)
+  (<|>) = coerce ((<|>) :: f (g a) -> f (g a) -> f (g a)) ::
+    forall a . (f :.: g) a -> (f :.: g) a -> (f :.: g) a
 
--- | Constants of kind @#@
-data family URec (a :: *) (p :: *)
+-- | Constants of unlifted kinds
+--
+-- @since 4.9.0.0
+data family URec (a :: *) (p :: k)
 
 -- | Used for marking occurrences of 'Addr#'
-data instance URec (Ptr ()) p = UAddr { uAddr# :: Addr# }
+--
+-- @since 4.9.0.0
+data instance URec (Ptr ()) (p :: k) = UAddr { uAddr# :: Addr# }
   deriving (Eq, Ord, Functor, Generic, Generic1)
 
 -- | Used for marking occurrences of 'Char#'
-data instance URec Char p = UChar { uChar# :: Char# }
+--
+-- @since 4.9.0.0
+data instance URec Char (p :: k) = UChar { uChar# :: Char# }
   deriving (Eq, Ord, Show, Functor, Generic, Generic1)
 
 -- | Used for marking occurrences of 'Double#'
-data instance URec Double p = UDouble { uDouble# :: Double# }
+--
+-- @since 4.9.0.0
+data instance URec Double (p :: k) = UDouble { uDouble# :: Double# }
   deriving (Eq, Ord, Show, Functor, Generic, Generic1)
 
 -- | Used for marking occurrences of 'Float#'
-data instance URec Float p = UFloat { uFloat# :: Float# }
+--
+-- @since 4.9.0.0
+data instance URec Float (p :: k) = UFloat { uFloat# :: Float# }
   deriving (Eq, Ord, Show, Functor, Generic, Generic1)
 
 -- | Used for marking occurrences of 'Int#'
-data instance URec Int p = UInt { uInt# :: Int# }
+--
+-- @since 4.9.0.0
+data instance URec Int (p :: k) = UInt { uInt# :: Int# }
   deriving (Eq, Ord, Show, Functor, Generic, Generic1)
 
 -- | Used for marking occurrences of 'Word#'
-data instance URec Word p = UWord { uWord# :: Word# }
+--
+-- @since 4.9.0.0
+data instance URec Word (p :: k) = UWord { uWord# :: Word# }
   deriving (Eq, Ord, Show, Functor, Generic, Generic1)
 
--- | Type synonym for 'URec': 'Addr#'
+-- | Type synonym for @'URec' 'Addr#'@
+--
+-- @since 4.9.0.0
 type UAddr   = URec (Ptr ())
--- | Type synonym for 'URec': 'Char#'
+-- | Type synonym for @'URec' 'Char#'@
+--
+-- @since 4.9.0.0
 type UChar   = URec Char
--- | Type synonym for 'URec': 'Double#'
+
+-- | Type synonym for @'URec' 'Double#'@
+--
+-- @since 4.9.0.0
 type UDouble = URec Double
--- | Type synonym for 'URec': 'Float#'
+
+-- | Type synonym for @'URec' 'Float#'@
+--
+-- @since 4.9.0.0
 type UFloat  = URec Float
--- | Type synonym for 'URec': 'Int#'
+
+-- | Type synonym for @'URec' 'Int#'@
+--
+-- @since 4.9.0.0
 type UInt    = URec Int
--- | Type synonym for 'URec': 'Word#'
+
+-- | Type synonym for @'URec' 'Word#'@
+--
+-- @since 4.9.0.0
 type UWord   = URec Word
 
--- | Tag for K1: recursion (of kind *)
+-- | Tag for K1: recursion (of kind @*@)
 data R
 
--- | Type synonym for encoding recursion (of kind *)
+-- | Type synonym for encoding recursion (of kind @*@)
 type Rec0  = K1 R
 
 -- | Tag for M1: datatype
@@ -919,15 +992,20 @@
 -- | Class for datatypes that represent datatypes
 class Datatype d where
   -- | The name of the datatype (unqualified)
-  datatypeName :: t d (f :: * -> *) a -> [Char]
+  datatypeName :: t d (f :: k -> *) (a :: k) -> [Char]
   -- | The fully-qualified name of the module where the type is declared
-  moduleName   :: t d (f :: * -> *) a -> [Char]
+  moduleName   :: t d (f :: k -> *) (a :: k) -> [Char]
   -- | The package name of the module where the type is declared
-  packageName :: t d (f :: * -> *) a -> [Char]
+  --
+  -- @since 4.9.0.0
+  packageName :: t d (f :: k -> *) (a :: k) -> [Char]
   -- | Marks if the datatype is actually a newtype
-  isNewtype    :: t d (f :: * -> *) a -> Bool
+  --
+  -- @since 4.7.0.0
+  isNewtype    :: t d (f :: k -> *) (a :: k) -> Bool
   isNewtype _ = False
 
+-- | @since 4.9.0.0
 instance (KnownSymbol n, KnownSymbol m, KnownSymbol p, SingI nt)
     => Datatype ('MetaData n m p nt) where
   datatypeName _ = symbolVal (Proxy :: Proxy n)
@@ -938,16 +1016,17 @@
 -- | Class for datatypes that represent data constructors
 class Constructor c where
   -- | The name of the constructor
-  conName :: t c (f :: * -> *) a -> [Char]
+  conName :: t c (f :: k -> *) (a :: k) -> [Char]
 
   -- | The fixity of the constructor
-  conFixity :: t c (f :: * -> *) a -> Fixity
+  conFixity :: t c (f :: k -> *) (a :: k) -> Fixity
   conFixity _ = Prefix
 
   -- | Marks if this constructor is a record
-  conIsRecord :: t c (f :: * -> *) a -> Bool
+  conIsRecord :: t c (f :: k -> *) (a :: k) -> Bool
   conIsRecord _ = False
 
+-- | @since 4.9.0.0
 instance (KnownSymbol n, SingI f, SingI r)
     => Constructor ('MetaCons n f r) where
   conName     _ = symbolVal (Proxy :: Proxy n)
@@ -960,6 +1039,8 @@
   deriving (Eq, Show, Ord, Read, Generic)
 
 -- | This variant of 'Fixity' appears at the type level.
+--
+-- @since 4.9.0.0
 data FixityI = PrefixI | InfixI Associativity Nat
 
 -- | Get the precedence of a fixity value.
@@ -984,6 +1065,8 @@
 --
 -- The fields of @ExampleConstructor@ have 'NoSourceUnpackedness',
 -- 'SourceNoUnpack', and 'SourceUnpack', respectively.
+--
+-- @since 4.9.0.0
 data SourceUnpackedness = NoSourceUnpackedness
                         | SourceNoUnpack
                         | SourceUnpack
@@ -998,6 +1081,8 @@
 --
 -- The fields of @ExampleConstructor@ have 'NoSourceStrictness',
 -- 'SourceLazy', and 'SourceStrict', respectively.
+--
+-- @since 4.9.0.0
 data SourceStrictness = NoSourceStrictness
                       | SourceLazy
                       | SourceStrict
@@ -1023,6 +1108,8 @@
 --
 -- * If compiled with @-O2@ enabled, then the fields will have 'DecidedUnpack',
 --   'DecidedStrict', and 'DecidedLazy', respectively.
+--
+-- @since 4.9.0.0
 data DecidedStrictness = DecidedLazy
                        | DecidedStrict
                        | DecidedUnpack
@@ -1031,14 +1118,21 @@
 -- | Class for datatypes that represent records
 class Selector s where
   -- | The name of the selector
-  selName :: t s (f :: * -> *) a -> [Char]
+  selName :: t s (f :: k -> *) (a :: k) -> [Char]
   -- | The selector's unpackedness annotation (if any)
-  selSourceUnpackedness :: t s (f :: * -> *) a -> SourceUnpackedness
+  --
+  -- @since 4.9.0.0
+  selSourceUnpackedness :: t s (f :: k -> *) (a :: k) -> SourceUnpackedness
   -- | The selector's strictness annotation (if any)
-  selSourceStrictness :: t s (f :: * -> *) a -> SourceStrictness
+  --
+  -- @since 4.9.0.0
+  selSourceStrictness :: t s (f :: k -> *) (a :: k) -> SourceStrictness
   -- | The strictness that the compiler inferred for the selector
-  selDecidedStrictness :: t s (f :: * -> *) a -> DecidedStrictness
+  --
+  -- @since 4.9.0.0
+  selDecidedStrictness :: t s (f :: k -> *) (a :: k) -> DecidedStrictness
 
+-- | @since 4.9.0.0
 instance (SingI mn, SingI su, SingI ss, SingI ds)
     => Selector ('MetaSel mn su ss ds) where
   selName _ = fromMaybe "" (fromSing (sing :: Sing mn))
@@ -1057,11 +1151,12 @@
   to    :: (Rep a) x -> a
 
 
--- | Representable types of kind * -> *.
--- This class is derivable in GHC with the DeriveGeneric flag on.
-class Generic1 f where
+-- | Representable types of kind @* -> *@ (or kind @k -> *@, when @PolyKinds@
+-- is enabled).
+-- This class is derivable in GHC with the @DeriveGeneric@ flag on.
+class Generic1 (f :: k -> *) where
   -- | Generic representation type
-  type Rep1 f :: * -> *
+  type Rep1 f :: k -> *
   -- | Convert from the datatype to its representation
   from1  :: f a -> (Rep1 f) a
   -- | Convert from the representation to the datatype
@@ -1081,10 +1176,12 @@
 -- * In @MetaCons n f s@, @n@ is the constructor's name, @f@ is its fixity,
 --   and @s@ is @'True@ if the constructor contains record selectors.
 --
--- * In @MetaSel mn su ss ds@, if the field is uses record syntax, then @mn@ is
---   'Just' the record name. Otherwise, @mn@ is 'Nothing. @su@ and @ss@ are the
---   field's unpackedness and strictness annotations, and @ds@ is the
+-- * In @MetaSel mn su ss ds@, if the field uses record syntax, then @mn@ is
+--   'Just' the record name. Otherwise, @mn@ is 'Nothing'. @su@ and @ss@ are
+--   the field's unpackedness and strictness annotations, and @ds@ is the
 --   strictness that GHC infers for the field.
+--
+-- @since 4.9.0.0
 data Meta = MetaData Symbol Symbol Symbol Bool
           | MetaCons Symbol FixityI Bool
           | MetaSel  (Maybe Symbol)
@@ -1137,22 +1234,24 @@
 -- | The 'SingKind' class is essentially a /kind/ class. It classifies all kinds
 -- for which singletons are defined. The class supports converting between a singleton
 -- type and the base (unrefined) type which it is built from.
-class (kparam ~ 'KProxy) => SingKind (kparam :: KProxy k) where
+class SingKind k where
   -- | Get a base type from a proxy for the promoted kind. For example,
-  -- @DemoteRep ('KProxy :: KProxy Bool)@ will be the type @Bool@.
-  type DemoteRep kparam :: *
+  -- @DemoteRep Bool@ will be the type @Bool@.
+  type DemoteRep k :: *
 
   -- | Convert a singleton to its unrefined version.
-  fromSing :: Sing (a :: k) -> DemoteRep kparam
+  fromSing :: Sing (a :: k) -> DemoteRep k
 
 -- Singleton symbols
 data instance Sing (s :: Symbol) where
   SSym :: KnownSymbol s => Sing s
 
+-- | @since 4.9.0.0
 instance KnownSymbol a => SingI a where sing = SSym
 
-instance SingKind ('KProxy :: KProxy Symbol) where
-  type DemoteRep ('KProxy :: KProxy Symbol) = String
+-- | @since 4.9.0.0
+instance SingKind Symbol where
+  type DemoteRep Symbol = String
   fromSing (SSym :: Sing s) = symbolVal (Proxy :: Proxy s)
 
 -- Singleton booleans
@@ -1160,11 +1259,15 @@
   STrue  :: Sing 'True
   SFalse :: Sing 'False
 
+-- | @since 4.9.0.0
 instance SingI 'True  where sing = STrue
+
+-- | @since 4.9.0.0
 instance SingI 'False where sing = SFalse
 
-instance SingKind ('KProxy :: KProxy Bool) where
-  type DemoteRep ('KProxy :: KProxy Bool) = Bool
+-- | @since 4.9.0.0
+instance SingKind Bool where
+  type DemoteRep Bool = Bool
   fromSing STrue  = True
   fromSing SFalse = False
 
@@ -1173,13 +1276,15 @@
   SNothing :: Sing 'Nothing
   SJust    :: Sing a -> Sing ('Just a)
 
+-- | @since 4.9.0.0
 instance            SingI 'Nothing  where sing = SNothing
+
+-- | @since 4.9.0.0
 instance SingI a => SingI ('Just a) where sing = SJust sing
 
-instance SingKind ('KProxy :: KProxy a) =>
-    SingKind ('KProxy :: KProxy (Maybe a)) where
-  type DemoteRep ('KProxy :: KProxy (Maybe a)) =
-      Maybe (DemoteRep ('KProxy :: KProxy a))
+-- | @since 4.9.0.0
+instance SingKind a => SingKind (Maybe a) where
+  type DemoteRep (Maybe a) = Maybe (DemoteRep a)
   fromSing SNothing  = Nothing
   fromSing (SJust a) = Just (fromSing a)
 
@@ -1188,12 +1293,16 @@
   SPrefix :: Sing 'PrefixI
   SInfix  :: Sing a -> Integer -> Sing ('InfixI a n)
 
+-- | @since 4.9.0.0
 instance SingI 'PrefixI where sing = SPrefix
+
+-- | @since 4.9.0.0
 instance (SingI a, KnownNat n) => SingI ('InfixI a n) where
   sing = SInfix (sing :: Sing a) (natVal (Proxy :: Proxy n))
 
-instance SingKind ('KProxy :: KProxy FixityI) where
-  type DemoteRep ('KProxy :: KProxy FixityI) = Fixity
+-- | @since 4.9.0.0
+instance SingKind FixityI where
+  type DemoteRep FixityI = Fixity
   fromSing SPrefix      = Prefix
   fromSing (SInfix a n) = Infix (fromSing a) (I# (integerToInt n))
 
@@ -1203,12 +1312,18 @@
   SRightAssociative :: Sing 'RightAssociative
   SNotAssociative   :: Sing 'NotAssociative
 
+-- | @since 4.9.0.0
 instance SingI 'LeftAssociative  where sing = SLeftAssociative
+
+-- | @since 4.9.0.0
 instance SingI 'RightAssociative where sing = SRightAssociative
+
+-- | @since 4.9.0.0
 instance SingI 'NotAssociative   where sing = SNotAssociative
 
-instance SingKind ('KProxy :: KProxy Associativity) where
-  type DemoteRep ('KProxy :: KProxy Associativity) = Associativity
+-- | @since 4.0.0.0
+instance SingKind Associativity where
+  type DemoteRep Associativity = Associativity
   fromSing SLeftAssociative  = LeftAssociative
   fromSing SRightAssociative = RightAssociative
   fromSing SNotAssociative   = NotAssociative
@@ -1219,12 +1334,18 @@
   SSourceNoUnpack       :: Sing 'SourceNoUnpack
   SSourceUnpack         :: Sing 'SourceUnpack
 
+-- | @since 4.9.0.0
 instance SingI 'NoSourceUnpackedness where sing = SNoSourceUnpackedness
+
+-- | @since 4.9.0.0
 instance SingI 'SourceNoUnpack       where sing = SSourceNoUnpack
+
+-- | @since 4.9.0.0
 instance SingI 'SourceUnpack         where sing = SSourceUnpack
 
-instance SingKind ('KProxy :: KProxy SourceUnpackedness) where
-  type DemoteRep ('KProxy :: KProxy SourceUnpackedness) = SourceUnpackedness
+-- | @since 4.9.0.0
+instance SingKind SourceUnpackedness where
+  type DemoteRep SourceUnpackedness = SourceUnpackedness
   fromSing SNoSourceUnpackedness = NoSourceUnpackedness
   fromSing SSourceNoUnpack       = SourceNoUnpack
   fromSing SSourceUnpack         = SourceUnpack
@@ -1235,12 +1356,18 @@
   SSourceLazy         :: Sing 'SourceLazy
   SSourceStrict       :: Sing 'SourceStrict
 
+-- | @since 4.9.0.0
 instance SingI 'NoSourceStrictness where sing = SNoSourceStrictness
+
+-- | @since 4.9.0.0
 instance SingI 'SourceLazy         where sing = SSourceLazy
+
+-- | @since 4.9.0.0
 instance SingI 'SourceStrict       where sing = SSourceStrict
 
-instance SingKind ('KProxy :: KProxy SourceStrictness) where
-  type DemoteRep ('KProxy :: KProxy SourceStrictness) = SourceStrictness
+-- | @since 4.9.0.0
+instance SingKind SourceStrictness where
+  type DemoteRep SourceStrictness = SourceStrictness
   fromSing SNoSourceStrictness = NoSourceStrictness
   fromSing SSourceLazy         = SourceLazy
   fromSing SSourceStrict       = SourceStrict
@@ -1251,12 +1378,18 @@
   SDecidedStrict :: Sing 'DecidedStrict
   SDecidedUnpack :: Sing 'DecidedUnpack
 
+-- | @since 4.9.0.0
 instance SingI 'DecidedLazy   where sing = SDecidedLazy
+
+-- | @since 4.9.0.0
 instance SingI 'DecidedStrict where sing = SDecidedStrict
+
+-- | @since 4.9.0.0
 instance SingI 'DecidedUnpack where sing = SDecidedUnpack
 
-instance SingKind ('KProxy :: KProxy DecidedStrictness) where
-  type DemoteRep ('KProxy :: KProxy DecidedStrictness) = DecidedStrictness
+-- | @since 4.9.0.0
+instance SingKind DecidedStrictness where
+  type DemoteRep DecidedStrictness = DecidedStrictness
   fromSing SDecidedLazy   = DecidedLazy
   fromSing SDecidedStrict = DecidedStrict
   fromSing SDecidedUnpack = DecidedUnpack
diff --git a/GHC/IO.hs b/GHC/IO.hs
--- a/GHC/IO.hs
+++ b/GHC/IO.hs
@@ -3,6 +3,7 @@
            , BangPatterns
            , RankNTypes
            , MagicHash
+           , ScopedTypeVariables
            , UnboxedTuples
   #-}
 {-# OPTIONS_GHC -funbox-strict-fields #-}
@@ -33,7 +34,7 @@
 
         FilePath,
 
-        catchException, catchAny, throwIO,
+        catch, catchException, catchAny, throwIO,
         mask, mask_, uninterruptibleMask, uninterruptibleMask_,
         MaskingState(..), getMaskingState,
         unsafeUnmask, interruptible,
@@ -59,15 +60,15 @@
 NOTE: The IO representation is deeply wired in to various parts of the
 system.  The following list may or may not be exhaustive:
 
-Compiler  - types of various primitives in PrimOp.lhs
+Compiler  - types of various primitives in PrimOp.hs
 
-RTS       - forceIO (StgMiscClosures.hc)
+RTS       - forceIO (StgStartup.cmm)
           - catchzh_fast, (un)?blockAsyncExceptionszh_fast, raisezh_fast
-            (Exceptions.hc)
-          - raiseAsync (Schedule.c)
+            (Exception.cmm)
+          - raiseAsync (RaiseAsync.c)
 
-Prelude   - GHC.IO.lhs, and several other places including
-            GHC.Exception.lhs.
+Prelude   - GHC.IO.hs, and several other places including
+            GHC.Exception.hs.
 
 Libraries - parts of hslibs/lang.
 
@@ -83,22 +84,31 @@
 -- ---------------------------------------------------------------------------
 -- Coercions between IO and ST
 
--- | A monad transformer embedding strict state transformers in the 'IO'
--- monad.  The 'RealWorld' parameter indicates that the internal state
+-- | Embed a strict state transformer in an 'IO'
+-- action.  The 'RealWorld' parameter indicates that the internal state
 -- used by the 'ST' computation is a special one supplied by the 'IO'
 -- monad, and thus distinct from those used by invocations of 'runST'.
 stToIO        :: ST RealWorld a -> IO a
 stToIO (ST m) = IO m
 
+-- | Convert an 'IO' action into an 'ST' action. The type of the result
+-- is constrained to use a 'RealWorld' state, and therefore the result cannot
+-- be passed to 'runST'.
 ioToST        :: IO a -> ST RealWorld a
 ioToST (IO m) = (ST m)
 
--- This relies on IO and ST having the same representation modulo the
--- constraint on the type of the state
---
+-- | Convert an 'IO' action to an 'ST' action.
+-- This relies on 'IO' and 'ST' having the same representation modulo the
+-- constraint on the type of the state.
 unsafeIOToST        :: IO a -> ST s a
 unsafeIOToST (IO io) = ST $ \ s -> (unsafeCoerce# io) s
 
+-- | Convert an 'ST' action to an 'IO' action.
+-- This relies on 'IO' and 'ST' having the same representation modulo the
+-- constraint on the type of the state.
+--
+-- For an example demonstrating why this is unsafe, see
+-- https://mail.haskell.org/pipermail/haskell-cafe/2009-April/060719.html
 unsafeSTToIO :: ST s a -> IO a
 unsafeSTToIO (ST m) = IO (unsafeCoerce# m)
 
@@ -113,7 +123,7 @@
 -- Primitive catch and throwIO
 
 {-
-catchException used to handle the passing around of the state to the
+catchException/catch used to handle the passing around of the state to the
 action and the handler.  This turned out to be a bad idea - it meant
 that we had to wrap both arguments in thunks so they could be entered
 as normal (remember IO returns an unboxed pair...).
@@ -123,7 +133,7 @@
     catch# :: IO a -> (b -> IO a) -> IO a
 
 (well almost; the compiler doesn't know about the IO newtype so we
-have to work around that in the definition of catchException below).
+have to work around that in the definition of catch below).
 -}
 
 -- | Catch an exception in the 'IO' monad.
@@ -132,25 +142,66 @@
 -- @catchException undefined b == _|_@. See #exceptions_and_strictness#
 -- for details.
 catchException :: Exception e => IO a -> (e -> IO a) -> IO a
-catchException (IO io) handler = IO $ catch# io handler'
+catchException !io handler = catch io handler
+
+-- | This is the simplest of the exception-catching functions.  It
+-- takes a single argument, runs it, and if an exception is raised
+-- the \"handler\" is executed, with the value of the exception passed as an
+-- argument.  Otherwise, the result is returned as normal.  For example:
+--
+-- >   catch (readFile f)
+-- >         (\e -> do let err = show (e :: IOException)
+-- >                   hPutStr stderr ("Warning: Couldn't open " ++ f ++ ": " ++ err)
+-- >                   return "")
+--
+-- Note that we have to give a type signature to @e@, or the program
+-- will not typecheck as the type is ambiguous. While it is possible
+-- to catch exceptions of any type, see the section \"Catching all
+-- exceptions\" (in "Control.Exception") for an explanation of the problems with doing so.
+--
+-- For catching exceptions in pure (non-'IO') expressions, see the
+-- function 'evaluate'.
+--
+-- Note that due to Haskell\'s unspecified evaluation order, an
+-- expression may throw one of several possible exceptions: consider
+-- the expression @(error \"urk\") + (1 \`div\` 0)@.  Does
+-- the expression throw
+-- @ErrorCall \"urk\"@, or @DivideByZero@?
+--
+-- The answer is \"it might throw either\"; the choice is
+-- non-deterministic. If you are catching any type of exception then you
+-- might catch either. If you are calling @catch@ with type
+-- @IO Int -> (ArithException -> IO Int) -> IO Int@ then the handler may
+-- get run with @DivideByZero@ as an argument, or an @ErrorCall \"urk\"@
+-- exception may be propogated further up. If you call it again, you
+-- might get a the opposite behaviour. This is ok, because 'catch' is an
+-- 'IO' computation.
+--
+catch   :: Exception e
+        => IO a         -- ^ The computation to run
+        -> (e -> IO a)  -- ^ Handler to invoke if an exception is raised
+        -> IO a
+-- See #exceptions_and_strictness#.
+catch (IO io) handler = IO $ catch# io handler'
     where handler' e = case fromException e of
                        Just e' -> unIO (handler e')
                        Nothing -> raiseIO# e
 
+
 -- | Catch any 'Exception' type in the 'IO' monad.
 --
 -- Note that this function is /strict/ in the action. That is,
--- @catchException undefined b == _|_@. See #exceptions_and_strictness# for
+-- @catchAny undefined b == _|_@. See #exceptions_and_strictness# for
 -- details.
 catchAny :: IO a -> (forall e . Exception e => e -> IO a) -> IO a
-catchAny (IO io) handler = IO $ catch# io handler'
+catchAny !(IO io) handler = IO $ catch# io handler'
     where handler' (SomeException e) = unIO (handler e)
 
-
+-- Using catchException here means that if `m` throws an
+-- 'IOError' /as an imprecise exception/, we will not catch
+-- it. No one should really be doing that anyway.
 mplusIO :: IO a -> IO a -> IO a
-mplusIO m n = m `catchIOError` \ _ -> n
-    where catchIOError :: IO a -> (IOError -> IO a) -> IO a
-          catchIOError = catchException
+mplusIO m n = m `catchException` \ (_ :: IOError) -> n
 
 -- | A variant of 'throw' that can only be used within the 'IO' monad.
 --
@@ -284,7 +335,7 @@
 -- use @mask_ $ forkIO ...@.  This is particularly useful if you need
 -- to establish an exception handler in the forked thread before any
 -- asynchronous exceptions are received.  To create a a new thread in
--- an unmasked state use 'Control.Concurrent.forkIOUnmasked'.
+-- an unmasked state use 'Control.Concurrent.forkIOWithUnmask'.
 --
 mask  :: ((forall a. IO a -> IO a) -> IO b) -> IO b
 
@@ -387,28 +438,20 @@
 {- $exceptions_and_strictness
 
 Laziness can interact with @catch@-like operations in non-obvious ways (see,
-e.g. GHC Trac #11555). For instance, consider these subtly-different examples,
+e.g. GHC Trac #11555 and #13330). For instance, consider these subtly-different
+examples:
 
 > test1 = Control.Exception.catch (error "uh oh") (\(_ :: SomeException) -> putStrLn "it failed")
 >
 > test2 = GHC.IO.catchException (error "uh oh") (\(_ :: SomeException) -> putStrLn "it failed")
 
-While the first case is always guaranteed to print "it failed", the behavior of
-@test2@ may vary with optimization level.
-
-The unspecified behavior of @test2@ is due to the fact that GHC may assume that
-'catchException' (and the 'catch#' primitive operation which it is built upon)
-is strict in its first argument. This assumption allows the compiler to better
-optimize @catchException@ calls at the expense of deterministic behavior when
-the action may be bottom.
+While @test1@ will print "it failed", @test2@ will print "uh oh".
 
-Namely, the assumed strictness means that exceptions thrown while evaluating the
-action-to-be-executed may not be caught; only exceptions thrown during execution
-of the action will be handled by the exception handler.
+When using 'catchException', exceptions thrown while evaluating the
+action-to-be-executed will not be caught; only exceptions thrown during
+execution of the action will be handled by the exception handler.
 
 Since this strictness is a small optimization and may lead to surprising
 results, all of the @catch@ and @handle@ variants offered by "Control.Exception"
-are lazy in their first argument. If you are certain that that the action to be
-executed won't bottom in performance-sensitive code, you might consider using
-'GHC.IO.catchException' or 'GHC.IO.catchAny' for a small speed-up.
+use 'catch' rather than 'catchException'.
 -}
diff --git a/GHC/IO/Buffer.hs b/GHC/IO/Buffer.hs
--- a/GHC/IO/Buffer.hs
+++ b/GHC/IO/Buffer.hs
@@ -173,7 +173,7 @@
 --
 -- The "live" elements of the buffer are those between the 'bufL' and
 -- 'bufR' offsets.  In an empty buffer, 'bufL' is equal to 'bufR', but
--- they might not be zero: for exmaple, the buffer might correspond to
+-- they might not be zero: for example, the buffer might correspond to
 -- a memory-mapped file and in which case 'bufL' will point to the
 -- next location to be written, which is not necessarily the beginning
 -- of the file.
diff --git a/GHC/IO/Encoding.hs b/GHC/IO/Encoding.hs
--- a/GHC/IO/Encoding.hs
+++ b/GHC/IO/Encoding.hs
@@ -245,8 +245,16 @@
     "UTF32"   -> return $ UTF32.mkUTF32 cfm
     "UTF32LE" -> return $ UTF32.mkUTF32le cfm
     "UTF32BE" -> return $ UTF32.mkUTF32be cfm
-  -- ISO8859-1 we can handle ourselves as well
-    "ISO88591" -> return $ Latin1.mkLatin1 cfm
+    -- On AIX, we want to avoid iconv, because it is either
+    -- a) totally broken, or b) non-reentrant, or c) actually works.
+    -- Detecting b) is difficult as you'd have to trigger the reentrancy
+    -- corruption.
+    -- Therefore, on AIX, we handle the popular ASCII and latin1 encodings
+    -- ourselves. For consistency, we do the same on other platforms.
+    -- We use `mkLatin1_checked` instead of `mkLatin1`, since the latter
+    -- completely ignores the CodingFailureMode (TEST=encoding005).
+    _ | isAscii -> return (Latin1.mkAscii cfm)
+    _ | isLatin1 -> return (Latin1.mkLatin1_checked cfm)
 #if defined(mingw32_HOST_OS)
     'C':'P':n | [(cp,"")] <- reads n -> return $ CodePage.mkCodePageEncoding cfm cp
     _ -> unknownEncodingErr (enc ++ codingFailureModeSuffix cfm)
@@ -256,25 +264,21 @@
     -- Unfortunately there is no good way to determine whether iconv is actually
     -- functional without telling it to do something.
     _ -> do res <- Iconv.mkIconvEncoding cfm enc
-            let isAscii = any (== enc) ansiEncNames
             case res of
               Just e -> return e
-              -- At this point we know that we can't count on iconv to work
-              -- (see, for instance, Trac #10298). However, we still want to do
-              --  what we can to work with what we have. For instance, ASCII is
-              -- easy. We match on ASCII encodings directly using several
-              -- possible aliases (specified by RFC 1345 & Co) and for this use
-              -- the 'ascii' encoding
-              Nothing
-                | isAscii   -> return (Latin1.mkAscii cfm)
-                | otherwise ->
-                    unknownEncodingErr (enc ++ codingFailureModeSuffix cfm)
+              Nothing -> unknownEncodingErr (enc ++ codingFailureModeSuffix cfm)
+#endif
   where
-    ansiEncNames = -- ASCII aliases
+    isAscii = enc `elem` asciiEncNames
+    isLatin1 = enc `elem` latin1EncNames
+    asciiEncNames = -- ASCII aliases specified by RFC 1345 and RFC 3808.
       [ "ANSI_X3.4-1968", "iso-ir-6", "ANSI_X3.4-1986", "ISO_646.irv:1991"
       , "US-ASCII", "us", "IBM367", "cp367", "csASCII", "ASCII", "ISO646-US"
       ]
-#endif
+    latin1EncNames = -- latin1 aliases specified by RFC 1345 and RFC 3808.
+      [ "ISO_8859-1:1987", "iso-ir-100", "ISO_8859-1", "ISO-8859-1", "latin1",
+        "l1", "IBM819", "CP819", "csISOLatin1"
+      ]
 
 
 latin1_encode :: CharBuffer -> Buffer Word8 -> IO (CharBuffer, Buffer Word8)
diff --git a/GHC/IO/Encoding/CodePage/API.hs b/GHC/IO/Encoding/CodePage/API.hs
--- a/GHC/IO/Encoding/CodePage/API.hs
+++ b/GHC/IO/Encoding/CodePage/API.hs
@@ -64,6 +64,7 @@
     leadByte    :: [BYTE]  -- ^ Always of length mAX_LEADBYTES
   }
 
+-- | @since 4.7.0.0
 instance Storable CPINFO where
     sizeOf    _ = sizeOf (undefined :: UINT) + (mAX_DEFAULTCHAR + mAX_LEADBYTES) * sizeOf (undefined :: BYTE)
     alignment _ = alignment (undefined :: CInt)
diff --git a/GHC/IO/Encoding/Latin1.hs b/GHC/IO/Encoding/Latin1.hs
--- a/GHC/IO/Encoding/Latin1.hs
+++ b/GHC/IO/Encoding/Latin1.hs
@@ -50,7 +50,7 @@
 
 -- | @since 4.4.0.0
 mkLatin1 :: CodingFailureMode -> TextEncoding
-mkLatin1 cfm = TextEncoding { textEncodingName = "ISO8859-1",
+mkLatin1 cfm = TextEncoding { textEncodingName = "ISO-8859-1",
                               mkTextDecoder = latin1_DF cfm,
                               mkTextEncoder = latin1_EF cfm }
 
@@ -79,7 +79,7 @@
 
 -- | @since 4.4.0.0
 mkLatin1_checked :: CodingFailureMode -> TextEncoding
-mkLatin1_checked cfm = TextEncoding { textEncodingName = "ISO8859-1(checked)",
+mkLatin1_checked cfm = TextEncoding { textEncodingName = "ISO-8859-1",
                                       mkTextDecoder = latin1_DF cfm,
                                       mkTextEncoder = latin1_checked_EF cfm }
 
diff --git a/GHC/IO/Encoding/Types.hs b/GHC/IO/Encoding/Types.hs
--- a/GHC/IO/Encoding/Types.hs
+++ b/GHC/IO/Encoding/Types.hs
@@ -117,6 +117,7 @@
                    -- be shared between several character sequences or simultaneously across threads
   }
 
+-- | @since 4.3.0.0
 instance Show TextEncoding where
   -- | Returns the value of 'textEncodingName'
   show te = textEncodingName te
diff --git a/GHC/IO/Exception.hs b/GHC/IO/Exception.hs
--- a/GHC/IO/Exception.hs
+++ b/GHC/IO/Exception.hs
@@ -24,6 +24,8 @@
   Deadlock(..),
   AllocationLimitExceeded(..), allocationLimitExceeded,
   AssertionFailed(..),
+  CompactionFailed(..),
+  cannotCompactFunction, cannotCompactPinned, cannotCompactMutable,
 
   SomeAsyncException(..),
   asyncExceptionToException, asyncExceptionFromException,
@@ -64,8 +66,10 @@
 -- to the @MVar@ so it can't ever continue.
 data BlockedIndefinitelyOnMVar = BlockedIndefinitelyOnMVar
 
+-- | @since 4.1.0.0
 instance Exception BlockedIndefinitelyOnMVar
 
+-- | @since 4.1.0.0
 instance Show BlockedIndefinitelyOnMVar where
     showsPrec _ BlockedIndefinitelyOnMVar = showString "thread blocked indefinitely in an MVar operation"
 
@@ -78,8 +82,10 @@
 -- other references to any @TVar@s involved, so it can't ever continue.
 data BlockedIndefinitelyOnSTM = BlockedIndefinitelyOnSTM
 
+-- | @since 4.1.0.0
 instance Exception BlockedIndefinitelyOnSTM
 
+-- | @since 4.1.0.0
 instance Show BlockedIndefinitelyOnSTM where
     showsPrec _ BlockedIndefinitelyOnSTM = showString "thread blocked indefinitely in an STM transaction"
 
@@ -92,8 +98,10 @@
 -- The @Deadlock@ exception is raised in the main thread only.
 data Deadlock = Deadlock
 
+-- | @since 4.1.0.0
 instance Exception Deadlock
 
+-- | @since 4.1.0.0
 instance Show Deadlock where
     showsPrec _ Deadlock = showString "<<deadlock>>"
 
@@ -106,10 +114,12 @@
 -- @since 4.8.0.0
 data AllocationLimitExceeded = AllocationLimitExceeded
 
+-- | @since 4.8.0.0
 instance Exception AllocationLimitExceeded where
   toException = asyncExceptionToException
   fromException = asyncExceptionFromException
 
+-- | @since 4.7.1.0
 instance Show AllocationLimitExceeded where
     showsPrec _ AllocationLimitExceeded =
       showString "allocation limit exceeded"
@@ -119,11 +129,42 @@
 
 -----
 
+-- | Compaction found an object that cannot be compacted.  Functions
+-- cannot be compacted, nor can mutable objects or pinned objects.
+-- See 'GHC.Compact.compact'.
+--
+-- @since 4.10.0.0
+newtype CompactionFailed = CompactionFailed String
+
+-- | @since 4.10.0.0
+instance Exception CompactionFailed where
+
+-- | @since 4.10.0.0
+instance Show CompactionFailed where
+    showsPrec _ (CompactionFailed why) =
+      showString ("compaction failed: " ++ why)
+
+cannotCompactFunction :: SomeException -- for the RTS
+cannotCompactFunction =
+  toException (CompactionFailed "cannot compact functions")
+
+cannotCompactPinned :: SomeException -- for the RTS
+cannotCompactPinned =
+  toException (CompactionFailed "cannot compact pinned objects")
+
+cannotCompactMutable :: SomeException -- for the RTS
+cannotCompactMutable =
+  toException (CompactionFailed "cannot compact mutable objects")
+
+-----
+
 -- |'assert' was applied to 'False'.
 newtype AssertionFailed = AssertionFailed String
 
+-- | @since 4.1.0.0
 instance Exception AssertionFailed
 
+-- | @since 4.1.0.0
 instance Show AssertionFailed where
     showsPrec _ (AssertionFailed err) = showString err
 
@@ -134,9 +175,11 @@
 -- @since 4.7.0.0
 data SomeAsyncException = forall e . Exception e => SomeAsyncException e
 
+-- | @since 4.7.0.0
 instance Show SomeAsyncException where
     show (SomeAsyncException e) = show e
 
+-- | @since 4.7.0.0
 instance Exception SomeAsyncException
 
 -- |@since 4.7.0.0
@@ -164,8 +207,15 @@
         -- live data it has. Notes:
         --
         --   * It is undefined which thread receives this exception.
+        --     GHC currently throws this to the same thread that
+        --     receives 'UserInterrupt', but this may change in the
+        --     future.
         --
-        --   * GHC currently does not throw 'HeapOverflow' exceptions.
+        --   * The GHC RTS currently can only recover from heap overflow
+        --     if it detects that an explicit memory limit (set via RTS flags).
+        --     has been exceeded.  Currently, failure to allocate memory from
+        --     the operating system results in immediate termination of the
+        --     program.
   | ThreadKilled
         -- ^This exception is raised by another thread
         -- calling 'Control.Concurrent.killThread', or by the system
@@ -177,6 +227,7 @@
         -- via the usual mechanism(s) (e.g. Control-C in the console).
   deriving (Eq, Ord)
 
+-- | @since 4.7.0.0
 instance Exception AsyncException where
   toException = asyncExceptionToException
   fromException = asyncExceptionFromException
@@ -191,6 +242,7 @@
         -- array that had not been initialized.
   deriving (Eq, Ord)
 
+-- | @since 4.1.0.0
 instance Exception ArrayException
 
 -- for the RTS
@@ -198,12 +250,14 @@
 stackOverflow = toException StackOverflow
 heapOverflow  = toException HeapOverflow
 
+-- | @since 4.1.0.0
 instance Show AsyncException where
   showsPrec _ StackOverflow   = showString "stack overflow"
   showsPrec _ HeapOverflow    = showString "heap overflow"
   showsPrec _ ThreadKilled    = showString "thread killed"
   showsPrec _ UserInterrupt   = showString "user interrupt"
 
+-- | @since 4.1.0.0
 instance Show ArrayException where
   showsPrec _ (IndexOutOfBounds s)
         = showString "array index out of range"
@@ -230,6 +284,7 @@
                 -- may be prohibited (e.g. 0 on a POSIX-compliant system).
   deriving (Eq, Ord, Read, Show, Generic)
 
+-- | @since 4.1.0.0
 instance Exception ExitCode
 
 ioException     :: IOException -> IO a
@@ -265,8 +320,10 @@
      ioe_filename :: Maybe FilePath  -- filename the error is related to.
    }
 
+-- | @since 4.1.0.0
 instance Exception IOException
 
+-- | @since 4.1.0.0
 instance Eq IOException where
   (IOError h1 e1 loc1 str1 en1 fn1) == (IOError h2 e2 loc2 str2 en2 fn2) =
     e1==e2 && str1==str2 && h1==h2 && loc1==loc2 && en1==en2 && fn1==fn2
@@ -295,9 +352,11 @@
   | ResourceVanished
   | Interrupted
 
+-- | @since 4.1.0.0
 instance Eq IOErrorType where
    x == y = isTrue# (getTag x ==# getTag y)
 
+-- | @since 4.1.0.0
 instance Show IOErrorType where
   showsPrec _ e =
     showString $
@@ -336,6 +395,7 @@
 -- ---------------------------------------------------------------------------
 -- Showing IOErrors
 
+-- | @since 4.1.0.0
 instance Show IOException where
     showsPrec p (IOError hdl iot loc s _ fn) =
       (case fn of
diff --git a/GHC/IO/FD.hs b/GHC/IO/FD.hs
--- a/GHC/IO/FD.hs
+++ b/GHC/IO/FD.hs
@@ -88,15 +88,18 @@
 fdIsSocket fd = fdIsSocket_ fd /= 0
 #endif
 
+-- | @since 4.1.0.0
 instance Show FD where
   show fd = show (fdFD fd)
 
+-- | @since 4.1.0.0
 instance GHC.IO.Device.RawIO FD where
   read             = fdRead
   readNonBlocking  = fdReadNonBlocking
   write            = fdWrite
   writeNonBlocking = fdWriteNonBlocking
 
+-- | @since 4.1.0.0
 instance GHC.IO.Device.IODevice FD where
   ready         = ready
   close         = close
@@ -118,8 +121,9 @@
 -- varies too much though: it is 512 on Windows, 1024 on OS X and 8192
 -- on Linux.  So let's just use a decent size on every platform:
 dEFAULT_FD_BUFFER_SIZE :: Int
-dEFAULT_FD_BUFFER_SIZE = 8096
+dEFAULT_FD_BUFFER_SIZE = 8192
 
+-- | @since 4.1.0.0
 instance BufferedIO FD where
   newBuffer _dev state = newByteBuffer dEFAULT_FD_BUFFER_SIZE state
   fillReadBuffer    fd buf = readBuf' fd buf
@@ -496,7 +500,7 @@
 -}
 
 readRawBufferPtr :: String -> FD -> Ptr Word8 -> Int -> CSize -> IO Int
-readRawBufferPtr loc !fd buf off len
+readRawBufferPtr loc !fd !buf !off !len
   | isNonBlocking fd = unsafe_read -- unsafe is ok, it can't block
   | otherwise    = do r <- throwErrnoIfMinus1 loc
                                 (unsafe_fdReady (fdFD fd) 0 0 0)
@@ -513,7 +517,7 @@
 
 -- return: -1 indicates EOF, >=0 is bytes read
 readRawBufferPtrNoBlock :: String -> FD -> Ptr Word8 -> Int -> CSize -> IO Int
-readRawBufferPtrNoBlock loc !fd buf off len
+readRawBufferPtrNoBlock loc !fd !buf !off !len
   | isNonBlocking fd  = unsafe_read -- unsafe is ok, it can't block
   | otherwise    = do r <- unsafe_fdReady (fdFD fd) 0 0 0
                       if r /= 0 then safe_read
@@ -529,7 +533,7 @@
    safe_read    = do_read (c_safe_read (fdFD fd) (buf `plusPtr` off) len)
 
 writeRawBufferPtr :: String -> FD -> Ptr Word8 -> Int -> CSize -> IO CInt
-writeRawBufferPtr loc !fd buf off len
+writeRawBufferPtr loc !fd !buf !off !len
   | isNonBlocking fd = unsafe_write -- unsafe is ok, it can't block
   | otherwise   = do r <- unsafe_fdReady (fdFD fd) 1 0 0
                      if r /= 0
@@ -544,7 +548,7 @@
     safe_write    = do_write (c_safe_write (fdFD fd) (buf `plusPtr` off) len)
 
 writeRawBufferPtrNoBlock :: String -> FD -> Ptr Word8 -> Int -> CSize -> IO CInt
-writeRawBufferPtrNoBlock loc !fd buf off len
+writeRawBufferPtrNoBlock loc !fd !buf !off !len
   | isNonBlocking fd = unsafe_write -- unsafe is ok, it can't block
   | otherwise   = do r <- unsafe_fdReady (fdFD fd) 1 0 0
                      if r /= 0 then write
@@ -567,12 +571,12 @@
 #else /* mingw32_HOST_OS.... */
 
 readRawBufferPtr :: String -> FD -> Ptr Word8 -> Int -> CSize -> IO CInt
-readRawBufferPtr loc !fd buf off len
+readRawBufferPtr loc !fd !buf !off !len
   | threaded  = blockingReadRawBufferPtr loc fd buf off len
   | otherwise = asyncReadRawBufferPtr    loc fd buf off len
 
 writeRawBufferPtr :: String -> FD -> Ptr Word8 -> Int -> CSize -> IO CInt
-writeRawBufferPtr loc !fd buf off len
+writeRawBufferPtr loc !fd !buf !off !len
   | threaded  = blockingWriteRawBufferPtr loc fd buf off len
   | otherwise = asyncWriteRawBufferPtr    loc fd buf off len
 
@@ -585,7 +589,7 @@
 -- Async versions of the read/write primitives, for the non-threaded RTS
 
 asyncReadRawBufferPtr :: String -> FD -> Ptr Word8 -> Int -> CSize -> IO CInt
-asyncReadRawBufferPtr loc !fd buf off len = do
+asyncReadRawBufferPtr loc !fd !buf !off !len = do
     (l, rc) <- asyncRead (fromIntegral (fdFD fd)) (fdIsSocket_ fd)
                         (fromIntegral len) (buf `plusPtr` off)
     if l == (-1)
@@ -594,7 +598,7 @@
       else return (fromIntegral l)
 
 asyncWriteRawBufferPtr :: String -> FD -> Ptr Word8 -> Int -> CSize -> IO CInt
-asyncWriteRawBufferPtr loc !fd buf off len = do
+asyncWriteRawBufferPtr loc !fd !buf !off !len = do
     (l, rc) <- asyncWrite (fromIntegral (fdFD fd)) (fdIsSocket_ fd)
                   (fromIntegral len) (buf `plusPtr` off)
     if l == (-1)
@@ -605,14 +609,14 @@
 -- Blocking versions of the read/write primitives, for the threaded RTS
 
 blockingReadRawBufferPtr :: String -> FD -> Ptr Word8 -> Int -> CSize -> IO CInt
-blockingReadRawBufferPtr loc fd buf off len
+blockingReadRawBufferPtr loc !fd !buf !off !len
   = throwErrnoIfMinus1Retry loc $
         if fdIsSocket fd
            then c_safe_recv (fdFD fd) (buf `plusPtr` off) (fromIntegral len) 0
            else c_safe_read (fdFD fd) (buf `plusPtr` off) (fromIntegral len)
 
 blockingWriteRawBufferPtr :: String -> FD -> Ptr Word8-> Int -> CSize -> IO CInt
-blockingWriteRawBufferPtr loc fd buf off len
+blockingWriteRawBufferPtr loc !fd !buf !off !len
   = throwErrnoIfMinus1Retry loc $
         if fdIsSocket fd
            then c_safe_send  (fdFD fd) (buf `plusPtr` off) (fromIntegral len) 0
@@ -638,7 +642,7 @@
 
 #endif
 
-foreign import ccall "rtsSupportsBoundThreads" threaded :: Bool
+foreign import ccall unsafe "rtsSupportsBoundThreads" threaded :: Bool
 
 -- -----------------------------------------------------------------------------
 -- utils
diff --git a/GHC/IO/Handle.hs b/GHC/IO/Handle.hs
--- a/GHC/IO/Handle.hs
+++ b/GHC/IO/Handle.hs
@@ -26,12 +26,14 @@
 
    mkFileHandle, mkDuplexHandle,
 
-   hFileSize, hSetFileSize, hIsEOF, hLookAhead,
+   hFileSize, hSetFileSize, hIsEOF, isEOF, hLookAhead,
    hSetBuffering, hSetBinaryMode, hSetEncoding, hGetEncoding,
    hFlush, hFlushAll, hDuplicate, hDuplicateTo,
 
    hClose, hClose_help,
 
+   LockMode(..), hLock, hTryLock,
+
    HandlePosition, HandlePosn(..), hGetPosn, hSetPosn,
    SeekMode(..), hSeek, hTell,
 
@@ -54,6 +56,8 @@
 import GHC.IO.Buffer
 import GHC.IO.BufferedIO ( BufferedIO )
 import GHC.IO.Device as IODevice
+import GHC.IO.Handle.FD
+import GHC.IO.Handle.Lock
 import GHC.IO.Handle.Types
 import GHC.IO.Handle.Internals
 import GHC.IO.Handle.Text
@@ -162,6 +166,15 @@
              return False
 
 -- ---------------------------------------------------------------------------
+-- isEOF
+
+-- | The computation 'isEOF' is identical to 'hIsEOF',
+-- except that it works only on 'stdin'.
+
+isEOF :: IO Bool
+isEOF = hIsEOF stdin
+
+-- ---------------------------------------------------------------------------
 -- Looking ahead
 
 -- | Computation 'hLookAhead' returns the next character from the handle
@@ -316,9 +329,11 @@
 
 data HandlePosn = HandlePosn Handle HandlePosition
 
+-- | @since 4.1.0.0
 instance Eq HandlePosn where
     (HandlePosn h1 p1) == (HandlePosn h2 p2) = p1==p2 && h1==h2
 
+-- | @since 4.1.0.0
 instance Show HandlePosn where
    showsPrec p (HandlePosn h pos) =
         showsPrec p h . showString " at position " . shows pos
diff --git a/GHC/IO/Handle/FD.hs b/GHC/IO/Handle/FD.hs
--- a/GHC/IO/Handle/FD.hs
+++ b/GHC/IO/Handle/FD.hs
@@ -18,13 +18,13 @@
 module GHC.IO.Handle.FD ( 
   stdin, stdout, stderr,
   openFile, openBinaryFile, openFileBlocking,
-  mkHandleFromFD, fdToHandle, fdToHandle',
-  isEOF
+  mkHandleFromFD, fdToHandle, fdToHandle', handleToFd
  ) where
 
 import GHC.Base
 import GHC.Show
 import Data.Maybe
+import Data.Typeable
 import Foreign.C.Types
 import GHC.MVar
 import GHC.IO
@@ -32,7 +32,6 @@
 import GHC.IO.Device as IODevice
 import GHC.IO.Exception
 import GHC.IO.IOMode
-import GHC.IO.Handle
 import GHC.IO.Handle.Types
 import GHC.IO.Handle.Internals
 import qualified GHC.IO.FD as FD
@@ -105,15 +104,6 @@
 #endif
 
 -- ---------------------------------------------------------------------------
--- isEOF
-
--- | The computation 'isEOF' is identical to 'hIsEOF',
--- except that it works only on 'stdin'.
-
-isEOF :: IO Bool
-isEOF = hIsEOF stdin
-
--- ---------------------------------------------------------------------------
 -- Opening and Closing Files
 
 addFilePathToIOError :: String -> FilePath -> IOException -> IOException
@@ -199,7 +189,7 @@
 
 
 -- ---------------------------------------------------------------------------
--- Converting file descriptors to Handles
+-- Converting file descriptors from/to Handles
 
 mkHandleFromFD
    :: FD.FD
@@ -282,6 +272,21 @@
    let fd_str = "<file descriptor: " ++ show fd ++ ">"
    mkHandleFromFD fd fd_type fd_str iomode False{-non-block-} 
                   Nothing -- bin mode
+
+-- | Turn an existing Handle into a file descriptor. This function throws an
+-- IOError if the Handle does not reference a file descriptor.
+handleToFd :: Handle -> IO FD.FD
+handleToFd h = case h of
+  FileHandle _ mv -> do
+    Handle__{haDevice = dev} <- readMVar mv
+    case cast dev of
+      Just fd -> return fd
+      Nothing -> throwErr "not a file descriptor"
+  DuplexHandle{} -> throwErr "not a file handle"
+  where
+    throwErr msg = ioException $ IOError (Just h)
+      InappropriateType "handleToFd" msg Nothing Nothing
+
 
 -- ---------------------------------------------------------------------------
 -- Are files opened by default in text or binary mode, if the user doesn't
diff --git a/GHC/IO/Handle/Lock.hsc b/GHC/IO/Handle/Lock.hsc
new file mode 100644
--- /dev/null
+++ b/GHC/IO/Handle/Lock.hsc
@@ -0,0 +1,164 @@
+{-# LANGUAGE CPP #-}
+{-# LANGUAGE InterruptibleFFI #-}
+{-# LANGUAGE LambdaCase #-}
+{-# LANGUAGE MultiWayIf #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+module GHC.IO.Handle.Lock (
+    FileLockingNotSupported(..)
+  , LockMode(..)
+  , hLock
+  , hTryLock
+  ) where
+
+#include "HsBaseConfig.h"
+
+#if HAVE_FLOCK
+
+#include <sys/file.h>
+
+import Data.Bits
+import Data.Function
+import Foreign.C.Error
+import Foreign.C.Types
+import GHC.IO.Exception
+import GHC.IO.FD
+import GHC.IO.Handle.FD
+
+#elif defined(mingw32_HOST_OS)
+
+#if defined(i386_HOST_ARCH)
+## define WINDOWS_CCONV stdcall
+#elif defined(x86_64_HOST_ARCH)
+## define WINDOWS_CCONV ccall
+#else
+# error Unknown mingw32 arch
+#endif
+
+#include <windows.h>
+
+import Data.Bits
+import Data.Function
+import Foreign.C.Error
+import Foreign.C.Types
+import Foreign.Marshal.Alloc
+import Foreign.Marshal.Utils
+import GHC.IO.FD
+import GHC.IO.Handle.FD
+import GHC.Ptr
+import GHC.Windows
+
+#else
+
+import GHC.IO (throwIO)
+
+#endif
+
+import Data.Functor
+import GHC.Base
+import GHC.Exception
+import GHC.IO.Handle.Types
+import GHC.Show
+
+-- | Exception thrown by 'hLock' on non-Windows platforms that don't support
+-- 'flock'.
+data FileLockingNotSupported = FileLockingNotSupported
+  deriving Show
+
+instance Exception FileLockingNotSupported
+
+-- | Indicates a mode in which a file should be locked.
+data LockMode = SharedLock | ExclusiveLock
+
+-- | If a 'Handle' references a file descriptor, attempt to lock contents of the
+-- underlying file in appropriate mode. If the file is already locked in
+-- incompatible mode, this function blocks until the lock is established. The
+-- lock is automatically released upon closing a 'Handle'.
+--
+-- Things to be aware of:
+--
+-- 1) This function may block inside a C call. If it does, in order to be able
+-- to interrupt it with asynchronous exceptions and/or for other threads to
+-- continue working, you MUST use threaded version of the runtime system.
+--
+-- 2) The implementation uses 'LockFileEx' on Windows and 'flock' otherwise,
+-- hence all of their caveats also apply here.
+--
+-- 3) On non-Windows plaftorms that don't support 'flock' (e.g. Solaris) this
+-- function throws 'FileLockingNotImplemented'. We deliberately choose to not
+-- provide fcntl based locking instead because of its broken semantics.
+--
+-- @since 4.10.0.0
+hLock :: Handle -> LockMode -> IO ()
+hLock h mode = void $ lockImpl h "hLock" mode True
+
+-- | Non-blocking version of 'hLock'.
+--
+-- @since 4.10.0.0
+hTryLock :: Handle -> LockMode -> IO Bool
+hTryLock h mode = lockImpl h "hTryLock" mode False
+
+----------------------------------------
+
+#if HAVE_FLOCK
+
+lockImpl :: Handle -> String -> LockMode -> Bool -> IO Bool
+lockImpl h ctx mode block = do
+  FD{fdFD = fd} <- handleToFd h
+  let flags = cmode .|. (if block then 0 else #{const LOCK_NB})
+  fix $ \retry -> c_flock fd flags >>= \case
+    0 -> return True
+    _ -> getErrno >>= \errno -> if
+      | not block && errno == eWOULDBLOCK -> return False
+      | errno == eINTR -> retry
+      | otherwise -> ioException $ errnoToIOError ctx errno (Just h) Nothing
+  where
+    cmode = case mode of
+      SharedLock    -> #{const LOCK_SH}
+      ExclusiveLock -> #{const LOCK_EX}
+
+foreign import ccall interruptible "flock"
+  c_flock :: CInt -> CInt -> IO CInt
+
+#elif defined(mingw32_HOST_OS)
+
+lockImpl :: Handle -> String -> LockMode -> Bool -> IO Bool
+lockImpl h ctx mode block = do
+  FD{fdFD = fd} <- handleToFd h
+  wh <- throwErrnoIf (== iNVALID_HANDLE_VALUE) ctx $ c_get_osfhandle fd
+  allocaBytes sizeof_OVERLAPPED $ \ovrlpd -> do
+    fillBytes ovrlpd 0 sizeof_OVERLAPPED
+    let flags = cmode .|. (if block then 0 else #{const LOCKFILE_FAIL_IMMEDIATELY})
+    -- We want to lock the whole file without looking up its size to be
+    -- consistent with what flock does. According to documentation of LockFileEx
+    -- "locking a region that goes beyond the current end-of-file position is
+    -- not an error", however some versions of Windows seem to have issues with
+    -- large regions and set ERROR_INVALID_LOCK_RANGE in such case for
+    -- mysterious reasons. Work around that by setting only low 32 bits.
+    fix $ \retry -> c_LockFileEx wh flags 0 0xffffffff 0xffffffff ovrlpd >>= \case
+      True  -> return True
+      False -> getLastError >>= \err -> if
+        | not block && err == #{const ERROR_LOCK_VIOLATION} -> return False
+        | err == #{const ERROR_OPERATION_ABORTED} -> retry
+        | otherwise -> failWith ctx err
+  where
+    sizeof_OVERLAPPED = #{size OVERLAPPED}
+
+    cmode = case mode of
+      SharedLock    -> 0
+      ExclusiveLock -> #{const LOCKFILE_EXCLUSIVE_LOCK}
+
+-- https://msdn.microsoft.com/en-us/library/aa297958.aspx
+foreign import ccall unsafe "_get_osfhandle"
+  c_get_osfhandle :: CInt -> IO HANDLE
+
+-- https://msdn.microsoft.com/en-us/library/windows/desktop/aa365203.aspx
+foreign import WINDOWS_CCONV interruptible "LockFileEx"
+  c_LockFileEx :: HANDLE -> DWORD -> DWORD -> DWORD -> DWORD -> Ptr () -> IO BOOL
+
+#else
+
+-- | No-op implementation.
+lockImpl :: Handle -> String -> LockMode -> Bool -> IO Bool
+lockImpl _ _ _ _ = throwIO FileLockingNotSupported
+
+#endif
diff --git a/GHC/IO/Handle/Text.hs b/GHC/IO/Handle/Text.hs
--- a/GHC/IO/Handle/Text.hs
+++ b/GHC/IO/Handle/Text.hs
@@ -736,20 +736,40 @@
   old_buf@Buffer{ bufRaw=old_raw, bufR=w, bufSize=size }
      <- readIORef haByteBuffer
 
-  -- enough room in handle buffer?
-  if (size - w > count)
-        -- There's enough room in the buffer:
+  -- TODO: Possible optimisation:
+  --       If we know that `w + count > size`, we should write both the
+  --       handle buffer and the `ptr` in a single `writev()` syscall.
+
+  -- Need to buffer and enough room in handle buffer?
+  -- There's no need to buffer if the data to be written is larger than
+  -- the handle buffer (`count >= size`).
+  if (count < size && count <= size - w)
+        -- We need to buffer and there's enough room in the buffer:
         -- just copy the data in and update bufR.
         then do debugIO ("hPutBuf: copying to buffer, w=" ++ show w)
                 copyToRawBuffer old_raw w ptr count
-                writeIORef haByteBuffer old_buf{ bufR = w + count }
+                let copied_buf = old_buf{ bufR = w + count }
+                -- If the write filled the buffer completely, we need to flush,
+                -- to maintain the "INVARIANTS on Buffers" from
+                -- GHC.IO.Buffer.checkBuffer: "a write buffer is never full".
+                if (count == size - w)
+                  then do
+                    debugIO "hPutBuf: flushing full buffer after writing"
+                    flushed_buf <- Buffered.flushWriteBuffer haDevice copied_buf
+                            -- TODO: we should do a non-blocking flush here
+                    writeIORef haByteBuffer flushed_buf
+                  else do
+                    writeIORef haByteBuffer copied_buf
                 return count
 
-        -- else, we have to flush
-        else do debugIO "hPutBuf: flushing first"
-                old_buf' <- Buffered.flushWriteBuffer haDevice old_buf
-                        -- TODO: we should do a non-blocking flush here
-                writeIORef haByteBuffer old_buf'
+        -- else, we have to flush any existing handle buffer data
+        -- and can then write out the data in `ptr` directly.
+        else do -- No point flushing when there's nothing in the buffer.
+                when (w > 0) $ do
+                  debugIO "hPutBuf: flushing first"
+                  flushed_buf <- Buffered.flushWriteBuffer haDevice old_buf
+                          -- TODO: we should do a non-blocking flush here
+                  writeIORef haByteBuffer flushed_buf
                 -- if we can fit in the buffer, then just loop
                 if count < size
                    then bufWrite h_ ptr count can_block
diff --git a/GHC/IO/Handle/Types.hs b/GHC/IO/Handle/Types.hs
--- a/GHC/IO/Handle/Types.hs
+++ b/GHC/IO/Handle/Types.hs
@@ -112,6 +112,7 @@
 --    * A 'FileHandle' is seekable.  A 'DuplexHandle' may or may not be
 --      seekable.
 
+-- | @since 4.1.0.0
 instance Eq Handle where
  (FileHandle _ h1)     == (FileHandle _ h2)     = h1 == h2
  (DuplexHandle _ h1 _) == (DuplexHandle _ h2 _) = h1 == h2
@@ -407,6 +408,7 @@
 -- we provide a more user-friendly Show instance for it
 -- than the derived one.
 
+-- | @since 4.1.0.0
 instance Show HandleType where
   showsPrec _ t =
     case t of
@@ -417,6 +419,7 @@
       AppendHandle      -> showString "writable (append)"
       ReadWriteHandle   -> showString "read-writable"
 
+-- | @since 4.1.0.0
 instance Show Handle where
   showsPrec _ (FileHandle   file _)   = showHandle file
   showsPrec _ (DuplexHandle file _ _) = showHandle file
diff --git a/GHC/IO/Unsafe.hs b/GHC/IO/Unsafe.hs
--- a/GHC/IO/Unsafe.hs
+++ b/GHC/IO/Unsafe.hs
@@ -103,35 +103,8 @@
 unsafeDupablePerformIO  :: IO a -> a
 unsafeDupablePerformIO (IO m) = case runRW# m of (# _, a #) -> a
 
--- Note [unsafeDupablePerformIO is NOINLINE]
--- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
--- Why do we NOINLINE unsafeDupablePerformIO?  See the comment with
--- GHC.ST.runST.  Essentially the issue is that the IO computation
--- inside unsafePerformIO must be atomic: it must either all run, or
--- not at all.  If we let the compiler see the application of the IO
--- to realWorld#, it might float out part of the IO.
-
--- Note [unsafeDupablePerformIO has a lazy RHS]
--- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
--- Why is there a call to 'lazy' in unsafeDupablePerformIO?
--- If we don't have it, the demand analyser discovers the following strictness
--- for unsafeDupablePerformIO:  C(U(AV))
--- But then consider
---      unsafeDupablePerformIO (\s -> let r = f x in
---                             case writeIORef v r s of (# s1, _ #) ->
---                             (# s1, r #) )
--- The strictness analyser will find that the binding for r is strict,
--- (because of uPIO's strictness sig), and so it'll evaluate it before
--- doing the writeIORef.  This actually makes libraries/base/tests/memo002
--- get a deadlock, where we specifically wanted to write a lazy thunk
--- into the ref cell.
---
--- Solution: don't expose the strictness of unsafeDupablePerformIO,
---           by hiding it with 'lazy'
--- But see discussion in Trac #9390 (comment:33)
-
 {-|
-'unsafeInterleaveIO' allows 'IO' computation to be deferred lazily.
+'unsafeInterleaveIO' allows an 'IO' computation to be deferred lazily.
 When passed a value of type @IO a@, the 'IO' will only be performed
 when the value of the @a@ is demanded.  This is used to implement lazy
 file reading, see 'System.IO.hGetContents'.
@@ -140,6 +113,9 @@
 unsafeInterleaveIO :: IO a -> IO a
 unsafeInterleaveIO m = unsafeDupableInterleaveIO (noDuplicate >> m)
 
+-- Note [unsafeDupableInterleaveIO should not be inlined]
+-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+--
 -- We used to believe that INLINE on unsafeInterleaveIO was safe,
 -- because the state from this IO thread is passed explicitly to the
 -- interleaved IO, so it cannot be floated out and shared.
@@ -158,7 +134,18 @@
 -- share and sometimes not (plus it probably breaks the noDuplicate).
 -- So now, we do not inline unsafeDupableInterleaveIO.
 
+{-|
+'unsafeDupableInterleaveIO' allows an 'IO' computation to be deferred lazily.
+When passed a value of type @IO a@, the 'IO' will only be performed
+when the value of the @a@ is demanded.
+
+The computation may be performed multiple times by different threads,
+possibly at the same time. To ensure that the computation is performed
+only once, use 'unsafeInterleaveIO' instead.
+-}
+
 {-# NOINLINE unsafeDupableInterleaveIO #-}
+-- See Note [unsafeDupableInterleaveIO should not be inlined]
 unsafeDupableInterleaveIO :: IO a -> IO a
 unsafeDupableInterleaveIO (IO m)
   = IO ( \ s -> let
diff --git a/GHC/IOArray.hs b/GHC/IOArray.hs
--- a/GHC/IOArray.hs
+++ b/GHC/IOArray.hs
@@ -44,6 +44,7 @@
 type role IOArray nominal representational
 
 -- explicit instance because Haddock can't figure out a derived one
+-- | @since 4.1.0.0
 instance Eq (IOArray i e) where
   IOArray x == IOArray y = x == y
 
diff --git a/GHC/IORef.hs b/GHC/IORef.hs
--- a/GHC/IORef.hs
+++ b/GHC/IORef.hs
@@ -33,6 +33,7 @@
 newtype IORef a = IORef (STRef RealWorld a)
 
 -- explicit instance because Haddock can't figure out a derived one
+-- | @since 4.1.0.0
 instance Eq (IORef a) where
   IORef x == IORef y = x == y
 
diff --git a/GHC/Int.hs b/GHC/Int.hs
--- a/GHC/Int.hs
+++ b/GHC/Int.hs
@@ -58,6 +58,7 @@
 -- ^ 8-bit signed integer type
 
 -- See GHC.Classes#matching_overloaded_methods_in_rules
+-- | @since 2.01
 instance Eq Int8 where
     (==) = eqInt8
     (/=) = neInt8
@@ -68,6 +69,7 @@
 {-# INLINE [1] eqInt8 #-}
 {-# INLINE [1] neInt8 #-}
 
+-- | @since 2.01
 instance Ord Int8 where
     (<)  = ltInt8
     (<=) = leInt8
@@ -84,9 +86,11 @@
 (I8# x) `ltInt8` (I8# y) = isTrue# (x <#  y)
 (I8# x) `leInt8` (I8# y) = isTrue# (x <=# y)
 
+-- | @since 2.01
 instance Show Int8 where
     showsPrec p x = showsPrec p (fromIntegral x :: Int)
 
+-- | @since 2.01
 instance Num Int8 where
     (I8# x#) + (I8# y#)    = I8# (narrow8Int# (x# +# y#))
     (I8# x#) - (I8# y#)    = I8# (narrow8Int# (x# -# y#))
@@ -99,9 +103,11 @@
     signum _               = -1
     fromInteger i          = I8# (narrow8Int# (integerToInt i))
 
+-- | @since 2.01
 instance Real Int8 where
     toRational x = toInteger x % 1
 
+-- | @since 2.01
 instance Enum Int8 where
     succ x
         | x /= maxBound = x + 1
@@ -117,6 +123,7 @@
     enumFrom            = boundedEnumFrom
     enumFromThen        = boundedEnumFromThen
 
+-- | @since 2.01
 instance Integral Int8 where
     quot    x@(I8# x#) y@(I8# y#)
         | y == 0                     = divZeroError
@@ -150,18 +157,22 @@
                                             I8# (narrow8Int# m))
     toInteger (I8# x#)               = smallInteger x#
 
+-- | @since 2.01
 instance Bounded Int8 where
     minBound = -0x80
     maxBound =  0x7F
 
+-- | @since 2.01
 instance Ix Int8 where
     range (m,n)         = [m..n]
     unsafeIndex (m,_) i = fromIntegral i - fromIntegral m
     inRange (m,n) i     = m <= i && i <= n
 
+-- | @since 2.01
 instance Read Int8 where
     readsPrec p s = [(fromIntegral (x::Int), r) | (x, r) <- readsPrec p s]
 
+-- | @since 2.01
 instance Bits Int8 where
     {-# INLINE shift #-}
     {-# INLINE bit #-}
@@ -194,6 +205,7 @@
     bit                       = bitDefault
     testBit                   = testBitDefault
 
+-- | @since 4.6.0.0
 instance FiniteBits Int8 where
     finiteBitSize _ = 8
     countLeadingZeros  (I8# x#) = I# (word2Int# (clz8# (int2Word# x#)))
@@ -246,6 +258,7 @@
 -- ^ 16-bit signed integer type
 
 -- See GHC.Classes#matching_overloaded_methods_in_rules
+-- | @since 2.01
 instance Eq Int16 where
     (==) = eqInt16
     (/=) = neInt16
@@ -256,6 +269,7 @@
 {-# INLINE [1] eqInt16 #-}
 {-# INLINE [1] neInt16 #-}
 
+-- | @since 2.01
 instance Ord Int16 where
     (<)  = ltInt16
     (<=) = leInt16
@@ -272,9 +286,11 @@
 (I16# x) `ltInt16` (I16# y) = isTrue# (x <#  y)
 (I16# x) `leInt16` (I16# y) = isTrue# (x <=# y)
 
+-- | @since 2.01
 instance Show Int16 where
     showsPrec p x = showsPrec p (fromIntegral x :: Int)
 
+-- | @since 2.01
 instance Num Int16 where
     (I16# x#) + (I16# y#)  = I16# (narrow16Int# (x# +# y#))
     (I16# x#) - (I16# y#)  = I16# (narrow16Int# (x# -# y#))
@@ -287,9 +303,11 @@
     signum _               = -1
     fromInteger i          = I16# (narrow16Int# (integerToInt i))
 
+-- | @since 2.01
 instance Real Int16 where
     toRational x = toInteger x % 1
 
+-- | @since 2.01
 instance Enum Int16 where
     succ x
         | x /= maxBound = x + 1
@@ -305,6 +323,7 @@
     enumFrom            = boundedEnumFrom
     enumFromThen        = boundedEnumFromThen
 
+-- | @since 2.01
 instance Integral Int16 where
     quot    x@(I16# x#) y@(I16# y#)
         | y == 0                     = divZeroError
@@ -338,18 +357,22 @@
                                             I16# (narrow16Int# m))
     toInteger (I16# x#)              = smallInteger x#
 
+-- | @since 2.01
 instance Bounded Int16 where
     minBound = -0x8000
     maxBound =  0x7FFF
 
+-- | @since 2.01
 instance Ix Int16 where
     range (m,n)         = [m..n]
     unsafeIndex (m,_) i = fromIntegral i - fromIntegral m
     inRange (m,n) i     = m <= i && i <= n
 
+-- | @since 2.01
 instance Read Int16 where
     readsPrec p s = [(fromIntegral (x::Int), r) | (x, r) <- readsPrec p s]
 
+-- | @since 2.01
 instance Bits Int16 where
     {-# INLINE shift #-}
     {-# INLINE bit #-}
@@ -382,6 +405,7 @@
     bit                        = bitDefault
     testBit                    = testBitDefault
 
+-- | @since 4.6.0.0
 instance FiniteBits Int16 where
     finiteBitSize _ = 16
     countLeadingZeros  (I16# x#) = I# (word2Int# (clz16# (int2Word# x#)))
@@ -439,6 +463,7 @@
 -- ^ 32-bit signed integer type
 
 -- See GHC.Classes#matching_overloaded_methods_in_rules
+-- | @since 2.01
 instance Eq Int32 where
     (==) = eqInt32
     (/=) = neInt32
@@ -449,6 +474,7 @@
 {-# INLINE [1] eqInt32 #-}
 {-# INLINE [1] neInt32 #-}
 
+-- | @since 2.01
 instance Ord Int32 where
     (<)  = ltInt32
     (<=) = leInt32
@@ -465,9 +491,11 @@
 (I32# x) `ltInt32` (I32# y) = isTrue# (x <#  y)
 (I32# x) `leInt32` (I32# y) = isTrue# (x <=# y)
 
+-- | @since 2.01
 instance Show Int32 where
     showsPrec p x = showsPrec p (fromIntegral x :: Int)
 
+-- | @since 2.01
 instance Num Int32 where
     (I32# x#) + (I32# y#)  = I32# (narrow32Int# (x# +# y#))
     (I32# x#) - (I32# y#)  = I32# (narrow32Int# (x# -# y#))
@@ -480,6 +508,7 @@
     signum _               = -1
     fromInteger i          = I32# (narrow32Int# (integerToInt i))
 
+-- | @since 2.01
 instance Enum Int32 where
     succ x
         | x /= maxBound = x + 1
@@ -499,6 +528,7 @@
     enumFrom            = boundedEnumFrom
     enumFromThen        = boundedEnumFromThen
 
+-- | @since 2.01
 instance Integral Int32 where
     quot    x@(I32# x#) y@(I32# y#)
         | y == 0                     = divZeroError
@@ -540,9 +570,11 @@
                                             I32# (narrow32Int# m))
     toInteger (I32# x#)              = smallInteger x#
 
+-- | @since 2.01
 instance Read Int32 where
     readsPrec p s = [(fromIntegral (x::Int), r) | (x, r) <- readsPrec p s]
 
+-- | @since 2.01
 instance Bits Int32 where
     {-# INLINE shift #-}
     {-# INLINE bit #-}
@@ -576,6 +608,7 @@
     bit                        = bitDefault
     testBit                    = testBitDefault
 
+-- | @since 4.6.0.0
 instance FiniteBits Int32 where
     finiteBitSize _ = 32
     countLeadingZeros  (I32# x#) = I# (word2Int# (clz32# (int2Word# x#)))
@@ -621,13 +654,16 @@
     round    = (fromIntegral :: Int -> Int32) . (round  :: Double -> Int)
   #-}
 
+-- | @since 2.01
 instance Real Int32 where
     toRational x = toInteger x % 1
 
+-- | @since 2.01
 instance Bounded Int32 where
     minBound = -0x80000000
     maxBound =  0x7FFFFFFF
 
+-- | @since 2.01
 instance Ix Int32 where
     range (m,n)         = [m..n]
     unsafeIndex (m,_) i = fromIntegral i - fromIntegral m
@@ -643,6 +679,7 @@
 -- ^ 64-bit signed integer type
 
 -- See GHC.Classes#matching_overloaded_methods_in_rules
+-- | @since 2.01
 instance Eq Int64 where
     (==) = eqInt64
     (/=) = neInt64
@@ -653,6 +690,7 @@
 {-# INLINE [1] eqInt64 #-}
 {-# INLINE [1] neInt64 #-}
 
+-- | @since 2.01
 instance Ord Int64 where
     (<)  = ltInt64
     (<=) = leInt64
@@ -669,9 +707,11 @@
 (I64# x) `ltInt64` (I64# y) = isTrue# (x `ltInt64#` y)
 (I64# x) `leInt64` (I64# y) = isTrue# (x `leInt64#` y)
 
+-- | @since 2.01
 instance Show Int64 where
     showsPrec p x = showsPrec p (toInteger x)
 
+-- | @since 2.01
 instance Num Int64 where
     (I64# x#) + (I64# y#)  = I64# (x# `plusInt64#`  y#)
     (I64# x#) - (I64# y#)  = I64# (x# `minusInt64#` y#)
@@ -684,6 +724,7 @@
     signum _               = -1
     fromInteger i          = I64# (integerToInt64 i)
 
+-- | @since 2.01
 instance Enum Int64 where
     succ x
         | x /= maxBound = x + 1
@@ -701,6 +742,7 @@
     enumFromTo          = integralEnumFromTo
     enumFromThenTo      = integralEnumFromThenTo
 
+-- | @since 2.01
 instance Integral Int64 where
     quot    x@(I64# x#) y@(I64# y#)
         | y == 0                     = divZeroError
@@ -762,9 +804,11 @@
     !zero = intToInt64# 0#
     !r# = x# `remInt64#` y#
 
+-- | @since 2.01
 instance Read Int64 where
     readsPrec p s = [(fromInteger x, r) | (x, r) <- readsPrec p s]
 
+-- | @since 2.01
 instance Bits Int64 where
     {-# INLINE shift #-}
     {-# INLINE bit #-}
@@ -835,6 +879,7 @@
 -- ^ 64-bit signed integer type
 
 -- See GHC.Classes#matching_overloaded_methods_in_rules
+-- | @since 2.01
 instance Eq Int64 where
     (==) = eqInt64
     (/=) = neInt64
@@ -845,6 +890,7 @@
 {-# INLINE [1] eqInt64 #-}
 {-# INLINE [1] neInt64 #-}
 
+-- | @since 2.01
 instance Ord Int64 where
     (<)  = ltInt64
     (<=) = leInt64
@@ -861,9 +907,11 @@
 (I64# x) `ltInt64` (I64# y) = isTrue# (x <#  y)
 (I64# x) `leInt64` (I64# y) = isTrue# (x <=# y)
 
+-- | @since 2.01
 instance Show Int64 where
     showsPrec p x = showsPrec p (fromIntegral x :: Int)
 
+-- | @since 2.01
 instance Num Int64 where
     (I64# x#) + (I64# y#)  = I64# (x# +# y#)
     (I64# x#) - (I64# y#)  = I64# (x# -# y#)
@@ -876,6 +924,7 @@
     signum _               = -1
     fromInteger i          = I64# (integerToInt i)
 
+-- | @since 2.01
 instance Enum Int64 where
     succ x
         | x /= maxBound = x + 1
@@ -888,6 +937,7 @@
     enumFrom            = boundedEnumFrom
     enumFromThen        = boundedEnumFromThen
 
+-- | @since 2.01
 instance Integral Int64 where
     quot    x@(I64# x#) y@(I64# y#)
         | y == 0                     = divZeroError
@@ -927,9 +977,11 @@
                                            (I64# d, I64# m)
     toInteger (I64# x#)              = smallInteger x#
 
+-- | @since 2.01
 instance Read Int64 where
     readsPrec p s = [(fromIntegral (x::Int), r) | (x, r) <- readsPrec p s]
 
+-- | @since 2.01
 instance Bits Int64 where
     {-# INLINE shift #-}
     {-# INLINE bit #-}
@@ -1004,6 +1056,7 @@
 uncheckedIShiftRA64# = uncheckedIShiftRA#
 #endif
 
+-- | @since 4.6.0.0
 instance FiniteBits Int64 where
     finiteBitSize _ = 64
 #if WORD_SIZE_IN_BITS < 64
@@ -1014,13 +1067,16 @@
     countTrailingZeros (I64# x#) = I# (word2Int# (ctz64# (int2Word# x#)))
 #endif
 
+-- | @since 2.01
 instance Real Int64 where
     toRational x = toInteger x % 1
 
+-- | @since 2.01
 instance Bounded Int64 where
     minBound = -0x8000000000000000
     maxBound =  0x7FFFFFFFFFFFFFFF
 
+-- | @since 2.01
 instance Ix Int64 where
     range (m,n)         = [m..n]
     unsafeIndex (m,_) i = fromIntegral i - fromIntegral m
diff --git a/GHC/List.hs b/GHC/List.hs
--- a/GHC/List.hs
+++ b/GHC/List.hs
@@ -153,7 +153,7 @@
   | pred x         = x : filter pred xs
   | otherwise      = filter pred xs
 
-{-# NOINLINE [0] filterFB #-}
+{-# INLINE [0] filterFB #-} -- See Note [Inline FB functions]
 filterFB :: (a -> b -> b) -> (a -> Bool) -> a -> b -> b
 filterFB c p x r | p x       = x `c` r
                  | otherwise = r
@@ -182,10 +182,6 @@
 --
 -- The list must be finite.
 
--- We write foldl as a non-recursive thing, so that it
--- can be inlined, and then (often) strictness-analysed,
--- and hence the classic space leak on foldl (+) 0 xs
-
 foldl :: forall a b. (b -> a -> b) -> b -> [a] -> b
 {-# INLINE foldl #-}
 foldl k z0 xs =
@@ -210,6 +206,28 @@
 argumets to foldr, where we know how the arguments are called.
 -}
 
+{-
+Note [Inline FB functions]
+~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+After fusion rules successfully fire, we are usually left with one or more calls
+to list-producing functions abstracted over cons and nil. Here we call them
+FB functions because their names usually end with 'FB'. It's a good idea to
+inline FB functions because:
+
+* They are higher-order functions and therefore benefits from inlining.
+
+* When the final consumer is a left fold, inlining the FB functions is the only
+  way to make arity expansion to happen. See Note [Left fold via right fold].
+
+For this reason we mark all FB functions INLINE [0]. The [0] phase-specifier
+ensures that calls to FB functions can be written back to the original form
+when no fusion happens.
+
+Without these inline pragmas, the loop in perf/should_run/T13001 won't be
+allocation-free. Also see Trac #13001.
+-}
+
 -- ----------------------------------------------------------------------------
 
 -- | A strict version of 'foldl'.
@@ -271,7 +289,7 @@
     foldr (scanlFB f (:)) (constScanl []) bs a = tail (scanl f a bs)
  #-}
 
-{-# INLINE [0] scanlFB #-}
+{-# INLINE [0] scanlFB #-} -- See Note [Inline FB functions]
 scanlFB :: (b -> a -> b) -> (b -> c -> c) -> a -> (b -> c) -> b -> c
 scanlFB f c = \b g -> oneShot (\x -> let b' = f x b in b' `c` g b')
   -- See Note [Left folds via right fold]
@@ -309,7 +327,7 @@
     foldr (scanlFB' f (:)) (flipSeqScanl' []) bs a = tail (scanl' f a bs)
  #-}
 
-{-# INLINE [0] scanlFB' #-}
+{-# INLINE [0] scanlFB' #-} -- See Note [Inline FB functions]
 scanlFB' :: (b -> a -> b) -> (b -> c -> c) -> a -> (b -> c) -> b -> c
 scanlFB' f c = \b g -> oneShot (\x -> let !b' = f x b in b' `c` g b')
   -- See Note [Left folds via right fold]
@@ -376,7 +394,7 @@
 strictUncurryScanr f pair = case pair of
                               (x, y) -> f x y
 
-{-# INLINE [0] scanrFB #-}
+{-# INLINE [0] scanrFB #-} -- See Note [Inline FB functions]
 scanrFB :: (a -> b -> b) -> (b -> c -> c) -> a -> (b, c) -> (b, c)
 scanrFB f c = \x (r, est) -> (f x r, r `c` est)
 
@@ -400,7 +418,7 @@
 -- It is a special case of 'Data.List.maximumBy', which allows the
 -- programmer to supply their own comparison function.
 maximum                 :: (Ord a) => [a] -> a
-{-# INLINEABLE maximum #-}
+{-# INLINABLE maximum #-}
 maximum []              =  errorEmptyList "maximum"
 maximum xs              =  foldl1 max xs
 
@@ -415,7 +433,7 @@
 -- It is a special case of 'Data.List.minimumBy', which allows the
 -- programmer to supply their own comparison function.
 minimum                 :: (Ord a) => [a] -> a
-{-# INLINEABLE minimum #-}
+{-# INLINABLE minimum #-}
 minimum []              =  errorEmptyList "minimum"
 minimum xs              =  foldl1 min xs
 
@@ -432,7 +450,7 @@
 iterate :: (a -> a) -> a -> [a]
 iterate f x =  x : iterate f (f x)
 
-{-# NOINLINE [0] iterateFB #-}
+{-# INLINE [0] iterateFB #-} -- See Note [Inline FB functions]
 iterateFB :: (a -> b -> b) -> (a -> a) -> a -> b
 iterateFB c f x0 = go x0
   where go x = x `c` go (f x)
@@ -449,7 +467,7 @@
 -- The pragma just gives the rules more chance to fire
 repeat x = xs where xs = x : xs
 
-{-# INLINE [0] repeatFB #-}     -- ditto
+{-# INLINE [0] repeatFB #-}     -- ditto -- See Note [Inline FB functions]
 repeatFB :: (a -> b -> b) -> a -> b
 repeatFB c x = xs where xs = x `c` xs
 
@@ -490,7 +508,7 @@
             | p x       =  x : takeWhile p xs
             | otherwise =  []
 
-{-# INLINE [0] takeWhileFB #-}
+{-# INLINE [0] takeWhileFB #-} -- See Note [Inline FB functions]
 takeWhileFB :: (a -> Bool) -> (a -> b -> b) -> b -> a -> b -> b
 takeWhileFB p c n = \x r -> if p x then x `c` r else n
 
@@ -576,7 +594,7 @@
 flipSeqTake :: a -> Int -> a
 flipSeqTake x !_n = x
 
-{-# INLINE [0] takeFB #-}
+{-# INLINE [0] takeFB #-} -- See Note [Inline FB functions]
 takeFB :: (a -> b -> b) -> b -> a -> (Int -> b) -> Int -> b
 -- The \m accounts for the fact that takeFB is used in a higher-order
 -- way by takeFoldr, so it's better to inline.  A good example is
@@ -918,7 +936,7 @@
 zip _as    []     = []
 zip (a:as) (b:bs) = (a,b) : zip as bs
 
-{-# INLINE [0] zipFB #-}
+{-# INLINE [0] zipFB #-} -- See Note [Inline FB functions]
 zipFB :: ((a, b) -> c -> d) -> a -> b -> c -> d
 zipFB c = \x y r -> (x,y) `c` r
 
@@ -957,7 +975,7 @@
 
 -- zipWithFB must have arity 2 since it gets two arguments in the "zipWith"
 -- rule; it might not get inlined otherwise
-{-# INLINE [0] zipWithFB #-}
+{-# INLINE [0] zipWithFB #-} -- See Note [Inline FB functions]
 zipWithFB :: (a -> b -> c) -> (d -> e -> a) -> d -> e -> b -> c
 zipWithFB c f = \x y r -> (x `f` y) `c` r
 
diff --git a/GHC/MVar.hs b/GHC/MVar.hs
--- a/GHC/MVar.hs
+++ b/GHC/MVar.hs
@@ -42,6 +42,7 @@
 -}
 
 -- pull in Eq (Mvar a) too, to avoid GHC.Conc being an orphan-instance module
+-- | @since 4.1.0.0
 instance Eq (MVar a) where
         (MVar mvar1#) == (MVar mvar2#) = isTrue# (sameMVar# mvar1# mvar2#)
 
diff --git a/GHC/Natural.hs b/GHC/Natural.hs
--- a/GHC/Natural.hs
+++ b/GHC/Natural.hs
@@ -36,6 +36,7 @@
       Natural(..)
     , isValidNatural
       -- * Conversions
+    , naturalFromInteger
     , wordToNatural
     , naturalToWordMaybe
       -- * Checked subtraction
@@ -54,7 +55,7 @@
 
 import GHC.Arr
 import GHC.Base
-import GHC.Exception
+import {-# SOURCE #-} GHC.Exception (underflowException)
 #if HAVE_GMP_BIGNAT
 import GHC.Integer.GMP.Internals
 import Data.Word
@@ -68,12 +69,26 @@
 import GHC.List
 
 import Data.Bits
-import Data.Data
 
 default ()
 
+-------------------------------------------------------------------------------
+-- Arithmetic underflow
+-------------------------------------------------------------------------------
+
+-- We put them here because they are needed relatively early
+-- in the libraries before the Exception type has been defined yet.
+
+{-# NOINLINE underflowError #-}
+underflowError :: a
+underflowError = raise# underflowException
+
+-------------------------------------------------------------------------------
+-- Natural type
+-------------------------------------------------------------------------------
+
 #if HAVE_GMP_BIGNAT
--- TODO: if saturated arithmetic is to used, replace 'throw Underflow' by '0'
+-- TODO: if saturated arithmetic is to used, replace 'underflowError' by '0'
 
 -- | Type representing arbitrary-precision non-negative integers.
 --
@@ -150,18 +165,19 @@
   #-}
 #endif
 
+-- | @since 4.8.0.0
 instance Show Natural where
     showsPrec p (NatS# w#)  = showsPrec p (W# w#)
     showsPrec p (NatJ# bn)  = showsPrec p (Jp# bn)
 
+-- | @since 4.8.0.0
 instance Read Natural where
     readsPrec d = map (\(n, s) -> (fromInteger n, s))
                   . filter ((>= 0) . (\(x,_)->x)) . readsPrec d
 
+-- | @since 4.8.0.0
 instance Num Natural where
-    fromInteger (S# i#) | I# i# >= 0  = NatS# (int2Word# i#)
-    fromInteger (Jp# bn)              = bigNatToNatural bn
-    fromInteger _                     = throw Underflow
+    fromInteger          = naturalFromInteger
 
     (+) = plusNatural
     (*) = timesNatural
@@ -173,8 +189,16 @@
     signum _             = NatS# 1##
 
     negate (NatS# 0##)   = NatS# 0##
-    negate _             = throw Underflow
+    negate _             = underflowError
 
+-- | @since 4.10.0.0
+naturalFromInteger :: Integer -> Natural
+naturalFromInteger (S# i#) | I# i# >= 0  = NatS# (int2Word# i#)
+naturalFromInteger (Jp# bn)              = bigNatToNatural bn
+naturalFromInteger _                     = underflowError
+{-# INLINE naturalFromInteger #-}
+
+-- | @since 4.8.0.0
 instance Real Natural where
     toRational (NatS# w)  = toRational (W# w)
     toRational (NatJ# bn) = toRational (Jp# bn)
@@ -206,6 +230,7 @@
 
 #endif
 
+-- | @since 4.8.0.0
 instance Enum Natural where
     succ n = n `plusNatural`  NatS# 1##
     pred n = n `minusNatural` NatS# 1##
@@ -248,6 +273,7 @@
 
 ----------------------------------------------------------------------------
 
+-- | @since 4.8.0.0
 instance Integral Natural where
     toInteger (NatS# w)  = wordToInteger w
     toInteger (NatJ# bn) = Jp# bn
@@ -256,7 +282,7 @@
     div    = quot
     mod    = rem
 
-    quotRem _ (NatS# 0##) = throw DivideByZero
+    quotRem _ (NatS# 0##) = divZeroError
     quotRem n (NatS# 1##) = (n,NatS# 0##)
     quotRem n@(NatS# _) (NatJ# _) = (NatS# 0##, n)
     quotRem (NatS# n) (NatS# d) = case quotRem (W# n) (W# d) of
@@ -266,20 +292,21 @@
     quotRem (NatJ# n) (NatJ# d) = case quotRemBigNat n d of
         (# q,r #) -> (bigNatToNatural q, bigNatToNatural r)
 
-    quot _       (NatS# 0##) = throw DivideByZero
+    quot _       (NatS# 0##) = divZeroError
     quot n       (NatS# 1##) = n
     quot (NatS# _) (NatJ# _) = NatS# 0##
     quot (NatS# n) (NatS# d) = wordToNatural (quot (W# n) (W# d))
     quot (NatJ# n) (NatS# d) = bigNatToNatural (quotBigNatWord n d)
     quot (NatJ# n) (NatJ# d) = bigNatToNatural (quotBigNat n d)
 
-    rem _         (NatS# 0##) = throw DivideByZero
+    rem _         (NatS# 0##) = divZeroError
     rem _         (NatS# 1##) = NatS# 0##
     rem n@(NatS# _) (NatJ# _) = n
     rem   (NatS# n) (NatS# d) = wordToNatural (rem (W# n) (W# d))
     rem   (NatJ# n) (NatS# d) = NatS# (remBigNatWord n d)
     rem   (NatJ# n) (NatJ# d) = bigNatToNatural (remBigNat n d)
 
+-- | @since 4.8.0.0
 instance Ix Natural where
     range (m,n) = [m..n]
     inRange (m,n) i = m <= i && i <= n
@@ -288,6 +315,7 @@
               | otherwise   = indexError b i "Natural"
 
 
+-- | @since 4.8.0.0
 instance Bits Natural where
     NatS# n .&. NatS# m = wordToNatural (W# n .&. W# m)
     NatS# n .&. NatJ# m = wordToNatural (W# n .&. W# (bigNatToWord m))
@@ -371,8 +399,8 @@
 minusNatural x         (NatS# 0##) = x
 minusNatural (NatS# x) (NatS# y) = case subWordC# x y of
     (# l, 0# #) -> NatS# l
-    _           -> throw Underflow
-minusNatural (NatS# _) (NatJ# _) = throw Underflow
+    _           -> underflowError
+minusNatural (NatS# _) (NatJ# _) = underflowError
 minusNatural (NatJ# x) (NatS# y)
     = bigNatToNatural $ minusBigNatWord x y
 minusNatural (NatJ# x) (NatJ# y)
@@ -401,7 +429,7 @@
 bigNatToNatural :: BigNat -> Natural
 bigNatToNatural bn
   | isTrue# (sizeofBigNat# bn ==# 1#) = NatS# (bigNatToWord bn)
-  | isTrue# (isNullBigNat# bn)        = throw Underflow
+  | isTrue# (isNullBigNat# bn)        = underflowError
   | otherwise                         = NatJ# bn
 
 naturalToBigNat :: Natural -> BigNat
@@ -411,7 +439,7 @@
 -- | Convert 'Int' to 'Natural'.
 -- Throws 'Underflow' when passed a negative 'Int'.
 intToNatural :: Int -> Natural
-intToNatural i | i<0 = throw Underflow
+intToNatural i | i<0 = underflowError
 intToNatural (I# i#) = NatS# (int2Word# i#)
 
 naturalToWord :: Natural -> Word
@@ -444,19 +472,22 @@
 isValidNatural :: Natural -> Bool
 isValidNatural (Natural i) = i >= 0
 
+-- | @since 4.8.0.0
 instance Read Natural where
     readsPrec d = map (\(n, s) -> (Natural n, s))
                   . filter ((>= 0) . (\(x,_)->x)) . readsPrec d
 
+-- | @since 4.8.0.0
 instance Show Natural where
     showsPrec d (Natural i) = showsPrec d i
 
+-- | @since 4.8.0.0
 instance Num Natural where
   Natural n + Natural m = Natural (n + m)
   {-# INLINE (+) #-}
   Natural n * Natural m = Natural (n * m)
   {-# INLINE (*) #-}
-  Natural n - Natural m | result < 0 = throw Underflow
+  Natural n - Natural m | result < 0 = underflowError
                         | otherwise  = Natural result
     where result = n - m
   {-# INLINE (-) #-}
@@ -464,11 +495,16 @@
   {-# INLINE abs #-}
   signum (Natural n) = Natural (signum n)
   {-# INLINE signum #-}
-  fromInteger n
-    | n >= 0 = Natural n
-    | otherwise = throw Underflow
+  fromInteger = naturalFromInteger
   {-# INLINE fromInteger #-}
 
+-- | @since 4.10.0.0
+naturalFromInteger :: Integer -> Natural
+naturalFromInteger n
+  | n >= 0 = Natural n
+  | otherwise = underflowError
+{-# INLINE naturalFromInteger #-}
+
 -- | 'Natural' subtraction. Returns 'Nothing's for non-positive results.
 --
 -- @since 4.8.0.0
@@ -477,6 +513,7 @@
   | x >= y    = Just (x - y)
   | otherwise = Nothing
 
+-- | @since 4.8.0.0
 instance Bits Natural where
   Natural n .&. Natural m = Natural (n .&. m)
   {-# INLINE (.&.) #-}
@@ -518,10 +555,12 @@
   {-# INLINE popCount #-}
   zeroBits = Natural 0
 
+-- | @since 4.8.0.0
 instance Real Natural where
   toRational (Natural a) = toRational a
   {-# INLINE toRational #-}
 
+-- | @since 4.8.0.0
 instance Enum Natural where
   pred (Natural 0) = errorWithoutStackTrace "Natural.pred: 0"
   pred (Natural n) = Natural (pred n)
@@ -543,6 +582,7 @@
   enumFromThenTo
     = coerce (enumFromThenTo :: Integer -> Integer -> Integer -> [Integer])
 
+-- | @since 4.8.0.0
 instance Integral Natural where
   quot (Natural a) (Natural b) = Natural (quot a b)
   {-# INLINE quot #-}
@@ -588,26 +628,13 @@
     maxw = toInteger (maxBound :: Word)
 #endif
 
--- This follows the same style as the other integral 'Data' instances
--- defined in "Data.Data"
-naturalType :: DataType
-naturalType = mkIntType "Numeric.Natural.Natural"
-
-instance Data Natural where
-  toConstr x = mkIntegralConstr naturalType x
-  gunfold _ z c = case constrRep c of
-                    (IntConstr x) -> z (fromIntegral x)
-                    _ -> errorWithoutStackTrace $ "Data.Data.gunfold: Constructor " ++ show c
-                                 ++ " is not of type Natural"
-  dataTypeOf _ = naturalType
-
 -- | \"@'powModNatural' /b/ /e/ /m/@\" computes base @/b/@ raised to
 -- exponent @/e/@ modulo @/m/@.
 --
 -- @since 4.8.0.0
 powModNatural :: Natural -> Natural -> Natural -> Natural
 #if HAVE_GMP_BIGNAT
-powModNatural _           _           (NatS# 0##) = throw DivideByZero
+powModNatural _           _           (NatS# 0##) = divZeroError
 powModNatural _           _           (NatS# 1##) = NatS# 0##
 powModNatural _           (NatS# 0##) _           = NatS# 1##
 powModNatural (NatS# 0##) _           _           = NatS# 0##
@@ -619,7 +646,7 @@
   = bigNatToNatural (powModBigNat (naturalToBigNat b) (naturalToBigNat e) m)
 #else
 -- Portable reference fallback implementation
-powModNatural _ _ 0 = throw DivideByZero
+powModNatural _ _ 0 = divZeroError
 powModNatural _ _ 1 = 0
 powModNatural _ 0 _ = 1
 powModNatural 0 _ _ = 0
diff --git a/GHC/Num.hs b/GHC/Num.hs
--- a/GHC/Num.hs
+++ b/GHC/Num.hs
@@ -64,6 +64,7 @@
 subtract :: (Num a) => a -> a -> a
 subtract x y = y - x
 
+-- | @since 2.01
 instance  Num Int  where
     I# x + I# y = I# (x +# y)
     I# x - I# y = I# (x -# y)
@@ -78,6 +79,7 @@
     {-# INLINE fromInteger #-}   -- Just to be sure!
     fromInteger i = I# (integerToInt i)
 
+-- | @since 2.01
 instance Num Word where
     (W# x#) + (W# y#)      = W# (x# `plusWord#` y#)
     (W# x#) - (W# y#)      = W# (x# `minusWord#` y#)
@@ -88,6 +90,7 @@
     signum _               = 1
     fromInteger i          = W# (integerToWord i)
 
+-- | @since 2.01
 instance  Num Integer  where
     (+) = plusInteger
     (-) = minusInteger
diff --git a/GHC/OverloadedLabels.hs b/GHC/OverloadedLabels.hs
--- a/GHC/OverloadedLabels.hs
+++ b/GHC/OverloadedLabels.hs
@@ -1,48 +1,54 @@
-{-# LANGUAGE NoImplicitPrelude
-           , MultiParamTypeClasses
-           , MagicHash
-           , KindSignatures
+{-# LANGUAGE AllowAmbiguousTypes
            , DataKinds
+           , FlexibleInstances
+           , KindSignatures
+           , MultiParamTypeClasses
+           , ScopedTypeVariables
+           , TypeApplications
   #-}
 
 -----------------------------------------------------------------------------
 -- |
 -- Module      :  GHC.OverloadedLabels
--- Copyright   :  (c) Adam Gundry 2015
+-- Copyright   :  (c) Adam Gundry 2015-2016
 -- License     :  see libraries/base/LICENSE
 --
 -- Maintainer  :  cvs-ghc@haskell.org
 -- Stability   :  internal
 -- Portability :  non-portable (GHC extensions)
 --
--- This module defines the `IsLabel` class is used by the
--- OverloadedLabels extension.  See the
+-- This module defines the 'IsLabel' class is used by the
+-- @OverloadedLabels@ extension.  See the
 -- <https://ghc.haskell.org/trac/ghc/wiki/Records/OverloadedRecordFields/OverloadedLabels wiki page>
 -- for more details.
 --
--- The key idea is that when GHC sees an occurrence of the new
--- overloaded label syntax @#foo@, it is replaced with
+-- When @OverloadedLabels@ is enabled, if GHC sees an occurrence of
+-- the overloaded label syntax @#foo@, it is replaced with
 --
--- > fromLabel (proxy# :: Proxy# "foo") :: alpha
+-- > fromLabel @"foo" :: alpha
 --
 -- plus a wanted constraint @IsLabel "foo" alpha@.
 --
+-- Note that if @RebindableSyntax@ is enabled, the desugaring of
+-- overloaded label syntax will make use of whatever @fromLabel@ is in
+-- scope.
+--
 -----------------------------------------------------------------------------
 
 -- Note [Overloaded labels]
 -- ~~~~~~~~~~~~~~~~~~~~~~~~
 -- An overloaded label is represented by the 'HsOverLabel' constructor
--- of 'HsExpr', which stores a 'FastString'.  It is passed through
--- unchanged by the renamer, and the type-checker transforms it into a
--- call to 'fromLabel'.  See Note [Type-checking overloaded labels] in
--- TcExpr for more details in how type-checking works.
+-- of 'HsExpr', which stores the 'FastString' text of the label and an
+-- optional id for the 'fromLabel' function to use (if
+-- RebindableSyntax is enabled) .  The type-checker transforms it into
+-- a call to 'fromLabel'.  See Note [Type-checking overloaded labels]
+-- in TcExpr for more details in how type-checking works.
 
 module GHC.OverloadedLabels
        ( IsLabel(..)
        ) where
 
 import GHC.Base ( Symbol )
-import GHC.Exts ( Proxy# )
 
 class IsLabel (x :: Symbol) a where
-  fromLabel :: Proxy# x -> a
+  fromLabel :: a
diff --git a/GHC/Profiling.hs b/GHC/Profiling.hs
--- a/GHC/Profiling.hs
+++ b/GHC/Profiling.hs
@@ -6,5 +6,14 @@
 
 import GHC.Base
 
-foreign import ccall startProfTimer :: IO ()
+-- | Stop attributing ticks to cost centres. Allocations will still be
+-- attributed.
+--
+-- @since 4.7.0.0
 foreign import ccall stopProfTimer :: IO ()
+
+-- | Start attributing ticks to cost centres. This is called by the RTS on
+-- startup.
+--
+-- @since 4.7.0.0
+foreign import ccall startProfTimer :: IO ()
diff --git a/GHC/Ptr.hs b/GHC/Ptr.hs
--- a/GHC/Ptr.hs
+++ b/GHC/Ptr.hs
@@ -163,6 +163,7 @@
 ------------------------------------------------------------------------
 -- Show instances for Ptr and FunPtr
 
+-- | @since 2.01
 instance Show (Ptr a) where
    showsPrec _ (Ptr a) rs = pad_out (showHex (wordToInteger(int2Word#(addr2Int# a))) "")
      where
@@ -170,5 +171,6 @@
        pad_out ls =
           '0':'x':(replicate (2*SIZEOF_HSPTR - length ls) '0') ++ ls ++ rs
 
+-- | @since 2.01
 instance Show (FunPtr a) where
    showsPrec p = showsPrec p . castFunPtrToPtr
diff --git a/GHC/RTS/Flags.hsc b/GHC/RTS/Flags.hsc
--- a/GHC/RTS/Flags.hsc
+++ b/GHC/RTS/Flags.hsc
@@ -3,14 +3,13 @@
 
 -- | Accessors to GHC RTS flags.
 -- Descriptions of flags can be seen in
--- <https://www.haskell.org/ghc/docs/latest/html/users_guide/runtime-control.html GHC User's Guide>,
+-- <https://www.haskell.org/ghc/docs/latest/html/users_guide/runtime_control.html GHC User's Guide>,
 -- or by running RTS help message using @+RTS --help@.
 --
 -- @since 4.8.0.0
 --
 module GHC.RTS.Flags
   ( RtsTime
-  , RtsNat
   , RTSFlags (..)
   , GiveGCStats (..)
   , GCFlags (..)
@@ -24,6 +23,7 @@
   , DoTrace (..)
   , TraceFlags (..)
   , TickyFlags (..)
+  , ParFlags (..)
   , getRTSFlags
   , getGCFlags
   , getConcFlags
@@ -33,6 +33,7 @@
   , getProfFlags
   , getTraceFlags
   , getTickyFlags
+  , getParFlags
   ) where
 
 #include "Rts.h"
@@ -41,28 +42,20 @@
 import Control.Applicative
 import Control.Monad
 
-import Foreign.C.String    (peekCString)
-import Foreign.C.Types     (CChar, CInt)
-import Foreign.Ptr         (Ptr, nullPtr)
-import Foreign.Storable    (peekByteOff)
+import Foreign
+import Foreign.C
 
 import GHC.Base
 import GHC.Enum
 import GHC.IO
 import GHC.Real
 import GHC.Show
-import GHC.Word
 
 -- | @'Time'@ is defined as a @'StgWord64'@ in @stg/Types.h@
 --
 -- @since 4.8.2.0
 type RtsTime = Word64
 
--- | @'nat'@ defined in @rts/Types.h@
---
--- @since 4.8.2.0
-type RtsNat = #{type unsigned int}
-
 -- | Should we produce a summary of the garbage collector statistics after the
 -- program has exited?
 --
@@ -75,6 +68,7 @@
     | VerboseGCStats
     deriving (Show)
 
+-- | @since 4.8.0.0
 instance Enum GiveGCStats where
     fromEnum NoGCStats      = #{const NO_GC_STATS}
     fromEnum CollectGCStats = #{const COLLECT_GC_STATS}
@@ -95,30 +89,32 @@
 data GCFlags = GCFlags
     { statsFile             :: Maybe FilePath
     , giveStats             :: GiveGCStats
-    , maxStkSize            :: RtsNat
-    , initialStkSize        :: RtsNat
-    , stkChunkSize          :: RtsNat
-    , stkChunkBufferSize    :: RtsNat
-    , maxHeapSize           :: RtsNat
-    , minAllocAreaSize      :: RtsNat
-    , minOldGenSize         :: RtsNat
-    , heapSizeSuggestion    :: RtsNat
+    , maxStkSize            :: Word32
+    , initialStkSize        :: Word32
+    , stkChunkSize          :: Word32
+    , stkChunkBufferSize    :: Word32
+    , maxHeapSize           :: Word32
+    , minAllocAreaSize      :: Word32
+    , largeAllocLim         :: Word32
+    , nurseryChunkSize      :: Word32
+    , minOldGenSize         :: Word32
+    , heapSizeSuggestion    :: Word32
     , heapSizeSuggestionAuto :: Bool
     , oldGenFactor          :: Double
     , pcFreeHeap            :: Double
-    , generations           :: RtsNat
-    , steps                 :: RtsNat
+    , generations           :: Word32
     , squeezeUpdFrames      :: Bool
     , compact               :: Bool -- ^ True <=> "compact all the time"
     , compactThreshold      :: Double
     , sweep                 :: Bool
       -- ^ use "mostly mark-sweep" instead of copying for the oldest generation
     , ringBell              :: Bool
-    , frontpanel            :: Bool
     , idleGCDelayTime       :: RtsTime
     , doIdleGC              :: Bool
     , heapBase              :: Word -- ^ address to ask the OS for memory
     , allocLimitGrace       :: Word
+    , numa                  :: Bool
+    , numaMask              :: Word
     } deriving (Show)
 
 -- | Parameters concerning context switching
@@ -170,21 +166,22 @@
     | CostCentresSummary
     | CostCentresVerbose
     | CostCentresAll
-    | CostCentresXML
+    | CostCentresJSON
     deriving (Show)
 
+-- | @since 4.8.0.0
 instance Enum DoCostCentres where
     fromEnum CostCentresNone    = #{const COST_CENTRES_NONE}
     fromEnum CostCentresSummary = #{const COST_CENTRES_SUMMARY}
     fromEnum CostCentresVerbose = #{const COST_CENTRES_VERBOSE}
     fromEnum CostCentresAll     = #{const COST_CENTRES_ALL}
-    fromEnum CostCentresXML     = #{const COST_CENTRES_XML}
+    fromEnum CostCentresJSON    = #{const COST_CENTRES_JSON}
 
     toEnum #{const COST_CENTRES_NONE}    = CostCentresNone
     toEnum #{const COST_CENTRES_SUMMARY} = CostCentresSummary
     toEnum #{const COST_CENTRES_VERBOSE} = CostCentresVerbose
     toEnum #{const COST_CENTRES_ALL}     = CostCentresAll
-    toEnum #{const COST_CENTRES_XML}     = CostCentresXML
+    toEnum #{const COST_CENTRES_JSON}    = CostCentresJSON
     toEnum e = errorWithoutStackTrace ("invalid enum for DoCostCentres: " ++ show e)
 
 -- | Parameters pertaining to the cost-center profiler.
@@ -210,6 +207,7 @@
     | HeapByClosureType
     deriving (Show)
 
+-- | @since 4.8.0.0
 instance Enum DoHeapProfile where
     fromEnum NoHeapProfiling   = #{const NO_HEAP_PROFILING}
     fromEnum HeapByCCS         = #{const HEAP_BY_CCS}
@@ -259,6 +257,7 @@
     | TraceStderr    -- ^ send tracing events to @stderr@
     deriving (Show)
 
+-- | @since 4.8.0.0
 instance Enum DoTrace where
     fromEnum TraceNone     = #{const TRACE_NONE}
     fromEnum TraceEventLog = #{const TRACE_EVENTLOG}
@@ -290,6 +289,23 @@
     , tickyFile      :: Maybe FilePath
     } deriving (Show)
 
+-- | Parameters pertaining to parallelism
+--
+-- @since 4.8.0.0
+data ParFlags = ParFlags
+    { nCapabilities :: Word32
+    , migrate :: Bool
+    , maxLocalSparks :: Word32
+    , parGcEnabled :: Bool
+    , parGcGen :: Word32
+    , parGcLoadBalancingEnabled :: Bool
+    , parGcLoadBalancingGen :: Word32
+    , parGcNoSyncWithIdle :: Word32
+    , parGcThreads :: Word32
+    , setAffinity :: Bool
+    }
+    deriving (Show)
+
 -- | Parameters of the runtime system
 --
 -- @since 4.8.0.0
@@ -302,30 +318,10 @@
     , profilingFlags  :: ProfFlags
     , traceFlags      :: TraceFlags
     , tickyFlags      :: TickyFlags
+    , parFlags        :: ParFlags
     } deriving (Show)
 
-foreign import ccall safe "getGcFlags"
-  getGcFlagsPtr :: IO (Ptr ())
-
-foreign import ccall safe "getConcFlags"
-  getConcFlagsPtr :: IO (Ptr ())
-
-foreign import ccall safe "getMiscFlags"
-  getMiscFlagsPtr :: IO (Ptr ())
-
-foreign import ccall safe "getDebugFlags"
-  getDebugFlagsPtr :: IO (Ptr ())
-
-foreign import ccall safe "getCcFlags"
-  getCcFlagsPtr :: IO (Ptr ())
-
-foreign import ccall safe "getProfFlags" getProfFlagsPtr :: IO (Ptr ())
-
-foreign import ccall safe "getTraceFlags"
-  getTraceFlagsPtr :: IO (Ptr ())
-
-foreign import ccall safe "getTickyFlags"
-  getTickyFlagsPtr :: IO (Ptr ())
+foreign import ccall "&RtsFlags" rtsFlagsPtr :: Ptr RTSFlags
 
 getRTSFlags :: IO RTSFlags
 getRTSFlags = do
@@ -337,6 +333,7 @@
            <*> getProfFlags
            <*> getTraceFlags
            <*> getTickyFlags
+           <*> getParFlags
 
 peekFilePath :: Ptr () -> IO (Maybe FilePath)
 peekFilePath ptr
@@ -351,43 +348,60 @@
 
 getGCFlags :: IO GCFlags
 getGCFlags = do
-  ptr <- getGcFlagsPtr
+  let ptr = (#ptr RTS_FLAGS, GcFlags) rtsFlagsPtr
   GCFlags <$> (peekFilePath =<< #{peek GC_FLAGS, statsFile} ptr)
           <*> (toEnum . fromIntegral <$>
-                (#{peek GC_FLAGS, giveStats} ptr :: IO RtsNat))
+                (#{peek GC_FLAGS, giveStats} ptr :: IO Word32))
           <*> #{peek GC_FLAGS, maxStkSize} ptr
           <*> #{peek GC_FLAGS, initialStkSize} ptr
           <*> #{peek GC_FLAGS, stkChunkSize} ptr
           <*> #{peek GC_FLAGS, stkChunkBufferSize} ptr
           <*> #{peek GC_FLAGS, maxHeapSize} ptr
           <*> #{peek GC_FLAGS, minAllocAreaSize} ptr
+          <*> #{peek GC_FLAGS, largeAllocLim} ptr
+          <*> #{peek GC_FLAGS, nurseryChunkSize} ptr
           <*> #{peek GC_FLAGS, minOldGenSize} ptr
           <*> #{peek GC_FLAGS, heapSizeSuggestion} ptr
           <*> #{peek GC_FLAGS, heapSizeSuggestionAuto} ptr
           <*> #{peek GC_FLAGS, oldGenFactor} ptr
           <*> #{peek GC_FLAGS, pcFreeHeap} ptr
           <*> #{peek GC_FLAGS, generations} ptr
-          <*> #{peek GC_FLAGS, steps} ptr
           <*> #{peek GC_FLAGS, squeezeUpdFrames} ptr
           <*> #{peek GC_FLAGS, compact} ptr
           <*> #{peek GC_FLAGS, compactThreshold} ptr
           <*> #{peek GC_FLAGS, sweep} ptr
           <*> #{peek GC_FLAGS, ringBell} ptr
-          <*> #{peek GC_FLAGS, frontpanel} ptr
           <*> #{peek GC_FLAGS, idleGCDelayTime} ptr
           <*> #{peek GC_FLAGS, doIdleGC} ptr
           <*> #{peek GC_FLAGS, heapBase} ptr
           <*> #{peek GC_FLAGS, allocLimitGrace} ptr
+          <*> #{peek GC_FLAGS, numa} ptr
+          <*> #{peek GC_FLAGS, numaMask} ptr
 
+getParFlags :: IO ParFlags
+getParFlags = do
+  let ptr = (#ptr RTS_FLAGS, ParFlags) rtsFlagsPtr
+  ParFlags
+    <$> #{peek PAR_FLAGS, nCapabilities} ptr
+    <*> #{peek PAR_FLAGS, migrate} ptr
+    <*> #{peek PAR_FLAGS, maxLocalSparks} ptr
+    <*> #{peek PAR_FLAGS, parGcEnabled} ptr
+    <*> #{peek PAR_FLAGS, parGcGen} ptr
+    <*> #{peek PAR_FLAGS, parGcLoadBalancingEnabled} ptr
+    <*> #{peek PAR_FLAGS, parGcLoadBalancingGen} ptr
+    <*> #{peek PAR_FLAGS, parGcNoSyncWithIdle} ptr
+    <*> #{peek PAR_FLAGS, parGcThreads} ptr
+    <*> #{peek PAR_FLAGS, setAffinity} ptr
+
 getConcFlags :: IO ConcFlags
 getConcFlags = do
-  ptr <- getConcFlagsPtr
+  let ptr = (#ptr RTS_FLAGS, ConcFlags) rtsFlagsPtr
   ConcFlags <$> #{peek CONCURRENT_FLAGS, ctxtSwitchTime} ptr
             <*> #{peek CONCURRENT_FLAGS, ctxtSwitchTicks} ptr
 
 getMiscFlags :: IO MiscFlags
 getMiscFlags = do
-  ptr <- getMiscFlagsPtr
+  let ptr = (#ptr RTS_FLAGS, MiscFlags) rtsFlagsPtr
   MiscFlags <$> #{peek MISC_FLAGS, tickInterval} ptr
             <*> #{peek MISC_FLAGS, install_signal_handlers} ptr
             <*> #{peek MISC_FLAGS, machineReadable} ptr
@@ -395,7 +409,7 @@
 
 getDebugFlags :: IO DebugFlags
 getDebugFlags = do
-  ptr <- getDebugFlagsPtr
+  let ptr = (#ptr RTS_FLAGS, DebugFlags) rtsFlagsPtr
   DebugFlags <$> #{peek DEBUG_FLAGS, scheduler} ptr
              <*> #{peek DEBUG_FLAGS, interpreter} ptr
              <*> #{peek DEBUG_FLAGS, weak} ptr
@@ -414,15 +428,15 @@
 
 getCCFlags :: IO CCFlags
 getCCFlags = do
-  ptr <- getCcFlagsPtr
+  let ptr = (#ptr RTS_FLAGS, GcFlags) rtsFlagsPtr
   CCFlags <$> (toEnum . fromIntegral
-                <$> (#{peek COST_CENTRE_FLAGS, doCostCentres} ptr :: IO RtsNat))
+                <$> (#{peek COST_CENTRE_FLAGS, doCostCentres} ptr :: IO Word32))
           <*> #{peek COST_CENTRE_FLAGS, profilerTicks} ptr
           <*> #{peek COST_CENTRE_FLAGS, msecsPerTick} ptr
 
 getProfFlags :: IO ProfFlags
 getProfFlags = do
-  ptr <- getProfFlagsPtr
+  let ptr = (#ptr RTS_FLAGS, ProfFlags) rtsFlagsPtr
   ProfFlags <$> (toEnum <$> #{peek PROFILING_FLAGS, doHeapProfile} ptr)
             <*> #{peek PROFILING_FLAGS, heapProfileInterval} ptr
             <*> #{peek PROFILING_FLAGS, heapProfileIntervalTicks} ptr
@@ -440,7 +454,7 @@
 
 getTraceFlags :: IO TraceFlags
 getTraceFlags = do
-  ptr <- getTraceFlagsPtr
+  let ptr = (#ptr RTS_FLAGS, TraceFlags) rtsFlagsPtr
   TraceFlags <$> (toEnum . fromIntegral
                    <$> (#{peek TRACE_FLAGS, tracing} ptr :: IO CInt))
              <*> #{peek TRACE_FLAGS, timestamp} ptr
@@ -452,6 +466,6 @@
 
 getTickyFlags :: IO TickyFlags
 getTickyFlags = do
-  ptr <- getTickyFlagsPtr
+  let ptr = (#ptr RTS_FLAGS, TickyFlags) rtsFlagsPtr
   TickyFlags <$> #{peek TICKY_FLAGS, showTickyStats} ptr
              <*> (peekFilePath =<< #{peek TICKY_FLAGS, tickyFile} ptr)
diff --git a/GHC/Read.hs b/GHC/Read.hs
--- a/GHC/Read.hs
+++ b/GHC/Read.hs
@@ -147,6 +147,31 @@
 -- >                 up_prec = 5
 -- >
 -- >         readListPrec = readListPrecDefault
+--
+-- Why do both 'readsPrec' and 'readPrec' exist, and why does GHC opt to
+-- implement 'readPrec' in derived 'Read' instances instead of 'readsPrec'?
+-- The reason is that 'readsPrec' is based on the 'ReadS' type, and although
+-- 'ReadS' is mentioned in the Haskell 2010 Report, it is not a very efficient
+-- parser data structure.
+--
+-- 'readPrec', on the other hand, is based on a much more efficient 'ReadPrec'
+-- datatype (a.k.a \"new-style parsers\"), but its definition relies on the use
+-- of the @RankNTypes@ language extension. Therefore, 'readPrec' (and its
+-- cousin, 'readListPrec') are marked as GHC-only. Nevertheless, it is
+-- recommended to use 'readPrec' instead of 'readsPrec' whenever possible
+-- for the efficiency improvements it brings.
+--
+-- As mentioned above, derived 'Read' instances in GHC will implement
+-- 'readPrec' instead of 'readsPrec'. The default implementations of
+-- 'readsPrec' (and its cousin, 'readList') will simply use 'readPrec' under
+-- the hood. If you are writing a 'Read' instance by hand, it is recommended
+-- to write it like so:
+--
+-- @
+-- instance 'Read' T where
+--   'readPrec'     = ...
+--   'readListPrec' = 'readListPrecDefault'
+-- @
 
 class Read a where
   {-# MINIMAL readsPrec | readPrec #-}
@@ -270,17 +295,6 @@
     else pfail
 {-# INLINE expectCharP #-}
 
--- A version of skipSpaces that takes the next
--- parser as an argument. That is,
---
--- skipSpacesThenP m = lift skipSpaces >> m
---
--- Since skipSpaces is recursive, it appears that we get
--- cleaner code by providing the continuation explicitly.
--- In particular, we avoid passing an extra continuation
--- of the form
---
--- \ () -> ...
 skipSpacesThenP :: ReadPrec a -> ReadPrec a
 skipSpacesThenP m =
   do s <- look
@@ -294,14 +308,6 @@
 --      where @p@ parses \"P0\" in precedence context zero
 paren p = skipSpacesThenP (paren' p)
 
--- We try very hard to make paren' efficient, because parens is ubiquitous.
--- Earlier code used `expectP` to look for the parentheses. The problem is that
--- this lexes a (potentially long) token just to check if it's a parenthesis or
--- not. So the first token of pretty much every value would be fully lexed
--- twice. Now, we look for the '(' by hand instead. Since there's no reason not
--- to, and it allows for faster failure, we do the same for ')'. This strategy
--- works particularly well here because neither '(' nor ')' can begin any other
--- lexeme.
 paren' :: ReadPrec a -> ReadPrec a
 paren' p = expectCharP '(' $ reset p >>= \x ->
               skipSpacesThenP (expectCharP ')' (pure x))
@@ -311,9 +317,9 @@
 --      where @p@ parses \"P\"  in the current precedence context
 --          and parses \"P0\" in precedence context zero
 parens p = optional
- where
-  optional  = p +++ mandatory
-  mandatory = paren optional
+  where
+    optional = skipSpacesThenP (p +++ mandatory)
+    mandatory = paren' optional
 
 list :: ReadPrec a -> ReadPrec [a]
 -- ^ @(list p)@ parses a list of things parsed by @p@,
@@ -356,6 +362,7 @@
 
 deriving instance Read GeneralCategory
 
+-- | @since 2.01
 instance Read Char where
   readPrec =
     parens
@@ -373,6 +380,7 @@
 
   readList = readListDefault
 
+-- | @since 2.01
 instance Read Bool where
   readPrec =
     parens
@@ -386,6 +394,7 @@
   readListPrec = readListPrecDefault
   readList     = readListDefault
 
+-- | @since 2.01
 instance Read Ordering where
   readPrec =
     parens
@@ -427,6 +436,7 @@
 'Just'.
 -}
 
+-- | @since 2.01
 instance Read a => Read (Maybe a) where
   readPrec =
     parens
@@ -442,6 +452,7 @@
   readListPrec = readListPrecDefault
   readList     = readListDefault
 
+-- | @since 2.01
 instance Read a => Read [a] where
   {-# SPECIALISE instance Read [String] #-}
   {-# SPECIALISE instance Read [Char] #-}
@@ -450,6 +461,7 @@
   readListPrec = readListPrecDefault
   readList     = readListDefault
 
+-- | @since 2.01
 instance  (Ix a, Read a, Read b) => Read (Array a b)  where
     readPrec = parens $ prec appPrec $
                do expectP (L.Ident "array")
@@ -460,6 +472,7 @@
     readListPrec = readListPrecDefault
     readList     = readListDefault
 
+-- | @since 2.01
 instance Read L.Lexeme where
   readPrec     = lexP
   readListPrec = readListPrecDefault
@@ -497,29 +510,35 @@
                               Just rat -> return $ fromRational rat
 convertFrac _            = pfail
 
+-- | @since 2.01
 instance Read Int where
   readPrec     = readNumber convertInt
   readListPrec = readListPrecDefault
   readList     = readListDefault
 
+-- | @since 4.5.0.0
 instance Read Word where
     readsPrec p s = [(fromInteger x, r) | (x, r) <- readsPrec p s]
 
+-- | @since 2.01
 instance Read Integer where
   readPrec     = readNumber convertInt
   readListPrec = readListPrecDefault
   readList     = readListDefault
 
+-- | @since 2.01
 instance Read Float where
   readPrec     = readNumber convertFrac
   readListPrec = readListPrecDefault
   readList     = readListDefault
 
+-- | @since 2.01
 instance Read Double where
   readPrec     = readNumber convertFrac
   readListPrec = readListPrecDefault
   readList     = readListDefault
 
+-- | @since 2.01
 instance (Integral a, Read a) => Read (Ratio a) where
   readPrec =
     parens
@@ -539,6 +558,7 @@
 -- Tuple instances of Read, up to size 15
 ------------------------------------------------------------------------
 
+-- | @since 2.01
 instance Read () where
   readPrec =
     parens
@@ -550,6 +570,7 @@
   readListPrec = readListPrecDefault
   readList     = readListDefault
 
+-- | @since 2.01
 instance (Read a, Read b) => Read (a,b) where
   readPrec = wrap_tup read_tup2
   readListPrec = readListPrecDefault
@@ -583,6 +604,7 @@
                 return (a,b,c,d,e,f,g,h)
 
 
+-- | @since 2.01
 instance (Read a, Read b, Read c) => Read (a, b, c) where
   readPrec = wrap_tup (do { (a,b) <- read_tup2; read_comma
                           ; c <- readPrec
@@ -590,11 +612,13 @@
   readListPrec = readListPrecDefault
   readList     = readListDefault
 
+-- | @since 2.01
 instance (Read a, Read b, Read c, Read d) => Read (a, b, c, d) where
   readPrec = wrap_tup read_tup4
   readListPrec = readListPrecDefault
   readList     = readListDefault
 
+-- | @since 2.01
 instance (Read a, Read b, Read c, Read d, Read e) => Read (a, b, c, d, e) where
   readPrec = wrap_tup (do { (a,b,c,d) <- read_tup4; read_comma
                           ; e <- readPrec
@@ -602,6 +626,7 @@
   readListPrec = readListPrecDefault
   readList     = readListDefault
 
+-- | @since 2.01
 instance (Read a, Read b, Read c, Read d, Read e, Read f)
         => Read (a, b, c, d, e, f) where
   readPrec = wrap_tup (do { (a,b,c,d) <- read_tup4; read_comma
@@ -610,6 +635,7 @@
   readListPrec = readListPrecDefault
   readList     = readListDefault
 
+-- | @since 2.01
 instance (Read a, Read b, Read c, Read d, Read e, Read f, Read g)
         => Read (a, b, c, d, e, f, g) where
   readPrec = wrap_tup (do { (a,b,c,d) <- read_tup4; read_comma
@@ -619,12 +645,14 @@
   readListPrec = readListPrecDefault
   readList     = readListDefault
 
+-- | @since 2.01
 instance (Read a, Read b, Read c, Read d, Read e, Read f, Read g, Read h)
         => Read (a, b, c, d, e, f, g, h) where
   readPrec     = wrap_tup read_tup8
   readListPrec = readListPrecDefault
   readList     = readListDefault
 
+-- | @since 2.01
 instance (Read a, Read b, Read c, Read d, Read e, Read f, Read g, Read h,
           Read i)
         => Read (a, b, c, d, e, f, g, h, i) where
@@ -634,6 +662,7 @@
   readListPrec = readListPrecDefault
   readList     = readListDefault
 
+-- | @since 2.01
 instance (Read a, Read b, Read c, Read d, Read e, Read f, Read g, Read h,
           Read i, Read j)
         => Read (a, b, c, d, e, f, g, h, i, j) where
@@ -643,6 +672,7 @@
   readListPrec = readListPrecDefault
   readList     = readListDefault
 
+-- | @since 2.01
 instance (Read a, Read b, Read c, Read d, Read e, Read f, Read g, Read h,
           Read i, Read j, Read k)
         => Read (a, b, c, d, e, f, g, h, i, j, k) where
@@ -653,6 +683,7 @@
   readListPrec = readListPrecDefault
   readList     = readListDefault
 
+-- | @since 2.01
 instance (Read a, Read b, Read c, Read d, Read e, Read f, Read g, Read h,
           Read i, Read j, Read k, Read l)
         => Read (a, b, c, d, e, f, g, h, i, j, k, l) where
@@ -662,6 +693,7 @@
   readListPrec = readListPrecDefault
   readList     = readListDefault
 
+-- | @since 2.01
 instance (Read a, Read b, Read c, Read d, Read e, Read f, Read g, Read h,
           Read i, Read j, Read k, Read l, Read m)
         => Read (a, b, c, d, e, f, g, h, i, j, k, l, m) where
@@ -672,6 +704,7 @@
   readListPrec = readListPrecDefault
   readList     = readListDefault
 
+-- | @since 2.01
 instance (Read a, Read b, Read c, Read d, Read e, Read f, Read g, Read h,
           Read i, Read j, Read k, Read l, Read m, Read n)
         => Read (a, b, c, d, e, f, g, h, i, j, k, l, m, n) where
@@ -682,6 +715,7 @@
   readListPrec = readListPrecDefault
   readList     = readListDefault
 
+-- | @since 2.01
 instance (Read a, Read b, Read c, Read d, Read e, Read f, Read g, Read h,
           Read i, Read j, Read k, Read l, Read m, Read n, Read o)
         => Read (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o) where
diff --git a/GHC/Real.hs b/GHC/Real.hs
--- a/GHC/Real.hs
+++ b/GHC/Real.hs
@@ -236,9 +236,11 @@
 -- Instances for Int
 --------------------------------------------------------------
 
+-- | @since 2.0.1
 instance  Real Int  where
     toRational x        =  toInteger x :% 1
 
+-- | @since 2.0.1
 instance  Integral Int  where
     toInteger (I# i) = smallInteger i
 
@@ -286,9 +288,11 @@
 -- Instances for @Word@
 --------------------------------------------------------------
 
+-- | @since 2.01
 instance Real Word where
     toRational x = toInteger x % 1
 
+-- | @since 2.01
 instance Integral Word where
     quot    (W# x#) y@(W# y#)
         | y /= 0                = W# (x# `quotWord#` y#)
@@ -316,6 +320,7 @@
 -- Instances for Integer
 --------------------------------------------------------------
 
+-- | @since 2.0.1
 instance  Real Integer  where
     toRational x        =  x :% 1
 
@@ -324,13 +329,14 @@
 --
 -- Constant folding of quot, rem, div, mod, divMod and quotRem for
 -- Integer arguments depends crucially on inlining. Constant folding
--- rules defined in compiler/prelude/PrelRules.lhs trigger for
+-- rules defined in compiler/prelude/PrelRules.hs trigger for
 -- quotInteger, remInteger and so on. So if calls to quot, rem and so on
 -- were not inlined the rules would not fire. The rules would also not
 -- fire if calls to quotInteger and so on were inlined, but this does not
 -- happen because they are all marked with NOINLINE pragma - see documentation
 -- of integer-gmp or integer-simple.
 
+-- | @since 2.0.1
 instance  Integral Integer where
     toInteger n      = n
 
@@ -364,11 +370,13 @@
 -- Instances for @Ratio@
 --------------------------------------------------------------
 
+-- | @since 2.0.1
 instance  (Integral a)  => Ord (Ratio a)  where
     {-# SPECIALIZE instance Ord Rational #-}
     (x:%y) <= (x':%y')  =  x * y' <= x' * y
     (x:%y) <  (x':%y')  =  x * y' <  x' * y
 
+-- | @since 2.0.1
 instance  (Integral a)  => Num (Ratio a)  where
     {-# SPECIALIZE instance Num Rational #-}
     (x:%y) + (x':%y')   =  reduce (x*y' + x'*y) (y*y')
@@ -379,6 +387,7 @@
     signum (x:%_)       =  signum x :% 1
     fromInteger x       =  fromInteger x :% 1
 
+-- | @since 2.0.1
 {-# RULES "fromRational/id" fromRational = id :: Rational -> Rational #-}
 instance  (Integral a)  => Fractional (Ratio a)  where
     {-# SPECIALIZE instance Fractional Rational #-}
@@ -389,15 +398,18 @@
         | otherwise     = y :% x
     fromRational (x:%y) =  fromInteger x % fromInteger y
 
+-- | @since 2.0.1
 instance  (Integral a)  => Real (Ratio a)  where
     {-# SPECIALIZE instance Real Rational #-}
     toRational (x:%y)   =  toInteger x :% toInteger y
 
+-- | @since 2.0.1
 instance  (Integral a)  => RealFrac (Ratio a)  where
     {-# SPECIALIZE instance RealFrac Rational #-}
     properFraction (x:%y) = (fromInteger (toInteger q), r:%y)
                           where (q,r) = quotRem x y
 
+-- | @since 2.0.1
 instance  (Show a)  => Show (Ratio a)  where
     {-# SPECIALIZE instance Show Rational #-}
     showsPrec p (x:%y)  =  showParen (p > ratioPrec) $
@@ -409,6 +421,7 @@
                            -- Haskell 98 [Sep 08, #1920]
                            showsPrec ratioPrec1 y
 
+-- | @since 2.0.1
 instance  (Integral a)  => Enum (Ratio a)  where
     {-# SPECIALIZE instance Enum Rational #-}
     succ x              =  x + 1
@@ -463,8 +476,8 @@
 even, odd       :: (Integral a) => a -> Bool
 even n          =  n `rem` 2 == 0
 odd             =  not . even
-{-# INLINEABLE even #-}
-{-# INLINEABLE odd  #-}
+{-# INLINABLE even #-}
+{-# INLINABLE odd  #-}
 
 -------------------------------------------------------
 -- | raise a number to a non-negative integral power
diff --git a/GHC/Records.hs b/GHC/Records.hs
new file mode 100644
--- /dev/null
+++ b/GHC/Records.hs
@@ -0,0 +1,34 @@
+{-# LANGUAGE AllowAmbiguousTypes
+           , FunctionalDependencies
+           , KindSignatures
+           , MultiParamTypeClasses
+           , PolyKinds
+  #-}
+
+-----------------------------------------------------------------------------
+-- |
+-- Module      :  GHC.Records
+-- Copyright   :  (c) Adam Gundry 2015-2016
+-- License     :  see libraries/base/LICENSE
+--
+-- Maintainer  :  cvs-ghc@haskell.org
+-- Stability   :  internal
+-- Portability :  non-portable (GHC extensions)
+--
+-- This module defines the 'HasField' class used by the
+-- @OverloadedRecordFields@ extension.  See the
+-- <https://ghc.haskell.org/trac/ghc/wiki/Records/OverloadedRecordFields
+-- wiki page> for more details.
+--
+-----------------------------------------------------------------------------
+
+module GHC.Records
+       ( HasField(..)
+       ) where
+
+-- | Constraint representing the fact that the field @x@ belongs to
+-- the record type @r@ and has field type @a@.  This will be solved
+-- automatically, but manual instances may be provided as well.
+class HasField (x :: k) r a | x r -> a where
+  -- | Selector function to extract the field from the record.
+  getField :: r -> a
diff --git a/GHC/ST.hs b/GHC/ST.hs
--- a/GHC/ST.hs
+++ b/GHC/ST.hs
@@ -21,7 +21,7 @@
         fixST, runST,
 
         -- * Unsafe functions
-        liftST, unsafeInterleaveST
+        liftST, unsafeInterleaveST, unsafeDupableInterleaveST
     ) where
 
 import GHC.Base
@@ -52,18 +52,22 @@
 newtype ST s a = ST (STRep s a)
 type STRep s a = State# s -> (# State# s, a #)
 
+-- | @since 2.01
 instance Functor (ST s) where
     fmap f (ST m) = ST $ \ s ->
       case (m s) of { (# new_s, r #) ->
       (# new_s, f r #) }
 
+-- | @since 4.4.0.0
 instance Applicative (ST s) where
     {-# INLINE pure #-}
     {-# INLINE (*>)   #-}
     pure x = ST (\ s -> (# s, x #))
     m *> k = m >>= \ _ -> k
     (<*>) = ap
+    liftA2 = liftM2
 
+-- | @since 2.01
 instance Monad (ST s) where
     {-# INLINE (>>=)  #-}
     (>>) = (*>)
@@ -80,9 +84,29 @@
 liftST :: ST s a -> State# s -> STret s a
 liftST (ST m) = \s -> case m s of (# s', r #) -> STret s' r
 
-{-# NOINLINE unsafeInterleaveST #-}
+noDuplicateST :: ST s ()
+noDuplicateST = ST $ \s -> (# noDuplicate# s, () #)
+
+-- | 'unsafeInterleaveST' allows an 'ST' computation to be deferred
+-- lazily.  When passed a value of type @ST a@, the 'ST' computation will
+-- only be performed when the value of the @a@ is demanded.
+{-# INLINE unsafeInterleaveST #-}
 unsafeInterleaveST :: ST s a -> ST s a
-unsafeInterleaveST (ST m) = ST ( \ s ->
+unsafeInterleaveST m = unsafeDupableInterleaveST (noDuplicateST >> m)
+
+-- | 'unsafeDupableInterleaveST' allows an 'ST' computation to be deferred
+-- lazily.  When passed a value of type @ST a@, the 'ST' computation will
+-- only be performed when the value of the @a@ is demanded.
+--
+-- The computation may be performed multiple times by different threads,
+-- possibly at the same time. To prevent this, use 'unsafeInterleaveST' instead.
+--
+-- @since 4.11
+{-# NOINLINE unsafeDupableInterleaveST #-}
+-- See Note [unsafeDupableInterleaveIO should not be inlined]
+-- in GHC.IO.Unsafe
+unsafeDupableInterleaveST :: ST s a -> ST s a
+unsafeDupableInterleaveST (ST m) = ST ( \ s ->
     let
         r = case m s of (# _, res #) -> res
     in
@@ -99,6 +123,7 @@
     in
     case ans of STret s' x -> (# s', x #)
 
+-- | @since 2.01
 instance  Show (ST s a)  where
     showsPrec _ _  = showString "<<ST action>>"
     showList       = showList__ (showsPrec 0)
diff --git a/GHC/STRef.hs b/GHC/STRef.hs
--- a/GHC/STRef.hs
+++ b/GHC/STRef.hs
@@ -45,5 +45,6 @@
     (# s2#, () #) }
 
 -- Just pointer equality on mutable references:
+-- | @since 2.01
 instance Eq (STRef s a) where
     STRef v1# == STRef v2# = isTrue# (sameMutVar# v1# v2#)
diff --git a/GHC/Show.hs b/GHC/Show.hs
--- a/GHC/Show.hs
+++ b/GHC/Show.hs
@@ -39,7 +39,7 @@
 
         -- Show support code
         shows, showChar, showString, showMultiLineString,
-        showParen, showList__, showSpace,
+        showParen, showList__, showCommaSpace, showSpace,
         showLitChar, showLitString, protectEsc,
         intToDigit, showSignedInt,
         appPrec, appPrec1,
@@ -165,6 +165,7 @@
 
 deriving instance Show ()
 
+-- | @since 2.01
 instance Show a => Show [a]  where
   {-# SPECIALISE instance Show [String] #-}
   {-# SPECIALISE instance Show [Char] #-}
@@ -174,15 +175,18 @@
 deriving instance Show Bool
 deriving instance Show Ordering
 
+-- | @since 2.01
 instance  Show Char  where
     showsPrec _ '\'' = showString "'\\''"
     showsPrec _ c    = showChar '\'' . showLitChar c . showChar '\''
 
     showList cs = showChar '"' . showLitString cs . showChar '"'
 
+-- | @since 2.01
 instance Show Int where
     showsPrec = showSignedInt
 
+-- | @since 2.01
 instance Show Word where
     showsPrec _ (W# w) = showWord w
 
@@ -195,16 +199,20 @@
 
 deriving instance Show a => Show (Maybe a)
 
+-- | @since 2.01
 instance Show TyCon where
-  showsPrec p (TyCon _ _ _ tc_name) = showsPrec p tc_name
+  showsPrec p (TyCon _ _ _ tc_name _ _) = showsPrec p tc_name
 
+-- | @since 4.9.0.0
 instance Show TrName where
   showsPrec _ (TrNameS s) = showString (unpackCString# s)
   showsPrec _ (TrNameD s) = showString s
 
+-- | @since 4.9.0.0
 instance Show Module where
   showsPrec _ (Module p m) = shows p . (':' :) . shows m
 
+-- | @since 4.9.0.0
 instance Show CallStack where
   showsPrec _ = shows . getCallStack
 
@@ -220,49 +228,60 @@
 --      showsPrec _ (x,y) = let sx = shows x; sy = shows y in
 --                          \s -> showChar '(' (sx (showChar ',' (sy (showChar ')' s))))
 
+-- | @since 2.01
 instance  (Show a, Show b) => Show (a,b)  where
   showsPrec _ (a,b) s = show_tuple [shows a, shows b] s
 
+-- | @since 2.01
 instance (Show a, Show b, Show c) => Show (a, b, c) where
   showsPrec _ (a,b,c) s = show_tuple [shows a, shows b, shows c] s
 
+-- | @since 2.01
 instance (Show a, Show b, Show c, Show d) => Show (a, b, c, d) where
   showsPrec _ (a,b,c,d) s = show_tuple [shows a, shows b, shows c, shows d] s
 
+-- | @since 2.01
 instance (Show a, Show b, Show c, Show d, Show e) => Show (a, b, c, d, e) where
   showsPrec _ (a,b,c,d,e) s = show_tuple [shows a, shows b, shows c, shows d, shows e] s
 
+-- | @since 2.01
 instance (Show a, Show b, Show c, Show d, Show e, Show f) => Show (a,b,c,d,e,f) where
   showsPrec _ (a,b,c,d,e,f) s = show_tuple [shows a, shows b, shows c, shows d, shows e, shows f] s
 
+-- | @since 2.01
 instance (Show a, Show b, Show c, Show d, Show e, Show f, Show g)
         => Show (a,b,c,d,e,f,g) where
   showsPrec _ (a,b,c,d,e,f,g) s
         = show_tuple [shows a, shows b, shows c, shows d, shows e, shows f, shows g] s
 
+-- | @since 2.01
 instance (Show a, Show b, Show c, Show d, Show e, Show f, Show g, Show h)
          => Show (a,b,c,d,e,f,g,h) where
   showsPrec _ (a,b,c,d,e,f,g,h) s
         = show_tuple [shows a, shows b, shows c, shows d, shows e, shows f, shows g, shows h] s
 
+-- | @since 2.01
 instance (Show a, Show b, Show c, Show d, Show e, Show f, Show g, Show h, Show i)
          => Show (a,b,c,d,e,f,g,h,i) where
   showsPrec _ (a,b,c,d,e,f,g,h,i) s
         = show_tuple [shows a, shows b, shows c, shows d, shows e, shows f, shows g, shows h,
                       shows i] s
 
+-- | @since 2.01
 instance (Show a, Show b, Show c, Show d, Show e, Show f, Show g, Show h, Show i, Show j)
          => Show (a,b,c,d,e,f,g,h,i,j) where
   showsPrec _ (a,b,c,d,e,f,g,h,i,j) s
         = show_tuple [shows a, shows b, shows c, shows d, shows e, shows f, shows g, shows h,
                       shows i, shows j] s
 
+-- | @since 2.01
 instance (Show a, Show b, Show c, Show d, Show e, Show f, Show g, Show h, Show i, Show j, Show k)
          => Show (a,b,c,d,e,f,g,h,i,j,k) where
   showsPrec _ (a,b,c,d,e,f,g,h,i,j,k) s
         = show_tuple [shows a, shows b, shows c, shows d, shows e, shows f, shows g, shows h,
                       shows i, shows j, shows k] s
 
+-- | @since 2.01
 instance (Show a, Show b, Show c, Show d, Show e, Show f, Show g, Show h, Show i, Show j, Show k,
           Show l)
          => Show (a,b,c,d,e,f,g,h,i,j,k,l) where
@@ -270,6 +289,7 @@
         = show_tuple [shows a, shows b, shows c, shows d, shows e, shows f, shows g, shows h,
                       shows i, shows j, shows k, shows l] s
 
+-- | @since 2.01
 instance (Show a, Show b, Show c, Show d, Show e, Show f, Show g, Show h, Show i, Show j, Show k,
           Show l, Show m)
          => Show (a,b,c,d,e,f,g,h,i,j,k,l,m) where
@@ -277,6 +297,7 @@
         = show_tuple [shows a, shows b, shows c, shows d, shows e, shows f, shows g, shows h,
                       shows i, shows j, shows k, shows l, shows m] s
 
+-- | @since 2.01
 instance (Show a, Show b, Show c, Show d, Show e, Show f, Show g, Show h, Show i, Show j, Show k,
           Show l, Show m, Show n)
          => Show (a,b,c,d,e,f,g,h,i,j,k,l,m,n) where
@@ -284,6 +305,7 @@
         = show_tuple [shows a, shows b, shows c, shows d, shows e, shows f, shows g, shows h,
                       shows i, shows j, shows k, shows l, shows m, shows n] s
 
+-- | @since 2.01
 instance (Show a, Show b, Show c, Show d, Show e, Show f, Show g, Show h, Show i, Show j, Show k,
           Show l, Show m, Show n, Show o)
          => Show (a,b,c,d,e,f,g,h,i,j,k,l,m,n,o) where
@@ -322,6 +344,8 @@
 showSpace :: ShowS
 showSpace = {-showChar ' '-} \ xs -> ' ' : xs
 
+showCommaSpace :: ShowS
+showCommaSpace = showString ", "
 -- Code specific for characters
 
 -- | Convert a character to a string using only printable characters,
@@ -434,6 +458,7 @@
 -- The Integer instances for Show
 --------------------------------------------------------------
 
+-- | @since 2.01
 instance Show Integer where
     showsPrec p n r
         | p > 6 && n < 0 = '(' : integerToString n (')' : r)
diff --git a/GHC/Stable.hs b/GHC/Stable.hs
--- a/GHC/Stable.hs
+++ b/GHC/Stable.hs
@@ -101,6 +101,7 @@
 castPtrToStablePtr :: Ptr () -> StablePtr a
 castPtrToStablePtr (Ptr a) = StablePtr (unsafeCoerce# a)
 
+-- | @since 2.1
 instance Eq (StablePtr a) where
     (StablePtr sp1) == (StablePtr sp2) =
         case eqStablePtr# sp1 sp2 of
diff --git a/GHC/Stack/CCS.hsc b/GHC/Stack/CCS.hsc
--- a/GHC/Stack/CCS.hsc
+++ b/GHC/Stack/CCS.hsc
@@ -82,7 +82,7 @@
 -- | Returns a @[String]@ representing the current call stack.  This
 -- can be useful for debugging.
 --
--- The implementation uses the call-stack simulation maintined by the
+-- The implementation uses the call-stack simulation maintained by the
 -- profiler, so it only works if the program was compiled with @-prof@
 -- and contains suitable SCC annotations (e.g. by using @-fprof-auto@).
 -- Otherwise, the list returned is likely to be empty or
diff --git a/GHC/StaticPtr.hs b/GHC/StaticPtr.hs
--- a/GHC/StaticPtr.hs
+++ b/GHC/StaticPtr.hs
@@ -1,6 +1,7 @@
+{-# LANGUAGE CPP                       #-}
+{-# LANGUAGE ExistentialQuantification #-}
 {-# LANGUAGE MagicHash                 #-}
 {-# LANGUAGE UnboxedTuples             #-}
-{-# LANGUAGE ExistentialQuantification #-}
 -----------------------------------------------------------------------------
 -- |
 -- Module      :  GHC.StaticPtr
@@ -47,14 +48,24 @@
 import GHC.Exts            (addrToAny#)
 import GHC.Ptr             (Ptr(..), nullPtr)
 import GHC.Fingerprint     (Fingerprint(..))
+import GHC.Prim
+import GHC.Word            (Word64(..))
 
 
--- | A reference to a value of type 'a'.
-data StaticPtr a = StaticPtr StaticKey StaticPtrInfo a
+#include "MachDeps.h"
 
+-- | A reference to a value of type 'a'.
+#if WORD_SIZE_IN_BITS < 64
+data StaticPtr a = StaticPtr Word64# Word64# -- The flattened Fingerprint is
+                                             -- convenient in the compiler.
+                             StaticPtrInfo a
+#else
+data StaticPtr a = StaticPtr Word# Word#
+                             StaticPtrInfo a
+#endif
 -- | Dereferences a static pointer.
 deRefStaticPtr :: StaticPtr a -> a
-deRefStaticPtr (StaticPtr _ _ v) = v
+deRefStaticPtr (StaticPtr _ _ _ v) = v
 
 -- | A key for `StaticPtrs` that can be serialized and used with
 -- 'unsafeLookupStaticPtr'.
@@ -62,7 +73,7 @@
 
 -- | The 'StaticKey' that can be used to look up the given 'StaticPtr'.
 staticKey :: StaticPtr a -> StaticKey
-staticKey (StaticPtr k _ _) = k
+staticKey (StaticPtr w0 w1 _ _) = Fingerprint (W64# w0) (W64# w1)
 
 -- | Looks up a 'StaticPtr' by its 'StaticKey'.
 --
@@ -85,6 +96,7 @@
 class IsStatic p where
     fromStaticPtr :: StaticPtr a -> p a
 
+-- | @since 4.9.0.0
 instance IsStatic StaticPtr where
     fromStaticPtr = id
 
@@ -94,9 +106,6 @@
       spInfoUnitId  :: String
       -- | Name of the module where the static pointer is defined
     , spInfoModuleName :: String
-      -- | An internal name that is distinct for every static pointer defined in
-      -- a given module.
-    , spInfoName       :: String
       -- | Source location of the definition of the static pointer as a
       -- @(Line, Column)@ pair.
     , spInfoSrcLoc     :: (Int, Int)
@@ -105,7 +114,7 @@
 
 -- | 'StaticPtrInfo' of the given 'StaticPtr'.
 staticPtrInfo :: StaticPtr a -> StaticPtrInfo
-staticPtrInfo (StaticPtr _ n _) = n
+staticPtrInfo (StaticPtr _ _ n _) = n
 
 -- | A list of all known keys.
 staticPtrKeys :: IO [StaticKey]
diff --git a/GHC/StaticPtr/Internal.hs b/GHC/StaticPtr/Internal.hs
new file mode 100644
--- /dev/null
+++ b/GHC/StaticPtr/Internal.hs
@@ -0,0 +1,27 @@
+-- |
+-- Module      :  GHC.StaticPtr
+-- Copyright   :  (C) 2016 I/O Tweag
+-- License     :  see libraries/base/LICENSE
+--
+-- Maintainer  :  cvs-ghc@haskell.org
+-- Stability   :  internal
+-- Portability :  non-portable (GHC Extensions)
+--
+-- Internal definitions needed for compiling static forms.
+--
+
+-- By omitting interface pragmas, we drop the strictness annotations
+-- which otherwise would bias GHC to conclude that any code using
+-- the static form would fail.
+{-# OPTIONS_GHC -fomit-interface-pragmas #-}
+module GHC.StaticPtr.Internal (makeStatic) where
+
+import GHC.StaticPtr(StaticPtr)
+
+-- 'makeStatic' should never be called by the user.
+-- See Note [Grand plan for static forms] in StaticPtrTable.
+
+makeStatic :: (Int, Int) -> a -> StaticPtr a
+makeStatic (line, col) _ =
+    error $ "GHC bug - makeStatic: Unresolved static form at line "
+            ++ show line ++ ", column " ++ show col ++ "."
diff --git a/GHC/Stats.hsc b/GHC/Stats.hsc
--- a/GHC/Stats.hsc
+++ b/GHC/Stats.hsc
@@ -13,14 +13,25 @@
 -- @since 4.5.0.0
 -----------------------------------------------------------------------------
 module GHC.Stats
-    ( GCStats(..)
+    (
+    -- * Runtime statistics
+      RTSStats(..), GCDetails(..), RtsTime
+    , getRTSStats
+    , getRTSStatsEnabled
+
+    -- * DEPRECATED, don't use
+    , GCStats(..)
     , getGCStats
     , getGCStatsEnabled
 ) where
 
+import Control.Applicative
 import Control.Monad
 import Data.Int
+import Data.Word
 import GHC.Base
+import GHC.Num (Num(..))
+import GHC.Real (quot, fromIntegral, (/))
 import GHC.Read ( Read )
 import GHC.Show ( Show )
 import GHC.IO.Exception
@@ -30,13 +41,164 @@
 
 #include "Rts.h"
 
-foreign import ccall "getGCStats"        getGCStats_       :: Ptr () -> IO ()
+foreign import ccall "getRTSStats" getRTSStats_ :: Ptr () -> IO ()
 
 -- | Returns whether GC stats have been enabled (with @+RTS -T@, for example).
 --
--- @since 4.6.0.0
-foreign import ccall "getGCStatsEnabled" getGCStatsEnabled :: IO Bool
+-- @since 4.9.0.0
+foreign import ccall "getRTSStatsEnabled" getRTSStatsEnabled :: IO Bool
 
+--
+-- | Statistics about runtime activity since the start of the
+-- program.  This is a mirror of the C @struct RTSStats@ in @RtsAPI.h@
+--
+-- @since 4.9.0.0
+--
+data RTSStats = RTSStats {
+  -- -----------------------------------
+  -- Cumulative stats about memory use
+
+    -- | Total number of GCs
+    gcs :: Word32
+    -- | Total number of major (oldest generation) GCs
+  , major_gcs :: Word32
+    -- | Total bytes allocated
+  , allocated_bytes :: Word64
+    -- | Maximum live data (including large objects + compact regions)
+  , max_live_bytes :: Word64
+    -- | Maximum live data in large objects
+  , max_large_objects_bytes :: Word64
+    -- | Maximum live data in compact regions
+  , max_compact_bytes :: Word64
+    -- | Maximum slop
+  , max_slop_bytes :: Word64
+    -- | Maximum memory in use by the RTS
+  , max_mem_in_use_bytes :: Word64
+    -- | Sum of live bytes across all major GCs.  Divided by major_gcs
+    -- gives the average live data over the lifetime of the program.
+  , cumulative_live_bytes :: Word64
+    -- | Sum of copied_bytes across all GCs
+  , copied_bytes :: Word64
+    -- | Sum of copied_bytes across all parallel GCs
+  , par_copied_bytes :: Word64
+    -- | Sum of par_max_copied_bytes across all parallel GCs
+  , cumulative_par_max_copied_bytes :: Word64
+
+  -- -----------------------------------
+  -- Cumulative stats about time use
+  -- (we use signed values here because due to inaccuracies in timers
+  -- the values can occasionally go slightly negative)
+
+    -- | Total CPU time used by the mutator
+  , mutator_cpu_ns :: RtsTime
+    -- | Total elapsed time used by the mutator
+  , mutator_elapsed_ns :: RtsTime
+    -- | Total CPU time used by the GC
+  , gc_cpu_ns :: RtsTime
+    -- | Total elapsed time used by the GC
+  , gc_elapsed_ns :: RtsTime
+    -- | Total CPU time (at the previous GC)
+  , cpu_ns :: RtsTime
+    -- | Total elapsed time (at the previous GC)
+  , elapsed_ns :: RtsTime
+
+    -- | Details about the most recent GC
+  , gc :: GCDetails
+  } deriving (Read, Show)
+
+--
+-- | Statistics about a single GC.  This is a mirror of the C @struct
+--   GCDetails@ in @RtsAPI.h@, with the field prefixed with @gc_@ to
+--   avoid collisions with 'RTSStats'.
+--
+data GCDetails = GCDetails {
+    -- | The generation number of this GC
+    gcdetails_gen :: Word32
+    -- | Number of threads used in this GC
+  , gcdetails_threads :: Word32
+    -- | Number of bytes allocated since the previous GC
+  , gcdetails_allocated_bytes :: Word64
+    -- | Total amount of live data in the heap (incliudes large + compact data)
+  , gcdetails_live_bytes :: Word64
+    -- | Total amount of live data in large objects
+  , gcdetails_large_objects_bytes :: Word64
+    -- | Total amount of live data in compact regions
+  , gcdetails_compact_bytes :: Word64
+    -- | Total amount of slop (wasted memory)
+  , gcdetails_slop_bytes :: Word64
+    -- | Total amount of memory in use by the RTS
+  , gcdetails_mem_in_use_bytes :: Word64
+    -- | Total amount of data copied during this GC
+  , gcdetails_copied_bytes :: Word64
+    -- | In parallel GC, the max amount of data copied by any one thread
+  , gcdetails_par_max_copied_bytes :: Word64
+    -- | The time elapsed during synchronisation before GC
+  , gcdetails_sync_elapsed_ns :: RtsTime
+    -- | The CPU time used during GC itself
+  , gcdetails_cpu_ns :: RtsTime
+    -- | The time elapsed during GC itself
+  , gcdetails_elapsed_ns :: RtsTime
+  } deriving (Read, Show)
+
+-- | Time values from the RTS, using a fixed resolution of nanoseconds.
+type RtsTime = Int64
+
+-- @since 4.9.0.0
+--
+getRTSStats :: IO RTSStats
+getRTSStats = do
+  statsEnabled <- getGCStatsEnabled
+  unless statsEnabled .  ioError $ IOError
+    Nothing
+    UnsupportedOperation
+    ""
+    "getGCStats: GC stats not enabled. Use `+RTS -T -RTS' to enable them."
+    Nothing
+    Nothing
+  allocaBytes (#size RTSStats) $ \p -> do
+    getRTSStats_ p
+    gcs <- (# peek RTSStats, gcs) p
+    major_gcs <- (# peek RTSStats, major_gcs) p
+    allocated_bytes <- (# peek RTSStats, allocated_bytes) p
+    max_live_bytes <- (# peek RTSStats, max_live_bytes) p
+    max_large_objects_bytes <- (# peek RTSStats, max_large_objects_bytes) p
+    max_compact_bytes <- (# peek RTSStats, max_compact_bytes) p
+    max_slop_bytes <- (# peek RTSStats, max_slop_bytes) p
+    max_mem_in_use_bytes <- (# peek RTSStats, max_mem_in_use_bytes) p
+    cumulative_live_bytes <- (# peek RTSStats, cumulative_live_bytes) p
+    copied_bytes <- (# peek RTSStats, copied_bytes) p
+    par_copied_bytes <- (# peek RTSStats, par_copied_bytes) p
+    cumulative_par_max_copied_bytes <-
+      (# peek RTSStats, cumulative_par_max_copied_bytes) p
+    mutator_cpu_ns <- (# peek RTSStats, mutator_cpu_ns) p
+    mutator_elapsed_ns <- (# peek RTSStats, mutator_elapsed_ns) p
+    gc_cpu_ns <- (# peek RTSStats, gc_cpu_ns) p
+    gc_elapsed_ns <- (# peek RTSStats, gc_elapsed_ns) p
+    cpu_ns <- (# peek RTSStats, cpu_ns) p
+    elapsed_ns <- (# peek RTSStats, elapsed_ns) p
+    let pgc = (# ptr RTSStats, gc) p
+    gc <- do
+      gcdetails_gen <- (# peek GCDetails, gen) pgc
+      gcdetails_threads <- (# peek GCDetails, threads) pgc
+      gcdetails_allocated_bytes <- (# peek GCDetails, allocated_bytes) pgc
+      gcdetails_live_bytes <- (# peek GCDetails, live_bytes) pgc
+      gcdetails_large_objects_bytes <-
+        (# peek GCDetails, large_objects_bytes) pgc
+      gcdetails_compact_bytes <- (# peek GCDetails, compact_bytes) pgc
+      gcdetails_slop_bytes <- (# peek GCDetails, slop_bytes) pgc
+      gcdetails_mem_in_use_bytes <- (# peek GCDetails, mem_in_use_bytes) pgc
+      gcdetails_copied_bytes <- (# peek GCDetails, copied_bytes) pgc
+      gcdetails_par_max_copied_bytes <-
+        (# peek GCDetails, par_max_copied_bytes) pgc
+      gcdetails_sync_elapsed_ns <- (# peek GCDetails, sync_elapsed_ns) pgc
+      gcdetails_cpu_ns <- (# peek GCDetails, cpu_ns) pgc
+      gcdetails_elapsed_ns <- (# peek GCDetails, elapsed_ns) pgc
+      return GCDetails{..}
+    return RTSStats{..}
+
+-- -----------------------------------------------------------------------------
+-- DEPRECATED API
+
 -- I'm probably violating a bucket of constraints here... oops.
 
 -- | Statistics about memory usage and the garbage collector. Apart from
@@ -44,6 +206,7 @@
 -- the program started.
 --
 -- @since 4.5.0.0
+{-# DEPRECATED GCStats "Use RTSStats instead.  This will be removed in GHC 8.4.1" #-}
 data GCStats = GCStats
     { -- | Total number of bytes allocated
     bytesAllocated :: !Int64
@@ -72,6 +235,7 @@
     , peakMegabytesAllocated :: !Int64
     -- | CPU time spent running mutator threads.  This does not include
     -- any profiling overhead or initialization.
+    , mblocksAllocated :: !Int64 -- ^ Number of allocated megablocks
     , mutatorCpuSeconds :: !Double
 
     -- | Wall clock time spent running mutator threads.  This does not
@@ -99,16 +263,13 @@
     , parMaxBytesCopied :: !Int64
     } deriving (Show, Read)
 
-    {-
-    , initCpuSeconds :: !Double
-    , initWallSeconds :: !Double
-    -}
-
 -- | Retrieves garbage collection and memory statistics as of the last
 -- garbage collection.  If you would like your statistics as recent as
 -- possible, first run a 'System.Mem.performGC'.
 --
 -- @since 4.5.0.0
+{-# DEPRECATED getGCStats
+    "Use getRTSStats instead.  This will be removed in GHC 8.4.1" #-}
 getGCStats :: IO GCStats
 getGCStats = do
   statsEnabled <- getGCStatsEnabled
@@ -119,55 +280,38 @@
     "getGCStats: GC stats not enabled. Use `+RTS -T -RTS' to enable them."
     Nothing
     Nothing
-  allocaBytes (#size GCStats) $ \p -> do
-    getGCStats_ p
-    bytesAllocated <- (# peek GCStats, bytes_allocated) p
-    numGcs <- (# peek GCStats, num_gcs ) p
-    numByteUsageSamples <- (# peek GCStats, num_byte_usage_samples ) p
-    maxBytesUsed <- (# peek GCStats, max_bytes_used ) p
-    cumulativeBytesUsed <- (# peek GCStats, cumulative_bytes_used ) p
-    bytesCopied <- (# peek GCStats, bytes_copied ) p
-    currentBytesUsed <- (# peek GCStats, current_bytes_used ) p
-    currentBytesSlop <- (# peek GCStats, current_bytes_slop) p
-    maxBytesSlop <- (# peek GCStats, max_bytes_slop) p
-    peakMegabytesAllocated <- (# peek GCStats, peak_megabytes_allocated ) p
-    {-
-    initCpuSeconds <- (# peek GCStats, init_cpu_seconds) p
-    initWallSeconds <- (# peek GCStats, init_wall_seconds) p
-    -}
-    mutatorCpuSeconds <- (# peek GCStats, mutator_cpu_seconds) p
-    mutatorWallSeconds <- (# peek GCStats, mutator_wall_seconds) p
-    gcCpuSeconds <- (# peek GCStats, gc_cpu_seconds) p
-    gcWallSeconds <- (# peek GCStats, gc_wall_seconds) p
-    cpuSeconds <- (# peek GCStats, cpu_seconds) p
-    wallSeconds <- (# peek GCStats, wall_seconds) p
-    parTotBytesCopied <- (# peek GCStats, par_tot_bytes_copied) p
-    parMaxBytesCopied <- (# peek GCStats, par_max_bytes_copied) p
+  allocaBytes (#size RTSStats) $ \p -> do
+    getRTSStats_ p
+    bytesAllocated <- (# peek RTSStats, allocated_bytes) p
+    numGcs <- (# peek RTSStats, gcs ) p
+    numByteUsageSamples <- (# peek RTSStats, major_gcs ) p
+    maxBytesUsed <- (# peek RTSStats, max_live_bytes ) p
+    cumulativeBytesUsed <- (# peek RTSStats, cumulative_live_bytes ) p
+    bytesCopied <- (# peek RTSStats, copied_bytes ) p
+    currentBytesUsed <- (# peek RTSStats, gc.live_bytes ) p
+    currentBytesSlop <- (# peek RTSStats, gc.slop_bytes) p
+    maxBytesSlop <- (# peek RTSStats, max_slop_bytes) p
+    peakMegabytesAllocated <- do
+      bytes <- (# peek RTSStats, max_mem_in_use_bytes ) p
+      return (bytes `quot` (1024*1024))
+    mblocksAllocated <- do
+      bytes <- (# peek RTSStats, gc.mem_in_use_bytes) p
+      return (bytes `quot` (1024*1024))
+    mutatorCpuSeconds <- nsToSecs <$> (# peek RTSStats, mutator_cpu_ns) p
+    mutatorWallSeconds <-
+      nsToSecs <$> (# peek RTSStats, mutator_elapsed_ns) p
+    gcCpuSeconds <- nsToSecs <$> (# peek RTSStats, gc_cpu_ns) p
+    gcWallSeconds <- nsToSecs <$> (# peek RTSStats, gc_elapsed_ns) p
+    cpuSeconds <- nsToSecs <$> (# peek RTSStats, cpu_ns) p
+    wallSeconds <- nsToSecs <$> (# peek RTSStats, elapsed_ns) p
+    parTotBytesCopied <- (# peek RTSStats, par_copied_bytes) p
+    parMaxBytesCopied <- (# peek RTSStats, cumulative_par_max_copied_bytes) p
     return GCStats { .. }
 
-{-
-
--- Nontrivial to implement: TaskStats needs arbitrarily large
--- amounts of memory, spark stats wants to use SparkCounters
--- but that needs a new rts/ header.
-
-data TaskStats = TaskStats
-    { taskMutCpuSeconds :: Int64
-    , taskMutWallSeconds :: Int64
-    , taskGcCpuSeconds :: Int64
-    , taskGcWallSeconds :: Int64
-    } deriving (Show, Read)
-
-data SparkStats = SparkStats
-    { sparksCreated :: Int64
-    , sparksDud :: Int64
-    , sparksOverflowed :: Int64
-    , sparksConverted :: Int64
-    , sparksGcd :: Int64
-    , sparksFizzled :: Int64
-    } deriving (Show, Read)
-
--- We also could get per-generation stats, which requires a
--- non-constant but at runtime known about of memory.
+nsToSecs :: Int64 -> Double
+nsToSecs ns = fromIntegral ns / (# const TIME_RESOLUTION)
 
--}
+{-# DEPRECATED getGCStatsEnabled
+    "use getRTSStatsEnabled instead.  This will be removed in GHC 8.4.1" #-}
+getGCStatsEnabled :: IO Bool
+getGCStatsEnabled = getRTSStatsEnabled
diff --git a/GHC/TopHandler.hs b/GHC/TopHandler.hs
--- a/GHC/TopHandler.hs
+++ b/GHC/TopHandler.hs
@@ -3,6 +3,7 @@
            , NoImplicitPrelude
            , MagicHash
            , UnboxedTuples
+           , UnliftedFFITypes
   #-}
 {-# OPTIONS_HADDOCK hide #-}
 
@@ -50,6 +51,30 @@
 import Data.Dynamic (toDyn)
 #endif
 
+-- Note [rts_setMainThread must be called unsafely]
+-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+--
+-- rts_setMainThread must be called as unsafe, because it
+-- dereferences the Weak# and manipulates the raw Haskell value
+-- behind it.  Therefore, it must not race with a garbage collection.
+
+-- Note [rts_setMainThread has an unsound type]
+-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+--
+-- 'rts_setMainThread' is imported with type Weak# ThreadId -> IO (),
+-- but this is an unsound type for it: it grabs the /key/ of the
+-- 'Weak#' object, which isn't tracked by the type at all.
+-- That this works at all is a consequence of the fact that
+-- 'mkWeakThreadId' produces a 'Weak#' with a 'ThreadId#' as the key
+-- This is fairly robust, in that 'mkWeakThreadId' wouldn't work
+-- otherwise, but it still is sufficiently non-trivial to justify an
+-- ASSERT in rts/TopHandler.c.
+
+-- see Note [rts_setMainThread must be called unsafely] and
+-- Note [rts_setMainThread has an unsound type]
+foreign import ccall unsafe "rts_setMainThread"
+  setMainThread :: Weak# ThreadId -> IO ()
+
 -- | 'runMainIO' is wrapped around 'Main.main' (or whatever main is
 -- called in the program).  It catches otherwise uncaught exceptions,
 -- and also flushes stdout\/stderr before exiting.
@@ -58,6 +83,7 @@
     do
       main_thread_id <- myThreadId
       weak_tid <- mkWeakThreadId main_thread_id
+      case weak_tid of (Weak w) -> setMainThread w
       install_interrupt_handler $ do
            m <- deRefWeak weak_tid
            case m of
@@ -149,7 +175,11 @@
            reportStackOverflow
            exit 2
 
-      Just UserInterrupt  -> exitInterrupted
+      Just UserInterrupt -> exitInterrupted
+
+      Just HeapOverflow -> do
+           reportHeapOverflow
+           exit 251
 
       _ -> case fromException se of
            -- only the main thread gets ExitException exceptions
diff --git a/GHC/TypeLits.hs b/GHC/TypeLits.hs
--- a/GHC/TypeLits.hs
+++ b/GHC/TypeLits.hs
@@ -26,16 +26,17 @@
     Nat, Symbol  -- Both declared in GHC.Types in package ghc-prim
 
     -- * Linking type and value level
-  , KnownNat, natVal, natVal'
+  , N.KnownNat, natVal, natVal'
   , KnownSymbol, symbolVal, symbolVal'
-  , SomeNat(..), SomeSymbol(..)
+  , N.SomeNat(..), SomeSymbol(..)
   , someNatVal, someSymbolVal
-  , sameNat, sameSymbol
+  , N.sameNat, sameSymbol
 
 
     -- * Functions on type literals
-  , type (<=), type (<=?), type (+), type (*), type (^), type (-)
-  , CmpNat, CmpSymbol
+  , type (N.<=), type (N.<=?), type (N.+), type (N.*), type (N.^), type (N.-)
+  , AppendSymbol
+  , N.CmpNat, CmpSymbol
 
   -- * User-defined type errors
   , TypeError
@@ -45,24 +46,21 @@
 
 import GHC.Base(Eq(..), Ord(..), Bool(True,False), Ordering(..), otherwise)
 import GHC.Types( Nat, Symbol )
-import GHC.Num(Integer)
+import GHC.Num(Integer, fromInteger)
 import GHC.Base(String)
 import GHC.Show(Show(..))
 import GHC.Read(Read(..))
+import GHC.Real(toInteger)
 import GHC.Prim(magicDict, Proxy#)
 import Data.Maybe(Maybe(..))
 import Data.Proxy (Proxy(..))
 import Data.Type.Equality(type (==), (:~:)(Refl))
 import Unsafe.Coerce(unsafeCoerce)
 
---------------------------------------------------------------------------------
+import GHC.TypeNats (KnownNat)
+import qualified GHC.TypeNats as N
 
--- | This class gives the integer associated with a type-level natural.
--- There are instances of the class for every concrete literal: 0, 1, 2, etc.
---
--- @since 4.7.0.0
-class KnownNat (n :: Nat) where
-  natSing :: SNat n
+--------------------------------------------------------------------------------
 
 -- | This class gives the string associated with a type-level symbol.
 -- There are instances of the class for every concrete literal: "hello", etc.
@@ -73,8 +71,7 @@
 
 -- | @since 4.7.0.0
 natVal :: forall n proxy. KnownNat n => proxy n -> Integer
-natVal _ = case natSing :: SNat n of
-             SNat x -> x
+natVal p = toInteger (N.natVal p)
 
 -- | @since 4.7.0.0
 symbolVal :: forall n proxy. KnownSymbol n => proxy n -> String
@@ -83,8 +80,7 @@
 
 -- | @since 4.8.0.0
 natVal' :: forall n. KnownNat n => Proxy# n -> Integer
-natVal' _ = case natSing :: SNat n of
-             SNat x -> x
+natVal' p = toInteger (N.natVal' p)
 
 -- | @since 4.8.0.0
 symbolVal' :: forall n. KnownSymbol n => Proxy# n -> String
@@ -92,11 +88,6 @@
                 SSymbol x -> x
 
 
-
--- | This type represents unknown type-level natural numbers.
-data SomeNat    = forall n. KnownNat n    => SomeNat    (Proxy n)
-                  -- ^ @since 4.7.0.0
-
 -- | This type represents unknown type-level symbols.
 data SomeSymbol = forall n. KnownSymbol n => SomeSymbol (Proxy n)
                   -- ^ @since 4.7.0.0
@@ -104,9 +95,9 @@
 -- | Convert an integer into an unknown type-level natural.
 --
 -- @since 4.7.0.0
-someNatVal :: Integer -> Maybe SomeNat
+someNatVal :: Integer -> Maybe N.SomeNat
 someNatVal n
-  | n >= 0        = Just (withSNat SomeNat (SNat n) Proxy)
+  | n >= 0        = Just (N.someNatVal (fromInteger n))
   | otherwise     = Nothing
 
 -- | Convert a string into an unknown type-level symbol.
@@ -115,41 +106,22 @@
 someSymbolVal :: String -> SomeSymbol
 someSymbolVal n   = withSSymbol SomeSymbol (SSymbol n) Proxy
 
-
-
-instance Eq SomeNat where
-  SomeNat x == SomeNat y = natVal x == natVal y
-
-instance Ord SomeNat where
-  compare (SomeNat x) (SomeNat y) = compare (natVal x) (natVal y)
-
-instance Show SomeNat where
-  showsPrec p (SomeNat x) = showsPrec p (natVal x)
-
-instance Read SomeNat where
-  readsPrec p xs = do (a,ys) <- readsPrec p xs
-                      case someNatVal a of
-                        Nothing -> []
-                        Just n  -> [(n,ys)]
-
-
+-- | @since 4.7.0.0
 instance Eq SomeSymbol where
   SomeSymbol x == SomeSymbol y = symbolVal x == symbolVal y
 
+-- | @since 4.7.0.0
 instance Ord SomeSymbol where
   compare (SomeSymbol x) (SomeSymbol y) = compare (symbolVal x) (symbolVal y)
 
+-- | @since 4.7.0.0
 instance Show SomeSymbol where
   showsPrec p (SomeSymbol x) = showsPrec p (symbolVal x)
 
+-- | @since 4.7.0.0
 instance Read SomeSymbol where
   readsPrec p xs = [ (someSymbolVal a, ys) | (a,ys) <- readsPrec p xs ]
 
-type family EqNat (a :: Nat) (b :: Nat) where
-  EqNat a a = 'True
-  EqNat a b = 'False
-type instance a == b = EqNat a b
-
 type family EqSymbol (a :: Symbol) (b :: Symbol) where
   EqSymbol a a = 'True
   EqSymbol a b = 'False
@@ -157,44 +129,15 @@
 
 --------------------------------------------------------------------------------
 
-infix  4 <=?, <=
-infixl 6 +, -
-infixl 7 *
-infixr 8 ^
-
--- | Comparison of type-level naturals, as a constraint.
-type x <= y = (x <=? y) ~ 'True
-
 -- | Comparison of type-level symbols, as a function.
 --
 -- @since 4.7.0.0
 type family CmpSymbol (m :: Symbol) (n :: Symbol) :: Ordering
 
--- | Comparison of type-level naturals, as a function.
---
--- @since 4.7.0.0
-type family CmpNat    (m :: Nat)    (n :: Nat)    :: Ordering
-
-{- | Comparison of type-level naturals, as a function.
-NOTE: The functionality for this function should be subsumed
-by 'CmpNat', so this might go away in the future.
-Please let us know, if you encounter discrepancies between the two. -}
-type family (m :: Nat) <=? (n :: Nat) :: Bool
-
--- | Addition of type-level naturals.
-type family (m :: Nat) + (n :: Nat) :: Nat
-
--- | Multiplication of type-level naturals.
-type family (m :: Nat) * (n :: Nat) :: Nat
-
--- | Exponentiation of type-level naturals.
-type family (m :: Nat) ^ (n :: Nat) :: Nat
-
--- | Subtraction of type-level naturals.
+-- | Concatenation of type-level symbols.
 --
--- @since 4.7.0.0
-type family (m :: Nat) - (n :: Nat) :: Nat
-
+-- @since 4.10.0.0
+type family AppendSymbol (m ::Symbol) (n :: Symbol) :: Symbol
 
 -- | A description of a custom type error.
 data {-kind-} ErrorMessage = Text Symbol
@@ -219,7 +162,7 @@
 --
 -- The polymorphic kind of this type allows it to be used in several settings.
 -- For instance, it can be used as a constraint, e.g. to provide a better error
--- message for a non-existant instance,
+-- message for a non-existent instance,
 --
 -- @
 -- -- in a context
@@ -247,16 +190,6 @@
 --------------------------------------------------------------------------------
 
 -- | We either get evidence that this function was instantiated with the
--- same type-level numbers, or 'Nothing'.
---
--- @since 4.7.0.0
-sameNat :: (KnownNat a, KnownNat b) =>
-           Proxy a -> Proxy b -> Maybe (a :~: b)
-sameNat x y
-  | natVal x == natVal y = Just (unsafeCoerce Refl)
-  | otherwise            = Nothing
-
--- | We either get evidence that this function was instantiated with the
 -- same type-level symbols, or 'Nothing'.
 --
 -- @since 4.7.0.0
@@ -269,16 +202,9 @@
 --------------------------------------------------------------------------------
 -- PRIVATE:
 
-newtype SNat    (n :: Nat)    = SNat    Integer
 newtype SSymbol (s :: Symbol) = SSymbol String
 
-data WrapN a b = WrapN (KnownNat    a => Proxy a -> b)
 data WrapS a b = WrapS (KnownSymbol a => Proxy a -> b)
-
--- See Note [magicDictId magic] in "basicType/MkId.hs"
-withSNat :: (KnownNat a => Proxy a -> b)
-         -> SNat a      -> Proxy a -> b
-withSNat f x y = magicDict (WrapN f) x y
 
 -- See Note [magicDictId magic] in "basicType/MkId.hs"
 withSSymbol :: (KnownSymbol a => Proxy a -> b)
diff --git a/GHC/TypeNats.hs b/GHC/TypeNats.hs
new file mode 100644
--- /dev/null
+++ b/GHC/TypeNats.hs
@@ -0,0 +1,160 @@
+{-# LANGUAGE Trustworthy #-}
+{-# LANGUAGE DataKinds #-}
+{-# LANGUAGE KindSignatures #-}
+{-# LANGUAGE TypeFamilies #-}
+{-# LANGUAGE TypeOperators #-}
+{-# LANGUAGE FlexibleInstances #-}
+{-# LANGUAGE FlexibleContexts #-}
+{-# LANGUAGE ScopedTypeVariables #-}
+{-# LANGUAGE ConstraintKinds #-}
+{-# LANGUAGE ExistentialQuantification #-}
+{-# LANGUAGE RankNTypes #-}
+{-# LANGUAGE UndecidableInstances #-}  -- for compiling instances of (==)
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE MagicHash #-}
+{-# LANGUAGE PolyKinds #-}
+
+{-| This module is an internal GHC module.  It declares the constants used
+in the implementation of type-level natural numbers.  The programmer interface
+for working with type-level naturals should be defined in a separate library.
+
+@since 4.10.0.0
+-}
+
+module GHC.TypeNats
+  ( -- * Nat Kind
+    Nat -- declared in GHC.Types in package ghc-prim
+
+    -- * Linking type and value level
+  , KnownNat, natVal, natVal'
+  , SomeNat(..)
+  , someNatVal
+  , sameNat
+
+    -- * Functions on type literals
+  , type (<=), type (<=?), type (+), type (*), type (^), type (-)
+  , CmpNat
+
+  ) where
+
+import GHC.Base(Eq(..), Ord(..), Bool(True,False), Ordering(..), otherwise)
+import GHC.Types( Nat )
+import GHC.Natural(Natural)
+import GHC.Show(Show(..))
+import GHC.Read(Read(..))
+import GHC.Prim(magicDict, Proxy#)
+import Data.Maybe(Maybe(..))
+import Data.Proxy (Proxy(..))
+import Data.Type.Equality(type (==), (:~:)(Refl))
+import Unsafe.Coerce(unsafeCoerce)
+
+--------------------------------------------------------------------------------
+
+-- | This class gives the integer associated with a type-level natural.
+-- There are instances of the class for every concrete literal: 0, 1, 2, etc.
+--
+-- @since 4.7.0.0
+class KnownNat (n :: Nat) where
+  natSing :: SNat n
+
+-- | @since 4.10.0.0
+natVal :: forall n proxy. KnownNat n => proxy n -> Natural
+natVal _ = case natSing :: SNat n of
+             SNat x -> x
+
+-- | @since 4.10.0.0
+natVal' :: forall n. KnownNat n => Proxy# n -> Natural
+natVal' _ = case natSing :: SNat n of
+             SNat x -> x
+
+-- | This type represents unknown type-level natural numbers.
+--
+-- @since 4.10.0.0
+data SomeNat    = forall n. KnownNat n    => SomeNat    (Proxy n)
+
+-- | Convert an integer into an unknown type-level natural.
+--
+-- @since 4.10.0.0
+someNatVal :: Natural -> SomeNat
+someNatVal n = withSNat SomeNat (SNat n) Proxy
+
+-- | @since 4.7.0.0
+instance Eq SomeNat where
+  SomeNat x == SomeNat y = natVal x == natVal y
+
+-- | @since 4.7.0.0
+instance Ord SomeNat where
+  compare (SomeNat x) (SomeNat y) = compare (natVal x) (natVal y)
+
+-- | @since 4.7.0.0
+instance Show SomeNat where
+  showsPrec p (SomeNat x) = showsPrec p (natVal x)
+
+-- | @since 4.7.0.0
+instance Read SomeNat where
+  readsPrec p xs = do (a,ys) <- readsPrec p xs
+                      [(someNatVal a, ys)]
+
+type family EqNat (a :: Nat) (b :: Nat) where
+  EqNat a a = 'True
+  EqNat a b = 'False
+type instance a == b = EqNat a b
+
+--------------------------------------------------------------------------------
+
+infix  4 <=?, <=
+infixl 6 +, -
+infixl 7 *
+infixr 8 ^
+
+-- | Comparison of type-level naturals, as a constraint.
+type x <= y = (x <=? y) ~ 'True
+
+-- | Comparison of type-level naturals, as a function.
+--
+-- @since 4.7.0.0
+type family CmpNat    (m :: Nat)    (n :: Nat)    :: Ordering
+
+{- | Comparison of type-level naturals, as a function.
+NOTE: The functionality for this function should be subsumed
+by 'CmpNat', so this might go away in the future.
+Please let us know, if you encounter discrepancies between the two. -}
+type family (m :: Nat) <=? (n :: Nat) :: Bool
+
+-- | Addition of type-level naturals.
+type family (m :: Nat) + (n :: Nat) :: Nat
+
+-- | Multiplication of type-level naturals.
+type family (m :: Nat) * (n :: Nat) :: Nat
+
+-- | Exponentiation of type-level naturals.
+type family (m :: Nat) ^ (n :: Nat) :: Nat
+
+-- | Subtraction of type-level naturals.
+--
+-- @since 4.7.0.0
+type family (m :: Nat) - (n :: Nat) :: Nat
+
+--------------------------------------------------------------------------------
+
+-- | We either get evidence that this function was instantiated with the
+-- same type-level numbers, or 'Nothing'.
+--
+-- @since 4.7.0.0
+sameNat :: (KnownNat a, KnownNat b) =>
+           Proxy a -> Proxy b -> Maybe (a :~: b)
+sameNat x y
+  | natVal x == natVal y = Just (unsafeCoerce Refl)
+  | otherwise            = Nothing
+
+--------------------------------------------------------------------------------
+-- PRIVATE:
+
+newtype SNat    (n :: Nat)    = SNat    Natural
+
+data WrapN a b = WrapN (KnownNat    a => Proxy a -> b)
+
+-- See Note [magicDictId magic] in "basicType/MkId.hs"
+withSNat :: (KnownNat a => Proxy a -> b)
+         -> SNat a      -> Proxy a -> b
+withSNat f x y = magicDict (WrapN f) x y
diff --git a/GHC/Word.hs b/GHC/Word.hs
--- a/GHC/Word.hs
+++ b/GHC/Word.hs
@@ -66,6 +66,7 @@
 -- ^ 8-bit unsigned integer type
 
 -- See GHC.Classes#matching_overloaded_methods_in_rules
+-- | @since 2.01
 instance Eq Word8 where
     (==) = eqWord8
     (/=) = neWord8
@@ -76,6 +77,7 @@
 {-# INLINE [1] eqWord8 #-}
 {-# INLINE [1] neWord8 #-}
 
+-- | @since 2.01
 instance Ord Word8 where
     (<)  = ltWord8
     (<=) = leWord8
@@ -92,9 +94,11 @@
 (W8# x) `ltWord8` (W8# y) = isTrue# (x `ltWord#` y)
 (W8# x) `leWord8` (W8# y) = isTrue# (x `leWord#` y)
 
+-- | @since 2.01
 instance Show Word8 where
     showsPrec p x = showsPrec p (fromIntegral x :: Int)
 
+-- | @since 2.01
 instance Num Word8 where
     (W8# x#) + (W8# y#)    = W8# (narrow8Word# (x# `plusWord#` y#))
     (W8# x#) - (W8# y#)    = W8# (narrow8Word# (x# `minusWord#` y#))
@@ -105,9 +109,11 @@
     signum _               = 1
     fromInteger i          = W8# (narrow8Word# (integerToWord i))
 
+-- | @since 2.01
 instance Real Word8 where
     toRational x = toInteger x % 1
 
+-- | @since 2.01
 instance Enum Word8 where
     succ x
         | x /= maxBound = x + 1
@@ -123,6 +129,7 @@
     enumFrom            = boundedEnumFrom
     enumFromThen        = boundedEnumFromThen
 
+-- | @since 2.01
 instance Integral Word8 where
     quot    (W8# x#) y@(W8# y#)
         | y /= 0                  = W8# (x# `quotWord#` y#)
@@ -146,18 +153,22 @@
         | otherwise               = divZeroError
     toInteger (W8# x#)            = smallInteger (word2Int# x#)
 
+-- | @since 2.01
 instance Bounded Word8 where
     minBound = 0
     maxBound = 0xFF
 
+-- | @since 2.01
 instance Ix Word8 where
     range (m,n)         = [m..n]
     unsafeIndex (m,_) i = fromIntegral (i - m)
     inRange (m,n) i     = m <= i && i <= n
 
+-- | @since 2.01
 instance Read Word8 where
     readsPrec p s = [(fromIntegral (x::Int), r) | (x, r) <- readsPrec p s]
 
+-- | @since 2.01
 instance Bits Word8 where
     {-# INLINE shift #-}
     {-# INLINE bit #-}
@@ -189,6 +200,7 @@
     bit                       = bitDefault
     testBit                   = testBitDefault
 
+-- | @since 4.6.0.0
 instance FiniteBits Word8 where
     finiteBitSize _ = 8
     countLeadingZeros  (W8# x#) = I# (word2Int# (clz8# x#))
@@ -242,6 +254,7 @@
 -- ^ 16-bit unsigned integer type
 
 -- See GHC.Classes#matching_overloaded_methods_in_rules
+-- | @since 2.01
 instance Eq Word16 where
     (==) = eqWord16
     (/=) = neWord16
@@ -252,6 +265,7 @@
 {-# INLINE [1] eqWord16 #-}
 {-# INLINE [1] neWord16 #-}
 
+-- | @since 2.01
 instance Ord Word16 where
     (<)  = ltWord16
     (<=) = leWord16
@@ -268,9 +282,11 @@
 (W16# x) `ltWord16` (W16# y) = isTrue# (x `ltWord#` y)
 (W16# x) `leWord16` (W16# y) = isTrue# (x `leWord#` y)
 
+-- | @since 2.01
 instance Show Word16 where
     showsPrec p x = showsPrec p (fromIntegral x :: Int)
 
+-- | @since 2.01
 instance Num Word16 where
     (W16# x#) + (W16# y#)  = W16# (narrow16Word# (x# `plusWord#` y#))
     (W16# x#) - (W16# y#)  = W16# (narrow16Word# (x# `minusWord#` y#))
@@ -281,9 +297,11 @@
     signum _               = 1
     fromInteger i          = W16# (narrow16Word# (integerToWord i))
 
+-- | @since 2.01
 instance Real Word16 where
     toRational x = toInteger x % 1
 
+-- | @since 2.01
 instance Enum Word16 where
     succ x
         | x /= maxBound = x + 1
@@ -299,6 +317,7 @@
     enumFrom            = boundedEnumFrom
     enumFromThen        = boundedEnumFromThen
 
+-- | @since 2.01
 instance Integral Word16 where
     quot    (W16# x#) y@(W16# y#)
         | y /= 0                    = W16# (x# `quotWord#` y#)
@@ -322,18 +341,22 @@
         | otherwise                 = divZeroError
     toInteger (W16# x#)             = smallInteger (word2Int# x#)
 
+-- | @since 2.01
 instance Bounded Word16 where
     minBound = 0
     maxBound = 0xFFFF
 
+-- | @since 2.01
 instance Ix Word16 where
     range (m,n)         = [m..n]
     unsafeIndex (m,_) i = fromIntegral (i - m)
     inRange (m,n) i     = m <= i && i <= n
 
+-- | @since 2.01
 instance Read Word16 where
     readsPrec p s = [(fromIntegral (x::Int), r) | (x, r) <- readsPrec p s]
 
+-- | @since 2.01
 instance Bits Word16 where
     {-# INLINE shift #-}
     {-# INLINE bit #-}
@@ -365,6 +388,7 @@
     bit                       = bitDefault
     testBit                   = testBitDefault
 
+-- | @since 4.6.0.0
 instance FiniteBits Word16 where
     finiteBitSize _ = 16
     countLeadingZeros  (W16# x#) = I# (word2Int# (clz16# x#))
@@ -461,6 +485,7 @@
 -- ^ 32-bit unsigned integer type
 
 -- See GHC.Classes#matching_overloaded_methods_in_rules
+-- | @since 2.01
 instance Eq Word32 where
     (==) = eqWord32
     (/=) = neWord32
@@ -471,6 +496,7 @@
 {-# INLINE [1] eqWord32 #-}
 {-# INLINE [1] neWord32 #-}
 
+-- | @since 2.01
 instance Ord Word32 where
     (<)  = ltWord32
     (<=) = leWord32
@@ -487,6 +513,7 @@
 (W32# x) `ltWord32` (W32# y) = isTrue# (x `ltWord#` y)
 (W32# x) `leWord32` (W32# y) = isTrue# (x `leWord#` y)
 
+-- | @since 2.01
 instance Num Word32 where
     (W32# x#) + (W32# y#)  = W32# (narrow32Word# (x# `plusWord#` y#))
     (W32# x#) - (W32# y#)  = W32# (narrow32Word# (x# `minusWord#` y#))
@@ -497,6 +524,7 @@
     signum _               = 1
     fromInteger i          = W32# (narrow32Word# (integerToWord i))
 
+-- | @since 2.01
 instance Enum Word32 where
     succ x
         | x /= maxBound = x + 1
@@ -526,6 +554,7 @@
     enumFromThen        = boundedEnumFromThen
 #endif
 
+-- | @since 2.01
 instance Integral Word32 where
     quot    (W32# x#) y@(W32# y#)
         | y /= 0                    = W32# (x# `quotWord#` y#)
@@ -557,6 +586,7 @@
                                     = smallInteger (word2Int# x#)
 #endif
 
+-- | @since 2.01
 instance Bits Word32 where
     {-# INLINE shift #-}
     {-# INLINE bit #-}
@@ -588,6 +618,7 @@
     bit                       = bitDefault
     testBit                   = testBitDefault
 
+-- | @since 4.6.0.0
 instance FiniteBits Word32 where
     finiteBitSize _ = 32
     countLeadingZeros  (W32# x#) = I# (word2Int# (clz32# x#))
@@ -602,6 +633,7 @@
 "fromIntegral/Word32->a"       fromIntegral = \(W32# x#) -> fromIntegral (W# x#)
   #-}
 
+-- | @since 2.01
 instance Show Word32 where
 #if WORD_SIZE_IN_BITS < 33
     showsPrec p x = showsPrec p (toInteger x)
@@ -610,18 +642,22 @@
 #endif
 
 
+-- | @since 2.01
 instance Real Word32 where
     toRational x = toInteger x % 1
 
+-- | @since 2.01
 instance Bounded Word32 where
     minBound = 0
     maxBound = 0xFFFFFFFF
 
+-- | @since 2.01
 instance Ix Word32 where
     range (m,n)         = [m..n]
     unsafeIndex (m,_) i = fromIntegral (i - m)
     inRange (m,n) i     = m <= i && i <= n
 
+-- | @since 2.01
 instance Read Word32 where
 #if WORD_SIZE_IN_BITS < 33
     readsPrec p s = [(fromInteger x, r) | (x, r) <- readsPrec p s]
@@ -645,6 +681,7 @@
 -- ^ 64-bit unsigned integer type
 
 -- See GHC.Classes#matching_overloaded_methods_in_rules
+-- | @since 2.01
 instance Eq Word64 where
     (==) = eqWord64
     (/=) = neWord64
@@ -655,6 +692,7 @@
 {-# INLINE [1] eqWord64 #-}
 {-# INLINE [1] neWord64 #-}
 
+-- | @since 2.01
 instance Ord Word64 where
     (<)  = ltWord64
     (<=) = leWord64
@@ -671,6 +709,7 @@
 (W64# x) `ltWord64` (W64# y) = isTrue# (x `ltWord64#` y)
 (W64# x) `leWord64` (W64# y) = isTrue# (x `leWord64#` y)
 
+-- | @since 2.01
 instance Num Word64 where
     (W64# x#) + (W64# y#)  = W64# (int64ToWord64# (word64ToInt64# x# `plusInt64#` word64ToInt64# y#))
     (W64# x#) - (W64# y#)  = W64# (int64ToWord64# (word64ToInt64# x# `minusInt64#` word64ToInt64# y#))
@@ -681,6 +720,7 @@
     signum _               = 1
     fromInteger i          = W64# (integerToWord64 i)
 
+-- | @since 2.01
 instance Enum Word64 where
     succ x
         | x /= maxBound = x + 1
@@ -700,6 +740,7 @@
     enumFromTo          = integralEnumFromTo
     enumFromThenTo      = integralEnumFromThenTo
 
+-- | @since 2.01
 instance Integral Word64 where
     quot    (W64# x#) y@(W64# y#)
         | y /= 0                    = W64# (x# `quotWord64#` y#)
@@ -721,6 +762,7 @@
         | otherwise                 = divZeroError
     toInteger (W64# x#)             = word64ToInteger x#
 
+-- | @since 2.01
 instance Bits Word64 where
     {-# INLINE shift #-}
     {-# INLINE bit #-}
@@ -781,6 +823,7 @@
 -- ^ 64-bit unsigned integer type
 
 -- See GHC.Classes#matching_overloaded_methods_in_rules
+-- | @since 2.01
 instance Eq Word64 where
     (==) = eqWord64
     (/=) = neWord64
@@ -791,6 +834,7 @@
 {-# INLINE [1] eqWord64 #-}
 {-# INLINE [1] neWord64 #-}
 
+-- | @since 2.01
 instance Ord Word64 where
     (<)  = ltWord64
     (<=) = leWord64
@@ -807,6 +851,7 @@
 (W64# x) `ltWord64` (W64# y) = isTrue# (x `ltWord#` y)
 (W64# x) `leWord64` (W64# y) = isTrue# (x `leWord#` y)
 
+-- | @since 2.01
 instance Num Word64 where
     (W64# x#) + (W64# y#)  = W64# (x# `plusWord#` y#)
     (W64# x#) - (W64# y#)  = W64# (x# `minusWord#` y#)
@@ -817,6 +862,7 @@
     signum _               = 1
     fromInteger i          = W64# (integerToWord i)
 
+-- | @since 2.01
 instance Enum Word64 where
     succ x
         | x /= maxBound = x + 1
@@ -836,6 +882,7 @@
     enumFromTo          = integralEnumFromTo
     enumFromThenTo      = integralEnumFromThenTo
 
+-- | @since 2.01
 instance Integral Word64 where
     quot    (W64# x#) y@(W64# y#)
         | y /= 0                    = W64# (x# `quotWord#` y#)
@@ -863,6 +910,7 @@
         where
         !i# = word2Int# x#
 
+-- | @since 2.01
 instance Bits Word64 where
     {-# INLINE shift #-}
     {-# INLINE bit #-}
@@ -906,26 +954,32 @@
 
 #endif
 
+-- | @since 4.6.0.0
 instance FiniteBits Word64 where
     finiteBitSize _ = 64
     countLeadingZeros  (W64# x#) = I# (word2Int# (clz64# x#))
     countTrailingZeros (W64# x#) = I# (word2Int# (ctz64# x#))
 
+-- | @since 2.01
 instance Show Word64 where
     showsPrec p x = showsPrec p (toInteger x)
 
+-- | @since 2.01
 instance Real Word64 where
     toRational x = toInteger x % 1
 
+-- | @since 2.01
 instance Bounded Word64 where
     minBound = 0
     maxBound = 0xFFFFFFFFFFFFFFFF
 
+-- | @since 2.01
 instance Ix Word64 where
     range (m,n)         = [m..n]
     unsafeIndex (m,_) i = fromIntegral (i - m)
     inRange (m,n) i     = m <= i && i <= n
 
+-- | @since 2.01
 instance Read Word64 where
     readsPrec p s = [(fromInteger x, r) | (x, r) <- readsPrec p s]
 
diff --git a/System/CPUTime.hsc b/System/CPUTime.hsc
--- a/System/CPUTime.hsc
+++ b/System/CPUTime.hsc
@@ -1,5 +1,5 @@
 {-# LANGUAGE Trustworthy #-}
-{-# LANGUAGE CPP, NondecreasingIndentation, CApiFFI #-}
+{-# LANGUAGE CPP, CApiFFI #-}
 
 -----------------------------------------------------------------------------
 -- |
@@ -18,144 +18,50 @@
 #include "HsFFI.h"
 #include "HsBaseConfig.h"
 
-module System.CPUTime
-        (
-         getCPUTime,       -- :: IO Integer
-         cpuTimePrecision  -- :: Integer
-        ) where
-
-import Data.Ratio
-
-import Foreign
-import Foreign.C
-
--- For struct rusage
-#if !defined(mingw32_HOST_OS) && !defined(irix_HOST_OS)
-# if HAVE_SYS_RESOURCE_H
-#  include <sys/resource.h>
-# endif
-#endif
-
--- For FILETIME etc. on Windows
-#if HAVE_WINDOWS_H
-#include <windows.h>
+-- For various _POSIX_* #defines
+#if defined(HAVE_UNISTD_H)
+#include <unistd.h>
 #endif
 
--- for struct tms
-#if HAVE_SYS_TIMES_H
-#include <sys/times.h>
-#endif
+module System.CPUTime
+    ( getCPUTime
+    , cpuTimePrecision
+    ) where
 
-##ifdef mingw32_HOST_OS
-## if defined(i386_HOST_ARCH)
-##  define WINDOWS_CCONV stdcall
-## elif defined(x86_64_HOST_ARCH)
-##  define WINDOWS_CCONV ccall
-## else
-##  error Unknown mingw32 arch
-## endif
-##else
-##endif
+import System.IO.Unsafe (unsafePerformIO)
 
-#if !defined(mingw32_HOST_OS)
-realToInteger :: Real a => a -> Integer
-realToInteger ct = round (realToFrac ct :: Double)
-  -- CTime, CClock, CUShort etc are in Real but not Fractional,
-  -- so we must convert to Double before we can round it
-#endif
+-- Here is where we decide which backend to use
+#if defined(mingw32_HOST_OS)
+import qualified System.CPUTime.Windows as I
 
--- -----------------------------------------------------------------------------
--- |Computation 'getCPUTime' returns the number of picoseconds CPU time
--- used by the current program.  The precision of this result is
--- implementation-dependent.
+#elif _POSIX_TIMERS > 0 && defined(_POSIX_CPUTIME) && _POSIX_CPUTIME >= 0
+import qualified System.CPUTime.Posix.ClockGetTime as I
 
-getCPUTime :: IO Integer
-getCPUTime = do
+#elif defined(HAVE_GETRUSAGE) && ! solaris2_HOST_OS
+import qualified System.CPUTime.Posix.RUsage as I
 
-#if !defined(mingw32_HOST_OS)
--- getrusage() is right royal pain to deal with when targetting multiple
+-- @getrusage()@ is right royal pain to deal with when targetting multiple
 -- versions of Solaris, since some versions supply it in libc (2.3 and 2.5),
 -- while 2.4 has got it in libucb (I wouldn't be too surprised if it was back
 -- again in libucb in 2.6..)
 --
 -- Avoid the problem by resorting to times() instead.
---
-#if defined(HAVE_GETRUSAGE) && ! irix_HOST_OS && ! solaris2_HOST_OS
-    allocaBytes (#const sizeof(struct rusage)) $ \ p_rusage -> do
-    throwErrnoIfMinus1_ "getrusage" $ getrusage (#const RUSAGE_SELF) p_rusage
-
-    let ru_utime = (#ptr struct rusage, ru_utime) p_rusage
-    let ru_stime = (#ptr struct rusage, ru_stime) p_rusage
-    u_sec  <- (#peek struct timeval,tv_sec)  ru_utime :: IO CTime
-    u_usec <- (#peek struct timeval,tv_usec) ru_utime :: IO CSUSeconds
-    s_sec  <- (#peek struct timeval,tv_sec)  ru_stime :: IO CTime
-    s_usec <- (#peek struct timeval,tv_usec) ru_stime :: IO CSUSeconds
-    return ((realToInteger u_sec * 1000000 + realToInteger u_usec +
-             realToInteger s_sec * 1000000 + realToInteger s_usec)
-                * 1000000)
-
-type CRUsage = ()
-foreign import capi unsafe "HsBase.h getrusage" getrusage :: CInt -> Ptr CRUsage -> IO CInt
 #elif defined(HAVE_TIMES)
-    allocaBytes (#const sizeof(struct tms)) $ \ p_tms -> do
-    _ <- times p_tms
-    u_ticks  <- (#peek struct tms,tms_utime) p_tms :: IO CClock
-    s_ticks  <- (#peek struct tms,tms_stime) p_tms :: IO CClock
-    return (( (realToInteger u_ticks + realToInteger s_ticks) * 1000000000000)
-                        `div` fromIntegral clockTicks)
+import qualified System.CPUTime.Posix.Times as I
 
-type CTms = ()
-foreign import ccall unsafe times :: Ptr CTms -> IO CClock
 #else
-    ioException (IOError Nothing UnsupportedOperation
-                         "getCPUTime"
-                         "can't get CPU time"
-                         Nothing)
+import qualified System.CPUTime.Unsupported as I
 #endif
 
-#else /* win32 */
-     -- NOTE: GetProcessTimes() is only supported on NT-based OSes.
-     -- The counts reported by GetProcessTimes() are in 100-ns (10^-7) units.
-    allocaBytes (#const sizeof(FILETIME)) $ \ p_creationTime -> do
-    allocaBytes (#const sizeof(FILETIME)) $ \ p_exitTime -> do
-    allocaBytes (#const sizeof(FILETIME)) $ \ p_kernelTime -> do
-    allocaBytes (#const sizeof(FILETIME)) $ \ p_userTime -> do
-    pid <- getCurrentProcess
-    ok <- getProcessTimes pid p_creationTime p_exitTime p_kernelTime p_userTime
-    if toBool ok then do
-      ut <- ft2psecs p_userTime
-      kt <- ft2psecs p_kernelTime
-      return (ut + kt)
-     else return 0
-  where
-        ft2psecs :: Ptr FILETIME -> IO Integer
-        ft2psecs ft = do
-          high <- (#peek FILETIME,dwHighDateTime) ft :: IO Word32
-          low  <- (#peek FILETIME,dwLowDateTime)  ft :: IO Word32
-            -- Convert 100-ns units to picosecs (10^-12)
-            -- => multiply by 10^5.
-          return (((fromIntegral high) * (2^(32::Int)) + (fromIntegral low)) * 100000)
-
-    -- ToDo: pin down elapsed times to just the OS thread(s) that
-    -- are evaluating/managing Haskell code.
-
-type FILETIME = ()
-type HANDLE = ()
--- need proper Haskell names (initial lower-case character)
-foreign import WINDOWS_CCONV unsafe "GetCurrentProcess" getCurrentProcess :: IO (Ptr HANDLE)
-foreign import WINDOWS_CCONV unsafe "GetProcessTimes" getProcessTimes :: Ptr HANDLE -> Ptr FILETIME -> Ptr FILETIME -> Ptr FILETIME -> Ptr FILETIME -> IO CInt
-
-#endif /* not _WIN32 */
-
-
--- |The 'cpuTimePrecision' constant is the smallest measurable difference
+-- | The 'cpuTimePrecision' constant is the smallest measurable difference
 -- in CPU time that the implementation can record, and is given as an
 -- integral number of picoseconds.
-
 cpuTimePrecision :: Integer
-cpuTimePrecision = round ((1000000000000::Integer) % fromIntegral (clockTicks))
-
-foreign import ccall unsafe clk_tck :: CLong
+cpuTimePrecision = unsafePerformIO I.getCpuTimePrecision
+{-# NOINLINE cpuTimePrecision #-}
 
-clockTicks :: Int
-clockTicks = fromIntegral clk_tck
+-- | Computation 'getCPUTime' returns the number of picoseconds CPU time
+-- used by the current program.  The precision of this result is
+-- implementation-dependent.
+getCPUTime :: IO Integer
+getCPUTime = I.getCPUTime
diff --git a/System/CPUTime/Posix/ClockGetTime.hsc b/System/CPUTime/Posix/ClockGetTime.hsc
new file mode 100644
--- /dev/null
+++ b/System/CPUTime/Posix/ClockGetTime.hsc
@@ -0,0 +1,55 @@
+{-# LANGUAGE CPP, CApiFFI, NumDecimals #-}
+
+#include "HsFFI.h"
+#include "HsBaseConfig.h"
+#if HAVE_TIME_H
+#include <unistd.h>
+#include <time.h>
+#endif
+
+module System.CPUTime.Posix.ClockGetTime
+    ( getCPUTime
+    , getCpuTimePrecision
+    ) where
+
+#if _POSIX_TIMERS > 0 && defined(_POSIX_CPUTIME) && _POSIX_CPUTIME >= 0
+
+import Foreign
+import Foreign.C
+import System.CPUTime.Utils
+
+getCPUTime :: IO Integer
+getCPUTime = fmap snd $ withTimespec $ \ts ->
+    throwErrnoIfMinus1_ "clock_gettime"
+    $ clock_gettime (#const CLOCK_PROCESS_CPUTIME_ID) ts
+
+getCpuTimePrecision :: IO Integer
+getCpuTimePrecision = fmap snd $ withTimespec $ \ts ->
+    throwErrnoIfMinus1_ "clock_getres"
+    $ clock_getres (#const CLOCK_PROCESS_CPUTIME_ID) ts
+
+data Timespec
+
+-- | Perform the given action to fill in a @struct timespec@, returning the
+-- result of the action and the value of the @timespec@ in picoseconds.
+withTimespec :: (Ptr Timespec -> IO a) -> IO (a, Integer)
+withTimespec action =
+    allocaBytes (# const sizeof(struct timespec)) $ \p_ts -> do
+        r <- action p_ts
+        u_sec  <- (#peek struct timespec,tv_sec)  p_ts :: IO CTime
+        u_nsec <- (#peek struct timespec,tv_nsec) p_ts :: IO CLong
+        return (r, cTimeToInteger u_sec * 1e12 + fromIntegral u_nsec * 1e3)
+
+foreign import capi unsafe "time.h clock_getres"  clock_getres  :: CInt -> Ptr Timespec -> IO CInt
+foreign import capi unsafe "time.h clock_gettime" clock_gettime :: CInt -> Ptr Timespec -> IO CInt
+
+#else
+
+-- This should never happen
+getCPUTime :: IO Integer
+getCPUTime = error "System.CPUTime.Posix.ClockGetTime: Unsupported"
+
+getCpuTimePrecision :: IO Integer
+getCpuTimePrecision = error "System.CPUTime.Posix.ClockGetTime: Unsupported"
+
+#endif // _POSIX_CPUTIME
diff --git a/System/CPUTime/Posix/RUsage.hsc b/System/CPUTime/Posix/RUsage.hsc
new file mode 100644
--- /dev/null
+++ b/System/CPUTime/Posix/RUsage.hsc
@@ -0,0 +1,42 @@
+{-# LANGUAGE CPP, CApiFFI, NumDecimals #-}
+
+#include "HsFFI.h"
+#include "HsBaseConfig.h"
+
+module System.CPUTime.Posix.RUsage
+    ( getCPUTime
+    , getCpuTimePrecision
+    ) where
+
+import Data.Ratio
+import Foreign
+import Foreign.C
+import System.CPUTime.Utils
+
+-- For struct rusage
+#if HAVE_SYS_RESOURCE_H
+#include <sys/resource.h>
+#endif
+
+getCPUTime :: IO Integer
+getCPUTime = allocaBytes (#const sizeof(struct rusage)) $ \ p_rusage -> do
+    throwErrnoIfMinus1_ "getrusage" $ getrusage (#const RUSAGE_SELF) p_rusage
+
+    let ru_utime = (#ptr struct rusage, ru_utime) p_rusage
+    let ru_stime = (#ptr struct rusage, ru_stime) p_rusage
+    u_sec  <- (#peek struct timeval,tv_sec)  ru_utime :: IO CTime
+    u_usec <- (#peek struct timeval,tv_usec) ru_utime :: IO CSUSeconds
+    s_sec  <- (#peek struct timeval,tv_sec)  ru_stime :: IO CTime
+    s_usec <- (#peek struct timeval,tv_usec) ru_stime :: IO CSUSeconds
+    let usec = cTimeToInteger u_sec * 1e6 + csuSecondsToInteger u_usec +
+               cTimeToInteger s_sec * 1e6 + csuSecondsToInteger s_usec
+    return (usec * 1e6)
+
+type CRUsage = ()
+foreign import capi unsafe "HsBase.h getrusage" getrusage :: CInt -> Ptr CRUsage -> IO CInt
+
+getCpuTimePrecision :: IO Integer
+getCpuTimePrecision =
+    return $ round ((1e12::Integer) % fromIntegral clk_tck)
+
+foreign import ccall unsafe clk_tck :: CLong
diff --git a/System/CPUTime/Posix/Times.hsc b/System/CPUTime/Posix/Times.hsc
new file mode 100644
--- /dev/null
+++ b/System/CPUTime/Posix/Times.hsc
@@ -0,0 +1,39 @@
+{-# LANGUAGE CPP, CApiFFI, NumDecimals #-}
+
+#include "HsFFI.h"
+#include "HsBaseConfig.h"
+
+module System.CPUTime.Posix.Times
+    ( getCPUTime
+    , getCpuTimePrecision
+    ) where
+
+import Data.Ratio
+import Foreign
+import Foreign.C
+import System.CPUTime.Utils
+
+-- for struct tms
+#if HAVE_SYS_TIMES_H
+#include <sys/times.h>
+#endif
+
+getCPUTime :: IO Integer
+getCPUTime = allocaBytes (#const sizeof(struct tms)) $ \ p_tms -> do
+    _ <- times p_tms
+    u_ticks  <- (#peek struct tms,tms_utime) p_tms :: IO CClock
+    s_ticks  <- (#peek struct tms,tms_stime) p_tms :: IO CClock
+    return (( (cClockToInteger u_ticks + cClockToInteger s_ticks) * 1e12)
+                        `div` fromIntegral clockTicks)
+
+type CTms = ()
+foreign import ccall unsafe times :: Ptr CTms -> IO CClock
+
+getCpuTimePrecision :: IO Integer
+getCpuTimePrecision =
+    return $ round ((1e12::Integer) % clockTicks)
+
+foreign import ccall unsafe clk_tck :: CLong
+
+clockTicks :: Integer
+clockTicks = fromIntegral clk_tck
diff --git a/System/CPUTime/Unsupported.hs b/System/CPUTime/Unsupported.hs
new file mode 100644
--- /dev/null
+++ b/System/CPUTime/Unsupported.hs
@@ -0,0 +1,20 @@
+module System.CPUTime.Unsupported
+    ( getCPUTime
+    , getCpuTimePrecision
+    ) where
+
+import GHC.IO.Exception
+
+getCPUTime :: IO Integer
+getCPUTime =
+    ioError (IOError Nothing UnsupportedOperation
+                     "getCPUTime"
+                     "can't get CPU time"
+                     Nothing Nothing)
+
+getCpuTimePrecision :: IO Integer
+getCpuTimePrecision =
+    ioError (IOError Nothing UnsupportedOperation
+                     "cpuTimePrecision"
+                     "can't get CPU time"
+                     Nothing Nothing)
diff --git a/System/CPUTime/Utils.hs b/System/CPUTime/Utils.hs
new file mode 100644
--- /dev/null
+++ b/System/CPUTime/Utils.hs
@@ -0,0 +1,19 @@
+module System.CPUTime.Utils
+    ( -- * Integer conversions
+      -- | These types have no 'Integral' instances in the Haskell report
+      -- so we must do this ourselves.
+      cClockToInteger
+    , cTimeToInteger
+    , csuSecondsToInteger
+    ) where
+
+import Foreign.C.Types
+
+cClockToInteger :: CClock -> Integer
+cClockToInteger (CClock n) = fromIntegral n
+
+cTimeToInteger :: CTime -> Integer
+cTimeToInteger (CTime n) = fromIntegral n
+
+csuSecondsToInteger :: CSUSeconds -> Integer
+csuSecondsToInteger (CSUSeconds n) = fromIntegral n
diff --git a/System/CPUTime/Windows.hsc b/System/CPUTime/Windows.hsc
new file mode 100644
--- /dev/null
+++ b/System/CPUTime/Windows.hsc
@@ -0,0 +1,63 @@
+{-# LANGUAGE CPP, CApiFFI, NondecreasingIndentation, NumDecimals #-}
+
+#include "HsFFI.h"
+#include "HsBaseConfig.h"
+
+module System.CPUTime.Windows
+    ( getCPUTime
+    , getCpuTimePrecision
+    ) where
+
+import Foreign
+import Foreign.C
+
+-- For FILETIME etc. on Windows
+#if HAVE_WINDOWS_H
+#include <windows.h>
+#endif
+
+getCPUTime :: IO Integer
+getCPUTime = do
+     -- NOTE: GetProcessTimes() is only supported on NT-based OSes.
+     -- The counts reported by GetProcessTimes() are in 100-ns (10^-7) units.
+    allocaBytes (#const sizeof(FILETIME)) $ \ p_creationTime -> do
+    allocaBytes (#const sizeof(FILETIME)) $ \ p_exitTime -> do
+    allocaBytes (#const sizeof(FILETIME)) $ \ p_kernelTime -> do
+    allocaBytes (#const sizeof(FILETIME)) $ \ p_userTime -> do
+    pid <- getCurrentProcess
+    ok <- getProcessTimes pid p_creationTime p_exitTime p_kernelTime p_userTime
+    if toBool ok then do
+      ut <- ft2psecs p_userTime
+      kt <- ft2psecs p_kernelTime
+      return (ut + kt)
+     else return 0
+  where
+        ft2psecs :: Ptr FILETIME -> IO Integer
+        ft2psecs ft = do
+          high <- (#peek FILETIME,dwHighDateTime) ft :: IO Word32
+          low  <- (#peek FILETIME,dwLowDateTime)  ft :: IO Word32
+            -- Convert 100-ns units to picosecs (10^-12)
+            -- => multiply by 10^5.
+          return (((fromIntegral high) * (2^(32::Int)) + (fromIntegral low)) * 100000)
+
+    -- ToDo: pin down elapsed times to just the OS thread(s) that
+    -- are evaluating/managing Haskell code.
+
+-- While it's hard to get reliable numbers, the consensus is that Windows only provides
+-- 16 millisecond resolution in GetProcessTimes (see Python PEP 0418)
+getCpuTimePrecision :: IO Integer
+getCpuTimePrecision = return 16e9
+
+type FILETIME = ()
+type HANDLE = ()
+
+-- need proper Haskell names (initial lower-case character)
+#if defined(i386_HOST_ARCH)
+foreign import stdcall unsafe "GetCurrentProcess" getCurrentProcess :: IO (Ptr HANDLE)
+foreign import stdcall unsafe "GetProcessTimes" getProcessTimes :: Ptr HANDLE -> Ptr FILETIME -> Ptr FILETIME -> Ptr FILETIME -> Ptr FILETIME -> IO CInt
+#elif defined(x86_64_HOST_ARCH)
+foreign import ccall unsafe "GetCurrentProcess" getCurrentProcess :: IO (Ptr HANDLE)
+foreign import ccall unsafe "GetProcessTimes" getProcessTimes :: Ptr HANDLE -> Ptr FILETIME -> Ptr FILETIME -> Ptr FILETIME -> Ptr FILETIME -> IO CInt
+#else
+#error Unknown mingw32 arch
+#endif
diff --git a/System/Console/GetOpt.hs b/System/Console/GetOpt.hs
--- a/System/Console/GetOpt.hs
+++ b/System/Console/GetOpt.hs
@@ -96,14 +96,17 @@
    | ReqArg (String       -> a) String -- ^   option requires argument
    | OptArg (Maybe String -> a) String -- ^   optional argument
 
+-- | @since 4.6.0.0
 instance Functor ArgOrder where
     fmap _ RequireOrder      = RequireOrder
     fmap _ Permute           = Permute
     fmap f (ReturnInOrder g) = ReturnInOrder (f . g)
 
+-- | @since 4.6.0.0
 instance Functor OptDescr where
     fmap f (Option a b argDescr c) = Option a b (fmap f argDescr) c
 
+-- | @since 4.6.0.0
 instance Functor ArgDescr where
     fmap f (NoArg a)    = NoArg (f a)
     fmap f (ReqArg g s) = ReqArg (f . g) s
@@ -121,7 +124,7 @@
 -- second argument.
 usageInfo :: String                    -- header
           -> [OptDescr a]              -- option descriptors
-          -> String                    -- nicely formatted decription of options
+          -> String                    -- nicely formatted description of options
 usageInfo header optDescr = unlines (header:table)
    where (ss,ls,ds)     = (unzip3 . concatMap fmtOpt) optDescr
          table          = zipWith3 paste (sameLen ss) (sameLen ls) ds
diff --git a/System/Environment.hs b/System/Environment.hs
--- a/System/Environment.hs
+++ b/System/Environment.hs
@@ -67,12 +67,24 @@
 
 #ifdef mingw32_HOST_OS
 
--- Ignore the arguments to hs_init on Windows for the sake of Unicode compat
+{-
+Note [Ignore hs_init argv]
+~~~~~~~~~~~~~~~~~~~~~~~~~~
+Ignore the arguments to hs_init on Windows for the sake of Unicode compat
 
+Instead on Windows we get the list of arguments from getCommandLineW and
+filter out arguments which the RTS would not have passed along.
+
+This is done to ensure we get the arguments in proper Unicode Encoding which
+the RTS at this moment does not seem provide. The filtering has to match the
+one done by the RTS to avoid inconsistencies like #13287.
+-}
+
 getWin32ProgArgv_certainly :: IO [String]
 getWin32ProgArgv_certainly = do
         mb_argv <- getWin32ProgArgv
         case mb_argv of
+          -- see Note [Ignore hs_init argv]
           Nothing   -> fmap dropRTSArgs getFullArgs
           Just argv -> return argv
 
@@ -106,8 +118,10 @@
 foreign import ccall unsafe "setWin32ProgArgv"
   c_setWin32ProgArgv :: CInt -> Ptr CWString -> IO ()
 
+-- See Note [Ignore hs_init argv]
 dropRTSArgs :: [String] -> [String]
 dropRTSArgs []             = []
+dropRTSArgs rest@("--":_)  = rest
 dropRTSArgs ("+RTS":rest)  = dropRTSArgs (dropWhile (/= "-RTS") rest)
 dropRTSArgs ("--RTS":rest) = rest
 dropRTSArgs ("-RTS":rest)  = dropRTSArgs rest
@@ -307,7 +321,7 @@
 foreign import ccall unsafe "putenv" c_putenv :: CString -> IO CInt
 #endif
 
--- | @unSet name@ removes the specified environment variable from the
+-- | @unsetEnv name@ removes the specified environment variable from the
 -- environment of the current process.
 --
 -- Throws `Control.Exception.IOException` if @name@ is the empty string or
diff --git a/System/Exit.hs b/System/Exit.hs
--- a/System/Exit.hs
+++ b/System/Exit.hs
@@ -43,7 +43,7 @@
 -- A program that fails in any other way is treated as if it had
 -- called 'exitFailure'.
 -- A program that terminates successfully without calling 'exitWith'
--- explicitly is treated as it it had called 'exitWith' 'ExitSuccess'.
+-- explicitly is treated as if it had called 'exitWith' 'ExitSuccess'.
 --
 -- As an 'ExitCode' is not an 'IOError', 'exitWith' bypasses
 -- the error handling in the 'IO' monad and cannot be intercepted by
diff --git a/System/IO.hs b/System/IO.hs
--- a/System/IO.hs
+++ b/System/IO.hs
@@ -233,6 +233,8 @@
 
 import GHC.Base
 import GHC.List
+import GHC.IORef
+import GHC.Num
 import GHC.IO hiding ( bracket, onException )
 import GHC.IO.IOMode
 import GHC.IO.Handle.FD
@@ -424,7 +426,7 @@
 -- | The function creates a temporary file in ReadWrite mode.
 -- The created file isn\'t deleted automatically, so you need to delete it manually.
 --
--- The file is creates with permissions such that only the current
+-- The file is created with permissions such that only the current
 -- user can read\/write it.
 --
 -- With some exceptions (see below), the file will be created securely
@@ -439,7 +441,8 @@
 openTempFile :: FilePath   -- ^ Directory in which to create the file
              -> String     -- ^ File name template. If the template is \"foo.ext\" then
                            -- the created file will be \"fooXXX.ext\" where XXX is some
-                           -- random number.
+                           -- random number. Note that this should not contain any path
+                           -- separator characters.
              -> IO (FilePath, Handle)
 openTempFile tmp_dir template
     = openTempFile' "openTempFile" tmp_dir template False 0o600
@@ -463,7 +466,10 @@
 
 openTempFile' :: String -> FilePath -> String -> Bool -> CMode
               -> IO (FilePath, Handle)
-openTempFile' loc tmp_dir template binary mode = findTempName
+openTempFile' loc tmp_dir template binary mode
+    | pathSeparator `elem` template
+    = fail $ "openTempFile': Template string must not contain path separator characters: "++template
+    | otherwise = findTempName
   where
     -- We split off the last extension, so we can use .foo.ext files
     -- for temporary files (hidden on Unix OSes). Unfortunately we're
@@ -508,15 +514,16 @@
                   | last a == pathSeparator = a ++ b
                   | otherwise = a ++ [pathSeparator] ++ b
 
--- int rand(void) from <stdlib.h>, limited by RAND_MAX (small value, 32768)
-foreign import capi "stdlib.h rand" c_rand :: IO CInt
+tempCounter :: IORef Int
+tempCounter = unsafePerformIO $ newIORef 0
+{-# NOINLINE tempCounter #-}
 
 -- build large digit-alike number
 rand_string :: IO String
 rand_string = do
-  r1 <- c_rand
-  r2 <- c_rand
-  return $ show r1 ++ show r2
+  r1 <- c_getpid
+  r2 <- atomicModifyIORef tempCounter (\n -> (n+1, n))
+  return $ show r1 ++ "-" ++ show r2
 
 data OpenNewFileResult
   = NewFileCreated CInt
diff --git a/System/Mem/StableName.hs b/System/Mem/StableName.hs
--- a/System/Mem/StableName.hs
+++ b/System/Mem/StableName.hs
@@ -53,7 +53,7 @@
 
   The reverse is not necessarily true: if two stable names are not
   equal, then the objects they name may still be equal.  Note in particular
-  that `mkStableName` may return a different `StableName` after an
+  that `makeStableName` may return a different `StableName` after an
   object is evaluated.
 
   Stable Names are similar to Stable Pointers ("Foreign.StablePtr"),
@@ -85,6 +85,7 @@
 hashStableName :: StableName a -> Int
 hashStableName (StableName sn) = I# (stableNameToInt# sn)
 
+-- | @since 2.01
 instance Eq (StableName a) where
     (StableName sn1) == (StableName sn2) =
        case eqStableName# sn1 sn2 of
diff --git a/System/Mem/Weak.hs b/System/Mem/Weak.hs
--- a/System/Mem/Weak.hs
+++ b/System/Mem/Weak.hs
@@ -67,6 +67,10 @@
         -- * A precise semantics
 
         -- $precise
+
+        -- * Implementation notes
+
+        -- $notes
    ) where
 
 import GHC.Weak
@@ -140,3 +144,25 @@
  * It is the value or finalizer of a weak pointer object whose key is reachable.
 -}
 
+{- $notes
+
+A finalizer is not always called after its weak pointer\'s object becomes
+unreachable. There are two situations that can cause this:
+
+ * If the object becomes unreachable right before the program exits,
+   then GC may not be performed. Finalizers run during GC, so finalizers
+   associated with the object do not run if GC does not happen.
+
+ * If a finalizer throws an exception, subsequent finalizers that had
+   been queued to run after it do not get run. This behavior may change
+   in a future release. See issue <https://ghc.haskell.org/trac/ghc/ticket/13167 13167>
+   on the issue tracker. Writing a finalizer that throws exceptions is
+   discouraged.
+
+Other than these two caveats, users can always expect that a finalizer
+will be run after its weak pointer\'s object becomes unreachable. However,
+the second caveat means that users need to trust that all of their
+transitive dependencies do not throw exceptions in finalizers, since
+any finalizers can end up queued together.
+
+-}
diff --git a/System/Posix/Types.hs b/System/Posix/Types.hs
--- a/System/Posix/Types.hs
+++ b/System/Posix/Types.hs
@@ -1,17 +1,17 @@
-{-# LANGUAGE Trustworthy #-}
-{-# LANGUAGE CPP
-           , NoImplicitPrelude
-           , MagicHash
-           , GeneralizedNewtypeDeriving
-  #-}
+{-# LANGUAGE CPP #-}
+{-# LANGUAGE DerivingStrategies #-}
+{-# LANGUAGE GeneralizedNewtypeDeriving #-}
+{-# LANGUAGE MagicHash #-}
+{-# LANGUAGE NoImplicitPrelude #-}
 {-# LANGUAGE StandaloneDeriving #-}
+{-# LANGUAGE Trustworthy #-}
 
 -----------------------------------------------------------------------------
 -- |
 -- Module      :  System.Posix.Types
 -- Copyright   :  (c) The University of Glasgow 2002
 -- License     :  BSD-style (see the file libraries/base/LICENSE)
--- 
+--
 -- Maintainer  :  libraries@haskell.org
 -- Stability   :  provisional
 -- Portability :  non-portable (requires POSIX)
@@ -71,9 +71,37 @@
 #if defined(HTYPE_RLIM_T)
   CRLim(..),
 #endif
+#if defined(HTYPE_BLKSIZE_T)
+  CBlkSize(..),
+#endif
+#if defined(HTYPE_BLKCNT_T)
+  CBlkCnt(..),
+#endif
+#if defined(HTYPE_CLOCKID_T)
+  CClockId(..),
+#endif
+#if defined(HTYPE_FSBLKCNT_T)
+  CFsBlkCnt(..),
+#endif
+#if defined(HTYPE_FSFILCNT_T)
+  CFsFilCnt(..),
+#endif
+#if defined(HTYPE_ID_T)
+  CId(..),
+#endif
+#if defined(HTYPE_KEY_T)
+  CKey(..),
+#endif
+#if defined(HTYPE_TIMER_T)
+  CTimer(..),
+#endif
 
   Fd(..),
 
+  -- See Note [Exporting constructors of marshallable foreign types]
+  -- in Foreign.Ptr for why the constructors for these newtypes are
+  -- exported.
+
 #if defined(HTYPE_NLINK_T)
   LinkCount,
 #endif
@@ -153,8 +181,38 @@
 INTEGRAL_TYPE(CRLim,HTYPE_RLIM_T)
 #endif
 
--- ToDo: blksize_t, clockid_t, blkcnt_t, fsblkcnt_t, fsfilcnt_t, id_t, key_t
--- suseconds_t, timer_t, useconds_t
+#if defined(HTYPE_BLKSIZE_T)
+-- | @since 4.10.0.0
+INTEGRAL_TYPE_WITH_CTYPE(CBlkSize,blksize_t,HTYPE_BLKSIZE_T)
+#endif
+#if defined(HTYPE_BLKCNT_T)
+-- | @since 4.10.0.0
+INTEGRAL_TYPE_WITH_CTYPE(CBlkCnt,blkcnt_t,HTYPE_BLKCNT_T)
+#endif
+#if defined(HTYPE_CLOCKID_T)
+-- | @since 4.10.0.0
+INTEGRAL_TYPE_WITH_CTYPE(CClockId,clockid_t,HTYPE_CLOCKID_T)
+#endif
+#if defined(HTYPE_FSBLKCNT_T)
+-- | @since 4.10.0.0
+INTEGRAL_TYPE_WITH_CTYPE(CFsBlkCnt,fsblkcnt_t,HTYPE_FSBLKCNT_T)
+#endif
+#if defined(HTYPE_FSFILCNT_T)
+-- | @since 4.10.0.0
+INTEGRAL_TYPE_WITH_CTYPE(CFsFilCnt,fsfilcnt_t,HTYPE_FSFILCNT_T)
+#endif
+#if defined(HTYPE_ID_T)
+-- | @since 4.10.0.0
+INTEGRAL_TYPE_WITH_CTYPE(CId,id_t,HTYPE_ID_T)
+#endif
+#if defined(HTYPE_KEY_T)
+-- | @since 4.10.0.0
+INTEGRAL_TYPE_WITH_CTYPE(CKey,key_t,HTYPE_KEY_T)
+#endif
+#if defined(HTYPE_TIMER_T)
+-- | @since 4.10.0.0
+OPAQUE_TYPE_WITH_CTYPE(CTimer,timer_t,HTYPE_TIMER_T)
+#endif
 
 -- Make an Fd type rather than using CInt everywhere
 INTEGRAL_TYPE(Fd,CInt)
@@ -180,4 +238,3 @@
 type FileOffset     = COff
 type ProcessGroupID = CPid
 type Limit          = CLong
-
diff --git a/System/Timeout.hs b/System/Timeout.hs
--- a/System/Timeout.hs
+++ b/System/Timeout.hs
@@ -37,10 +37,12 @@
 
 newtype Timeout = Timeout Unique deriving (Eq)
 
+-- | @since 3.0
 instance Show Timeout where
     show _ = "<<timeout>>"
 
 -- Timeout is a child of SomeAsyncException
+-- | @since 4.7.0.0
 instance Exception Timeout where
   toException = asyncExceptionToException
   fromException = asyncExceptionFromException
diff --git a/Text/ParserCombinators/ReadP.hs b/Text/ParserCombinators/ReadP.hs
--- a/Text/ParserCombinators/ReadP.hs
+++ b/Text/ParserCombinators/ReadP.hs
@@ -104,14 +104,15 @@
 
 -- Monad, MonadPlus
 
+-- | @since 4.5.0.0
 instance Applicative P where
   pure x = Result x Fail
   (<*>) = ap
 
-instance MonadPlus P where
-  mzero = empty
-  mplus = (<|>)
+-- | @since 2.01
+instance MonadPlus P
 
+-- | @since 2.01
 instance Monad P where
   (Get f)      >>= k = Get (\c -> f c >>= k)
   (Look f)     >>= k = Look (\s -> f s >>= k)
@@ -121,9 +122,11 @@
 
   fail _ = Fail
 
+-- | @since 4.9.0.0
 instance MonadFail P where
   fail _ = Fail
 
+-- | @since 4.5.0.0
 instance Alternative P where
   empty = Fail
 
@@ -160,27 +163,32 @@
 
 -- Functor, Monad, MonadPlus
 
+-- | @since 2.01
 instance Functor ReadP where
   fmap h (R f) = R (\k -> f (k . h))
 
+-- | @since 4.6.0.0
 instance Applicative ReadP where
     pure x = R (\k -> k x)
     (<*>) = ap
+    liftA2 = liftM2
 
+-- | @since 2.01
 instance Monad ReadP where
   fail _    = R (\_ -> Fail)
   R m >>= f = R (\k -> m (\a -> let R m' = f a in m' k))
 
+-- | @since 4.9.0.0
 instance MonadFail ReadP where
   fail _    = R (\_ -> Fail)
 
+-- | @since 4.6.0.0
 instance Alternative ReadP where
-    empty = mzero
-    (<|>) = mplus
+  empty = pfail
+  (<|>) = (+++)
 
-instance MonadPlus ReadP where
-  mzero = pfail
-  mplus = (+++)
+-- | @since 2.01
+instance MonadPlus ReadP
 
 -- ---------------------------------------------------------------------------
 -- Operations over P
diff --git a/Text/ParserCombinators/ReadPrec.hs b/Text/ParserCombinators/ReadPrec.hs
--- a/Text/ParserCombinators/ReadPrec.hs
+++ b/Text/ParserCombinators/ReadPrec.hs
@@ -73,27 +73,32 @@
 
 -- Functor, Monad, MonadPlus
 
+-- | @since 2.01
 instance Functor ReadPrec where
   fmap h (P f) = P (\n -> fmap h (f n))
 
+-- | @since 4.6.0.0
 instance Applicative ReadPrec where
     pure x  = P (\_ -> pure x)
     (<*>) = ap
+    liftA2 = liftM2
 
+-- | @since 2.01
 instance Monad ReadPrec where
   fail s    = P (\_ -> fail s)
   P f >>= k = P (\n -> do a <- f n; let P f' = k a in f' n)
 
+-- | @since 4.9.0.0
 instance MonadFail.MonadFail ReadPrec where
-  fail s    = P (\_ -> fail s)
+  fail s    = P (\_ -> MonadFail.fail s)
 
-instance MonadPlus ReadPrec where
-  mzero = pfail
-  mplus = (+++)
+-- | @since 2.01
+instance MonadPlus ReadPrec
 
+-- | @since 4.6.0.0
 instance Alternative ReadPrec where
-    empty = mzero
-    (<|>) = mplus
+  empty = pfail
+  (<|>) = (+++)
 
 -- precedences
 type Prec = Int
diff --git a/Text/Printf.hs b/Text/Printf.hs
--- a/Text/Printf.hs
+++ b/Text/Printf.hs
@@ -27,7 +27,7 @@
 --
 -- | This 'printf' can be extended to format types
 -- other than those provided for by default. This
--- is done by instancing 'PrintfArg' and providing
+-- is done by instantiating 'PrintfArg' and providing
 -- a 'formatArg' for the type. It is possible to
 -- provide a 'parseFormat' to process type-specific
 -- modifiers, but the default instance is usually
@@ -282,6 +282,7 @@
 instance PrintfType String where
     spr fmt args = uprintf fmt (reverse args)
 -}
+-- | @since 2.01
 instance (IsChar c) => PrintfType [c] where
     spr fmts args = map fromChar (uprintf fmts (reverse args))
 
@@ -289,18 +290,22 @@
 -- type system won't readily let us say that without
 -- bringing the GADTs. So we go conditional for these defs.
 
+-- | @since 4.7.0.0
 instance (a ~ ()) => PrintfType (IO a) where
     spr fmts args =
         putStr $ map fromChar $ uprintf fmts $ reverse args
 
+-- | @since 4.7.0.0
 instance (a ~ ()) => HPrintfType (IO a) where
     hspr hdl fmts args = do
         hPutStr hdl (uprintf fmts (reverse args))
 
+-- | @since 2.01
 instance (PrintfArg a, PrintfType r) => PrintfType (a -> r) where
     spr fmts args = \ a -> spr fmts
                              ((parseFormat a, formatArg a) : args)
 
+-- | @since 2.01
 instance (PrintfArg a, HPrintfType r) => HPrintfType (a -> r) where
     hspr hdl fmts args = \ a -> hspr hdl fmts
                                   ((parseFormat a, formatArg a) : args)
@@ -318,64 +323,80 @@
     parseFormat _ (c : cs) = FormatParse "" c cs
     parseFormat _ "" = errorShortFormat
 
+-- | @since 2.01
 instance PrintfArg Char where
     formatArg = formatChar
     parseFormat _ cf = parseIntFormat (undefined :: Int) cf
 
+-- | @since 2.01
 instance (IsChar c) => PrintfArg [c] where
     formatArg = formatString
 
+-- | @since 2.01
 instance PrintfArg Int where
     formatArg = formatInt
     parseFormat = parseIntFormat
 
+-- | @since 2.01
 instance PrintfArg Int8 where
     formatArg = formatInt
     parseFormat = parseIntFormat
 
+-- | @since 2.01
 instance PrintfArg Int16 where
     formatArg = formatInt
     parseFormat = parseIntFormat
 
+-- | @since 2.01
 instance PrintfArg Int32 where
     formatArg = formatInt
     parseFormat = parseIntFormat
 
+-- | @since 2.01
 instance PrintfArg Int64 where
     formatArg = formatInt
     parseFormat = parseIntFormat
 
+-- | @since 2.01
 instance PrintfArg Word where
     formatArg = formatInt
     parseFormat = parseIntFormat
 
+-- | @since 2.01
 instance PrintfArg Word8 where
     formatArg = formatInt
     parseFormat = parseIntFormat
 
+-- | @since 2.01
 instance PrintfArg Word16 where
     formatArg = formatInt
     parseFormat = parseIntFormat
 
+-- | @since 2.01
 instance PrintfArg Word32 where
     formatArg = formatInt
     parseFormat = parseIntFormat
 
+-- | @since 2.01
 instance PrintfArg Word64 where
     formatArg = formatInt
     parseFormat = parseIntFormat
 
+-- | @since 2.01
 instance PrintfArg Integer where
     formatArg = formatInteger
     parseFormat = parseIntFormat
 
+-- | @since 4.8.0.0
 instance PrintfArg Natural where
     formatArg = formatInteger . toInteger
     parseFormat = parseIntFormat
 
+-- | @since 2.01
 instance PrintfArg Float where
     formatArg = formatRealFloat
 
+-- | @since 2.01
 instance PrintfArg Double where
     formatArg = formatRealFloat
 
@@ -389,6 +410,7 @@
     -- | @since 4.7.0.0
     fromChar :: Char -> c
 
+-- | @since 2.01
 instance IsChar Char where
     toChar c = c
     fromChar c = c
diff --git a/Text/Show/Functions.hs b/Text/Show/Functions.hs
--- a/Text/Show/Functions.hs
+++ b/Text/Show/Functions.hs
@@ -21,6 +21,7 @@
 
 module Text.Show.Functions () where
 
+-- | @since 2.01
 instance Show (a -> b) where
         showsPrec _ _ = showString "<function>"
 
diff --git a/Type/Reflection.hs b/Type/Reflection.hs
new file mode 100644
--- /dev/null
+++ b/Type/Reflection.hs
@@ -0,0 +1,72 @@
+{-# LANGUAGE Trustworthy #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE PatternSynonyms #-}
+
+-----------------------------------------------------------------------------
+-- |
+-- Module      :  Type.Reflection
+-- Copyright   :  (c) The University of Glasgow, CWI 2001--2017
+-- License     :  BSD-style (see the file libraries/base/LICENSE)
+--
+-- Maintainer  :  libraries@haskell.org
+-- Stability   :  experimental
+-- Portability :  non-portable (requires GADTs and compiler support)
+--
+-- This provides a type-indexed type representation mechanism, similar to that
+-- described by,
+--
+-- * Simon Peyton-Jones, Stephanie Weirich, Richard Eisenberg,
+-- Dimitrios Vytiniotis. "A reflection on types." /Proc. Philip Wadler's 60th
+-- birthday Festschrift/, Edinburgh (April 2016).
+--
+-- The interface provides 'TypeRep', a type representation which can
+-- be safely decomposed and composed. See "Data.Dynamic" for an example of this.
+--
+-- @since 4.10.0.0
+--
+-----------------------------------------------------------------------------
+module Type.Reflection
+    ( -- * The Typeable class
+      I.Typeable
+    , I.typeRep
+    , I.withTypeable
+
+      -- * Propositional equality
+    , (:~:)(Refl)
+    , (:~~:)(HRefl)
+
+      -- * Type representations
+      -- ** Type-Indexed
+    , I.TypeRep
+    , I.typeOf
+    , pattern I.App, pattern I.Con, pattern I.Con', pattern I.Fun
+    , I.typeRepTyCon
+    , I.rnfTypeRep
+    , I.eqTypeRep
+    , I.typeRepKind
+    , I.splitApps
+
+      -- ** Quantified
+      --
+      -- "Data.Typeable" exports a variant of this interface (named differently
+      -- for backwards compatibility).
+    , I.SomeTypeRep(..)
+    , I.someTypeRep
+    , I.someTypeRepTyCon
+    , I.rnfSomeTypeRep
+
+      -- * Type constructors
+    , I.TyCon           -- abstract, instance of: Eq, Show, Typeable
+                        -- For now don't export Module, to avoid name clashes
+    , I.tyConPackage
+    , I.tyConModule
+    , I.tyConName
+    , I.rnfTyCon
+
+      -- * Module names
+    , I.Module
+    , I.moduleName, I.modulePackage, I.rnfModule
+    ) where
+
+import qualified Data.Typeable.Internal as I
+import Data.Type.Equality
diff --git a/Type/Reflection/Unsafe.hs b/Type/Reflection/Unsafe.hs
new file mode 100644
--- /dev/null
+++ b/Type/Reflection/Unsafe.hs
@@ -0,0 +1,25 @@
+-----------------------------------------------------------------------------
+-- |
+-- Module      :  Type.Reflection.Unsafe
+-- Copyright   :  (c) The University of Glasgow, CWI 2001--2015
+-- License     :  BSD-style (see the file libraries/base/LICENSE)
+--
+-- The representations of the types 'TyCon' and 'TypeRep', and the function
+-- 'mkTyCon' which is used by derived instances of 'Typeable' to construct
+-- 'TyCon's.
+--
+-- Be warned, these functions can be used to construct ill-kinded
+-- type representations.
+--
+-----------------------------------------------------------------------------
+
+module Type.Reflection.Unsafe (
+      -- * Type representations
+      TypeRep, mkTrApp, mkTyCon, typeRepFingerprint, someTypeRepFingerprint
+      -- * Kind representations
+    , KindRep(..), TypeLitSort(..)
+      -- * Type constructors
+    , TyCon, mkTrCon, tyConKindRep, tyConKindArgs, tyConFingerprint
+  ) where
+
+import Data.Typeable.Internal
diff --git a/Unsafe/Coerce.hs b/Unsafe/Coerce.hs
--- a/Unsafe/Coerce.hs
+++ b/Unsafe/Coerce.hs
@@ -44,9 +44,8 @@
 then the simple-optimiser that the desugarer runs will eta-reduce to
   unsafeCoerce :: forall (a:*) (b:*). a -> b
   unsafeCoerce = unsafeCoerce#
-And that, sadly, is ill-typed because unsafeCoerce# has OpenKind type variables
-And rightly so, because we shouldn't be calling unsafeCoerce# in a higher
-order way; it has a compulsory unfolding 
+But we shouldn't be calling unsafeCoerce# in a higher
+order way; it has a compulsory unfolding
    unsafeCoerce# a b x = x |> UnsafeCo a b
 and we really rely on it being inlined pronto. But the simple-optimiser doesn't.
 The identity function local_id delays the eta reduction just long enough
@@ -58,5 +57,4 @@
 unsafeCoerce :: a -> b
 unsafeCoerce x = local_id (unsafeCoerce# x)
   -- See Note [Unsafe coerce magic] in basicTypes/MkId
-  -- NB: Do not eta-reduce this definition, else the type checker 
-  -- give usafeCoerce the same (dangerous) type as unsafeCoerce#
+  -- NB: Do not eta-reduce this definition (see above)
diff --git a/aclocal.m4 b/aclocal.m4
--- a/aclocal.m4
+++ b/aclocal.m4
@@ -54,6 +54,7 @@
 dnl FPTOOLS_HTYPE_INCLUDES
 AC_DEFUN([FPTOOLS_HTYPE_INCLUDES],
 [
+#include <stdbool.h>
 #include <stdio.h>
 #include <stddef.h>
 
@@ -131,26 +132,43 @@
 
         if test "$HTYPE_IS_INTEGRAL" -eq 0
         then
-            FP_COMPUTE_INT([HTYPE_IS_FLOAT],[sizeof($1) == sizeof(float)],
-                           [FPTOOLS_HTYPE_INCLUDES],
-                           [AC_CV_NAME_supported=no])
-            FP_COMPUTE_INT([HTYPE_IS_DOUBLE],[sizeof($1) == sizeof(double)],
-                           [FPTOOLS_HTYPE_INCLUDES],
-                           [AC_CV_NAME_supported=no])
-            FP_COMPUTE_INT([HTYPE_IS_LDOUBLE],[sizeof($1) == sizeof(long double)],
-                           [FPTOOLS_HTYPE_INCLUDES],
-                           [AC_CV_NAME_supported=no])
-            if test "$HTYPE_IS_FLOAT" -eq 1
-            then
-                AC_CV_NAME=Float
-            elif test "$HTYPE_IS_DOUBLE" -eq 1
-            then
-                AC_CV_NAME=Double
-            elif test "$HTYPE_IS_LDOUBLE" -eq 1
+            dnl If the C type isn't an integer, we check if it's a pointer type
+            dnl by trying to dereference one of its values. If that fails to
+            dnl compile, it's not a pointer, so we check to see if it's a
+            dnl floating-point type.
+            AC_COMPILE_IFELSE(
+                [AC_LANG_PROGRAM(
+                    [FPTOOLS_HTYPE_INCLUDES],
+                    [$1 val; *val;]
+                )],
+                [HTYPE_IS_POINTER=yes],
+                [HTYPE_IS_POINTER=no])
+
+            if test "$HTYPE_IS_POINTER" = yes
             then
-                AC_CV_NAME=LDouble
+                AC_CV_NAME="Ptr ()"
             else
-                AC_CV_NAME_supported=no
+                FP_COMPUTE_INT([HTYPE_IS_FLOAT],[sizeof($1) == sizeof(float)],
+                               [FPTOOLS_HTYPE_INCLUDES],
+                               [AC_CV_NAME_supported=no])
+                FP_COMPUTE_INT([HTYPE_IS_DOUBLE],[sizeof($1) == sizeof(double)],
+                               [FPTOOLS_HTYPE_INCLUDES],
+                               [AC_CV_NAME_supported=no])
+                FP_COMPUTE_INT([HTYPE_IS_LDOUBLE],[sizeof($1) == sizeof(long double)],
+                               [FPTOOLS_HTYPE_INCLUDES],
+                               [AC_CV_NAME_supported=no])
+                if test "$HTYPE_IS_FLOAT" -eq 1
+                then
+                    AC_CV_NAME=Float
+                elif test "$HTYPE_IS_DOUBLE" -eq 1
+                then
+                    AC_CV_NAME=Double
+                elif test "$HTYPE_IS_LDOUBLE" -eq 1
+                then
+                    AC_CV_NAME=LDouble
+                else
+                    AC_CV_NAME_supported=no
+                fi
             fi
         else
             FP_COMPUTE_INT([HTYPE_IS_SIGNED],[(($1)(-1)) < (($1)0)],
diff --git a/base.cabal b/base.cabal
--- a/base.cabal
+++ b/base.cabal
@@ -1,5 +1,5 @@
 name:           base
-version:        4.9.1.0
+version:        4.10.0.0
 -- NOTE: Don't forget to update ./changelog.md
 license:        BSD3
 license-file:   LICENSE
@@ -44,11 +44,13 @@
 
 Flag integer-simple
     Description: Use integer-simple
+    Manual: True
     Default: False
 
 Flag integer-gmp
     Description: Use integer-gmp
-    Default: True
+    Manual: True
+    Default: False
 
 Library
     default-language: Haskell2010
@@ -128,7 +130,9 @@
         Control.Monad.ST.Strict
         Control.Monad.ST.Unsafe
         Control.Monad.Zip
+        Data.Bifoldable
         Data.Bifunctor
+        Data.Bitraversable
         Data.Bits
         Data.Bool
         Data.Char
@@ -170,7 +174,6 @@
         Data.Type.Coercion
         Data.Type.Equality
         Data.Typeable
-        Data.Typeable.Internal
         Data.Unique
         Data.Version
         Data.Void
@@ -241,6 +244,7 @@
         GHC.IO.Handle
         GHC.IO.Handle.FD
         GHC.IO.Handle.Internals
+        GHC.IO.Handle.Lock
         GHC.IO.Handle.Text
         GHC.IO.Handle.Types
         GHC.IO.IOMode
@@ -260,6 +264,7 @@
         GHC.Ptr
         GHC.Read
         GHC.Real
+        GHC.Records
         GHC.RTS.Flags
         GHC.ST
         GHC.StaticPtr
@@ -273,6 +278,7 @@
         GHC.Storable
         GHC.TopHandler
         GHC.TypeLits
+        GHC.TypeNats
         GHC.Unicode
         GHC.Weak
         GHC.Word
@@ -300,14 +306,20 @@
         Text.Read.Lex
         Text.Show
         Text.Show.Functions
+        Type.Reflection
+        Type.Reflection.Unsafe
         Unsafe.Coerce
 
     other-modules:
         Control.Monad.ST.Imp
         Control.Monad.ST.Lazy.Imp
+        Data.Functor.Utils
         Data.OldList
+        Data.Typeable.Internal
         Foreign.ForeignPtr.Imp
+        GHC.StaticPtr.Internal
         System.Environment.ExecutablePath
+        System.CPUTime.Utils
 
     c-sources:
         cbits/DarwinUtils.c
@@ -320,7 +332,6 @@
         cbits/inputReady.c
         cbits/md5.c
         cbits/primFloat.c
-        cbits/rts.c
         cbits/sysconf.c
 
     include-dirs: include
@@ -347,6 +358,8 @@
             GHC.IO.Encoding.CodePage.Table
             GHC.Conc.Windows
             GHC.Windows
+        other-modules:
+            System.CPUTime.Windows
     else
         exposed-modules:
             GHC.Event
@@ -365,6 +378,11 @@
             GHC.Event.Thread
             GHC.Event.TimerManager
             GHC.Event.Unique
+
+            System.CPUTime.Posix.ClockGetTime
+            System.CPUTime.Posix.Times
+            System.CPUTime.Posix.RUsage
+            System.CPUTime.Unsupported
 
     -- We need to set the unit id to base (without a version number)
     -- as it's magic.
diff --git a/cbits/inputReady.c b/cbits/inputReady.c
--- a/cbits/inputReady.c
+++ b/cbits/inputReady.c
@@ -9,11 +9,13 @@
 #include "HsBase.h"
 #if !defined(_WIN32)
 #include <poll.h>
+#include <sys/time.h>
 #endif
 
 /*
  * inputReady(fd) checks to see whether input is available on the file
- * descriptor 'fd'.  Input meaning 'can I safely read at least a
+ * descriptor 'fd' within 'msecs' milliseconds (or indefinitely if 'msecs' is
+ * negative). "Input is available" is defined as 'can I safely read at least a
  * *character* from this file object without blocking?'
  */
 int
@@ -21,23 +23,41 @@
 {
 
 #if !defined(_WIN32)
+    struct pollfd fds[1];
 
-    // We only handle msecs == 0 on non-Windows, because this is the
-    // only case we need.  Non-zero waiting is handled by the IO manager.
-    if (msecs != 0) {
-        fprintf(stderr, "fdReady: msecs != 0, this shouldn't happen");
-        abort();
+    // if we need to track the then record the current time in case we are
+    // interrupted.
+    struct timeval tv0;
+    if (msecs > 0) {
+        if (gettimeofday(&tv0, NULL) != 0) {
+            fprintf(stderr, "fdReady: gettimeofday failed: %s\n",
+                    strerror(errno));
+            abort();
+        }
     }
 
-    struct pollfd fds[1];
-
     fds[0].fd = fd;
     fds[0].events = write ? POLLOUT : POLLIN;
     fds[0].revents = 0;
 
     int res;
-    while ((res = poll(fds, 1, 0)) < 0) {
-        if (errno != EINTR) {
+    while ((res = poll(fds, 1, msecs)) < 0) {
+        if (errno == EINTR) {
+            if (msecs > 0) {
+                struct timeval tv;
+                if (gettimeofday(&tv, NULL) != 0) {
+                    fprintf(stderr, "fdReady: gettimeofday failed: %s\n",
+                            strerror(errno));
+                    abort();
+                }
+
+                int elapsed = 1000 * (tv.tv_sec - tv0.tv_sec)
+                            + (tv.tv_usec - tv0.tv_usec) / 1000;
+                msecs -= elapsed;
+                if (msecs <= 0) return 0;
+                tv0 = tv;
+            }
+        } else {
             return (-1);
         }
     }
diff --git a/cbits/rts.c b/cbits/rts.c
deleted file mode 100644
--- a/cbits/rts.c
+++ /dev/null
@@ -1,42 +0,0 @@
-#include "Rts.h"
-#include "rts/Flags.h"
-
-GC_FLAGS *getGcFlags()
-{
-    return &RtsFlags.GcFlags;
-}
-
-CONCURRENT_FLAGS *getConcFlags()
-{
-    return &RtsFlags.ConcFlags;
-}
-
-MISC_FLAGS *getMiscFlags()
-{
-    return &RtsFlags.MiscFlags;
-}
-
-DEBUG_FLAGS *getDebugFlags()
-{
-    return &RtsFlags.DebugFlags;
-}
-
-COST_CENTRE_FLAGS *getCcFlags()
-{
-    return &RtsFlags.CcFlags;
-}
-
-PROFILING_FLAGS *getProfFlags()
-{
-    return &RtsFlags.ProfFlags;
-}
-
-TRACE_FLAGS *getTraceFlags()
-{
-    return &RtsFlags.TraceFlags;
-}
-
-TICKY_FLAGS *getTickyFlags()
-{
-    return &RtsFlags.TickyFlags;
-}
diff --git a/changelog.md b/changelog.md
--- a/changelog.md
+++ b/changelog.md
@@ -1,13 +1,92 @@
 # Changelog for [`base` package](http://hackage.haskell.org/package/base)
 
-## 4.9.1.0  *Jan 2017*
+## 4.10.0.0 *July 2017*
+  * Bundled with GHC 8.2.1
 
-  * Bundled with GHC 8.0.2
+  * `Data.Type.Bool.Not` given a type family dependency (#12057).
 
-  * Performance improvements in `Read` implementation
+  * `Foreign.Ptr` now exports the constructors for `IntPtr` and `WordPtr`
+    (#11983)
 
-  * Teach event manager to use poll instead of select (#12912)
+  * `Generic1`, as well as the associated datatypes and typeclasses in
+    `GHC.Generics`, are now poly-kinded (#10604)
 
+  * `New modules `Data.Bifoldable` and `Data.Bitraversable` (previously defined
+    in the `bifunctors` package) (#10448)
+
+  * `Data.Either` now provides `fromLeft` and `fromRight` (#12402)
+
+  * `Data.Type.Coercion` now provides `gcoerceWith` (#12493)
+
+  * New methods `liftReadList(2)` and `liftReadListPrec(2)` in the
+    `Read1`/`Read2` classes that are defined in terms of `ReadPrec` instead of
+    `ReadS`, as well as related combinators, have been added to
+    `Data.Functor.Classes` (#12358)
+
+  * Add `Semigroup` instance for `IO`, as well as for `Event` and `Lifetime`
+    from `GHC.Event` (#12464)
+
+  * Add `Data` instance for `Const` (#12438)
+
+  * Added `Eq1`, `Ord1`, `Read1` and `Show1` instances for `NonEmpty`.
+
+  * Add wrappers for `blksize_t`, `blkcnt_t`, `clockid_t`, `fsblkcnt_t`,
+    `fsfilcnt_t`, `id_t`, `key_t`, and `timer_t` to System.Posix.Types (#12795)
+
+  * Add `CBool`, a wrapper around C's `bool` type, to `Foreign.C.Types`
+    (#13136)
+
+  * Raw buffer operations in `GHC.IO.FD` are now strict in the buffer, offset, and length operations (#9696)
+
+  * Add `plusForeignPtr` to `Foreign.ForeignPtr`.
+
+  * Add `type family AppendSymbol (m :: Symbol) (n :: Symbol) :: Symbol` to `GHC.TypeLits`
+    (#12162)
+
+  * Add `GHC.TypeNats` module with `Natural`-based `KnownNat`. The `Nat`
+    operations in `GHC.TypeLits` are a thin compatibility layer on top.
+    Note: the `KnownNat` evidence is changed from an `Integer` to a `Natural`.
+
+  * The type of `asProxyTypeOf` in `Data.Proxy` has been generalized (#12805)
+
+  * `liftA2` is now a method of the `Applicative` class. `liftA2` and
+    `<*>` each have a default implementation based on the other. Various
+    library functions have been updated to use `liftA2` where it might offer
+    some benefit. `liftA2` is not yet in the `Prelude`, and must currently be
+    imported from `Control.Applicative`. It is likely to be added to the
+    `Prelude` in the future. (#13191)
+
+  * A new module, `Type.Reflection`, exposing GHC's new type-indexed type
+    representation mechanism is now provided.
+
+  * `Data.Dynamic` now exports the `Dyn` data constructor, enabled by the new
+    type-indexed type representation mechanism.
+
+  * `Data.Type.Equality` now provides a kind heterogeneous type equality
+    evidence type, `(:~~:)`.
+
+  * The `CostCentresXML` constructor of `GHC.RTS.Flags.DoCostCentres` has been
+    replaced by `CostCentresJSON` due to the new JSON export format supported by
+    the cost centre profiler.
+
+  * The `ErrorCall` pattern synonym has been given a `COMPLETE` pragma so that
+    functions which solely match again `ErrorCall` do not produce
+    non-exhaustive pattern-match warnings (#8779)
+
+  * Change the implementations of `maximumBy` and `minimumBy` from
+    `Data.Foldable` to use `foldl1` instead of `foldr1`. This makes them run
+    in constant space when applied to lists. (#10830)
+
+  * `mkFunTy`, `mkAppTy`, and `mkTyConApp` from `Data.Typeable` no longer exist.
+    This functionality is superceded by the interfaces provided by
+    `Type.Reflection`.
+
+  * `mkTyCon3` is no longer exported by `Data.Typeable`. This function is
+    replaced by `Type.Reflection.Unsafe.mkTyCon`.
+
+  * `Data.List.NonEmpty.unfold` has been deprecated in favor of `unfoldr`,
+    which is functionally equivalent.
+
 ## 4.9.0.0  *May 2016*
 
   * Bundled with GHC 8.0
@@ -158,6 +237,11 @@
     (previously orphans in `transformers`) (#10755)
 
   * `CallStack` now has an `IsList` instance
+
+  * The field `spInfoName` of `GHC.StaticPtr.StaticPtrInfo` has been removed.
+    The value is no longer available when constructing the `StaticPtr`.
+
+  * `VecElem` and `VecCount` now have `Enum` and `Bounded` instances.
 
 ### Generalizations
 
diff --git a/config.guess b/config.guess
--- a/config.guess
+++ b/config.guess
@@ -1,8 +1,8 @@
 #! /bin/sh
 # Attempt to guess a canonical system name.
-#   Copyright 1992-2014 Free Software Foundation, Inc.
+#   Copyright 1992-2017 Free Software Foundation, Inc.
 
-timestamp='2014-03-23'
+timestamp='2017-07-19'
 
 # This file is free software; you can redistribute it and/or modify it
 # under the terms of the GNU General Public License as published by
@@ -24,12 +24,12 @@
 # program.  This Exception is an additional permission under section 7
 # of the GNU General Public License, version 3 ("GPLv3").
 #
-# Originally written by Per Bothner.
+# Originally written by Per Bothner; maintained since 2000 by Ben Elliston.
 #
 # You can get the latest version of this script from:
-# http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD
+# http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess
 #
-# Please send patches with a ChangeLog entry to config-patches@gnu.org.
+# Please send patches to <config-patches@gnu.org>.
 
 
 me=`echo "$0" | sed -e 's,.*/,,'`
@@ -50,7 +50,7 @@
 GNU config.guess ($timestamp)
 
 Originally written by Per Bothner.
-Copyright 1992-2014 Free Software Foundation, Inc.
+Copyright 1992-2017 Free Software Foundation, Inc.
 
 This is free software; see the source for copying conditions.  There is NO
 warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
@@ -168,19 +168,29 @@
 	# Note: NetBSD doesn't particularly care about the vendor
 	# portion of the name.  We always set it to "unknown".
 	sysctl="sysctl -n hw.machine_arch"
-	UNAME_MACHINE_ARCH=`(/sbin/$sysctl 2>/dev/null || \
-	    /usr/sbin/$sysctl 2>/dev/null || echo unknown)`
+	UNAME_MACHINE_ARCH=`(uname -p 2>/dev/null || \
+	    /sbin/$sysctl 2>/dev/null || \
+	    /usr/sbin/$sysctl 2>/dev/null || \
+	    echo unknown)`
 	case "${UNAME_MACHINE_ARCH}" in
 	    armeb) machine=armeb-unknown ;;
 	    arm*) machine=arm-unknown ;;
 	    sh3el) machine=shl-unknown ;;
 	    sh3eb) machine=sh-unknown ;;
 	    sh5el) machine=sh5le-unknown ;;
+	    earmv*)
+		arch=`echo ${UNAME_MACHINE_ARCH} | sed -e 's,^e\(armv[0-9]\).*$,\1,'`
+		endian=`echo ${UNAME_MACHINE_ARCH} | sed -ne 's,^.*\(eb\)$,\1,p'`
+		machine=${arch}${endian}-unknown
+		;;
 	    *) machine=${UNAME_MACHINE_ARCH}-unknown ;;
 	esac
 	# The Operating System including object format, if it has switched
-	# to ELF recently, or will in the future.
+	# to ELF recently (or will in the future) and ABI.
 	case "${UNAME_MACHINE_ARCH}" in
+	    earm*)
+		os=netbsdelf
+		;;
 	    arm*|i386|m68k|ns32k|sh3*|sparc|vax)
 		eval $set_cc_for_build
 		if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \
@@ -197,6 +207,13 @@
 		os=netbsd
 		;;
 	esac
+	# Determine ABI tags.
+	case "${UNAME_MACHINE_ARCH}" in
+	    earm*)
+		expr='s/^earmv[0-9]/-eabi/;s/eb$//'
+		abi=`echo ${UNAME_MACHINE_ARCH} | sed -e "$expr"`
+		;;
+	esac
 	# The OS release
 	# Debian GNU/NetBSD machines have a different userland, and
 	# thus, need a distinct triplet. However, they do not need
@@ -207,13 +224,13 @@
 		release='-gnu'
 		;;
 	    *)
-		release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'`
+		release=`echo ${UNAME_RELEASE} | sed -e 's/[-_].*//' | cut -d. -f1,2`
 		;;
 	esac
 	# Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM:
 	# contains redundant information, the shorter form:
 	# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used.
-	echo "${machine}-${os}${release}"
+	echo "${machine}-${os}${release}${abi}"
 	exit ;;
     *:Bitrig:*:*)
 	UNAME_MACHINE_ARCH=`arch | sed 's/Bitrig.//'`
@@ -223,6 +240,10 @@
 	UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'`
 	echo ${UNAME_MACHINE_ARCH}-unknown-openbsd${UNAME_RELEASE}
 	exit ;;
+    *:LibertyBSD:*:*)
+	UNAME_MACHINE_ARCH=`arch | sed 's/^.*BSD\.//'`
+	echo ${UNAME_MACHINE_ARCH}-unknown-libertybsd${UNAME_RELEASE}
+	exit ;;
     *:ekkoBSD:*:*)
 	echo ${UNAME_MACHINE}-unknown-ekkobsd${UNAME_RELEASE}
 	exit ;;
@@ -235,6 +256,9 @@
     *:MirBSD:*:*)
 	echo ${UNAME_MACHINE}-unknown-mirbsd${UNAME_RELEASE}
 	exit ;;
+    *:Sortix:*:*)
+	echo ${UNAME_MACHINE}-unknown-sortix
+	exit ;;
     alpha:OSF1:*:*)
 	case $UNAME_RELEASE in
 	*4.0)
@@ -251,42 +275,42 @@
 	ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^  The alpha \(.*\) processor.*$/\1/p' | head -n 1`
 	case "$ALPHA_CPU_TYPE" in
 	    "EV4 (21064)")
-		UNAME_MACHINE="alpha" ;;
+		UNAME_MACHINE=alpha ;;
 	    "EV4.5 (21064)")
-		UNAME_MACHINE="alpha" ;;
+		UNAME_MACHINE=alpha ;;
 	    "LCA4 (21066/21068)")
-		UNAME_MACHINE="alpha" ;;
+		UNAME_MACHINE=alpha ;;
 	    "EV5 (21164)")
-		UNAME_MACHINE="alphaev5" ;;
+		UNAME_MACHINE=alphaev5 ;;
 	    "EV5.6 (21164A)")
-		UNAME_MACHINE="alphaev56" ;;
+		UNAME_MACHINE=alphaev56 ;;
 	    "EV5.6 (21164PC)")
-		UNAME_MACHINE="alphapca56" ;;
+		UNAME_MACHINE=alphapca56 ;;
 	    "EV5.7 (21164PC)")
-		UNAME_MACHINE="alphapca57" ;;
+		UNAME_MACHINE=alphapca57 ;;
 	    "EV6 (21264)")
-		UNAME_MACHINE="alphaev6" ;;
+		UNAME_MACHINE=alphaev6 ;;
 	    "EV6.7 (21264A)")
-		UNAME_MACHINE="alphaev67" ;;
+		UNAME_MACHINE=alphaev67 ;;
 	    "EV6.8CB (21264C)")
-		UNAME_MACHINE="alphaev68" ;;
+		UNAME_MACHINE=alphaev68 ;;
 	    "EV6.8AL (21264B)")
-		UNAME_MACHINE="alphaev68" ;;
+		UNAME_MACHINE=alphaev68 ;;
 	    "EV6.8CX (21264D)")
-		UNAME_MACHINE="alphaev68" ;;
+		UNAME_MACHINE=alphaev68 ;;
 	    "EV6.9A (21264/EV69A)")
-		UNAME_MACHINE="alphaev69" ;;
+		UNAME_MACHINE=alphaev69 ;;
 	    "EV7 (21364)")
-		UNAME_MACHINE="alphaev7" ;;
+		UNAME_MACHINE=alphaev7 ;;
 	    "EV7.9 (21364A)")
-		UNAME_MACHINE="alphaev79" ;;
+		UNAME_MACHINE=alphaev79 ;;
 	esac
 	# A Pn.n version is a patched version.
 	# A Vn.n version is a released version.
 	# A Tn.n version is a released field test version.
 	# A Xn.n version is an unreleased experimental baselevel.
 	# 1.2 uses "1.2" for uname -r.
-	echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
+	echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz`
 	# Reset EXIT trap before exiting to avoid spurious non-zero exit code.
 	exitcode=$?
 	trap '' 0
@@ -359,16 +383,16 @@
 	exit ;;
     i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*)
 	eval $set_cc_for_build
-	SUN_ARCH="i386"
+	SUN_ARCH=i386
 	# If there is a compiler, see if it is configured for 64-bit objects.
 	# Note that the Sun cc does not turn __LP64__ into 1 like gcc does.
 	# This test works for both compilers.
-	if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then
+	if [ "$CC_FOR_BUILD" != no_compiler_found ]; then
 	    if (echo '#ifdef __amd64'; echo IS_64BIT_ARCH; echo '#endif') | \
-		(CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \
+		(CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \
 		grep IS_64BIT_ARCH >/dev/null
 	    then
-		SUN_ARCH="x86_64"
+		SUN_ARCH=x86_64
 	    fi
 	fi
 	echo ${SUN_ARCH}-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
@@ -393,7 +417,7 @@
 	exit ;;
     sun*:*:4.2BSD:*)
 	UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null`
-	test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3
+	test "x${UNAME_RELEASE}" = x && UNAME_RELEASE=3
 	case "`/bin/arch`" in
 	    sun3)
 		echo m68k-sun-sunos${UNAME_RELEASE}
@@ -579,8 +603,9 @@
 	else
 		IBM_ARCH=powerpc
 	fi
-	if [ -x /usr/bin/oslevel ] ; then
-		IBM_REV=`/usr/bin/oslevel`
+	if [ -x /usr/bin/lslpp ] ; then
+		IBM_REV=`/usr/bin/lslpp -Lqc bos.rte.libc |
+			   awk -F: '{ print $3 }' | sed s/[0-9]*$/0/`
 	else
 		IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE}
 	fi
@@ -617,13 +642,13 @@
 		    sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null`
 		    sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null`
 		    case "${sc_cpu_version}" in
-		      523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0
-		      528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1
+		      523) HP_ARCH=hppa1.0 ;; # CPU_PA_RISC1_0
+		      528) HP_ARCH=hppa1.1 ;; # CPU_PA_RISC1_1
 		      532)                      # CPU_PA_RISC2_0
 			case "${sc_kernel_bits}" in
-			  32) HP_ARCH="hppa2.0n" ;;
-			  64) HP_ARCH="hppa2.0w" ;;
-			  '') HP_ARCH="hppa2.0" ;;   # HP-UX 10.20
+			  32) HP_ARCH=hppa2.0n ;;
+			  64) HP_ARCH=hppa2.0w ;;
+			  '') HP_ARCH=hppa2.0 ;;   # HP-UX 10.20
 			esac ;;
 		    esac
 		fi
@@ -662,11 +687,11 @@
 		    exit (0);
 		}
 EOF
-		    (CCOPTS= $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy`
+		    (CCOPTS="" $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy`
 		    test -z "$HP_ARCH" && HP_ARCH=hppa
 		fi ;;
 	esac
-	if [ ${HP_ARCH} = "hppa2.0w" ]
+	if [ ${HP_ARCH} = hppa2.0w ]
 	then
 	    eval $set_cc_for_build
 
@@ -679,12 +704,12 @@
 	    # $ CC_FOR_BUILD="cc +DA2.0w" ./config.guess
 	    # => hppa64-hp-hpux11.23
 
-	    if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) |
+	    if echo __LP64__ | (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) |
 		grep -q __LP64__
 	    then
-		HP_ARCH="hppa2.0w"
+		HP_ARCH=hppa2.0w
 	    else
-		HP_ARCH="hppa64"
+		HP_ARCH=hppa64
 	    fi
 	fi
 	echo ${HP_ARCH}-hp-hpux${HPUX_REV}
@@ -789,14 +814,14 @@
 	echo craynv-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
 	exit ;;
     F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*)
-	FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
-	FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'`
+	FUJITSU_PROC=`uname -m | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz`
+	FUJITSU_SYS=`uname -p | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/\///'`
 	FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'`
 	echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
 	exit ;;
     5000:UNIX_System_V:4.*:*)
-	FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'`
-	FUJITSU_REL=`echo ${UNAME_RELEASE} | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/ /_/'`
+	FUJITSU_SYS=`uname -p | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/\///'`
+	FUJITSU_REL=`echo ${UNAME_RELEASE} | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/ /_/'`
 	echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
 	exit ;;
     i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*)
@@ -812,10 +837,11 @@
 	UNAME_PROCESSOR=`/usr/bin/uname -p`
 	case ${UNAME_PROCESSOR} in
 	    amd64)
-		echo x86_64-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
-	    *)
-		echo ${UNAME_PROCESSOR}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
+		UNAME_PROCESSOR=x86_64 ;;
+	    i386)
+		UNAME_PROCESSOR=i586 ;;
 	esac
+	echo ${UNAME_PROCESSOR}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`
 	exit ;;
     i*:CYGWIN*:*)
 	echo ${UNAME_MACHINE}-pc-cygwin
@@ -878,7 +904,7 @@
 	exit ;;
     *:GNU/*:*:*)
 	# other systems with GNU libc and userland
-	echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-${LIBC}
+	echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr "[:upper:]" "[:lower:]"``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-${LIBC}
 	exit ;;
     i*86:Minix:*:*)
 	echo ${UNAME_MACHINE}-pc-minix
@@ -901,7 +927,7 @@
 	  EV68*) UNAME_MACHINE=alphaev68 ;;
 	esac
 	objdump --private-headers /bin/sh | grep -q ld.so.1
-	if test "$?" = 0 ; then LIBC="gnulibc1" ; fi
+	if test "$?" = 0 ; then LIBC=gnulibc1 ; fi
 	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
 	exit ;;
     arc:Linux:*:* | arceb:Linux:*:*)
@@ -932,6 +958,9 @@
     crisv32:Linux:*:*)
 	echo ${UNAME_MACHINE}-axis-linux-${LIBC}
 	exit ;;
+    e2k:Linux:*:*)
+	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
+	exit ;;
     frv:Linux:*:*)
 	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
 	exit ;;
@@ -944,6 +973,9 @@
     ia64:Linux:*:*)
 	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
 	exit ;;
+    k1om:Linux:*:*)
+	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
+	exit ;;
     m32r*:Linux:*:*)
 	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
 	exit ;;
@@ -969,6 +1001,9 @@
 	eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^CPU'`
 	test x"${CPU}" != x && { echo "${CPU}-unknown-linux-${LIBC}"; exit; }
 	;;
+    mips64el:Linux:*:*)
+	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
+	exit ;;
     openrisc*:Linux:*:*)
 	echo or1k-unknown-linux-${LIBC}
 	exit ;;
@@ -1001,6 +1036,9 @@
     ppcle:Linux:*:*)
 	echo powerpcle-unknown-linux-${LIBC}
 	exit ;;
+    riscv32:Linux:*:* | riscv64:Linux:*:*)
+	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
+	exit ;;
     s390:Linux:*:* | s390x:Linux:*:*)
 	echo ${UNAME_MACHINE}-ibm-linux-${LIBC}
 	exit ;;
@@ -1020,7 +1058,7 @@
 	echo ${UNAME_MACHINE}-dec-linux-${LIBC}
 	exit ;;
     x86_64:Linux:*:*)
-	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
+	echo ${UNAME_MACHINE}-pc-linux-${LIBC}
 	exit ;;
     xtensa*:Linux:*:*)
 	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
@@ -1099,7 +1137,7 @@
 	# uname -m prints for DJGPP always 'pc', but it prints nothing about
 	# the processor, so we play safe by assuming i586.
 	# Note: whatever this is, it MUST be the same as what config.sub
-	# prints for the "djgpp" host, or else GDB configury will decide that
+	# prints for the "djgpp" host, or else GDB configure will decide that
 	# this is a cross-build.
 	echo i586-pc-msdosdjgpp
 	exit ;;
@@ -1248,6 +1286,9 @@
     SX-8R:SUPER-UX:*:*)
 	echo sx8r-nec-superux${UNAME_RELEASE}
 	exit ;;
+    SX-ACE:SUPER-UX:*:*)
+	echo sxace-nec-superux${UNAME_RELEASE}
+	exit ;;
     Power*:Rhapsody:*:*)
 	echo powerpc-apple-rhapsody${UNAME_RELEASE}
 	exit ;;
@@ -1261,16 +1302,23 @@
 	    UNAME_PROCESSOR=powerpc
 	fi
 	if test `echo "$UNAME_RELEASE" | sed -e 's/\..*//'` -le 10 ; then
-	    if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then
+	    if [ "$CC_FOR_BUILD" != no_compiler_found ]; then
 		if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \
-		    (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \
-		    grep IS_64BIT_ARCH >/dev/null
+		       (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \
+		       grep IS_64BIT_ARCH >/dev/null
 		then
 		    case $UNAME_PROCESSOR in
 			i386) UNAME_PROCESSOR=x86_64 ;;
 			powerpc) UNAME_PROCESSOR=powerpc64 ;;
 		    esac
 		fi
+		# On 10.4-10.6 one might compile for PowerPC via gcc -arch ppc
+		if (echo '#ifdef __POWERPC__'; echo IS_PPC; echo '#endif') | \
+		       (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \
+		       grep IS_PPC >/dev/null
+		then
+		    UNAME_PROCESSOR=powerpc
+		fi
 	    fi
 	elif test "$UNAME_PROCESSOR" = i386 ; then
 	    # Avoid executing cc on OS X 10.9, as it ships with a stub
@@ -1285,7 +1333,7 @@
 	exit ;;
     *:procnto*:*:* | *:QNX:[0123456789]*:*)
 	UNAME_PROCESSOR=`uname -p`
-	if test "$UNAME_PROCESSOR" = "x86"; then
+	if test "$UNAME_PROCESSOR" = x86; then
 		UNAME_PROCESSOR=i386
 		UNAME_MACHINE=pc
 	fi
@@ -1294,15 +1342,18 @@
     *:QNX:*:4*)
 	echo i386-pc-qnx
 	exit ;;
-    NEO-?:NONSTOP_KERNEL:*:*)
+    NEO-*:NONSTOP_KERNEL:*:*)
 	echo neo-tandem-nsk${UNAME_RELEASE}
 	exit ;;
     NSE-*:NONSTOP_KERNEL:*:*)
 	echo nse-tandem-nsk${UNAME_RELEASE}
 	exit ;;
-    NSR-?:NONSTOP_KERNEL:*:*)
+    NSR-*:NONSTOP_KERNEL:*:*)
 	echo nsr-tandem-nsk${UNAME_RELEASE}
 	exit ;;
+    NSX-*:NONSTOP_KERNEL:*:*)
+	echo nsx-tandem-nsk${UNAME_RELEASE}
+	exit ;;
     *:NonStop-UX:*:*)
 	echo mips-compaq-nonstopux
 	exit ;;
@@ -1316,7 +1367,7 @@
 	# "uname -m" is not consistent, so use $cputype instead. 386
 	# is converted to i386 for consistency with other x86
 	# operating systems.
-	if test "$cputype" = "386"; then
+	if test "$cputype" = 386; then
 	    UNAME_MACHINE=i386
 	else
 	    UNAME_MACHINE="$cputype"
@@ -1358,7 +1409,7 @@
 	echo i386-pc-xenix
 	exit ;;
     i*86:skyos:*:*)
-	echo ${UNAME_MACHINE}-pc-skyos`echo ${UNAME_RELEASE}` | sed -e 's/ .*$//'
+	echo ${UNAME_MACHINE}-pc-skyos`echo ${UNAME_RELEASE} | sed -e 's/ .*$//'`
 	exit ;;
     i*86:rdos:*:*)
 	echo ${UNAME_MACHINE}-pc-rdos
@@ -1369,23 +1420,25 @@
     x86_64:VMkernel:*:*)
 	echo ${UNAME_MACHINE}-unknown-esx
 	exit ;;
+    amd64:Isilon\ OneFS:*:*)
+	echo x86_64-unknown-onefs
+	exit ;;
 esac
 
 cat >&2 <<EOF
 $0: unable to guess system type
 
-This script, last modified $timestamp, has failed to recognize
-the operating system you are using. It is advised that you
-download the most up to date version of the config scripts from
+This script (version $timestamp), has failed to recognize the
+operating system you are using. If your script is old, overwrite *all*
+copies of config.guess and config.sub with the latest versions from:
 
-  http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD
+  http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess
 and
-  http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=HEAD
+  http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub
 
-If the version you run ($0) is already up to date, please
-send the following data and any information you think might be
-pertinent to <config-patches@gnu.org> in order to provide the needed
-information to handle your system.
+If $0 has already been updated, send the following data and any
+information you think might be pertinent to config-patches@gnu.org to
+provide the necessary information to handle your system.
 
 config.guess timestamp = $timestamp
 
diff --git a/config.sub b/config.sub
--- a/config.sub
+++ b/config.sub
@@ -1,8 +1,8 @@
 #! /bin/sh
 # Configuration validation subroutine script.
-#   Copyright 1992-2014 Free Software Foundation, Inc.
+#   Copyright 1992-2017 Free Software Foundation, Inc.
 
-timestamp='2014-05-01'
+timestamp='2017-04-02'
 
 # This file is free software; you can redistribute it and/or modify it
 # under the terms of the GNU General Public License as published by
@@ -25,7 +25,7 @@
 # of the GNU General Public License, version 3 ("GPLv3").
 
 
-# Please send patches with a ChangeLog entry to config-patches@gnu.org.
+# Please send patches to <config-patches@gnu.org>.
 #
 # Configuration subroutine to validate and canonicalize a configuration type.
 # Supply the specified configuration type as an argument.
@@ -33,7 +33,7 @@
 # Otherwise, we print the canonical config type on stdout and succeed.
 
 # You can get the latest version of this script from:
-# http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=HEAD
+# http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub
 
 # This file is supposed to be the same for all GNU packages
 # and recognize all the CPU types, system types and aliases
@@ -53,8 +53,7 @@
 me=`echo "$0" | sed -e 's,.*/,,'`
 
 usage="\
-Usage: $0 [OPTION] CPU-MFR-OPSYS
-       $0 [OPTION] ALIAS
+Usage: $0 [OPTION] CPU-MFR-OPSYS or ALIAS
 
 Canonicalize a configuration name.
 
@@ -68,7 +67,7 @@
 version="\
 GNU config.sub ($timestamp)
 
-Copyright 1992-2014 Free Software Foundation, Inc.
+Copyright 1992-2017 Free Software Foundation, Inc.
 
 This is free software; see the source for copying conditions.  There is NO
 warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
@@ -117,8 +116,8 @@
 case $maybe_os in
   nto-qnx* | linux-gnu* | linux-android* | linux-dietlibc | linux-newlib* | \
   linux-musl* | linux-uclibc* | uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | \
-  knetbsd*-gnu* | netbsd*-gnu* | \
-  kopensolaris*-gnu* | \
+  knetbsd*-gnu* | netbsd*-gnu* | netbsd*-eabi* | \
+  kopensolaris*-gnu* | cloudabi*-eabi* | \
   storm-chaos* | os2-emx* | rtmk-nova*)
     os=-$maybe_os
     basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`
@@ -255,15 +254,16 @@
 	| arc | arceb \
 	| arm | arm[bl]e | arme[lb] | armv[2-8] | armv[3-8][lb] | armv7[arm] \
 	| avr | avr32 \
+	| ba \
 	| be32 | be64 \
 	| bfin \
 	| c4x | c8051 | clipper \
 	| d10v | d30v | dlx | dsp16xx \
-	| epiphany \
-	| fido | fr30 | frv \
+	| e2k | epiphany \
+	| fido | fr30 | frv | ft32 \
 	| h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \
 	| hexagon \
-	| i370 | i860 | i960 | ia64 \
+	| i370 | i860 | i960 | ia16 | ia64 \
 	| ip2k | iq2000 \
 	| k1om \
 	| le32 | le64 \
@@ -301,10 +301,12 @@
 	| open8 | or1k | or1knd | or32 \
 	| pdp10 | pdp11 | pj | pjl \
 	| powerpc | powerpc64 | powerpc64le | powerpcle \
+	| pru \
 	| pyramid \
+	| riscv32 | riscv64 \
 	| rl78 | rx \
 	| score \
-	| sh | sh[1234] | sh[24]a | sh[24]aeb | sh[23]e | sh[34]eb | sheb | shbe | shle | sh[1234]le | sh3ele \
+	| sh | sh[1234] | sh[24]a | sh[24]aeb | sh[23]e | sh[234]eb | sheb | shbe | shle | sh[1234]le | sh3ele \
 	| sh64 | sh64le \
 	| sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet | sparclite \
 	| sparcv8 | sparcv9 | sparcv9b | sparcv9v \
@@ -312,6 +314,8 @@
 	| tahoe | tic4x | tic54x | tic55x | tic6x | tic80 | tron \
 	| ubicom32 \
 	| v850 | v850e | v850e1 | v850e2 | v850es | v850e2v3 \
+	| visium \
+	| wasm32 \
 	| we32k \
 	| x86 | xc16x | xstormy16 | xtensa \
 	| z8k | z80)
@@ -326,6 +330,9 @@
 	c6x)
 		basic_machine=tic6x-unknown
 		;;
+	leon|leon[3-9])
+		basic_machine=sparc-$basic_machine
+		;;
 	m6811 | m68hc11 | m6812 | m68hc12 | m68hcs12x | nvptx | picochip)
 		basic_machine=$basic_machine-unknown
 		os=-none
@@ -371,17 +378,18 @@
 	| alphapca5[67]-* | alpha64pca5[67]-* | arc-* | arceb-* \
 	| arm-*  | armbe-* | armle-* | armeb-* | armv*-* \
 	| avr-* | avr32-* \
+	| ba-* \
 	| be32-* | be64-* \
 	| bfin-* | bs2000-* \
 	| c[123]* | c30-* | [cjt]90-* | c4x-* \
 	| c8051-* | clipper-* | craynv-* | cydra-* \
 	| d10v-* | d30v-* | dlx-* \
-	| elxsi-* \
+	| e2k-* | elxsi-* \
 	| f30[01]-* | f700-* | fido-* | fr30-* | frv-* | fx80-* \
 	| h8300-* | h8500-* \
 	| hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \
 	| hexagon-* \
-	| i*86-* | i860-* | i960-* | ia64-* \
+	| i*86-* | i860-* | i960-* | ia16-* | ia64-* \
 	| ip2k-* | iq2000-* \
 	| k1om-* \
 	| le32-* | le64-* \
@@ -422,13 +430,15 @@
 	| orion-* \
 	| pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \
 	| powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* \
+	| pru-* \
 	| pyramid-* \
+	| riscv32-* | riscv64-* \
 	| rl78-* | romp-* | rs6000-* | rx-* \
 	| sh-* | sh[1234]-* | sh[24]a-* | sh[24]aeb-* | sh[23]e-* | sh[34]eb-* | sheb-* | shbe-* \
 	| shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \
 	| sparc-* | sparc64-* | sparc64b-* | sparc64v-* | sparc86x-* | sparclet-* \
 	| sparclite-* \
-	| sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | sv1-* | sx?-* \
+	| sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | sv1-* | sx*-* \
 	| tahoe-* \
 	| tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \
 	| tile*-* \
@@ -436,6 +446,8 @@
 	| ubicom32-* \
 	| v850-* | v850e-* | v850e1-* | v850es-* | v850e2-* | v850e2v3-* \
 	| vax-* \
+	| visium-* \
+	| wasm32-* \
 	| we32k-* \
 	| x86-* | x86_64-* | xc16x-* | xps100-* \
 	| xstormy16-* | xtensa*-* \
@@ -512,6 +524,9 @@
 		basic_machine=i386-pc
 		os=-aros
 		;;
+	asmjs)
+		basic_machine=asmjs-unknown
+		;;
 	aux)
 		basic_machine=m68k-apple
 		os=-aux
@@ -632,6 +647,14 @@
 		basic_machine=m68k-bull
 		os=-sysv3
 		;;
+	e500v[12])
+		basic_machine=powerpc-unknown
+		os=$os"spe"
+		;;
+	e500v[12]-*)
+		basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'`
+		os=$os"spe"
+		;;
 	ebmon29k)
 		basic_machine=a29k-amd
 		os=-ebmon
@@ -773,6 +796,9 @@
 		basic_machine=m68k-isi
 		os=-sysv
 		;;
+	leon-*|leon[3-9]-*)
+		basic_machine=sparc-`echo $basic_machine | sed 's/-.*//'`
+		;;
 	m68knommu)
 		basic_machine=m68k-unknown
 		os=-linux
@@ -828,6 +854,10 @@
 		basic_machine=powerpc-unknown
 		os=-morphos
 		;;
+	moxiebox)
+		basic_machine=moxie-unknown
+		os=-moxiebox
+		;;
 	msdos)
 		basic_machine=i386-pc
 		os=-msdos
@@ -920,6 +950,9 @@
 	nsr-tandem)
 		basic_machine=nsr-tandem
 		;;
+	nsx-tandem)
+		basic_machine=nsx-tandem
+		;;
 	op50n-* | op60c-*)
 		basic_machine=hppa1.1-oki
 		os=-proelf
@@ -1004,7 +1037,7 @@
 	ppc-* | ppcbe-*)
 		basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'`
 		;;
-	ppcle | powerpclittle | ppc-le | powerpc-little)
+	ppcle | powerpclittle)
 		basic_machine=powerpcle-unknown
 		;;
 	ppcle-* | powerpclittle-*)
@@ -1014,7 +1047,7 @@
 		;;
 	ppc64-*) basic_machine=powerpc64-`echo $basic_machine | sed 's/^[^-]*-//'`
 		;;
-	ppc64le | powerpc64little | ppc64-le | powerpc64-little)
+	ppc64le | powerpc64little)
 		basic_machine=powerpc64le-unknown
 		;;
 	ppc64le-* | powerpc64little-*)
@@ -1215,6 +1248,9 @@
 		basic_machine=a29k-wrs
 		os=-vxworks
 		;;
+	wasm32)
+		basic_machine=wasm32-unknown
+		;;
 	w65*)
 		basic_machine=w65-wdc
 		os=-none
@@ -1360,27 +1396,28 @@
 	      | -hpux* | -unos* | -osf* | -luna* | -dgux* | -auroraux* | -solaris* \
 	      | -sym* | -kopensolaris* | -plan9* \
 	      | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \
-	      | -aos* | -aros* \
+	      | -aos* | -aros* | -cloudabi* | -sortix* \
 	      | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \
 	      | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \
 	      | -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* \
-	      | -bitrig* | -openbsd* | -solidbsd* \
+	      | -bitrig* | -openbsd* | -solidbsd* | -libertybsd* \
 	      | -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \
 	      | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \
 	      | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \
 	      | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \
-	      | -chorusos* | -chorusrdb* | -cegcc* \
+	      | -chorusos* | -chorusrdb* | -cegcc* | -glidix* \
 	      | -cygwin* | -msys* | -pe* | -psos* | -moss* | -proelf* | -rtems* \
-	      | -mingw32* | -mingw64* | -linux-gnu* | -linux-android* \
+	      | -midipix* | -mingw32* | -mingw64* | -linux-gnu* | -linux-android* \
 	      | -linux-newlib* | -linux-musl* | -linux-uclibc* \
-	      | -uxpv* | -beos* | -mpeix* | -udk* \
+	      | -uxpv* | -beos* | -mpeix* | -udk* | -moxiebox* \
 	      | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \
 	      | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \
 	      | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \
 	      | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \
 	      | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \
 	      | -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \
-	      | -skyos* | -haiku* | -rdos* | -toppers* | -drops* | -es* | -tirtos*)
+	      | -skyos* | -haiku* | -rdos* | -toppers* | -drops* | -es* \
+	      | -onefs* | -tirtos* | -phoenix* | -fuchsia* | -redox*)
 	# Remember, each alternative MUST END IN *, to match a version number.
 		;;
 	-qnx*)
@@ -1512,6 +1549,8 @@
 		;;
 	-nacl*)
 		;;
+	-ios)
+		;;
 	-none)
 		;;
 	*)
@@ -1606,6 +1645,9 @@
 		;;
 	sparc-* | *-sun)
 		os=-sunos4.1.1
+		;;
+	pru-*)
+		os=-elf
 		;;
 	*-be)
 		os=-beos
diff --git a/configure b/configure
--- a/configure
+++ b/configure
@@ -694,19922 +694,27693 @@
 enable_largefile
 with_iconv_includes
 with_iconv_libraries
-'
-      ac_precious_vars='build_alias
-host_alias
-target_alias
-CC
-CFLAGS
-LDFLAGS
-LIBS
-CPPFLAGS
-CPP'
-
-
-# Initialize some variables set by options.
-ac_init_help=
-ac_init_version=false
-ac_unrecognized_opts=
-ac_unrecognized_sep=
-# The variables have the same names as the options, with
-# dashes changed to underlines.
-cache_file=/dev/null
-exec_prefix=NONE
-no_create=
-no_recursion=
-prefix=NONE
-program_prefix=NONE
-program_suffix=NONE
-program_transform_name=s,x,x,
-silent=
-site=
-srcdir=
-verbose=
-x_includes=NONE
-x_libraries=NONE
-
-# Installation directory options.
-# These are left unexpanded so users can "make install exec_prefix=/foo"
-# and all the variables that are supposed to be based on exec_prefix
-# by default will actually change.
-# Use braces instead of parens because sh, perl, etc. also accept them.
-# (The list follows the same order as the GNU Coding Standards.)
-bindir='${exec_prefix}/bin'
-sbindir='${exec_prefix}/sbin'
-libexecdir='${exec_prefix}/libexec'
-datarootdir='${prefix}/share'
-datadir='${datarootdir}'
-sysconfdir='${prefix}/etc'
-sharedstatedir='${prefix}/com'
-localstatedir='${prefix}/var'
-runstatedir='${localstatedir}/run'
-includedir='${prefix}/include'
-oldincludedir='/usr/include'
-docdir='${datarootdir}/doc/${PACKAGE_TARNAME}'
-infodir='${datarootdir}/info'
-htmldir='${docdir}'
-dvidir='${docdir}'
-pdfdir='${docdir}'
-psdir='${docdir}'
-libdir='${exec_prefix}/lib'
-localedir='${datarootdir}/locale'
-mandir='${datarootdir}/man'
-
-ac_prev=
-ac_dashdash=
-for ac_option
-do
-  # If the previous option needs an argument, assign it.
-  if test -n "$ac_prev"; then
-    eval $ac_prev=\$ac_option
-    ac_prev=
-    continue
-  fi
-
-  case $ac_option in
-  *=?*) ac_optarg=`expr "X$ac_option" : '[^=]*=\(.*\)'` ;;
-  *=)   ac_optarg= ;;
-  *)    ac_optarg=yes ;;
-  esac
-
-  # Accept the important Cygnus configure options, so we can diagnose typos.
-
-  case $ac_dashdash$ac_option in
-  --)
-    ac_dashdash=yes ;;
-
-  -bindir | --bindir | --bindi | --bind | --bin | --bi)
-    ac_prev=bindir ;;
-  -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*)
-    bindir=$ac_optarg ;;
-
-  -build | --build | --buil | --bui | --bu)
-    ac_prev=build_alias ;;
-  -build=* | --build=* | --buil=* | --bui=* | --bu=*)
-    build_alias=$ac_optarg ;;
-
-  -cache-file | --cache-file | --cache-fil | --cache-fi \
-  | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c)
-    ac_prev=cache_file ;;
-  -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \
-  | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*)
-    cache_file=$ac_optarg ;;
-
-  --config-cache | -C)
-    cache_file=config.cache ;;
-
-  -datadir | --datadir | --datadi | --datad)
-    ac_prev=datadir ;;
-  -datadir=* | --datadir=* | --datadi=* | --datad=*)
-    datadir=$ac_optarg ;;
-
-  -datarootdir | --datarootdir | --datarootdi | --datarootd | --dataroot \
-  | --dataroo | --dataro | --datar)
-    ac_prev=datarootdir ;;
-  -datarootdir=* | --datarootdir=* | --datarootdi=* | --datarootd=* \
-  | --dataroot=* | --dataroo=* | --dataro=* | --datar=*)
-    datarootdir=$ac_optarg ;;
-
-  -disable-* | --disable-*)
-    ac_useropt=`expr "x$ac_option" : 'x-*disable-\(.*\)'`
-    # Reject names that are not valid shell variable names.
-    expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null &&
-      as_fn_error $? "invalid feature name: $ac_useropt"
-    ac_useropt_orig=$ac_useropt
-    ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'`
-    case $ac_user_opts in
-      *"
-"enable_$ac_useropt"
-"*) ;;
-      *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--disable-$ac_useropt_orig"
-	 ac_unrecognized_sep=', ';;
-    esac
-    eval enable_$ac_useropt=no ;;
-
-  -docdir | --docdir | --docdi | --doc | --do)
-    ac_prev=docdir ;;
-  -docdir=* | --docdir=* | --docdi=* | --doc=* | --do=*)
-    docdir=$ac_optarg ;;
-
-  -dvidir | --dvidir | --dvidi | --dvid | --dvi | --dv)
-    ac_prev=dvidir ;;
-  -dvidir=* | --dvidir=* | --dvidi=* | --dvid=* | --dvi=* | --dv=*)
-    dvidir=$ac_optarg ;;
-
-  -enable-* | --enable-*)
-    ac_useropt=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'`
-    # Reject names that are not valid shell variable names.
-    expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null &&
-      as_fn_error $? "invalid feature name: $ac_useropt"
-    ac_useropt_orig=$ac_useropt
-    ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'`
-    case $ac_user_opts in
-      *"
-"enable_$ac_useropt"
-"*) ;;
-      *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--enable-$ac_useropt_orig"
-	 ac_unrecognized_sep=', ';;
-    esac
-    eval enable_$ac_useropt=\$ac_optarg ;;
-
-  -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \
-  | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \
-  | --exec | --exe | --ex)
-    ac_prev=exec_prefix ;;
-  -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \
-  | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \
-  | --exec=* | --exe=* | --ex=*)
-    exec_prefix=$ac_optarg ;;
-
-  -gas | --gas | --ga | --g)
-    # Obsolete; use --with-gas.
-    with_gas=yes ;;
-
-  -help | --help | --hel | --he | -h)
-    ac_init_help=long ;;
-  -help=r* | --help=r* | --hel=r* | --he=r* | -hr*)
-    ac_init_help=recursive ;;
-  -help=s* | --help=s* | --hel=s* | --he=s* | -hs*)
-    ac_init_help=short ;;
-
-  -host | --host | --hos | --ho)
-    ac_prev=host_alias ;;
-  -host=* | --host=* | --hos=* | --ho=*)
-    host_alias=$ac_optarg ;;
-
-  -htmldir | --htmldir | --htmldi | --htmld | --html | --htm | --ht)
-    ac_prev=htmldir ;;
-  -htmldir=* | --htmldir=* | --htmldi=* | --htmld=* | --html=* | --htm=* \
-  | --ht=*)
-    htmldir=$ac_optarg ;;
-
-  -includedir | --includedir | --includedi | --included | --include \
-  | --includ | --inclu | --incl | --inc)
-    ac_prev=includedir ;;
-  -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \
-  | --includ=* | --inclu=* | --incl=* | --inc=*)
-    includedir=$ac_optarg ;;
-
-  -infodir | --infodir | --infodi | --infod | --info | --inf)
-    ac_prev=infodir ;;
-  -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*)
-    infodir=$ac_optarg ;;
-
-  -libdir | --libdir | --libdi | --libd)
-    ac_prev=libdir ;;
-  -libdir=* | --libdir=* | --libdi=* | --libd=*)
-    libdir=$ac_optarg ;;
-
-  -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \
-  | --libexe | --libex | --libe)
-    ac_prev=libexecdir ;;
-  -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \
-  | --libexe=* | --libex=* | --libe=*)
-    libexecdir=$ac_optarg ;;
-
-  -localedir | --localedir | --localedi | --localed | --locale)
-    ac_prev=localedir ;;
-  -localedir=* | --localedir=* | --localedi=* | --localed=* | --locale=*)
-    localedir=$ac_optarg ;;
-
-  -localstatedir | --localstatedir | --localstatedi | --localstated \
-  | --localstate | --localstat | --localsta | --localst | --locals)
-    ac_prev=localstatedir ;;
-  -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \
-  | --localstate=* | --localstat=* | --localsta=* | --localst=* | --locals=*)
-    localstatedir=$ac_optarg ;;
-
-  -mandir | --mandir | --mandi | --mand | --man | --ma | --m)
-    ac_prev=mandir ;;
-  -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*)
-    mandir=$ac_optarg ;;
-
-  -nfp | --nfp | --nf)
-    # Obsolete; use --without-fp.
-    with_fp=no ;;
-
-  -no-create | --no-create | --no-creat | --no-crea | --no-cre \
-  | --no-cr | --no-c | -n)
-    no_create=yes ;;
-
-  -no-recursion | --no-recursion | --no-recursio | --no-recursi \
-  | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r)
-    no_recursion=yes ;;
-
-  -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \
-  | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \
-  | --oldin | --oldi | --old | --ol | --o)
-    ac_prev=oldincludedir ;;
-  -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \
-  | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \
-  | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*)
-    oldincludedir=$ac_optarg ;;
-
-  -prefix | --prefix | --prefi | --pref | --pre | --pr | --p)
-    ac_prev=prefix ;;
-  -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*)
-    prefix=$ac_optarg ;;
-
-  -program-prefix | --program-prefix | --program-prefi | --program-pref \
-  | --program-pre | --program-pr | --program-p)
-    ac_prev=program_prefix ;;
-  -program-prefix=* | --program-prefix=* | --program-prefi=* \
-  | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*)
-    program_prefix=$ac_optarg ;;
-
-  -program-suffix | --program-suffix | --program-suffi | --program-suff \
-  | --program-suf | --program-su | --program-s)
-    ac_prev=program_suffix ;;
-  -program-suffix=* | --program-suffix=* | --program-suffi=* \
-  | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*)
-    program_suffix=$ac_optarg ;;
-
-  -program-transform-name | --program-transform-name \
-  | --program-transform-nam | --program-transform-na \
-  | --program-transform-n | --program-transform- \
-  | --program-transform | --program-transfor \
-  | --program-transfo | --program-transf \
-  | --program-trans | --program-tran \
-  | --progr-tra | --program-tr | --program-t)
-    ac_prev=program_transform_name ;;
-  -program-transform-name=* | --program-transform-name=* \
-  | --program-transform-nam=* | --program-transform-na=* \
-  | --program-transform-n=* | --program-transform-=* \
-  | --program-transform=* | --program-transfor=* \
-  | --program-transfo=* | --program-transf=* \
-  | --program-trans=* | --program-tran=* \
-  | --progr-tra=* | --program-tr=* | --program-t=*)
-    program_transform_name=$ac_optarg ;;
-
-  -pdfdir | --pdfdir | --pdfdi | --pdfd | --pdf | --pd)
-    ac_prev=pdfdir ;;
-  -pdfdir=* | --pdfdir=* | --pdfdi=* | --pdfd=* | --pdf=* | --pd=*)
-    pdfdir=$ac_optarg ;;
-
-  -psdir | --psdir | --psdi | --psd | --ps)
-    ac_prev=psdir ;;
-  -psdir=* | --psdir=* | --psdi=* | --psd=* | --ps=*)
-    psdir=$ac_optarg ;;
-
-  -q | -quiet | --quiet | --quie | --qui | --qu | --q \
-  | -silent | --silent | --silen | --sile | --sil)
-    silent=yes ;;
-
-  -runstatedir | --runstatedir | --runstatedi | --runstated \
-  | --runstate | --runstat | --runsta | --runst | --runs \
-  | --run | --ru | --r)
-    ac_prev=runstatedir ;;
-  -runstatedir=* | --runstatedir=* | --runstatedi=* | --runstated=* \
-  | --runstate=* | --runstat=* | --runsta=* | --runst=* | --runs=* \
-  | --run=* | --ru=* | --r=*)
-    runstatedir=$ac_optarg ;;
-
-  -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb)
-    ac_prev=sbindir ;;
-  -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \
-  | --sbi=* | --sb=*)
-    sbindir=$ac_optarg ;;
-
-  -sharedstatedir | --sharedstatedir | --sharedstatedi \
-  | --sharedstated | --sharedstate | --sharedstat | --sharedsta \
-  | --sharedst | --shareds | --shared | --share | --shar \
-  | --sha | --sh)
-    ac_prev=sharedstatedir ;;
-  -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \
-  | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \
-  | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \
-  | --sha=* | --sh=*)
-    sharedstatedir=$ac_optarg ;;
-
-  -site | --site | --sit)
-    ac_prev=site ;;
-  -site=* | --site=* | --sit=*)
-    site=$ac_optarg ;;
-
-  -srcdir | --srcdir | --srcdi | --srcd | --src | --sr)
-    ac_prev=srcdir ;;
-  -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*)
-    srcdir=$ac_optarg ;;
-
-  -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \
-  | --syscon | --sysco | --sysc | --sys | --sy)
-    ac_prev=sysconfdir ;;
-  -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \
-  | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*)
-    sysconfdir=$ac_optarg ;;
-
-  -target | --target | --targe | --targ | --tar | --ta | --t)
-    ac_prev=target_alias ;;
-  -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*)
-    target_alias=$ac_optarg ;;
-
-  -v | -verbose | --verbose | --verbos | --verbo | --verb)
-    verbose=yes ;;
-
-  -version | --version | --versio | --versi | --vers | -V)
-    ac_init_version=: ;;
-
-  -with-* | --with-*)
-    ac_useropt=`expr "x$ac_option" : 'x-*with-\([^=]*\)'`
-    # Reject names that are not valid shell variable names.
-    expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null &&
-      as_fn_error $? "invalid package name: $ac_useropt"
-    ac_useropt_orig=$ac_useropt
-    ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'`
-    case $ac_user_opts in
-      *"
-"with_$ac_useropt"
-"*) ;;
-      *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--with-$ac_useropt_orig"
-	 ac_unrecognized_sep=', ';;
-    esac
-    eval with_$ac_useropt=\$ac_optarg ;;
-
-  -without-* | --without-*)
-    ac_useropt=`expr "x$ac_option" : 'x-*without-\(.*\)'`
-    # Reject names that are not valid shell variable names.
-    expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null &&
-      as_fn_error $? "invalid package name: $ac_useropt"
-    ac_useropt_orig=$ac_useropt
-    ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'`
-    case $ac_user_opts in
-      *"
-"with_$ac_useropt"
-"*) ;;
-      *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--without-$ac_useropt_orig"
-	 ac_unrecognized_sep=', ';;
-    esac
-    eval with_$ac_useropt=no ;;
-
-  --x)
-    # Obsolete; use --with-x.
-    with_x=yes ;;
-
-  -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \
-  | --x-incl | --x-inc | --x-in | --x-i)
-    ac_prev=x_includes ;;
-  -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \
-  | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*)
-    x_includes=$ac_optarg ;;
-
-  -x-libraries | --x-libraries | --x-librarie | --x-librari \
-  | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l)
-    ac_prev=x_libraries ;;
-  -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \
-  | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*)
-    x_libraries=$ac_optarg ;;
-
-  -*) as_fn_error $? "unrecognized option: \`$ac_option'
-Try \`$0 --help' for more information"
-    ;;
-
-  *=*)
-    ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='`
-    # Reject names that are not valid shell variable names.
-    case $ac_envvar in #(
-      '' | [0-9]* | *[!_$as_cr_alnum]* )
-      as_fn_error $? "invalid variable name: \`$ac_envvar'" ;;
-    esac
-    eval $ac_envvar=\$ac_optarg
-    export $ac_envvar ;;
-
-  *)
-    # FIXME: should be removed in autoconf 3.0.
-    $as_echo "$as_me: WARNING: you should use --build, --host, --target" >&2
-    expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null &&
-      $as_echo "$as_me: WARNING: invalid host type: $ac_option" >&2
-    : "${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option}"
-    ;;
-
-  esac
-done
-
-if test -n "$ac_prev"; then
-  ac_option=--`echo $ac_prev | sed 's/_/-/g'`
-  as_fn_error $? "missing argument to $ac_option"
-fi
-
-if test -n "$ac_unrecognized_opts"; then
-  case $enable_option_checking in
-    no) ;;
-    fatal) as_fn_error $? "unrecognized options: $ac_unrecognized_opts" ;;
-    *)     $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2 ;;
-  esac
-fi
-
-# Check all directory arguments for consistency.
-for ac_var in	exec_prefix prefix bindir sbindir libexecdir datarootdir \
-		datadir sysconfdir sharedstatedir localstatedir includedir \
-		oldincludedir docdir infodir htmldir dvidir pdfdir psdir \
-		libdir localedir mandir runstatedir
-do
-  eval ac_val=\$$ac_var
-  # Remove trailing slashes.
-  case $ac_val in
-    */ )
-      ac_val=`expr "X$ac_val" : 'X\(.*[^/]\)' \| "X$ac_val" : 'X\(.*\)'`
-      eval $ac_var=\$ac_val;;
-  esac
-  # Be sure to have absolute directory names.
-  case $ac_val in
-    [\\/$]* | ?:[\\/]* )  continue;;
-    NONE | '' ) case $ac_var in *prefix ) continue;; esac;;
-  esac
-  as_fn_error $? "expected an absolute directory name for --$ac_var: $ac_val"
-done
-
-# There might be people who depend on the old broken behavior: `$host'
-# used to hold the argument of --host etc.
-# FIXME: To remove some day.
-build=$build_alias
-host=$host_alias
-target=$target_alias
-
-# FIXME: To remove some day.
-if test "x$host_alias" != x; then
-  if test "x$build_alias" = x; then
-    cross_compiling=maybe
-  elif test "x$build_alias" != "x$host_alias"; then
-    cross_compiling=yes
-  fi
-fi
-
-ac_tool_prefix=
-test -n "$host_alias" && ac_tool_prefix=$host_alias-
-
-test "$silent" = yes && exec 6>/dev/null
-
-
-ac_pwd=`pwd` && test -n "$ac_pwd" &&
-ac_ls_di=`ls -di .` &&
-ac_pwd_ls_di=`cd "$ac_pwd" && ls -di .` ||
-  as_fn_error $? "working directory cannot be determined"
-test "X$ac_ls_di" = "X$ac_pwd_ls_di" ||
-  as_fn_error $? "pwd does not report name of working directory"
-
-
-# Find the source files, if location was not specified.
-if test -z "$srcdir"; then
-  ac_srcdir_defaulted=yes
-  # Try the directory containing this script, then the parent directory.
-  ac_confdir=`$as_dirname -- "$as_myself" ||
-$as_expr X"$as_myself" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
-	 X"$as_myself" : 'X\(//\)[^/]' \| \
-	 X"$as_myself" : 'X\(//\)$' \| \
-	 X"$as_myself" : 'X\(/\)' \| . 2>/dev/null ||
-$as_echo X"$as_myself" |
-    sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
-	    s//\1/
-	    q
-	  }
-	  /^X\(\/\/\)[^/].*/{
-	    s//\1/
-	    q
-	  }
-	  /^X\(\/\/\)$/{
-	    s//\1/
-	    q
-	  }
-	  /^X\(\/\).*/{
-	    s//\1/
-	    q
-	  }
-	  s/.*/./; q'`
-  srcdir=$ac_confdir
-  if test ! -r "$srcdir/$ac_unique_file"; then
-    srcdir=..
-  fi
-else
-  ac_srcdir_defaulted=no
-fi
-if test ! -r "$srcdir/$ac_unique_file"; then
-  test "$ac_srcdir_defaulted" = yes && srcdir="$ac_confdir or .."
-  as_fn_error $? "cannot find sources ($ac_unique_file) in $srcdir"
-fi
-ac_msg="sources are in $srcdir, but \`cd $srcdir' does not work"
-ac_abs_confdir=`(
-	cd "$srcdir" && test -r "./$ac_unique_file" || as_fn_error $? "$ac_msg"
-	pwd)`
-# When building in place, set srcdir=.
-if test "$ac_abs_confdir" = "$ac_pwd"; then
-  srcdir=.
-fi
-# Remove unnecessary trailing slashes from srcdir.
-# Double slashes in file names in object file debugging info
-# mess up M-x gdb in Emacs.
-case $srcdir in
-*/) srcdir=`expr "X$srcdir" : 'X\(.*[^/]\)' \| "X$srcdir" : 'X\(.*\)'`;;
-esac
-for ac_var in $ac_precious_vars; do
-  eval ac_env_${ac_var}_set=\${${ac_var}+set}
-  eval ac_env_${ac_var}_value=\$${ac_var}
-  eval ac_cv_env_${ac_var}_set=\${${ac_var}+set}
-  eval ac_cv_env_${ac_var}_value=\$${ac_var}
-done
-
-#
-# Report the --help message.
-#
-if test "$ac_init_help" = "long"; then
-  # Omit some internal or obsolete options to make the list less imposing.
-  # This message is too long to be a string in the A/UX 3.1 sh.
-  cat <<_ACEOF
-\`configure' configures Haskell base package 1.0 to adapt to many kinds of systems.
-
-Usage: $0 [OPTION]... [VAR=VALUE]...
-
-To assign environment variables (e.g., CC, CFLAGS...), specify them as
-VAR=VALUE.  See below for descriptions of some of the useful variables.
-
-Defaults for the options are specified in brackets.
-
-Configuration:
-  -h, --help              display this help and exit
-      --help=short        display options specific to this package
-      --help=recursive    display the short help of all the included packages
-  -V, --version           display version information and exit
-  -q, --quiet, --silent   do not print \`checking ...' messages
-      --cache-file=FILE   cache test results in FILE [disabled]
-  -C, --config-cache      alias for \`--cache-file=config.cache'
-  -n, --no-create         do not create output files
-      --srcdir=DIR        find the sources in DIR [configure dir or \`..']
-
-Installation directories:
-  --prefix=PREFIX         install architecture-independent files in PREFIX
-                          [$ac_default_prefix]
-  --exec-prefix=EPREFIX   install architecture-dependent files in EPREFIX
-                          [PREFIX]
-
-By default, \`make install' will install all the files in
-\`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc.  You can specify
-an installation prefix other than \`$ac_default_prefix' using \`--prefix',
-for instance \`--prefix=\$HOME'.
-
-For better control, use the options below.
-
-Fine tuning of the installation directories:
-  --bindir=DIR            user executables [EPREFIX/bin]
-  --sbindir=DIR           system admin executables [EPREFIX/sbin]
-  --libexecdir=DIR        program executables [EPREFIX/libexec]
-  --sysconfdir=DIR        read-only single-machine data [PREFIX/etc]
-  --sharedstatedir=DIR    modifiable architecture-independent data [PREFIX/com]
-  --localstatedir=DIR     modifiable single-machine data [PREFIX/var]
-  --runstatedir=DIR       modifiable per-process data [LOCALSTATEDIR/run]
-  --libdir=DIR            object code libraries [EPREFIX/lib]
-  --includedir=DIR        C header files [PREFIX/include]
-  --oldincludedir=DIR     C header files for non-gcc [/usr/include]
-  --datarootdir=DIR       read-only arch.-independent data root [PREFIX/share]
-  --datadir=DIR           read-only architecture-independent data [DATAROOTDIR]
-  --infodir=DIR           info documentation [DATAROOTDIR/info]
-  --localedir=DIR         locale-dependent data [DATAROOTDIR/locale]
-  --mandir=DIR            man documentation [DATAROOTDIR/man]
-  --docdir=DIR            documentation root [DATAROOTDIR/doc/base]
-  --htmldir=DIR           html documentation [DOCDIR]
-  --dvidir=DIR            dvi documentation [DOCDIR]
-  --pdfdir=DIR            pdf documentation [DOCDIR]
-  --psdir=DIR             ps documentation [DOCDIR]
-_ACEOF
-
-  cat <<\_ACEOF
-
-System types:
-  --build=BUILD     configure for building on BUILD [guessed]
-  --host=HOST       cross-compile to build programs to run on HOST [BUILD]
-  --target=TARGET   configure for building compilers for TARGET [HOST]
-_ACEOF
-fi
-
-if test -n "$ac_init_help"; then
-  case $ac_init_help in
-     short | recursive ) echo "Configuration of Haskell base package 1.0:";;
-   esac
-  cat <<\_ACEOF
-
-Optional Features:
-  --disable-option-checking  ignore unrecognized --enable/--with options
-  --disable-FEATURE       do not include FEATURE (same as --enable-FEATURE=no)
-  --enable-FEATURE[=ARG]  include FEATURE [ARG=yes]
-  --disable-largefile     omit support for large files
-
-Optional Packages:
-  --with-PACKAGE[=ARG]    use PACKAGE [ARG=yes]
-  --without-PACKAGE       do not use PACKAGE (same as --with-PACKAGE=no)
-  --with-iconv-includes   directory containing iconv.h
-  --with-iconv-libraries  directory containing iconv library
-
-Some influential environment variables:
-  CC          C compiler command
-  CFLAGS      C compiler flags
-  LDFLAGS     linker flags, e.g. -L<lib dir> if you have libraries in a
-              nonstandard directory <lib dir>
-  LIBS        libraries to pass to the linker, e.g. -l<library>
-  CPPFLAGS    (Objective) C/C++ preprocessor flags, e.g. -I<include dir> if
-              you have headers in a nonstandard directory <include dir>
-  CPP         C preprocessor
-
-Use these variables to override the choices made by `configure' or to help
-it to find libraries and programs with nonstandard names/locations.
-
-Report bugs to <libraries@haskell.org>.
-_ACEOF
-ac_status=$?
-fi
-
-if test "$ac_init_help" = "recursive"; then
-  # If there are subdirs, report their specific --help.
-  for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue
-    test -d "$ac_dir" ||
-      { cd "$srcdir" && ac_pwd=`pwd` && srcdir=. && test -d "$ac_dir"; } ||
-      continue
-    ac_builddir=.
-
-case "$ac_dir" in
-.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;;
-*)
-  ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'`
-  # A ".." for each directory in $ac_dir_suffix.
-  ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'`
-  case $ac_top_builddir_sub in
-  "") ac_top_builddir_sub=. ac_top_build_prefix= ;;
-  *)  ac_top_build_prefix=$ac_top_builddir_sub/ ;;
-  esac ;;
-esac
-ac_abs_top_builddir=$ac_pwd
-ac_abs_builddir=$ac_pwd$ac_dir_suffix
-# for backward compatibility:
-ac_top_builddir=$ac_top_build_prefix
-
-case $srcdir in
-  .)  # We are building in place.
-    ac_srcdir=.
-    ac_top_srcdir=$ac_top_builddir_sub
-    ac_abs_top_srcdir=$ac_pwd ;;
-  [\\/]* | ?:[\\/]* )  # Absolute name.
-    ac_srcdir=$srcdir$ac_dir_suffix;
-    ac_top_srcdir=$srcdir
-    ac_abs_top_srcdir=$srcdir ;;
-  *) # Relative name.
-    ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix
-    ac_top_srcdir=$ac_top_build_prefix$srcdir
-    ac_abs_top_srcdir=$ac_pwd/$srcdir ;;
-esac
-ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix
-
-    cd "$ac_dir" || { ac_status=$?; continue; }
-    # Check for guested configure.
-    if test -f "$ac_srcdir/configure.gnu"; then
-      echo &&
-      $SHELL "$ac_srcdir/configure.gnu" --help=recursive
-    elif test -f "$ac_srcdir/configure"; then
-      echo &&
-      $SHELL "$ac_srcdir/configure" --help=recursive
-    else
-      $as_echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2
-    fi || ac_status=$?
-    cd "$ac_pwd" || { ac_status=$?; break; }
-  done
-fi
-
-test -n "$ac_init_help" && exit $ac_status
-if $ac_init_version; then
-  cat <<\_ACEOF
-Haskell base package configure 1.0
-generated by GNU Autoconf 2.69
-
-Copyright (C) 2012 Free Software Foundation, Inc.
-This configure script is free software; the Free Software Foundation
-gives unlimited permission to copy, distribute and modify it.
-_ACEOF
-  exit
-fi
-
-## ------------------------ ##
-## Autoconf initialization. ##
-## ------------------------ ##
-
-# ac_fn_c_try_compile LINENO
-# --------------------------
-# Try to compile conftest.$ac_ext, and return whether this succeeded.
-ac_fn_c_try_compile ()
-{
-  as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
-  rm -f conftest.$ac_objext
-  if { { ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
-$as_echo "$ac_try_echo"; } >&5
-  (eval "$ac_compile") 2>conftest.err
-  ac_status=$?
-  if test -s conftest.err; then
-    grep -v '^ *+' conftest.err >conftest.er1
-    cat conftest.er1 >&5
-    mv -f conftest.er1 conftest.err
-  fi
-  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
-  test $ac_status = 0; } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then :
-  ac_retval=0
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-	ac_retval=1
-fi
-  eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
-  as_fn_set_status $ac_retval
-
-} # ac_fn_c_try_compile
-
-# ac_fn_c_try_cpp LINENO
-# ----------------------
-# Try to preprocess conftest.$ac_ext, and return whether this succeeded.
-ac_fn_c_try_cpp ()
-{
-  as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
-  if { { ac_try="$ac_cpp conftest.$ac_ext"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
-$as_echo "$ac_try_echo"; } >&5
-  (eval "$ac_cpp conftest.$ac_ext") 2>conftest.err
-  ac_status=$?
-  if test -s conftest.err; then
-    grep -v '^ *+' conftest.err >conftest.er1
-    cat conftest.er1 >&5
-    mv -f conftest.er1 conftest.err
-  fi
-  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
-  test $ac_status = 0; } > conftest.i && {
-	 test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       }; then :
-  ac_retval=0
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-    ac_retval=1
-fi
-  eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
-  as_fn_set_status $ac_retval
-
-} # ac_fn_c_try_cpp
-
-# ac_fn_c_check_header_mongrel LINENO HEADER VAR INCLUDES
-# -------------------------------------------------------
-# Tests whether HEADER exists, giving a warning if it cannot be compiled using
-# the include files in INCLUDES and setting the cache variable VAR
-# accordingly.
-ac_fn_c_check_header_mongrel ()
-{
-  as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
-  if eval \${$3+:} false; then :
-  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
-$as_echo_n "checking for $2... " >&6; }
-if eval \${$3+:} false; then :
-  $as_echo_n "(cached) " >&6
-fi
-eval ac_res=\$$3
-	       { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
-$as_echo "$ac_res" >&6; }
-else
-  # Is the header compilable?
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 usability" >&5
-$as_echo_n "checking $2 usability... " >&6; }
-cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-$4
-#include <$2>
-_ACEOF
-if ac_fn_c_try_compile "$LINENO"; then :
-  ac_header_compiler=yes
-else
-  ac_header_compiler=no
-fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_compiler" >&5
-$as_echo "$ac_header_compiler" >&6; }
-
-# Is the header present?
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 presence" >&5
-$as_echo_n "checking $2 presence... " >&6; }
-cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-#include <$2>
-_ACEOF
-if ac_fn_c_try_cpp "$LINENO"; then :
-  ac_header_preproc=yes
-else
-  ac_header_preproc=no
-fi
-rm -f conftest.err conftest.i conftest.$ac_ext
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_preproc" >&5
-$as_echo "$ac_header_preproc" >&6; }
-
-# So?  What about this header?
-case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in #((
-  yes:no: )
-    { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&5
-$as_echo "$as_me: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&2;}
-    { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5
-$as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;}
-    ;;
-  no:yes:* )
-    { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: present but cannot be compiled" >&5
-$as_echo "$as_me: WARNING: $2: present but cannot be compiled" >&2;}
-    { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2:     check for missing prerequisite headers?" >&5
-$as_echo "$as_me: WARNING: $2:     check for missing prerequisite headers?" >&2;}
-    { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: see the Autoconf documentation" >&5
-$as_echo "$as_me: WARNING: $2: see the Autoconf documentation" >&2;}
-    { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2:     section \"Present But Cannot Be Compiled\"" >&5
-$as_echo "$as_me: WARNING: $2:     section \"Present But Cannot Be Compiled\"" >&2;}
-    { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5
-$as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;}
-( $as_echo "## ------------------------------------ ##
-## Report this to libraries@haskell.org ##
-## ------------------------------------ ##"
-     ) | sed "s/^/$as_me: WARNING:     /" >&2
-    ;;
-esac
-  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
-$as_echo_n "checking for $2... " >&6; }
-if eval \${$3+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  eval "$3=\$ac_header_compiler"
-fi
-eval ac_res=\$$3
-	       { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
-$as_echo "$ac_res" >&6; }
-fi
-  eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
-
-} # ac_fn_c_check_header_mongrel
-
-# ac_fn_c_try_run LINENO
-# ----------------------
-# Try to link conftest.$ac_ext, and return whether this succeeded. Assumes
-# that executables *can* be run.
-ac_fn_c_try_run ()
-{
-  as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
-  if { { ac_try="$ac_link"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
-$as_echo "$ac_try_echo"; } >&5
-  (eval "$ac_link") 2>&5
-  ac_status=$?
-  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
-  test $ac_status = 0; } && { ac_try='./conftest$ac_exeext'
-  { { case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
-$as_echo "$ac_try_echo"; } >&5
-  (eval "$ac_try") 2>&5
-  ac_status=$?
-  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
-  test $ac_status = 0; }; }; then :
-  ac_retval=0
-else
-  $as_echo "$as_me: program exited with status $ac_status" >&5
-       $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       ac_retval=$ac_status
-fi
-  rm -rf conftest.dSYM conftest_ipa8_conftest.oo
-  eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
-  as_fn_set_status $ac_retval
-
-} # ac_fn_c_try_run
-
-# ac_fn_c_check_header_compile LINENO HEADER VAR INCLUDES
-# -------------------------------------------------------
-# Tests whether HEADER exists and can be compiled using the include files in
-# INCLUDES, setting the cache variable VAR accordingly.
-ac_fn_c_check_header_compile ()
-{
-  as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
-  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
-$as_echo_n "checking for $2... " >&6; }
-if eval \${$3+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-$4
-#include <$2>
-_ACEOF
-if ac_fn_c_try_compile "$LINENO"; then :
-  eval "$3=yes"
-else
-  eval "$3=no"
-fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
-eval ac_res=\$$3
-	       { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
-$as_echo "$ac_res" >&6; }
-  eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
-
-} # ac_fn_c_check_header_compile
-
-# ac_fn_c_check_type LINENO TYPE VAR INCLUDES
-# -------------------------------------------
-# Tests whether TYPE exists after having included INCLUDES, setting cache
-# variable VAR accordingly.
-ac_fn_c_check_type ()
-{
-  as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
-  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
-$as_echo_n "checking for $2... " >&6; }
-if eval \${$3+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  eval "$3=no"
-  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-$4
-int
-main ()
-{
-if (sizeof ($2))
-	 return 0;
-  ;
-  return 0;
-}
-_ACEOF
-if ac_fn_c_try_compile "$LINENO"; then :
-  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-$4
-int
-main ()
-{
-if (sizeof (($2)))
-	    return 0;
-  ;
-  return 0;
-}
-_ACEOF
-if ac_fn_c_try_compile "$LINENO"; then :
-
-else
-  eval "$3=yes"
-fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
-eval ac_res=\$$3
-	       { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
-$as_echo "$ac_res" >&6; }
-  eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
-
-} # ac_fn_c_check_type
-
-# ac_fn_c_try_link LINENO
-# -----------------------
-# Try to link conftest.$ac_ext, and return whether this succeeded.
-ac_fn_c_try_link ()
-{
-  as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
-  rm -f conftest.$ac_objext conftest$ac_exeext
-  if { { ac_try="$ac_link"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
-$as_echo "$ac_try_echo"; } >&5
-  (eval "$ac_link") 2>conftest.err
-  ac_status=$?
-  if test -s conftest.err; then
-    grep -v '^ *+' conftest.err >conftest.er1
-    cat conftest.er1 >&5
-    mv -f conftest.er1 conftest.err
-  fi
-  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
-  test $ac_status = 0; } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest$ac_exeext && {
-	 test "$cross_compiling" = yes ||
-	 test -x conftest$ac_exeext
-       }; then :
-  ac_retval=0
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-	ac_retval=1
-fi
-  # Delete the IPA/IPO (Inter Procedural Analysis/Optimization) information
-  # created by the PGI compiler (conftest_ipa8_conftest.oo), as it would
-  # interfere with the next link command; also delete a directory that is
-  # left behind by Apple's compiler.  We do this before executing the actions.
-  rm -rf conftest.dSYM conftest_ipa8_conftest.oo
-  eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
-  as_fn_set_status $ac_retval
-
-} # ac_fn_c_try_link
-
-# ac_fn_c_check_func LINENO FUNC VAR
-# ----------------------------------
-# Tests whether FUNC exists, setting the cache variable VAR accordingly
-ac_fn_c_check_func ()
-{
-  as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
-  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
-$as_echo_n "checking for $2... " >&6; }
-if eval \${$3+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-/* Define $2 to an innocuous variant, in case <limits.h> declares $2.
-   For example, HP-UX 11i <limits.h> declares gettimeofday.  */
-#define $2 innocuous_$2
-
-/* System header to define __stub macros and hopefully few prototypes,
-    which can conflict with char $2 (); below.
-    Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
-    <limits.h> exists even on freestanding compilers.  */
-
-#ifdef __STDC__
-# include <limits.h>
-#else
-# include <assert.h>
-#endif
-
-#undef $2
-
-/* Override any GCC internal prototype to avoid an error.
-   Use char because int might match the return type of a GCC
-   builtin and then its argument prototype would still apply.  */
-#ifdef __cplusplus
-extern "C"
-#endif
-char $2 ();
-/* The GNU C library defines this for functions which it implements
-    to always fail with ENOSYS.  Some functions are actually named
-    something starting with __ and the normal name is an alias.  */
-#if defined __stub_$2 || defined __stub___$2
-choke me
-#endif
-
-int
-main ()
-{
-return $2 ();
-  ;
-  return 0;
-}
-_ACEOF
-if ac_fn_c_try_link "$LINENO"; then :
-  eval "$3=yes"
-else
-  eval "$3=no"
-fi
-rm -f core conftest.err conftest.$ac_objext \
-    conftest$ac_exeext conftest.$ac_ext
-fi
-eval ac_res=\$$3
-	       { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
-$as_echo "$ac_res" >&6; }
-  eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
-
-} # ac_fn_c_check_func
-
-# ac_fn_c_compute_int LINENO EXPR VAR INCLUDES
-# --------------------------------------------
-# Tries to find the compile-time value of EXPR in a program that includes
-# INCLUDES, setting VAR accordingly. Returns whether the value could be
-# computed
-ac_fn_c_compute_int ()
-{
-  as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
-  if test "$cross_compiling" = yes; then
-    # Depending upon the size, compute the lo and hi bounds.
-cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-$4
-int
-main ()
-{
-static int test_array [1 - 2 * !(($2) >= 0)];
-test_array [0] = 0;
-return test_array [0];
-
-  ;
-  return 0;
-}
-_ACEOF
-if ac_fn_c_try_compile "$LINENO"; then :
-  ac_lo=0 ac_mid=0
-  while :; do
-    cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-$4
-int
-main ()
-{
-static int test_array [1 - 2 * !(($2) <= $ac_mid)];
-test_array [0] = 0;
-return test_array [0];
-
-  ;
-  return 0;
-}
-_ACEOF
-if ac_fn_c_try_compile "$LINENO"; then :
-  ac_hi=$ac_mid; break
-else
-  as_fn_arith $ac_mid + 1 && ac_lo=$as_val
-			if test $ac_lo -le $ac_mid; then
-			  ac_lo= ac_hi=
-			  break
-			fi
-			as_fn_arith 2 '*' $ac_mid + 1 && ac_mid=$as_val
-fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-  done
-else
-  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-$4
-int
-main ()
-{
-static int test_array [1 - 2 * !(($2) < 0)];
-test_array [0] = 0;
-return test_array [0];
-
-  ;
-  return 0;
-}
-_ACEOF
-if ac_fn_c_try_compile "$LINENO"; then :
-  ac_hi=-1 ac_mid=-1
-  while :; do
-    cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-$4
-int
-main ()
-{
-static int test_array [1 - 2 * !(($2) >= $ac_mid)];
-test_array [0] = 0;
-return test_array [0];
-
-  ;
-  return 0;
-}
-_ACEOF
-if ac_fn_c_try_compile "$LINENO"; then :
-  ac_lo=$ac_mid; break
-else
-  as_fn_arith '(' $ac_mid ')' - 1 && ac_hi=$as_val
-			if test $ac_mid -le $ac_hi; then
-			  ac_lo= ac_hi=
-			  break
-			fi
-			as_fn_arith 2 '*' $ac_mid && ac_mid=$as_val
-fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-  done
-else
-  ac_lo= ac_hi=
-fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-# Binary search between lo and hi bounds.
-while test "x$ac_lo" != "x$ac_hi"; do
-  as_fn_arith '(' $ac_hi - $ac_lo ')' / 2 + $ac_lo && ac_mid=$as_val
-  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-$4
-int
-main ()
-{
-static int test_array [1 - 2 * !(($2) <= $ac_mid)];
-test_array [0] = 0;
-return test_array [0];
-
-  ;
-  return 0;
-}
-_ACEOF
-if ac_fn_c_try_compile "$LINENO"; then :
-  ac_hi=$ac_mid
-else
-  as_fn_arith '(' $ac_mid ')' + 1 && ac_lo=$as_val
-fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-done
-case $ac_lo in #((
-?*) eval "$3=\$ac_lo"; ac_retval=0 ;;
-'') ac_retval=1 ;;
-esac
-  else
-    cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-$4
-static long int longval () { return $2; }
-static unsigned long int ulongval () { return $2; }
-#include <stdio.h>
-#include <stdlib.h>
-int
-main ()
-{
-
-  FILE *f = fopen ("conftest.val", "w");
-  if (! f)
-    return 1;
-  if (($2) < 0)
-    {
-      long int i = longval ();
-      if (i != ($2))
-	return 1;
-      fprintf (f, "%ld", i);
-    }
-  else
-    {
-      unsigned long int i = ulongval ();
-      if (i != ($2))
-	return 1;
-      fprintf (f, "%lu", i);
-    }
-  /* Do not output a trailing newline, as this causes \r\n confusion
-     on some platforms.  */
-  return ferror (f) || fclose (f) != 0;
-
-  ;
-  return 0;
-}
-_ACEOF
-if ac_fn_c_try_run "$LINENO"; then :
-  echo >>conftest.val; read $3 <conftest.val; ac_retval=0
-else
-  ac_retval=1
-fi
-rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
-  conftest.$ac_objext conftest.beam conftest.$ac_ext
-rm -f conftest.val
-
-  fi
-  eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
-  as_fn_set_status $ac_retval
-
-} # ac_fn_c_compute_int
-cat >config.log <<_ACEOF
-This file contains any messages produced by compilers while
-running configure, to aid debugging if configure makes a mistake.
-
-It was created by Haskell base package $as_me 1.0, which was
-generated by GNU Autoconf 2.69.  Invocation command line was
-
-  $ $0 $@
-
-_ACEOF
-exec 5>>config.log
-{
-cat <<_ASUNAME
-## --------- ##
-## Platform. ##
-## --------- ##
-
-hostname = `(hostname || uname -n) 2>/dev/null | sed 1q`
-uname -m = `(uname -m) 2>/dev/null || echo unknown`
-uname -r = `(uname -r) 2>/dev/null || echo unknown`
-uname -s = `(uname -s) 2>/dev/null || echo unknown`
-uname -v = `(uname -v) 2>/dev/null || echo unknown`
-
-/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown`
-/bin/uname -X     = `(/bin/uname -X) 2>/dev/null     || echo unknown`
-
-/bin/arch              = `(/bin/arch) 2>/dev/null              || echo unknown`
-/usr/bin/arch -k       = `(/usr/bin/arch -k) 2>/dev/null       || echo unknown`
-/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown`
-/usr/bin/hostinfo      = `(/usr/bin/hostinfo) 2>/dev/null      || echo unknown`
-/bin/machine           = `(/bin/machine) 2>/dev/null           || echo unknown`
-/usr/bin/oslevel       = `(/usr/bin/oslevel) 2>/dev/null       || echo unknown`
-/bin/universe          = `(/bin/universe) 2>/dev/null          || echo unknown`
-
-_ASUNAME
-
-as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
-  IFS=$as_save_IFS
-  test -z "$as_dir" && as_dir=.
-    $as_echo "PATH: $as_dir"
-  done
-IFS=$as_save_IFS
-
-} >&5
-
-cat >&5 <<_ACEOF
-
-
-## ----------- ##
-## Core tests. ##
-## ----------- ##
-
-_ACEOF
-
-
-# Keep a trace of the command line.
-# Strip out --no-create and --no-recursion so they do not pile up.
-# Strip out --silent because we don't want to record it for future runs.
-# Also quote any args containing shell meta-characters.
-# Make two passes to allow for proper duplicate-argument suppression.
-ac_configure_args=
-ac_configure_args0=
-ac_configure_args1=
-ac_must_keep_next=false
-for ac_pass in 1 2
-do
-  for ac_arg
-  do
-    case $ac_arg in
-    -no-create | --no-c* | -n | -no-recursion | --no-r*) continue ;;
-    -q | -quiet | --quiet | --quie | --qui | --qu | --q \
-    | -silent | --silent | --silen | --sile | --sil)
-      continue ;;
-    *\'*)
-      ac_arg=`$as_echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;;
-    esac
-    case $ac_pass in
-    1) as_fn_append ac_configure_args0 " '$ac_arg'" ;;
-    2)
-      as_fn_append ac_configure_args1 " '$ac_arg'"
-      if test $ac_must_keep_next = true; then
-	ac_must_keep_next=false # Got value, back to normal.
-      else
-	case $ac_arg in
-	  *=* | --config-cache | -C | -disable-* | --disable-* \
-	  | -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \
-	  | -q | -quiet | --q* | -silent | --sil* | -v | -verb* \
-	  | -with-* | --with-* | -without-* | --without-* | --x)
-	    case "$ac_configure_args0 " in
-	      "$ac_configure_args1"*" '$ac_arg' "* ) continue ;;
-	    esac
-	    ;;
-	  -* ) ac_must_keep_next=true ;;
-	esac
-      fi
-      as_fn_append ac_configure_args " '$ac_arg'"
-      ;;
-    esac
-  done
-done
-{ ac_configure_args0=; unset ac_configure_args0;}
-{ ac_configure_args1=; unset ac_configure_args1;}
-
-# When interrupted or exit'd, cleanup temporary files, and complete
-# config.log.  We remove comments because anyway the quotes in there
-# would cause problems or look ugly.
-# WARNING: Use '\'' to represent an apostrophe within the trap.
-# WARNING: Do not start the trap code with a newline, due to a FreeBSD 4.0 bug.
-trap 'exit_status=$?
-  # Save into config.log some information that might help in debugging.
-  {
-    echo
-
-    $as_echo "## ---------------- ##
-## Cache variables. ##
-## ---------------- ##"
-    echo
-    # The following way of writing the cache mishandles newlines in values,
-(
-  for ac_var in `(set) 2>&1 | sed -n '\''s/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'\''`; do
-    eval ac_val=\$$ac_var
-    case $ac_val in #(
-    *${as_nl}*)
-      case $ac_var in #(
-      *_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5
-$as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;;
-      esac
-      case $ac_var in #(
-      _ | IFS | as_nl) ;; #(
-      BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #(
-      *) { eval $ac_var=; unset $ac_var;} ;;
-      esac ;;
-    esac
-  done
-  (set) 2>&1 |
-    case $as_nl`(ac_space='\'' '\''; set) 2>&1` in #(
-    *${as_nl}ac_space=\ *)
-      sed -n \
-	"s/'\''/'\''\\\\'\'''\''/g;
-	  s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\''\\2'\''/p"
-      ;; #(
-    *)
-      sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p"
-      ;;
-    esac |
-    sort
-)
-    echo
-
-    $as_echo "## ----------------- ##
-## Output variables. ##
-## ----------------- ##"
-    echo
-    for ac_var in $ac_subst_vars
-    do
-      eval ac_val=\$$ac_var
-      case $ac_val in
-      *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;;
-      esac
-      $as_echo "$ac_var='\''$ac_val'\''"
-    done | sort
-    echo
-
-    if test -n "$ac_subst_files"; then
-      $as_echo "## ------------------- ##
-## File substitutions. ##
-## ------------------- ##"
-      echo
-      for ac_var in $ac_subst_files
-      do
-	eval ac_val=\$$ac_var
-	case $ac_val in
-	*\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;;
-	esac
-	$as_echo "$ac_var='\''$ac_val'\''"
-      done | sort
-      echo
-    fi
-
-    if test -s confdefs.h; then
-      $as_echo "## ----------- ##
-## confdefs.h. ##
-## ----------- ##"
-      echo
-      cat confdefs.h
-      echo
-    fi
-    test "$ac_signal" != 0 &&
-      $as_echo "$as_me: caught signal $ac_signal"
-    $as_echo "$as_me: exit $exit_status"
-  } >&5
-  rm -f core *.core core.conftest.* &&
-    rm -f -r conftest* confdefs* conf$$* $ac_clean_files &&
-    exit $exit_status
-' 0
-for ac_signal in 1 2 13 15; do
-  trap 'ac_signal='$ac_signal'; as_fn_exit 1' $ac_signal
-done
-ac_signal=0
-
-# confdefs.h avoids OS command line length limits that DEFS can exceed.
-rm -f -r conftest* confdefs.h
-
-$as_echo "/* confdefs.h */" > confdefs.h
-
-# Predefined preprocessor variables.
-
-cat >>confdefs.h <<_ACEOF
-#define PACKAGE_NAME "$PACKAGE_NAME"
-_ACEOF
-
-cat >>confdefs.h <<_ACEOF
-#define PACKAGE_TARNAME "$PACKAGE_TARNAME"
-_ACEOF
-
-cat >>confdefs.h <<_ACEOF
-#define PACKAGE_VERSION "$PACKAGE_VERSION"
-_ACEOF
-
-cat >>confdefs.h <<_ACEOF
-#define PACKAGE_STRING "$PACKAGE_STRING"
-_ACEOF
-
-cat >>confdefs.h <<_ACEOF
-#define PACKAGE_BUGREPORT "$PACKAGE_BUGREPORT"
-_ACEOF
-
-cat >>confdefs.h <<_ACEOF
-#define PACKAGE_URL "$PACKAGE_URL"
-_ACEOF
-
-
-# Let the site file select an alternate cache file if it wants to.
-# Prefer an explicitly selected file to automatically selected ones.
-ac_site_file1=NONE
-ac_site_file2=NONE
-if test -n "$CONFIG_SITE"; then
-  # We do not want a PATH search for config.site.
-  case $CONFIG_SITE in #((
-    -*)  ac_site_file1=./$CONFIG_SITE;;
-    */*) ac_site_file1=$CONFIG_SITE;;
-    *)   ac_site_file1=./$CONFIG_SITE;;
-  esac
-elif test "x$prefix" != xNONE; then
-  ac_site_file1=$prefix/share/config.site
-  ac_site_file2=$prefix/etc/config.site
-else
-  ac_site_file1=$ac_default_prefix/share/config.site
-  ac_site_file2=$ac_default_prefix/etc/config.site
-fi
-for ac_site_file in "$ac_site_file1" "$ac_site_file2"
-do
-  test "x$ac_site_file" = xNONE && continue
-  if test /dev/null != "$ac_site_file" && test -r "$ac_site_file"; then
-    { $as_echo "$as_me:${as_lineno-$LINENO}: loading site script $ac_site_file" >&5
-$as_echo "$as_me: loading site script $ac_site_file" >&6;}
-    sed 's/^/| /' "$ac_site_file" >&5
-    . "$ac_site_file" \
-      || { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
-$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
-as_fn_error $? "failed to load site script $ac_site_file
-See \`config.log' for more details" "$LINENO" 5; }
-  fi
-done
-
-if test -r "$cache_file"; then
-  # Some versions of bash will fail to source /dev/null (special files
-  # actually), so we avoid doing that.  DJGPP emulates it as a regular file.
-  if test /dev/null != "$cache_file" && test -f "$cache_file"; then
-    { $as_echo "$as_me:${as_lineno-$LINENO}: loading cache $cache_file" >&5
-$as_echo "$as_me: loading cache $cache_file" >&6;}
-    case $cache_file in
-      [\\/]* | ?:[\\/]* ) . "$cache_file";;
-      *)                      . "./$cache_file";;
-    esac
-  fi
-else
-  { $as_echo "$as_me:${as_lineno-$LINENO}: creating cache $cache_file" >&5
-$as_echo "$as_me: creating cache $cache_file" >&6;}
-  >$cache_file
-fi
-
-# Check that the precious variables saved in the cache have kept the same
-# value.
-ac_cache_corrupted=false
-for ac_var in $ac_precious_vars; do
-  eval ac_old_set=\$ac_cv_env_${ac_var}_set
-  eval ac_new_set=\$ac_env_${ac_var}_set
-  eval ac_old_val=\$ac_cv_env_${ac_var}_value
-  eval ac_new_val=\$ac_env_${ac_var}_value
-  case $ac_old_set,$ac_new_set in
-    set,)
-      { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5
-$as_echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;}
-      ac_cache_corrupted=: ;;
-    ,set)
-      { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was not set in the previous run" >&5
-$as_echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;}
-      ac_cache_corrupted=: ;;
-    ,);;
-    *)
-      if test "x$ac_old_val" != "x$ac_new_val"; then
-	# differences in whitespace do not lead to failure.
-	ac_old_val_w=`echo x $ac_old_val`
-	ac_new_val_w=`echo x $ac_new_val`
-	if test "$ac_old_val_w" != "$ac_new_val_w"; then
-	  { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' has changed since the previous run:" >&5
-$as_echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;}
-	  ac_cache_corrupted=:
-	else
-	  { $as_echo "$as_me:${as_lineno-$LINENO}: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&5
-$as_echo "$as_me: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&2;}
-	  eval $ac_var=\$ac_old_val
-	fi
-	{ $as_echo "$as_me:${as_lineno-$LINENO}:   former value:  \`$ac_old_val'" >&5
-$as_echo "$as_me:   former value:  \`$ac_old_val'" >&2;}
-	{ $as_echo "$as_me:${as_lineno-$LINENO}:   current value: \`$ac_new_val'" >&5
-$as_echo "$as_me:   current value: \`$ac_new_val'" >&2;}
-      fi;;
-  esac
-  # Pass precious variables to config.status.
-  if test "$ac_new_set" = set; then
-    case $ac_new_val in
-    *\'*) ac_arg=$ac_var=`$as_echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;;
-    *) ac_arg=$ac_var=$ac_new_val ;;
-    esac
-    case " $ac_configure_args " in
-      *" '$ac_arg' "*) ;; # Avoid dups.  Use of quotes ensures accuracy.
-      *) as_fn_append ac_configure_args " '$ac_arg'" ;;
-    esac
-  fi
-done
-if $ac_cache_corrupted; then
-  { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
-$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
-  { $as_echo "$as_me:${as_lineno-$LINENO}: error: changes in the environment can compromise the build" >&5
-$as_echo "$as_me: error: changes in the environment can compromise the build" >&2;}
-  as_fn_error $? "run \`make distclean' and/or \`rm $cache_file' and start over" "$LINENO" 5
-fi
-## -------------------- ##
-## Main body of script. ##
-## -------------------- ##
-
-ac_ext=c
-ac_cpp='$CPP $CPPFLAGS'
-ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
-ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
-ac_compiler_gnu=$ac_cv_c_compiler_gnu
-
-
-
-# Safety check: Ensure that we are in the correct source directory.
-
-
-ac_config_headers="$ac_config_headers include/HsBaseConfig.h include/EventConfig.h"
-
-
-ac_aux_dir=
-for ac_dir in "$srcdir" "$srcdir/.." "$srcdir/../.."; do
-  if test -f "$ac_dir/install-sh"; then
-    ac_aux_dir=$ac_dir
-    ac_install_sh="$ac_aux_dir/install-sh -c"
-    break
-  elif test -f "$ac_dir/install.sh"; then
-    ac_aux_dir=$ac_dir
-    ac_install_sh="$ac_aux_dir/install.sh -c"
-    break
-  elif test -f "$ac_dir/shtool"; then
-    ac_aux_dir=$ac_dir
-    ac_install_sh="$ac_aux_dir/shtool install -c"
-    break
-  fi
-done
-if test -z "$ac_aux_dir"; then
-  as_fn_error $? "cannot find install-sh, install.sh, or shtool in \"$srcdir\" \"$srcdir/..\" \"$srcdir/../..\"" "$LINENO" 5
-fi
-
-# These three variables are undocumented and unsupported,
-# and are intended to be withdrawn in a future Autoconf release.
-# They can cause serious problems if a builder's source tree is in a directory
-# whose full name contains unusual characters.
-ac_config_guess="$SHELL $ac_aux_dir/config.guess"  # Please don't use this var.
-ac_config_sub="$SHELL $ac_aux_dir/config.sub"  # Please don't use this var.
-ac_configure="$SHELL $ac_aux_dir/configure"  # Please don't use this var.
-
-
-# Make sure we can run config.sub.
-$SHELL "$ac_aux_dir/config.sub" sun4 >/dev/null 2>&1 ||
-  as_fn_error $? "cannot run $SHELL $ac_aux_dir/config.sub" "$LINENO" 5
-
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking build system type" >&5
-$as_echo_n "checking build system type... " >&6; }
-if ${ac_cv_build+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  ac_build_alias=$build_alias
-test "x$ac_build_alias" = x &&
-  ac_build_alias=`$SHELL "$ac_aux_dir/config.guess"`
-test "x$ac_build_alias" = x &&
-  as_fn_error $? "cannot guess build type; you must specify one" "$LINENO" 5
-ac_cv_build=`$SHELL "$ac_aux_dir/config.sub" $ac_build_alias` ||
-  as_fn_error $? "$SHELL $ac_aux_dir/config.sub $ac_build_alias failed" "$LINENO" 5
-
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_build" >&5
-$as_echo "$ac_cv_build" >&6; }
-case $ac_cv_build in
-*-*-*) ;;
-*) as_fn_error $? "invalid value of canonical build" "$LINENO" 5;;
-esac
-build=$ac_cv_build
-ac_save_IFS=$IFS; IFS='-'
-set x $ac_cv_build
-shift
-build_cpu=$1
-build_vendor=$2
-shift; shift
-# Remember, the first character of IFS is used to create $*,
-# except with old shells:
-build_os=$*
-IFS=$ac_save_IFS
-case $build_os in *\ *) build_os=`echo "$build_os" | sed 's/ /-/g'`;; esac
-
-
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking host system type" >&5
-$as_echo_n "checking host system type... " >&6; }
-if ${ac_cv_host+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  if test "x$host_alias" = x; then
-  ac_cv_host=$ac_cv_build
-else
-  ac_cv_host=`$SHELL "$ac_aux_dir/config.sub" $host_alias` ||
-    as_fn_error $? "$SHELL $ac_aux_dir/config.sub $host_alias failed" "$LINENO" 5
-fi
-
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_host" >&5
-$as_echo "$ac_cv_host" >&6; }
-case $ac_cv_host in
-*-*-*) ;;
-*) as_fn_error $? "invalid value of canonical host" "$LINENO" 5;;
-esac
-host=$ac_cv_host
-ac_save_IFS=$IFS; IFS='-'
-set x $ac_cv_host
-shift
-host_cpu=$1
-host_vendor=$2
-shift; shift
-# Remember, the first character of IFS is used to create $*,
-# except with old shells:
-host_os=$*
-IFS=$ac_save_IFS
-case $host_os in *\ *) host_os=`echo "$host_os" | sed 's/ /-/g'`;; esac
-
-
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking target system type" >&5
-$as_echo_n "checking target system type... " >&6; }
-if ${ac_cv_target+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  if test "x$target_alias" = x; then
-  ac_cv_target=$ac_cv_host
-else
-  ac_cv_target=`$SHELL "$ac_aux_dir/config.sub" $target_alias` ||
-    as_fn_error $? "$SHELL $ac_aux_dir/config.sub $target_alias failed" "$LINENO" 5
-fi
-
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_target" >&5
-$as_echo "$ac_cv_target" >&6; }
-case $ac_cv_target in
-*-*-*) ;;
-*) as_fn_error $? "invalid value of canonical target" "$LINENO" 5;;
-esac
-target=$ac_cv_target
-ac_save_IFS=$IFS; IFS='-'
-set x $ac_cv_target
-shift
-target_cpu=$1
-target_vendor=$2
-shift; shift
-# Remember, the first character of IFS is used to create $*,
-# except with old shells:
-target_os=$*
-IFS=$ac_save_IFS
-case $target_os in *\ *) target_os=`echo "$target_os" | sed 's/ /-/g'`;; esac
-
-
-# The aliases save the names the user supplied, while $host etc.
-# will get canonicalized.
-test -n "$target_alias" &&
-  test "$program_prefix$program_suffix$program_transform_name" = \
-    NONENONEs,x,x, &&
-  program_prefix=${target_alias}-
-
-ac_ext=c
-ac_cpp='$CPP $CPPFLAGS'
-ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
-ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
-ac_compiler_gnu=$ac_cv_c_compiler_gnu
-if test -n "$ac_tool_prefix"; then
-  # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args.
-set dummy ${ac_tool_prefix}gcc; ac_word=$2
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_prog_CC+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  if test -n "$CC"; then
-  ac_cv_prog_CC="$CC" # Let the user override the test.
-else
-as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
-  IFS=$as_save_IFS
-  test -z "$as_dir" && as_dir=.
-    for ac_exec_ext in '' $ac_executable_extensions; do
-  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
-    ac_cv_prog_CC="${ac_tool_prefix}gcc"
-    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
-    break 2
-  fi
-done
-  done
-IFS=$as_save_IFS
-
-fi
-fi
-CC=$ac_cv_prog_CC
-if test -n "$CC"; then
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5
-$as_echo "$CC" >&6; }
-else
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-fi
-
-
-fi
-if test -z "$ac_cv_prog_CC"; then
-  ac_ct_CC=$CC
-  # Extract the first word of "gcc", so it can be a program name with args.
-set dummy gcc; ac_word=$2
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_prog_ac_ct_CC+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  if test -n "$ac_ct_CC"; then
-  ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test.
-else
-as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
-  IFS=$as_save_IFS
-  test -z "$as_dir" && as_dir=.
-    for ac_exec_ext in '' $ac_executable_extensions; do
-  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
-    ac_cv_prog_ac_ct_CC="gcc"
-    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
-    break 2
-  fi
-done
-  done
-IFS=$as_save_IFS
-
-fi
-fi
-ac_ct_CC=$ac_cv_prog_ac_ct_CC
-if test -n "$ac_ct_CC"; then
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5
-$as_echo "$ac_ct_CC" >&6; }
-else
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-fi
-
-  if test "x$ac_ct_CC" = x; then
-    CC=""
-  else
-    case $cross_compiling:$ac_tool_warned in
-yes:)
-{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
-$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
-ac_tool_warned=yes ;;
-esac
-    CC=$ac_ct_CC
-  fi
-else
-  CC="$ac_cv_prog_CC"
-fi
-
-if test -z "$CC"; then
-          if test -n "$ac_tool_prefix"; then
-    # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args.
-set dummy ${ac_tool_prefix}cc; ac_word=$2
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_prog_CC+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  if test -n "$CC"; then
-  ac_cv_prog_CC="$CC" # Let the user override the test.
-else
-as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
-  IFS=$as_save_IFS
-  test -z "$as_dir" && as_dir=.
-    for ac_exec_ext in '' $ac_executable_extensions; do
-  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
-    ac_cv_prog_CC="${ac_tool_prefix}cc"
-    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
-    break 2
-  fi
-done
-  done
-IFS=$as_save_IFS
-
-fi
-fi
-CC=$ac_cv_prog_CC
-if test -n "$CC"; then
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5
-$as_echo "$CC" >&6; }
-else
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-fi
-
-
-  fi
-fi
-if test -z "$CC"; then
-  # Extract the first word of "cc", so it can be a program name with args.
-set dummy cc; ac_word=$2
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_prog_CC+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  if test -n "$CC"; then
-  ac_cv_prog_CC="$CC" # Let the user override the test.
-else
-  ac_prog_rejected=no
-as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
-  IFS=$as_save_IFS
-  test -z "$as_dir" && as_dir=.
-    for ac_exec_ext in '' $ac_executable_extensions; do
-  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
-    if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then
-       ac_prog_rejected=yes
-       continue
-     fi
-    ac_cv_prog_CC="cc"
-    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
-    break 2
-  fi
-done
-  done
-IFS=$as_save_IFS
-
-if test $ac_prog_rejected = yes; then
-  # We found a bogon in the path, so make sure we never use it.
-  set dummy $ac_cv_prog_CC
-  shift
-  if test $# != 0; then
-    # We chose a different compiler from the bogus one.
-    # However, it has the same basename, so the bogon will be chosen
-    # first if we set CC to just the basename; use the full file name.
-    shift
-    ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@"
-  fi
-fi
-fi
-fi
-CC=$ac_cv_prog_CC
-if test -n "$CC"; then
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5
-$as_echo "$CC" >&6; }
-else
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-fi
-
-
-fi
-if test -z "$CC"; then
-  if test -n "$ac_tool_prefix"; then
-  for ac_prog in cl.exe
-  do
-    # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args.
-set dummy $ac_tool_prefix$ac_prog; ac_word=$2
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_prog_CC+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  if test -n "$CC"; then
-  ac_cv_prog_CC="$CC" # Let the user override the test.
-else
-as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
-  IFS=$as_save_IFS
-  test -z "$as_dir" && as_dir=.
-    for ac_exec_ext in '' $ac_executable_extensions; do
-  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
-    ac_cv_prog_CC="$ac_tool_prefix$ac_prog"
-    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
-    break 2
-  fi
-done
-  done
-IFS=$as_save_IFS
-
-fi
-fi
-CC=$ac_cv_prog_CC
-if test -n "$CC"; then
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5
-$as_echo "$CC" >&6; }
-else
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-fi
-
-
-    test -n "$CC" && break
-  done
-fi
-if test -z "$CC"; then
-  ac_ct_CC=$CC
-  for ac_prog in cl.exe
-do
-  # Extract the first word of "$ac_prog", so it can be a program name with args.
-set dummy $ac_prog; ac_word=$2
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_prog_ac_ct_CC+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  if test -n "$ac_ct_CC"; then
-  ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test.
-else
-as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
-  IFS=$as_save_IFS
-  test -z "$as_dir" && as_dir=.
-    for ac_exec_ext in '' $ac_executable_extensions; do
-  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
-    ac_cv_prog_ac_ct_CC="$ac_prog"
-    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
-    break 2
-  fi
-done
-  done
-IFS=$as_save_IFS
-
-fi
-fi
-ac_ct_CC=$ac_cv_prog_ac_ct_CC
-if test -n "$ac_ct_CC"; then
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5
-$as_echo "$ac_ct_CC" >&6; }
-else
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-fi
-
-
-  test -n "$ac_ct_CC" && break
-done
-
-  if test "x$ac_ct_CC" = x; then
-    CC=""
-  else
-    case $cross_compiling:$ac_tool_warned in
-yes:)
-{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
-$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
-ac_tool_warned=yes ;;
-esac
-    CC=$ac_ct_CC
-  fi
-fi
-
-fi
-
-
-test -z "$CC" && { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
-$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
-as_fn_error $? "no acceptable C compiler found in \$PATH
-See \`config.log' for more details" "$LINENO" 5; }
-
-# Provide some information about the compiler.
-$as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler version" >&5
-set X $ac_compile
-ac_compiler=$2
-for ac_option in --version -v -V -qversion; do
-  { { ac_try="$ac_compiler $ac_option >&5"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
-$as_echo "$ac_try_echo"; } >&5
-  (eval "$ac_compiler $ac_option >&5") 2>conftest.err
-  ac_status=$?
-  if test -s conftest.err; then
-    sed '10a\
-... rest of stderr output deleted ...
-         10q' conftest.err >conftest.er1
-    cat conftest.er1 >&5
-  fi
-  rm -f conftest.er1 conftest.err
-  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
-  test $ac_status = 0; }
-done
-
-cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-
-int
-main ()
-{
-
-  ;
-  return 0;
-}
-_ACEOF
-ac_clean_files_save=$ac_clean_files
-ac_clean_files="$ac_clean_files a.out a.out.dSYM a.exe b.out"
-# Try to create an executable without -o first, disregard a.out.
-# It will help us diagnose broken compilers, and finding out an intuition
-# of exeext.
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the C compiler works" >&5
-$as_echo_n "checking whether the C compiler works... " >&6; }
-ac_link_default=`$as_echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'`
-
-# The possible output files:
-ac_files="a.out conftest.exe conftest a.exe a_out.exe b.out conftest.*"
-
-ac_rmfiles=
-for ac_file in $ac_files
-do
-  case $ac_file in
-    *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;;
-    * ) ac_rmfiles="$ac_rmfiles $ac_file";;
-  esac
-done
-rm -f $ac_rmfiles
-
-if { { ac_try="$ac_link_default"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
-$as_echo "$ac_try_echo"; } >&5
-  (eval "$ac_link_default") 2>&5
-  ac_status=$?
-  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
-  test $ac_status = 0; }; then :
-  # Autoconf-2.13 could set the ac_cv_exeext variable to `no'.
-# So ignore a value of `no', otherwise this would lead to `EXEEXT = no'
-# in a Makefile.  We should not override ac_cv_exeext if it was cached,
-# so that the user can short-circuit this test for compilers unknown to
-# Autoconf.
-for ac_file in $ac_files ''
-do
-  test -f "$ac_file" || continue
-  case $ac_file in
-    *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj )
-	;;
-    [ab].out )
-	# We found the default executable, but exeext='' is most
-	# certainly right.
-	break;;
-    *.* )
-	if test "${ac_cv_exeext+set}" = set && test "$ac_cv_exeext" != no;
-	then :; else
-	   ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'`
-	fi
-	# We set ac_cv_exeext here because the later test for it is not
-	# safe: cross compilers may not add the suffix if given an `-o'
-	# argument, so we may need to know it at that point already.
-	# Even if this section looks crufty: it has the advantage of
-	# actually working.
-	break;;
-    * )
-	break;;
-  esac
-done
-test "$ac_cv_exeext" = no && ac_cv_exeext=
-
-else
-  ac_file=''
-fi
-if test -z "$ac_file"; then :
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-$as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
-$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
-as_fn_error 77 "C compiler cannot create executables
-See \`config.log' for more details" "$LINENO" 5; }
-else
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
-$as_echo "yes" >&6; }
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler default output file name" >&5
-$as_echo_n "checking for C compiler default output file name... " >&6; }
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_file" >&5
-$as_echo "$ac_file" >&6; }
-ac_exeext=$ac_cv_exeext
-
-rm -f -r a.out a.out.dSYM a.exe conftest$ac_cv_exeext b.out
-ac_clean_files=$ac_clean_files_save
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of executables" >&5
-$as_echo_n "checking for suffix of executables... " >&6; }
-if { { ac_try="$ac_link"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
-$as_echo "$ac_try_echo"; } >&5
-  (eval "$ac_link") 2>&5
-  ac_status=$?
-  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
-  test $ac_status = 0; }; then :
-  # If both `conftest.exe' and `conftest' are `present' (well, observable)
-# catch `conftest.exe'.  For instance with Cygwin, `ls conftest' will
-# work properly (i.e., refer to `conftest.exe'), while it won't with
-# `rm'.
-for ac_file in conftest.exe conftest conftest.*; do
-  test -f "$ac_file" || continue
-  case $ac_file in
-    *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;;
-    *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'`
-	  break;;
-    * ) break;;
-  esac
-done
-else
-  { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
-$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
-as_fn_error $? "cannot compute suffix of executables: cannot compile and link
-See \`config.log' for more details" "$LINENO" 5; }
-fi
-rm -f conftest conftest$ac_cv_exeext
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_exeext" >&5
-$as_echo "$ac_cv_exeext" >&6; }
-
-rm -f conftest.$ac_ext
-EXEEXT=$ac_cv_exeext
-ac_exeext=$EXEEXT
-cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-#include <stdio.h>
-int
-main ()
-{
-FILE *f = fopen ("conftest.out", "w");
- return ferror (f) || fclose (f) != 0;
-
-  ;
-  return 0;
-}
-_ACEOF
-ac_clean_files="$ac_clean_files conftest.out"
-# Check that the compiler produces executables we can run.  If not, either
-# the compiler is broken, or we cross compile.
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are cross compiling" >&5
-$as_echo_n "checking whether we are cross compiling... " >&6; }
-if test "$cross_compiling" != yes; then
-  { { ac_try="$ac_link"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
-$as_echo "$ac_try_echo"; } >&5
-  (eval "$ac_link") 2>&5
-  ac_status=$?
-  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
-  test $ac_status = 0; }
-  if { ac_try='./conftest$ac_cv_exeext'
-  { { case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
-$as_echo "$ac_try_echo"; } >&5
-  (eval "$ac_try") 2>&5
-  ac_status=$?
-  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
-  test $ac_status = 0; }; }; then
-    cross_compiling=no
-  else
-    if test "$cross_compiling" = maybe; then
-	cross_compiling=yes
-    else
-	{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
-$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
-as_fn_error $? "cannot run C compiled programs.
-If you meant to cross compile, use \`--host'.
-See \`config.log' for more details" "$LINENO" 5; }
-    fi
-  fi
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $cross_compiling" >&5
-$as_echo "$cross_compiling" >&6; }
-
-rm -f conftest.$ac_ext conftest$ac_cv_exeext conftest.out
-ac_clean_files=$ac_clean_files_save
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of object files" >&5
-$as_echo_n "checking for suffix of object files... " >&6; }
-if ${ac_cv_objext+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-
-int
-main ()
-{
-
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.o conftest.obj
-if { { ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
-$as_echo "$ac_try_echo"; } >&5
-  (eval "$ac_compile") 2>&5
-  ac_status=$?
-  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
-  test $ac_status = 0; }; then :
-  for ac_file in conftest.o conftest.obj conftest.*; do
-  test -f "$ac_file" || continue;
-  case $ac_file in
-    *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM ) ;;
-    *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'`
-       break;;
-  esac
-done
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
-$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
-as_fn_error $? "cannot compute suffix of object files: cannot compile
-See \`config.log' for more details" "$LINENO" 5; }
-fi
-rm -f conftest.$ac_cv_objext conftest.$ac_ext
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_objext" >&5
-$as_echo "$ac_cv_objext" >&6; }
-OBJEXT=$ac_cv_objext
-ac_objext=$OBJEXT
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU C compiler" >&5
-$as_echo_n "checking whether we are using the GNU C compiler... " >&6; }
-if ${ac_cv_c_compiler_gnu+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-
-int
-main ()
-{
-#ifndef __GNUC__
-       choke me
-#endif
-
-  ;
-  return 0;
-}
-_ACEOF
-if ac_fn_c_try_compile "$LINENO"; then :
-  ac_compiler_gnu=yes
-else
-  ac_compiler_gnu=no
-fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-ac_cv_c_compiler_gnu=$ac_compiler_gnu
-
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_compiler_gnu" >&5
-$as_echo "$ac_cv_c_compiler_gnu" >&6; }
-if test $ac_compiler_gnu = yes; then
-  GCC=yes
-else
-  GCC=
-fi
-ac_test_CFLAGS=${CFLAGS+set}
-ac_save_CFLAGS=$CFLAGS
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC accepts -g" >&5
-$as_echo_n "checking whether $CC accepts -g... " >&6; }
-if ${ac_cv_prog_cc_g+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  ac_save_c_werror_flag=$ac_c_werror_flag
-   ac_c_werror_flag=yes
-   ac_cv_prog_cc_g=no
-   CFLAGS="-g"
-   cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-
-int
-main ()
-{
-
-  ;
-  return 0;
-}
-_ACEOF
-if ac_fn_c_try_compile "$LINENO"; then :
-  ac_cv_prog_cc_g=yes
-else
-  CFLAGS=""
-      cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-
-int
-main ()
-{
-
-  ;
-  return 0;
-}
-_ACEOF
-if ac_fn_c_try_compile "$LINENO"; then :
-
-else
-  ac_c_werror_flag=$ac_save_c_werror_flag
-	 CFLAGS="-g"
-	 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-
-int
-main ()
-{
-
-  ;
-  return 0;
-}
-_ACEOF
-if ac_fn_c_try_compile "$LINENO"; then :
-  ac_cv_prog_cc_g=yes
-fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-   ac_c_werror_flag=$ac_save_c_werror_flag
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_g" >&5
-$as_echo "$ac_cv_prog_cc_g" >&6; }
-if test "$ac_test_CFLAGS" = set; then
-  CFLAGS=$ac_save_CFLAGS
-elif test $ac_cv_prog_cc_g = yes; then
-  if test "$GCC" = yes; then
-    CFLAGS="-g -O2"
-  else
-    CFLAGS="-g"
-  fi
-else
-  if test "$GCC" = yes; then
-    CFLAGS="-O2"
-  else
-    CFLAGS=
-  fi
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CC option to accept ISO C89" >&5
-$as_echo_n "checking for $CC option to accept ISO C89... " >&6; }
-if ${ac_cv_prog_cc_c89+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  ac_cv_prog_cc_c89=no
-ac_save_CC=$CC
-cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-#include <stdarg.h>
-#include <stdio.h>
-struct stat;
-/* Most of the following tests are stolen from RCS 5.7's src/conf.sh.  */
-struct buf { int x; };
-FILE * (*rcsopen) (struct buf *, struct stat *, int);
-static char *e (p, i)
-     char **p;
-     int i;
-{
-  return p[i];
-}
-static char *f (char * (*g) (char **, int), char **p, ...)
-{
-  char *s;
-  va_list v;
-  va_start (v,p);
-  s = g (p, va_arg (v,int));
-  va_end (v);
-  return s;
-}
-
-/* OSF 4.0 Compaq cc is some sort of almost-ANSI by default.  It has
-   function prototypes and stuff, but not '\xHH' hex character constants.
-   These don't provoke an error unfortunately, instead are silently treated
-   as 'x'.  The following induces an error, until -std is added to get
-   proper ANSI mode.  Curiously '\x00'!='x' always comes out true, for an
-   array size at least.  It's necessary to write '\x00'==0 to get something
-   that's true only with -std.  */
-int osf4_cc_array ['\x00' == 0 ? 1 : -1];
-
-/* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters
-   inside strings and character constants.  */
-#define FOO(x) 'x'
-int xlc6_cc_array[FOO(a) == 'x' ? 1 : -1];
-
-int test (int i, double x);
-struct s1 {int (*f) (int a);};
-struct s2 {int (*f) (double a);};
-int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int);
-int argc;
-char **argv;
-int
-main ()
-{
-return f (e, argv, 0) != argv[0]  ||  f (e, argv, 1) != argv[1];
-  ;
-  return 0;
-}
-_ACEOF
-for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std \
-	-Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__"
-do
-  CC="$ac_save_CC $ac_arg"
-  if ac_fn_c_try_compile "$LINENO"; then :
-  ac_cv_prog_cc_c89=$ac_arg
-fi
-rm -f core conftest.err conftest.$ac_objext
-  test "x$ac_cv_prog_cc_c89" != "xno" && break
-done
-rm -f conftest.$ac_ext
-CC=$ac_save_CC
-
-fi
-# AC_CACHE_VAL
-case "x$ac_cv_prog_cc_c89" in
-  x)
-    { $as_echo "$as_me:${as_lineno-$LINENO}: result: none needed" >&5
-$as_echo "none needed" >&6; } ;;
-  xno)
-    { $as_echo "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5
-$as_echo "unsupported" >&6; } ;;
-  *)
-    CC="$CC $ac_cv_prog_cc_c89"
-    { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c89" >&5
-$as_echo "$ac_cv_prog_cc_c89" >&6; } ;;
-esac
-if test "x$ac_cv_prog_cc_c89" != xno; then :
-
-fi
-
-ac_ext=c
-ac_cpp='$CPP $CPPFLAGS'
-ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
-ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
-ac_compiler_gnu=$ac_cv_c_compiler_gnu
-
-
-ac_ext=c
-ac_cpp='$CPP $CPPFLAGS'
-ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
-ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
-ac_compiler_gnu=$ac_cv_c_compiler_gnu
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to run the C preprocessor" >&5
-$as_echo_n "checking how to run the C preprocessor... " >&6; }
-# On Suns, sometimes $CPP names a directory.
-if test -n "$CPP" && test -d "$CPP"; then
-  CPP=
-fi
-if test -z "$CPP"; then
-  if ${ac_cv_prog_CPP+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-      # Double quotes because CPP needs to be expanded
-    for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp"
-    do
-      ac_preproc_ok=false
-for ac_c_preproc_warn_flag in '' yes
-do
-  # Use a header file that comes with gcc, so configuring glibc
-  # with a fresh cross-compiler works.
-  # Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
-  # <limits.h> exists even on freestanding compilers.
-  # On the NeXT, cc -E runs the code through the compiler's parser,
-  # not just through cpp. "Syntax error" is here to catch this case.
-  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-#ifdef __STDC__
-# include <limits.h>
-#else
-# include <assert.h>
-#endif
-		     Syntax error
-_ACEOF
-if ac_fn_c_try_cpp "$LINENO"; then :
-
-else
-  # Broken: fails on valid input.
-continue
-fi
-rm -f conftest.err conftest.i conftest.$ac_ext
-
-  # OK, works on sane cases.  Now check whether nonexistent headers
-  # can be detected and how.
-  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-#include <ac_nonexistent.h>
-_ACEOF
-if ac_fn_c_try_cpp "$LINENO"; then :
-  # Broken: success on invalid input.
-continue
-else
-  # Passes both tests.
-ac_preproc_ok=:
-break
-fi
-rm -f conftest.err conftest.i conftest.$ac_ext
-
-done
-# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped.
-rm -f conftest.i conftest.err conftest.$ac_ext
-if $ac_preproc_ok; then :
-  break
-fi
-
-    done
-    ac_cv_prog_CPP=$CPP
-
-fi
-  CPP=$ac_cv_prog_CPP
-else
-  ac_cv_prog_CPP=$CPP
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $CPP" >&5
-$as_echo "$CPP" >&6; }
-ac_preproc_ok=false
-for ac_c_preproc_warn_flag in '' yes
-do
-  # Use a header file that comes with gcc, so configuring glibc
-  # with a fresh cross-compiler works.
-  # Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
-  # <limits.h> exists even on freestanding compilers.
-  # On the NeXT, cc -E runs the code through the compiler's parser,
-  # not just through cpp. "Syntax error" is here to catch this case.
-  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-#ifdef __STDC__
-# include <limits.h>
-#else
-# include <assert.h>
-#endif
-		     Syntax error
-_ACEOF
-if ac_fn_c_try_cpp "$LINENO"; then :
-
-else
-  # Broken: fails on valid input.
-continue
-fi
-rm -f conftest.err conftest.i conftest.$ac_ext
-
-  # OK, works on sane cases.  Now check whether nonexistent headers
-  # can be detected and how.
-  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-#include <ac_nonexistent.h>
-_ACEOF
-if ac_fn_c_try_cpp "$LINENO"; then :
-  # Broken: success on invalid input.
-continue
-else
-  # Passes both tests.
-ac_preproc_ok=:
-break
-fi
-rm -f conftest.err conftest.i conftest.$ac_ext
-
-done
-# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped.
-rm -f conftest.i conftest.err conftest.$ac_ext
-if $ac_preproc_ok; then :
-
-else
-  { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
-$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
-as_fn_error $? "C preprocessor \"$CPP\" fails sanity check
-See \`config.log' for more details" "$LINENO" 5; }
-fi
-
-ac_ext=c
-ac_cpp='$CPP $CPPFLAGS'
-ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
-ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
-ac_compiler_gnu=$ac_cv_c_compiler_gnu
-
-
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for grep that handles long lines and -e" >&5
-$as_echo_n "checking for grep that handles long lines and -e... " >&6; }
-if ${ac_cv_path_GREP+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  if test -z "$GREP"; then
-  ac_path_GREP_found=false
-  # Loop through the user's path and test for each of PROGNAME-LIST
-  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin
-do
-  IFS=$as_save_IFS
-  test -z "$as_dir" && as_dir=.
-    for ac_prog in grep ggrep; do
-    for ac_exec_ext in '' $ac_executable_extensions; do
-      ac_path_GREP="$as_dir/$ac_prog$ac_exec_ext"
-      as_fn_executable_p "$ac_path_GREP" || continue
-# Check for GNU ac_path_GREP and select it if it is found.
-  # Check for GNU $ac_path_GREP
-case `"$ac_path_GREP" --version 2>&1` in
-*GNU*)
-  ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_found=:;;
-*)
-  ac_count=0
-  $as_echo_n 0123456789 >"conftest.in"
-  while :
-  do
-    cat "conftest.in" "conftest.in" >"conftest.tmp"
-    mv "conftest.tmp" "conftest.in"
-    cp "conftest.in" "conftest.nl"
-    $as_echo 'GREP' >> "conftest.nl"
-    "$ac_path_GREP" -e 'GREP$' -e '-(cannot match)-' < "conftest.nl" >"conftest.out" 2>/dev/null || break
-    diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break
-    as_fn_arith $ac_count + 1 && ac_count=$as_val
-    if test $ac_count -gt ${ac_path_GREP_max-0}; then
-      # Best one so far, save it but keep looking for a better one
-      ac_cv_path_GREP="$ac_path_GREP"
-      ac_path_GREP_max=$ac_count
-    fi
-    # 10*(2^10) chars as input seems more than enough
-    test $ac_count -gt 10 && break
-  done
-  rm -f conftest.in conftest.tmp conftest.nl conftest.out;;
-esac
-
-      $ac_path_GREP_found && break 3
-    done
-  done
-  done
-IFS=$as_save_IFS
-  if test -z "$ac_cv_path_GREP"; then
-    as_fn_error $? "no acceptable grep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5
-  fi
-else
-  ac_cv_path_GREP=$GREP
-fi
-
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_GREP" >&5
-$as_echo "$ac_cv_path_GREP" >&6; }
- GREP="$ac_cv_path_GREP"
-
-
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for egrep" >&5
-$as_echo_n "checking for egrep... " >&6; }
-if ${ac_cv_path_EGREP+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  if echo a | $GREP -E '(a|b)' >/dev/null 2>&1
-   then ac_cv_path_EGREP="$GREP -E"
-   else
-     if test -z "$EGREP"; then
-  ac_path_EGREP_found=false
-  # Loop through the user's path and test for each of PROGNAME-LIST
-  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin
-do
-  IFS=$as_save_IFS
-  test -z "$as_dir" && as_dir=.
-    for ac_prog in egrep; do
-    for ac_exec_ext in '' $ac_executable_extensions; do
-      ac_path_EGREP="$as_dir/$ac_prog$ac_exec_ext"
-      as_fn_executable_p "$ac_path_EGREP" || continue
-# Check for GNU ac_path_EGREP and select it if it is found.
-  # Check for GNU $ac_path_EGREP
-case `"$ac_path_EGREP" --version 2>&1` in
-*GNU*)
-  ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_found=:;;
-*)
-  ac_count=0
-  $as_echo_n 0123456789 >"conftest.in"
-  while :
-  do
-    cat "conftest.in" "conftest.in" >"conftest.tmp"
-    mv "conftest.tmp" "conftest.in"
-    cp "conftest.in" "conftest.nl"
-    $as_echo 'EGREP' >> "conftest.nl"
-    "$ac_path_EGREP" 'EGREP$' < "conftest.nl" >"conftest.out" 2>/dev/null || break
-    diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break
-    as_fn_arith $ac_count + 1 && ac_count=$as_val
-    if test $ac_count -gt ${ac_path_EGREP_max-0}; then
-      # Best one so far, save it but keep looking for a better one
-      ac_cv_path_EGREP="$ac_path_EGREP"
-      ac_path_EGREP_max=$ac_count
-    fi
-    # 10*(2^10) chars as input seems more than enough
-    test $ac_count -gt 10 && break
-  done
-  rm -f conftest.in conftest.tmp conftest.nl conftest.out;;
-esac
-
-      $ac_path_EGREP_found && break 3
-    done
-  done
-  done
-IFS=$as_save_IFS
-  if test -z "$ac_cv_path_EGREP"; then
-    as_fn_error $? "no acceptable egrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5
-  fi
-else
-  ac_cv_path_EGREP=$EGREP
-fi
-
-   fi
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_EGREP" >&5
-$as_echo "$ac_cv_path_EGREP" >&6; }
- EGREP="$ac_cv_path_EGREP"
-
-
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ANSI C header files" >&5
-$as_echo_n "checking for ANSI C header files... " >&6; }
-if ${ac_cv_header_stdc+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-#include <stdlib.h>
-#include <stdarg.h>
-#include <string.h>
-#include <float.h>
-
-int
-main ()
-{
-
-  ;
-  return 0;
-}
-_ACEOF
-if ac_fn_c_try_compile "$LINENO"; then :
-  ac_cv_header_stdc=yes
-else
-  ac_cv_header_stdc=no
-fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-
-if test $ac_cv_header_stdc = yes; then
-  # SunOS 4.x string.h does not declare mem*, contrary to ANSI.
-  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-#include <string.h>
-
-_ACEOF
-if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
-  $EGREP "memchr" >/dev/null 2>&1; then :
-
-else
-  ac_cv_header_stdc=no
-fi
-rm -f conftest*
-
-fi
-
-if test $ac_cv_header_stdc = yes; then
-  # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI.
-  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-#include <stdlib.h>
-
-_ACEOF
-if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
-  $EGREP "free" >/dev/null 2>&1; then :
-
-else
-  ac_cv_header_stdc=no
-fi
-rm -f conftest*
-
-fi
-
-if test $ac_cv_header_stdc = yes; then
-  # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi.
-  if test "$cross_compiling" = yes; then :
-  :
-else
-  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-#include <ctype.h>
-#include <stdlib.h>
-#if ((' ' & 0x0FF) == 0x020)
-# define ISLOWER(c) ('a' <= (c) && (c) <= 'z')
-# define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c))
-#else
-# define ISLOWER(c) \
-		   (('a' <= (c) && (c) <= 'i') \
-		     || ('j' <= (c) && (c) <= 'r') \
-		     || ('s' <= (c) && (c) <= 'z'))
-# define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c))
-#endif
-
-#define XOR(e, f) (((e) && !(f)) || (!(e) && (f)))
-int
-main ()
-{
-  int i;
-  for (i = 0; i < 256; i++)
-    if (XOR (islower (i), ISLOWER (i))
-	|| toupper (i) != TOUPPER (i))
-      return 2;
-  return 0;
-}
-_ACEOF
-if ac_fn_c_try_run "$LINENO"; then :
-
-else
-  ac_cv_header_stdc=no
-fi
-rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
-  conftest.$ac_objext conftest.beam conftest.$ac_ext
-fi
-
-fi
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_stdc" >&5
-$as_echo "$ac_cv_header_stdc" >&6; }
-if test $ac_cv_header_stdc = yes; then
-
-$as_echo "#define STDC_HEADERS 1" >>confdefs.h
-
-fi
-
-# On IRIX 5.3, sys/types and inttypes.h are conflicting.
-for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \
-		  inttypes.h stdint.h unistd.h
-do :
-  as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
-ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default
-"
-if eval test \"x\$"$as_ac_Header"\" = x"yes"; then :
-  cat >>confdefs.h <<_ACEOF
-#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1
-_ACEOF
-
-fi
-
-done
-
-
-
-  ac_fn_c_check_header_mongrel "$LINENO" "minix/config.h" "ac_cv_header_minix_config_h" "$ac_includes_default"
-if test "x$ac_cv_header_minix_config_h" = xyes; then :
-  MINIX=yes
-else
-  MINIX=
-fi
-
-
-  if test "$MINIX" = yes; then
-
-$as_echo "#define _POSIX_SOURCE 1" >>confdefs.h
-
-
-$as_echo "#define _POSIX_1_SOURCE 2" >>confdefs.h
-
-
-$as_echo "#define _MINIX 1" >>confdefs.h
-
-  fi
-
-
-  { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether it is safe to define __EXTENSIONS__" >&5
-$as_echo_n "checking whether it is safe to define __EXTENSIONS__... " >&6; }
-if ${ac_cv_safe_to_define___extensions__+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-
-#         define __EXTENSIONS__ 1
-          $ac_includes_default
-int
-main ()
-{
-
-  ;
-  return 0;
-}
-_ACEOF
-if ac_fn_c_try_compile "$LINENO"; then :
-  ac_cv_safe_to_define___extensions__=yes
-else
-  ac_cv_safe_to_define___extensions__=no
-fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_safe_to_define___extensions__" >&5
-$as_echo "$ac_cv_safe_to_define___extensions__" >&6; }
-  test $ac_cv_safe_to_define___extensions__ = yes &&
-    $as_echo "#define __EXTENSIONS__ 1" >>confdefs.h
-
-  $as_echo "#define _ALL_SOURCE 1" >>confdefs.h
-
-  $as_echo "#define _GNU_SOURCE 1" >>confdefs.h
-
-  $as_echo "#define _POSIX_PTHREAD_SEMANTICS 1" >>confdefs.h
-
-  $as_echo "#define _TANDEM_SOURCE 1" >>confdefs.h
-
-
-
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for WINDOWS platform" >&5
-$as_echo_n "checking for WINDOWS platform... " >&6; }
-case $host in
-    *mingw32*|*mingw64*|*cygwin*|*msys*)
-        WINDOWS=YES;;
-    *)
-        WINDOWS=NO;;
-esac
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $WINDOWS" >&5
-$as_echo "$WINDOWS" >&6; }
-
-# do we have long longs?
-ac_fn_c_check_type "$LINENO" "long long" "ac_cv_type_long_long" "$ac_includes_default"
-if test "x$ac_cv_type_long_long" = xyes; then :
-
-cat >>confdefs.h <<_ACEOF
-#define HAVE_LONG_LONG 1
-_ACEOF
-
-
-fi
-
-
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ANSI C header files" >&5
-$as_echo_n "checking for ANSI C header files... " >&6; }
-if ${ac_cv_header_stdc+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-#include <stdlib.h>
-#include <stdarg.h>
-#include <string.h>
-#include <float.h>
-
-int
-main ()
-{
-
-  ;
-  return 0;
-}
-_ACEOF
-if ac_fn_c_try_compile "$LINENO"; then :
-  ac_cv_header_stdc=yes
-else
-  ac_cv_header_stdc=no
-fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-
-if test $ac_cv_header_stdc = yes; then
-  # SunOS 4.x string.h does not declare mem*, contrary to ANSI.
-  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-#include <string.h>
-
-_ACEOF
-if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
-  $EGREP "memchr" >/dev/null 2>&1; then :
-
-else
-  ac_cv_header_stdc=no
-fi
-rm -f conftest*
-
-fi
-
-if test $ac_cv_header_stdc = yes; then
-  # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI.
-  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-#include <stdlib.h>
-
-_ACEOF
-if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
-  $EGREP "free" >/dev/null 2>&1; then :
-
-else
-  ac_cv_header_stdc=no
-fi
-rm -f conftest*
-
-fi
-
-if test $ac_cv_header_stdc = yes; then
-  # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi.
-  if test "$cross_compiling" = yes; then :
-  :
-else
-  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-#include <ctype.h>
-#include <stdlib.h>
-#if ((' ' & 0x0FF) == 0x020)
-# define ISLOWER(c) ('a' <= (c) && (c) <= 'z')
-# define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c))
-#else
-# define ISLOWER(c) \
-		   (('a' <= (c) && (c) <= 'i') \
-		     || ('j' <= (c) && (c) <= 'r') \
-		     || ('s' <= (c) && (c) <= 'z'))
-# define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c))
-#endif
-
-#define XOR(e, f) (((e) && !(f)) || (!(e) && (f)))
-int
-main ()
-{
-  int i;
-  for (i = 0; i < 256; i++)
-    if (XOR (islower (i), ISLOWER (i))
-	|| toupper (i) != TOUPPER (i))
-      return 2;
-  return 0;
-}
-_ACEOF
-if ac_fn_c_try_run "$LINENO"; then :
-
-else
-  ac_cv_header_stdc=no
-fi
-rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
-  conftest.$ac_objext conftest.beam conftest.$ac_ext
-fi
-
-fi
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_stdc" >&5
-$as_echo "$ac_cv_header_stdc" >&6; }
-if test $ac_cv_header_stdc = yes; then
-
-$as_echo "#define STDC_HEADERS 1" >>confdefs.h
-
-fi
-
-
-# check for specific header (.h) files that we are interested in
-for ac_header in ctype.h errno.h fcntl.h inttypes.h limits.h signal.h sys/resource.h sys/select.h sys/stat.h sys/syscall.h sys/time.h sys/timeb.h sys/timers.h sys/times.h sys/types.h sys/utsname.h sys/wait.h termios.h time.h unistd.h utime.h windows.h winsock.h langinfo.h poll.h sys/epoll.h sys/event.h sys/eventfd.h
-do :
-  as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
-ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default"
-if eval test \"x\$"$as_ac_Header"\" = x"yes"; then :
-  cat >>confdefs.h <<_ACEOF
-#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1
-_ACEOF
-
-fi
-
-done
-
-
-# Enable large file support. Do this before testing the types ino_t, off_t, and
-# rlim_t, because it will affect the result of that test.
-# Check whether --enable-largefile was given.
-if test "${enable_largefile+set}" = set; then :
-  enableval=$enable_largefile;
-fi
-
-if test "$enable_largefile" != no; then
-
-  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for special C compiler options needed for large files" >&5
-$as_echo_n "checking for special C compiler options needed for large files... " >&6; }
-if ${ac_cv_sys_largefile_CC+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  ac_cv_sys_largefile_CC=no
-     if test "$GCC" != yes; then
-       ac_save_CC=$CC
-       while :; do
-	 # IRIX 6.2 and later do not support large files by default,
-	 # so use the C compiler's -n32 option if that helps.
-	 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-#include <sys/types.h>
- /* Check that off_t can represent 2**63 - 1 correctly.
-    We can't simply define LARGE_OFF_T to be 9223372036854775807,
-    since some C++ compilers masquerading as C compilers
-    incorrectly reject 9223372036854775807.  */
-#define LARGE_OFF_T ((((off_t) 1 << 31) << 31) - 1 + (((off_t) 1 << 31) << 31))
-  int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721
-		       && LARGE_OFF_T % 2147483647 == 1)
-		      ? 1 : -1];
-int
-main ()
-{
-
-  ;
-  return 0;
-}
-_ACEOF
-	 if ac_fn_c_try_compile "$LINENO"; then :
-  break
-fi
-rm -f core conftest.err conftest.$ac_objext
-	 CC="$CC -n32"
-	 if ac_fn_c_try_compile "$LINENO"; then :
-  ac_cv_sys_largefile_CC=' -n32'; break
-fi
-rm -f core conftest.err conftest.$ac_objext
-	 break
-       done
-       CC=$ac_save_CC
-       rm -f conftest.$ac_ext
-    fi
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sys_largefile_CC" >&5
-$as_echo "$ac_cv_sys_largefile_CC" >&6; }
-  if test "$ac_cv_sys_largefile_CC" != no; then
-    CC=$CC$ac_cv_sys_largefile_CC
-  fi
-
-  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for _FILE_OFFSET_BITS value needed for large files" >&5
-$as_echo_n "checking for _FILE_OFFSET_BITS value needed for large files... " >&6; }
-if ${ac_cv_sys_file_offset_bits+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  while :; do
-  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-#include <sys/types.h>
- /* Check that off_t can represent 2**63 - 1 correctly.
-    We can't simply define LARGE_OFF_T to be 9223372036854775807,
-    since some C++ compilers masquerading as C compilers
-    incorrectly reject 9223372036854775807.  */
-#define LARGE_OFF_T ((((off_t) 1 << 31) << 31) - 1 + (((off_t) 1 << 31) << 31))
-  int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721
-		       && LARGE_OFF_T % 2147483647 == 1)
-		      ? 1 : -1];
-int
-main ()
-{
-
-  ;
-  return 0;
-}
-_ACEOF
-if ac_fn_c_try_compile "$LINENO"; then :
-  ac_cv_sys_file_offset_bits=no; break
-fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-#define _FILE_OFFSET_BITS 64
-#include <sys/types.h>
- /* Check that off_t can represent 2**63 - 1 correctly.
-    We can't simply define LARGE_OFF_T to be 9223372036854775807,
-    since some C++ compilers masquerading as C compilers
-    incorrectly reject 9223372036854775807.  */
-#define LARGE_OFF_T ((((off_t) 1 << 31) << 31) - 1 + (((off_t) 1 << 31) << 31))
-  int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721
-		       && LARGE_OFF_T % 2147483647 == 1)
-		      ? 1 : -1];
-int
-main ()
-{
-
-  ;
-  return 0;
-}
-_ACEOF
-if ac_fn_c_try_compile "$LINENO"; then :
-  ac_cv_sys_file_offset_bits=64; break
-fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-  ac_cv_sys_file_offset_bits=unknown
-  break
-done
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sys_file_offset_bits" >&5
-$as_echo "$ac_cv_sys_file_offset_bits" >&6; }
-case $ac_cv_sys_file_offset_bits in #(
-  no | unknown) ;;
-  *)
-cat >>confdefs.h <<_ACEOF
-#define _FILE_OFFSET_BITS $ac_cv_sys_file_offset_bits
-_ACEOF
-;;
-esac
-rm -rf conftest*
-  if test $ac_cv_sys_file_offset_bits = unknown; then
-    { $as_echo "$as_me:${as_lineno-$LINENO}: checking for _LARGE_FILES value needed for large files" >&5
-$as_echo_n "checking for _LARGE_FILES value needed for large files... " >&6; }
-if ${ac_cv_sys_large_files+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  while :; do
-  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-#include <sys/types.h>
- /* Check that off_t can represent 2**63 - 1 correctly.
-    We can't simply define LARGE_OFF_T to be 9223372036854775807,
-    since some C++ compilers masquerading as C compilers
-    incorrectly reject 9223372036854775807.  */
-#define LARGE_OFF_T ((((off_t) 1 << 31) << 31) - 1 + (((off_t) 1 << 31) << 31))
-  int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721
-		       && LARGE_OFF_T % 2147483647 == 1)
-		      ? 1 : -1];
-int
-main ()
-{
-
-  ;
-  return 0;
-}
-_ACEOF
-if ac_fn_c_try_compile "$LINENO"; then :
-  ac_cv_sys_large_files=no; break
-fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-#define _LARGE_FILES 1
-#include <sys/types.h>
- /* Check that off_t can represent 2**63 - 1 correctly.
-    We can't simply define LARGE_OFF_T to be 9223372036854775807,
-    since some C++ compilers masquerading as C compilers
-    incorrectly reject 9223372036854775807.  */
-#define LARGE_OFF_T ((((off_t) 1 << 31) << 31) - 1 + (((off_t) 1 << 31) << 31))
-  int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721
-		       && LARGE_OFF_T % 2147483647 == 1)
-		      ? 1 : -1];
-int
-main ()
-{
-
-  ;
-  return 0;
-}
-_ACEOF
-if ac_fn_c_try_compile "$LINENO"; then :
-  ac_cv_sys_large_files=1; break
-fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-  ac_cv_sys_large_files=unknown
-  break
-done
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sys_large_files" >&5
-$as_echo "$ac_cv_sys_large_files" >&6; }
-case $ac_cv_sys_large_files in #(
-  no | unknown) ;;
-  *)
-cat >>confdefs.h <<_ACEOF
-#define _LARGE_FILES $ac_cv_sys_large_files
-_ACEOF
-;;
-esac
-rm -rf conftest*
-  fi
-
-
-fi
-
-
-for ac_header in wctype.h
-do :
-  ac_fn_c_check_header_mongrel "$LINENO" "wctype.h" "ac_cv_header_wctype_h" "$ac_includes_default"
-if test "x$ac_cv_header_wctype_h" = xyes; then :
-  cat >>confdefs.h <<_ACEOF
-#define HAVE_WCTYPE_H 1
-_ACEOF
- for ac_func in iswspace
-do :
-  ac_fn_c_check_func "$LINENO" "iswspace" "ac_cv_func_iswspace"
-if test "x$ac_cv_func_iswspace" = xyes; then :
-  cat >>confdefs.h <<_ACEOF
-#define HAVE_ISWSPACE 1
-_ACEOF
-
-fi
-done
-
-fi
-
-done
-
-
-for ac_func in lstat
-do :
-  ac_fn_c_check_func "$LINENO" "lstat" "ac_cv_func_lstat"
-if test "x$ac_cv_func_lstat" = xyes; then :
-  cat >>confdefs.h <<_ACEOF
-#define HAVE_LSTAT 1
-_ACEOF
-
-fi
-done
-
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for clock_gettime in -lrt" >&5
-$as_echo_n "checking for clock_gettime in -lrt... " >&6; }
-if ${ac_cv_lib_rt_clock_gettime+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  ac_check_lib_save_LIBS=$LIBS
-LIBS="-lrt  $LIBS"
-cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-
-/* Override any GCC internal prototype to avoid an error.
-   Use char because int might match the return type of a GCC
-   builtin and then its argument prototype would still apply.  */
-#ifdef __cplusplus
-extern "C"
-#endif
-char clock_gettime ();
-int
-main ()
-{
-return clock_gettime ();
-  ;
-  return 0;
-}
-_ACEOF
-if ac_fn_c_try_link "$LINENO"; then :
-  ac_cv_lib_rt_clock_gettime=yes
-else
-  ac_cv_lib_rt_clock_gettime=no
-fi
-rm -f core conftest.err conftest.$ac_objext \
-    conftest$ac_exeext conftest.$ac_ext
-LIBS=$ac_check_lib_save_LIBS
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_rt_clock_gettime" >&5
-$as_echo "$ac_cv_lib_rt_clock_gettime" >&6; }
-if test "x$ac_cv_lib_rt_clock_gettime" = xyes; then :
-  cat >>confdefs.h <<_ACEOF
-#define HAVE_LIBRT 1
-_ACEOF
-
-  LIBS="-lrt $LIBS"
-
-fi
-
-for ac_func in clock_gettime
-do :
-  ac_fn_c_check_func "$LINENO" "clock_gettime" "ac_cv_func_clock_gettime"
-if test "x$ac_cv_func_clock_gettime" = xyes; then :
-  cat >>confdefs.h <<_ACEOF
-#define HAVE_CLOCK_GETTIME 1
-_ACEOF
-
-fi
-done
-
-for ac_func in getclock getrusage times
-do :
-  as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
-ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var"
-if eval test \"x\$"$as_ac_var"\" = x"yes"; then :
-  cat >>confdefs.h <<_ACEOF
-#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
-_ACEOF
-
-fi
-done
-
-for ac_func in _chsize ftruncate
-do :
-  as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
-ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var"
-if eval test \"x\$"$as_ac_var"\" = x"yes"; then :
-  cat >>confdefs.h <<_ACEOF
-#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
-_ACEOF
-
-fi
-done
-
-
-for ac_func in epoll_ctl eventfd kevent kevent64 kqueue poll
-do :
-  as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
-ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var"
-if eval test \"x\$"$as_ac_var"\" = x"yes"; then :
-  cat >>confdefs.h <<_ACEOF
-#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
-_ACEOF
-
-fi
-done
-
-
-# event-related fun
-
-if test "$ac_cv_header_sys_epoll_h" = yes -a "$ac_cv_func_epoll_ctl" = yes; then
-
-$as_echo "#define HAVE_EPOLL 1" >>confdefs.h
-
-fi
-
-if test "$ac_cv_header_sys_event_h" = yes -a "$ac_cv_func_kqueue" = yes; then
-
-$as_echo "#define HAVE_KQUEUE 1" >>confdefs.h
-
-
-  # The cast to long int works around a bug in the HP C Compiler
-# version HP92453-01 B.11.11.23709.GP, which incorrectly rejects
-# declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'.
-# This bug is HP SR number 8606223364.
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking size of kev.filter" >&5
-$as_echo_n "checking size of kev.filter... " >&6; }
-if ${ac_cv_sizeof_kev_filter+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (kev.filter))" "ac_cv_sizeof_kev_filter"        "#include <sys/event.h>
-struct kevent kev;
-"; then :
-
-else
-  if test "$ac_cv_type_kev_filter" = yes; then
-     { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
-$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
-as_fn_error 77 "cannot compute sizeof (kev.filter)
-See \`config.log' for more details" "$LINENO" 5; }
-   else
-     ac_cv_sizeof_kev_filter=0
-   fi
-fi
-
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sizeof_kev_filter" >&5
-$as_echo "$ac_cv_sizeof_kev_filter" >&6; }
-
-
-
-cat >>confdefs.h <<_ACEOF
-#define SIZEOF_KEV_FILTER $ac_cv_sizeof_kev_filter
-_ACEOF
-
-
-
-  # The cast to long int works around a bug in the HP C Compiler
-# version HP92453-01 B.11.11.23709.GP, which incorrectly rejects
-# declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'.
-# This bug is HP SR number 8606223364.
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking size of kev.flags" >&5
-$as_echo_n "checking size of kev.flags... " >&6; }
-if ${ac_cv_sizeof_kev_flags+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (kev.flags))" "ac_cv_sizeof_kev_flags"        "#include <sys/event.h>
-struct kevent kev;
-"; then :
-
-else
-  if test "$ac_cv_type_kev_flags" = yes; then
-     { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
-$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
-as_fn_error 77 "cannot compute sizeof (kev.flags)
-See \`config.log' for more details" "$LINENO" 5; }
-   else
-     ac_cv_sizeof_kev_flags=0
-   fi
-fi
-
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sizeof_kev_flags" >&5
-$as_echo "$ac_cv_sizeof_kev_flags" >&6; }
-
-
-
-cat >>confdefs.h <<_ACEOF
-#define SIZEOF_KEV_FLAGS $ac_cv_sizeof_kev_flags
-_ACEOF
-
-
-fi
-
-if test "$ac_cv_header_poll_h" = yes -a "$ac_cv_func_poll" = yes; then
-
-$as_echo "#define HAVE_POLL 1" >>confdefs.h
-
-fi
-
-# unsetenv
-for ac_func in unsetenv
-do :
-  ac_fn_c_check_func "$LINENO" "unsetenv" "ac_cv_func_unsetenv"
-if test "x$ac_cv_func_unsetenv" = xyes; then :
-  cat >>confdefs.h <<_ACEOF
-#define HAVE_UNSETENV 1
-_ACEOF
-
-fi
-done
-
-
-###  POSIX.1003.1 unsetenv returns 0 or -1 (EINVAL), but older implementations
-###  in common use return void.
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking return type of unsetenv" >&5
-$as_echo_n "checking return type of unsetenv... " >&6; }
-if ${fptools_cv_func_unsetenv_return_type+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-#include <stdlib.h>
-
-_ACEOF
-if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
-  $EGREP "void[      ]+unsetenv" >/dev/null 2>&1; then :
-  fptools_cv_func_unsetenv_return_type=void
-else
-  fptools_cv_func_unsetenv_return_type=int
-fi
-rm -f conftest*
-
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $fptools_cv_func_unsetenv_return_type" >&5
-$as_echo "$fptools_cv_func_unsetenv_return_type" >&6; }
-case "$fptools_cv_func_unsetenv_return_type" in
-  "void" )
-
-$as_echo "#define UNSETENV_RETURNS_VOID 1" >>confdefs.h
-
-  ;;
-esac
-
-
-
-# Check whether --with-iconv-includes was given.
-if test "${with_iconv_includes+set}" = set; then :
-  withval=$with_iconv_includes; ICONV_INCLUDE_DIRS=$withval; CPPFLAGS="-I$withval $CPPFLAGS"
-else
-  ICONV_INCLUDE_DIRS=
-fi
-
-
-
-# Check whether --with-iconv-libraries was given.
-if test "${with_iconv_libraries+set}" = set; then :
-  withval=$with_iconv_libraries; ICONV_LIB_DIRS=$withval; LDFLAGS="-L$withval $LDFLAGS"
-else
-  ICONV_LIB_DIRS=
-fi
-
-
-
-
-
-# map standard C types and ISO types to Haskell types
-
-
-
-
-
-
-
-
-    { $as_echo "$as_me:${as_lineno-$LINENO}: checking Haskell type for char" >&5
-$as_echo_n "checking Haskell type for char... " >&6; }
-    if ${fptools_cv_htype_char+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-
-        fptools_cv_htype_sup_char=yes
-        if ac_fn_c_compute_int "$LINENO" "(char)0.2 - (char)0.4 < 0 ? 0 : 1" "HTYPE_IS_INTEGRAL"        "
-#include <stdio.h>
-#include <stddef.h>
-
-#if HAVE_SYS_TYPES_H
-# include <sys/types.h>
-#endif
-
-#if HAVE_UNISTD_H
-# include <unistd.h>
-#endif
-
-#if HAVE_SYS_STAT_H
-# include <sys/stat.h>
-#endif
-
-#if HAVE_FCNTL_H
-# include <fcntl.h>
-#endif
-
-#if HAVE_SIGNAL_H
-# include <signal.h>
-#endif
-
-#if HAVE_TIME_H
-# include <time.h>
-#endif
-
-#if HAVE_TERMIOS_H
-# include <termios.h>
-#endif
-
-#if HAVE_STRING_H
-# include <string.h>
-#endif
-
-#if HAVE_CTYPE_H
-# include <ctype.h>
-#endif
-
-#if HAVE_INTTYPES_H
-# include <inttypes.h>
-#else
-# if HAVE_STDINT_H
-#  include <stdint.h>
-# endif
-#endif
-
-#if HAVE_SYS_RESOURCE_H
-# include <sys/resource.h>
-#endif
-
-#include <stdlib.h>
-"; then :
-
-else
-  HTYPE_IS_INTEGRAL=0
-fi
-
-
-
-        if test "$HTYPE_IS_INTEGRAL" -eq 0
-        then
-            if ac_fn_c_compute_int "$LINENO" "sizeof(char) == sizeof(float)" "HTYPE_IS_FLOAT"        "
-#include <stdio.h>
-#include <stddef.h>
-
-#if HAVE_SYS_TYPES_H
-# include <sys/types.h>
-#endif
-
-#if HAVE_UNISTD_H
-# include <unistd.h>
-#endif
-
-#if HAVE_SYS_STAT_H
-# include <sys/stat.h>
-#endif
-
-#if HAVE_FCNTL_H
-# include <fcntl.h>
-#endif
-
-#if HAVE_SIGNAL_H
-# include <signal.h>
-#endif
-
-#if HAVE_TIME_H
-# include <time.h>
-#endif
-
-#if HAVE_TERMIOS_H
-# include <termios.h>
-#endif
-
-#if HAVE_STRING_H
-# include <string.h>
-#endif
-
-#if HAVE_CTYPE_H
-# include <ctype.h>
-#endif
-
-#if HAVE_INTTYPES_H
-# include <inttypes.h>
-#else
-# if HAVE_STDINT_H
-#  include <stdint.h>
-# endif
-#endif
-
-#if HAVE_SYS_RESOURCE_H
-# include <sys/resource.h>
-#endif
-
-#include <stdlib.h>
-"; then :
-
-else
-  fptools_cv_htype_sup_char=no
-fi
-
-
-            if ac_fn_c_compute_int "$LINENO" "sizeof(char) == sizeof(double)" "HTYPE_IS_DOUBLE"        "
-#include <stdio.h>
-#include <stddef.h>
-
-#if HAVE_SYS_TYPES_H
-# include <sys/types.h>
-#endif
-
-#if HAVE_UNISTD_H
-# include <unistd.h>
-#endif
-
-#if HAVE_SYS_STAT_H
-# include <sys/stat.h>
-#endif
-
-#if HAVE_FCNTL_H
-# include <fcntl.h>
-#endif
-
-#if HAVE_SIGNAL_H
-# include <signal.h>
-#endif
-
-#if HAVE_TIME_H
-# include <time.h>
-#endif
-
-#if HAVE_TERMIOS_H
-# include <termios.h>
-#endif
-
-#if HAVE_STRING_H
-# include <string.h>
-#endif
-
-#if HAVE_CTYPE_H
-# include <ctype.h>
-#endif
-
-#if HAVE_INTTYPES_H
-# include <inttypes.h>
-#else
-# if HAVE_STDINT_H
-#  include <stdint.h>
-# endif
-#endif
-
-#if HAVE_SYS_RESOURCE_H
-# include <sys/resource.h>
-#endif
-
-#include <stdlib.h>
-"; then :
-
-else
-  fptools_cv_htype_sup_char=no
-fi
-
-
-            if ac_fn_c_compute_int "$LINENO" "sizeof(char) == sizeof(long double)" "HTYPE_IS_LDOUBLE"        "
-#include <stdio.h>
-#include <stddef.h>
-
-#if HAVE_SYS_TYPES_H
-# include <sys/types.h>
-#endif
-
-#if HAVE_UNISTD_H
-# include <unistd.h>
-#endif
-
-#if HAVE_SYS_STAT_H
-# include <sys/stat.h>
-#endif
-
-#if HAVE_FCNTL_H
-# include <fcntl.h>
-#endif
-
-#if HAVE_SIGNAL_H
-# include <signal.h>
-#endif
-
-#if HAVE_TIME_H
-# include <time.h>
-#endif
-
-#if HAVE_TERMIOS_H
-# include <termios.h>
-#endif
-
-#if HAVE_STRING_H
-# include <string.h>
-#endif
-
-#if HAVE_CTYPE_H
-# include <ctype.h>
-#endif
-
-#if HAVE_INTTYPES_H
-# include <inttypes.h>
-#else
-# if HAVE_STDINT_H
-#  include <stdint.h>
-# endif
-#endif
-
-#if HAVE_SYS_RESOURCE_H
-# include <sys/resource.h>
-#endif
-
-#include <stdlib.h>
-"; then :
-
-else
-  fptools_cv_htype_sup_char=no
-fi
-
-
-            if test "$HTYPE_IS_FLOAT" -eq 1
-            then
-                fptools_cv_htype_char=Float
-            elif test "$HTYPE_IS_DOUBLE" -eq 1
-            then
-                fptools_cv_htype_char=Double
-            elif test "$HTYPE_IS_LDOUBLE" -eq 1
-            then
-                fptools_cv_htype_char=LDouble
-            else
-                fptools_cv_htype_sup_char=no
-            fi
-        else
-            if ac_fn_c_compute_int "$LINENO" "((char)(-1)) < ((char)0)" "HTYPE_IS_SIGNED"        "
-#include <stdio.h>
-#include <stddef.h>
-
-#if HAVE_SYS_TYPES_H
-# include <sys/types.h>
-#endif
-
-#if HAVE_UNISTD_H
-# include <unistd.h>
-#endif
-
-#if HAVE_SYS_STAT_H
-# include <sys/stat.h>
-#endif
-
-#if HAVE_FCNTL_H
-# include <fcntl.h>
-#endif
-
-#if HAVE_SIGNAL_H
-# include <signal.h>
-#endif
-
-#if HAVE_TIME_H
-# include <time.h>
-#endif
-
-#if HAVE_TERMIOS_H
-# include <termios.h>
-#endif
-
-#if HAVE_STRING_H
-# include <string.h>
-#endif
-
-#if HAVE_CTYPE_H
-# include <ctype.h>
-#endif
-
-#if HAVE_INTTYPES_H
-# include <inttypes.h>
-#else
-# if HAVE_STDINT_H
-#  include <stdint.h>
-# endif
-#endif
-
-#if HAVE_SYS_RESOURCE_H
-# include <sys/resource.h>
-#endif
-
-#include <stdlib.h>
-"; then :
-
-else
-  fptools_cv_htype_sup_char=no
-fi
-
-
-            if ac_fn_c_compute_int "$LINENO" "sizeof(char) * 8" "HTYPE_SIZE"        "
-#include <stdio.h>
-#include <stddef.h>
-
-#if HAVE_SYS_TYPES_H
-# include <sys/types.h>
-#endif
-
-#if HAVE_UNISTD_H
-# include <unistd.h>
-#endif
-
-#if HAVE_SYS_STAT_H
-# include <sys/stat.h>
-#endif
-
-#if HAVE_FCNTL_H
-# include <fcntl.h>
-#endif
-
-#if HAVE_SIGNAL_H
-# include <signal.h>
-#endif
-
-#if HAVE_TIME_H
-# include <time.h>
-#endif
-
-#if HAVE_TERMIOS_H
-# include <termios.h>
-#endif
-
-#if HAVE_STRING_H
-# include <string.h>
-#endif
-
-#if HAVE_CTYPE_H
-# include <ctype.h>
-#endif
-
-#if HAVE_INTTYPES_H
-# include <inttypes.h>
-#else
-# if HAVE_STDINT_H
-#  include <stdint.h>
-# endif
-#endif
-
-#if HAVE_SYS_RESOURCE_H
-# include <sys/resource.h>
-#endif
-
-#include <stdlib.h>
-"; then :
-
-else
-  fptools_cv_htype_sup_char=no
-fi
-
-
-            if test "$HTYPE_IS_SIGNED" -eq 0
-            then
-                fptools_cv_htype_char="Word$HTYPE_SIZE"
-            else
-                fptools_cv_htype_char="Int$HTYPE_SIZE"
-            fi
-        fi
-
-fi
-
-    if test "$fptools_cv_htype_sup_char" = no
-    then
-
-        fptools_cv_htype_char=NotReallyAType
-        { $as_echo "$as_me:${as_lineno-$LINENO}: result: not supported" >&5
-$as_echo "not supported" >&6; }
-
-    fi
-
-            if test "$fptools_cv_htype_sup_char" = yes; then
-        { $as_echo "$as_me:${as_lineno-$LINENO}: result: $fptools_cv_htype_char" >&5
-$as_echo "$fptools_cv_htype_char" >&6; }
-
-cat >>confdefs.h <<_ACEOF
-#define HTYPE_CHAR $fptools_cv_htype_char
-_ACEOF
-
-    fi
-
-
-
-
-
-
-
-
-
-
-    { $as_echo "$as_me:${as_lineno-$LINENO}: checking Haskell type for signed char" >&5
-$as_echo_n "checking Haskell type for signed char... " >&6; }
-    if ${fptools_cv_htype_signed_char+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-
-        fptools_cv_htype_sup_signed_char=yes
-        if ac_fn_c_compute_int "$LINENO" "(signed char)0.2 - (signed char)0.4 < 0 ? 0 : 1" "HTYPE_IS_INTEGRAL"        "
-#include <stdio.h>
-#include <stddef.h>
-
-#if HAVE_SYS_TYPES_H
-# include <sys/types.h>
-#endif
-
-#if HAVE_UNISTD_H
-# include <unistd.h>
-#endif
-
-#if HAVE_SYS_STAT_H
-# include <sys/stat.h>
-#endif
-
-#if HAVE_FCNTL_H
-# include <fcntl.h>
-#endif
-
-#if HAVE_SIGNAL_H
-# include <signal.h>
-#endif
-
-#if HAVE_TIME_H
-# include <time.h>
-#endif
-
-#if HAVE_TERMIOS_H
-# include <termios.h>
-#endif
-
-#if HAVE_STRING_H
-# include <string.h>
-#endif
-
-#if HAVE_CTYPE_H
-# include <ctype.h>
-#endif
-
-#if HAVE_INTTYPES_H
-# include <inttypes.h>
-#else
-# if HAVE_STDINT_H
-#  include <stdint.h>
-# endif
-#endif
-
-#if HAVE_SYS_RESOURCE_H
-# include <sys/resource.h>
-#endif
-
-#include <stdlib.h>
-"; then :
-
-else
-  HTYPE_IS_INTEGRAL=0
-fi
-
-
-
-        if test "$HTYPE_IS_INTEGRAL" -eq 0
-        then
-            if ac_fn_c_compute_int "$LINENO" "sizeof(signed char) == sizeof(float)" "HTYPE_IS_FLOAT"        "
-#include <stdio.h>
-#include <stddef.h>
-
-#if HAVE_SYS_TYPES_H
-# include <sys/types.h>
-#endif
-
-#if HAVE_UNISTD_H
-# include <unistd.h>
-#endif
-
-#if HAVE_SYS_STAT_H
-# include <sys/stat.h>
-#endif
-
-#if HAVE_FCNTL_H
-# include <fcntl.h>
-#endif
-
-#if HAVE_SIGNAL_H
-# include <signal.h>
-#endif
-
-#if HAVE_TIME_H
-# include <time.h>
-#endif
-
-#if HAVE_TERMIOS_H
-# include <termios.h>
-#endif
-
-#if HAVE_STRING_H
-# include <string.h>
-#endif
-
-#if HAVE_CTYPE_H
-# include <ctype.h>
-#endif
-
-#if HAVE_INTTYPES_H
-# include <inttypes.h>
-#else
-# if HAVE_STDINT_H
-#  include <stdint.h>
-# endif
-#endif
-
-#if HAVE_SYS_RESOURCE_H
-# include <sys/resource.h>
-#endif
-
-#include <stdlib.h>
-"; then :
-
-else
-  fptools_cv_htype_sup_signed_char=no
-fi
-
-
-            if ac_fn_c_compute_int "$LINENO" "sizeof(signed char) == sizeof(double)" "HTYPE_IS_DOUBLE"        "
-#include <stdio.h>
-#include <stddef.h>
-
-#if HAVE_SYS_TYPES_H
-# include <sys/types.h>
-#endif
-
-#if HAVE_UNISTD_H
-# include <unistd.h>
-#endif
-
-#if HAVE_SYS_STAT_H
-# include <sys/stat.h>
-#endif
-
-#if HAVE_FCNTL_H
-# include <fcntl.h>
-#endif
-
-#if HAVE_SIGNAL_H
-# include <signal.h>
-#endif
-
-#if HAVE_TIME_H
-# include <time.h>
-#endif
-
-#if HAVE_TERMIOS_H
-# include <termios.h>
-#endif
-
-#if HAVE_STRING_H
-# include <string.h>
-#endif
-
-#if HAVE_CTYPE_H
-# include <ctype.h>
-#endif
-
-#if HAVE_INTTYPES_H
-# include <inttypes.h>
-#else
-# if HAVE_STDINT_H
-#  include <stdint.h>
-# endif
-#endif
-
-#if HAVE_SYS_RESOURCE_H
-# include <sys/resource.h>
-#endif
-
-#include <stdlib.h>
-"; then :
-
-else
-  fptools_cv_htype_sup_signed_char=no
-fi
-
-
-            if ac_fn_c_compute_int "$LINENO" "sizeof(signed char) == sizeof(long double)" "HTYPE_IS_LDOUBLE"        "
-#include <stdio.h>
-#include <stddef.h>
-
-#if HAVE_SYS_TYPES_H
-# include <sys/types.h>
-#endif
-
-#if HAVE_UNISTD_H
-# include <unistd.h>
-#endif
-
-#if HAVE_SYS_STAT_H
-# include <sys/stat.h>
-#endif
-
-#if HAVE_FCNTL_H
-# include <fcntl.h>
-#endif
-
-#if HAVE_SIGNAL_H
-# include <signal.h>
-#endif
-
-#if HAVE_TIME_H
-# include <time.h>
-#endif
-
-#if HAVE_TERMIOS_H
-# include <termios.h>
-#endif
-
-#if HAVE_STRING_H
-# include <string.h>
-#endif
-
-#if HAVE_CTYPE_H
-# include <ctype.h>
-#endif
-
-#if HAVE_INTTYPES_H
-# include <inttypes.h>
-#else
-# if HAVE_STDINT_H
-#  include <stdint.h>
-# endif
-#endif
-
-#if HAVE_SYS_RESOURCE_H
-# include <sys/resource.h>
-#endif
-
-#include <stdlib.h>
-"; then :
-
-else
-  fptools_cv_htype_sup_signed_char=no
-fi
-
-
-            if test "$HTYPE_IS_FLOAT" -eq 1
-            then
-                fptools_cv_htype_signed_char=Float
-            elif test "$HTYPE_IS_DOUBLE" -eq 1
-            then
-                fptools_cv_htype_signed_char=Double
-            elif test "$HTYPE_IS_LDOUBLE" -eq 1
-            then
-                fptools_cv_htype_signed_char=LDouble
-            else
-                fptools_cv_htype_sup_signed_char=no
-            fi
-        else
-            if ac_fn_c_compute_int "$LINENO" "((signed char)(-1)) < ((signed char)0)" "HTYPE_IS_SIGNED"        "
-#include <stdio.h>
-#include <stddef.h>
-
-#if HAVE_SYS_TYPES_H
-# include <sys/types.h>
-#endif
-
-#if HAVE_UNISTD_H
-# include <unistd.h>
-#endif
-
-#if HAVE_SYS_STAT_H
-# include <sys/stat.h>
-#endif
-
-#if HAVE_FCNTL_H
-# include <fcntl.h>
-#endif
-
-#if HAVE_SIGNAL_H
-# include <signal.h>
-#endif
-
-#if HAVE_TIME_H
-# include <time.h>
-#endif
-
-#if HAVE_TERMIOS_H
-# include <termios.h>
-#endif
-
-#if HAVE_STRING_H
-# include <string.h>
-#endif
-
-#if HAVE_CTYPE_H
-# include <ctype.h>
-#endif
-
-#if HAVE_INTTYPES_H
-# include <inttypes.h>
-#else
-# if HAVE_STDINT_H
-#  include <stdint.h>
-# endif
-#endif
-
-#if HAVE_SYS_RESOURCE_H
-# include <sys/resource.h>
-#endif
-
-#include <stdlib.h>
-"; then :
-
-else
-  fptools_cv_htype_sup_signed_char=no
-fi
-
-
-            if ac_fn_c_compute_int "$LINENO" "sizeof(signed char) * 8" "HTYPE_SIZE"        "
-#include <stdio.h>
-#include <stddef.h>
-
-#if HAVE_SYS_TYPES_H
-# include <sys/types.h>
-#endif
-
-#if HAVE_UNISTD_H
-# include <unistd.h>
-#endif
-
-#if HAVE_SYS_STAT_H
-# include <sys/stat.h>
-#endif
-
-#if HAVE_FCNTL_H
-# include <fcntl.h>
-#endif
-
-#if HAVE_SIGNAL_H
-# include <signal.h>
-#endif
-
-#if HAVE_TIME_H
-# include <time.h>
-#endif
-
-#if HAVE_TERMIOS_H
-# include <termios.h>
-#endif
-
-#if HAVE_STRING_H
-# include <string.h>
-#endif
-
-#if HAVE_CTYPE_H
-# include <ctype.h>
-#endif
-
-#if HAVE_INTTYPES_H
-# include <inttypes.h>
-#else
-# if HAVE_STDINT_H
-#  include <stdint.h>
-# endif
-#endif
-
-#if HAVE_SYS_RESOURCE_H
-# include <sys/resource.h>
-#endif
-
-#include <stdlib.h>
-"; then :
-
-else
-  fptools_cv_htype_sup_signed_char=no
-fi
-
-
-            if test "$HTYPE_IS_SIGNED" -eq 0
-            then
-                fptools_cv_htype_signed_char="Word$HTYPE_SIZE"
-            else
-                fptools_cv_htype_signed_char="Int$HTYPE_SIZE"
-            fi
-        fi
-
-fi
-
-    if test "$fptools_cv_htype_sup_signed_char" = no
-    then
-
-        fptools_cv_htype_signed_char=NotReallyAType
-        { $as_echo "$as_me:${as_lineno-$LINENO}: result: not supported" >&5
-$as_echo "not supported" >&6; }
-
-    fi
-
-            if test "$fptools_cv_htype_sup_signed_char" = yes; then
-        { $as_echo "$as_me:${as_lineno-$LINENO}: result: $fptools_cv_htype_signed_char" >&5
-$as_echo "$fptools_cv_htype_signed_char" >&6; }
-
-cat >>confdefs.h <<_ACEOF
-#define HTYPE_SIGNED_CHAR $fptools_cv_htype_signed_char
-_ACEOF
-
-    fi
-
-
-
-
-
-
-
-
-
-
-    { $as_echo "$as_me:${as_lineno-$LINENO}: checking Haskell type for unsigned char" >&5
-$as_echo_n "checking Haskell type for unsigned char... " >&6; }
-    if ${fptools_cv_htype_unsigned_char+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-
-        fptools_cv_htype_sup_unsigned_char=yes
-        if ac_fn_c_compute_int "$LINENO" "(unsigned char)0.2 - (unsigned char)0.4 < 0 ? 0 : 1" "HTYPE_IS_INTEGRAL"        "
-#include <stdio.h>
-#include <stddef.h>
-
-#if HAVE_SYS_TYPES_H
-# include <sys/types.h>
-#endif
-
-#if HAVE_UNISTD_H
-# include <unistd.h>
-#endif
-
-#if HAVE_SYS_STAT_H
-# include <sys/stat.h>
-#endif
-
-#if HAVE_FCNTL_H
-# include <fcntl.h>
-#endif
-
-#if HAVE_SIGNAL_H
-# include <signal.h>
-#endif
-
-#if HAVE_TIME_H
-# include <time.h>
-#endif
-
-#if HAVE_TERMIOS_H
-# include <termios.h>
-#endif
-
-#if HAVE_STRING_H
-# include <string.h>
-#endif
-
-#if HAVE_CTYPE_H
-# include <ctype.h>
-#endif
-
-#if HAVE_INTTYPES_H
-# include <inttypes.h>
-#else
-# if HAVE_STDINT_H
-#  include <stdint.h>
-# endif
-#endif
-
-#if HAVE_SYS_RESOURCE_H
-# include <sys/resource.h>
-#endif
-
-#include <stdlib.h>
-"; then :
-
-else
-  HTYPE_IS_INTEGRAL=0
-fi
-
-
-
-        if test "$HTYPE_IS_INTEGRAL" -eq 0
-        then
-            if ac_fn_c_compute_int "$LINENO" "sizeof(unsigned char) == sizeof(float)" "HTYPE_IS_FLOAT"        "
-#include <stdio.h>
-#include <stddef.h>
-
-#if HAVE_SYS_TYPES_H
-# include <sys/types.h>
-#endif
-
-#if HAVE_UNISTD_H
-# include <unistd.h>
-#endif
-
-#if HAVE_SYS_STAT_H
-# include <sys/stat.h>
-#endif
-
-#if HAVE_FCNTL_H
-# include <fcntl.h>
-#endif
-
-#if HAVE_SIGNAL_H
-# include <signal.h>
-#endif
-
-#if HAVE_TIME_H
-# include <time.h>
-#endif
-
-#if HAVE_TERMIOS_H
-# include <termios.h>
-#endif
-
-#if HAVE_STRING_H
-# include <string.h>
-#endif
-
-#if HAVE_CTYPE_H
-# include <ctype.h>
-#endif
-
-#if HAVE_INTTYPES_H
-# include <inttypes.h>
-#else
-# if HAVE_STDINT_H
-#  include <stdint.h>
-# endif
-#endif
-
-#if HAVE_SYS_RESOURCE_H
-# include <sys/resource.h>
-#endif
-
-#include <stdlib.h>
-"; then :
-
-else
-  fptools_cv_htype_sup_unsigned_char=no
-fi
-
-
-            if ac_fn_c_compute_int "$LINENO" "sizeof(unsigned char) == sizeof(double)" "HTYPE_IS_DOUBLE"        "
-#include <stdio.h>
-#include <stddef.h>
-
-#if HAVE_SYS_TYPES_H
-# include <sys/types.h>
-#endif
-
-#if HAVE_UNISTD_H
-# include <unistd.h>
-#endif
-
-#if HAVE_SYS_STAT_H
-# include <sys/stat.h>
-#endif
-
-#if HAVE_FCNTL_H
-# include <fcntl.h>
-#endif
-
-#if HAVE_SIGNAL_H
-# include <signal.h>
-#endif
-
-#if HAVE_TIME_H
-# include <time.h>
-#endif
-
-#if HAVE_TERMIOS_H
-# include <termios.h>
-#endif
-
-#if HAVE_STRING_H
-# include <string.h>
-#endif
-
-#if HAVE_CTYPE_H
-# include <ctype.h>
-#endif
-
-#if HAVE_INTTYPES_H
-# include <inttypes.h>
-#else
-# if HAVE_STDINT_H
-#  include <stdint.h>
-# endif
-#endif
-
-#if HAVE_SYS_RESOURCE_H
-# include <sys/resource.h>
-#endif
-
-#include <stdlib.h>
-"; then :
-
-else
-  fptools_cv_htype_sup_unsigned_char=no
-fi
-
-
-            if ac_fn_c_compute_int "$LINENO" "sizeof(unsigned char) == sizeof(long double)" "HTYPE_IS_LDOUBLE"        "
-#include <stdio.h>
-#include <stddef.h>
-
-#if HAVE_SYS_TYPES_H
-# include <sys/types.h>
-#endif
-
-#if HAVE_UNISTD_H
-# include <unistd.h>
-#endif
-
-#if HAVE_SYS_STAT_H
-# include <sys/stat.h>
-#endif
-
-#if HAVE_FCNTL_H
-# include <fcntl.h>
-#endif
-
-#if HAVE_SIGNAL_H
-# include <signal.h>
-#endif
-
-#if HAVE_TIME_H
-# include <time.h>
-#endif
-
-#if HAVE_TERMIOS_H
-# include <termios.h>
-#endif
-
-#if HAVE_STRING_H
-# include <string.h>
-#endif
-
-#if HAVE_CTYPE_H
-# include <ctype.h>
-#endif
-
-#if HAVE_INTTYPES_H
-# include <inttypes.h>
-#else
-# if HAVE_STDINT_H
-#  include <stdint.h>
-# endif
-#endif
-
-#if HAVE_SYS_RESOURCE_H
-# include <sys/resource.h>
-#endif
-
-#include <stdlib.h>
-"; then :
-
-else
-  fptools_cv_htype_sup_unsigned_char=no
-fi
-
-
-            if test "$HTYPE_IS_FLOAT" -eq 1
-            then
-                fptools_cv_htype_unsigned_char=Float
-            elif test "$HTYPE_IS_DOUBLE" -eq 1
-            then
-                fptools_cv_htype_unsigned_char=Double
-            elif test "$HTYPE_IS_LDOUBLE" -eq 1
-            then
-                fptools_cv_htype_unsigned_char=LDouble
-            else
-                fptools_cv_htype_sup_unsigned_char=no
-            fi
-        else
-            if ac_fn_c_compute_int "$LINENO" "((unsigned char)(-1)) < ((unsigned char)0)" "HTYPE_IS_SIGNED"        "
-#include <stdio.h>
-#include <stddef.h>
-
-#if HAVE_SYS_TYPES_H
-# include <sys/types.h>
-#endif
-
-#if HAVE_UNISTD_H
-# include <unistd.h>
-#endif
-
-#if HAVE_SYS_STAT_H
-# include <sys/stat.h>
-#endif
-
-#if HAVE_FCNTL_H
-# include <fcntl.h>
-#endif
-
-#if HAVE_SIGNAL_H
-# include <signal.h>
-#endif
-
-#if HAVE_TIME_H
-# include <time.h>
-#endif
-
-#if HAVE_TERMIOS_H
-# include <termios.h>
-#endif
-
-#if HAVE_STRING_H
-# include <string.h>
-#endif
-
-#if HAVE_CTYPE_H
-# include <ctype.h>
-#endif
-
-#if HAVE_INTTYPES_H
-# include <inttypes.h>
-#else
-# if HAVE_STDINT_H
-#  include <stdint.h>
-# endif
-#endif
-
-#if HAVE_SYS_RESOURCE_H
-# include <sys/resource.h>
-#endif
-
-#include <stdlib.h>
-"; then :
-
-else
-  fptools_cv_htype_sup_unsigned_char=no
-fi
-
-
-            if ac_fn_c_compute_int "$LINENO" "sizeof(unsigned char) * 8" "HTYPE_SIZE"        "
-#include <stdio.h>
-#include <stddef.h>
-
-#if HAVE_SYS_TYPES_H
-# include <sys/types.h>
-#endif
-
-#if HAVE_UNISTD_H
-# include <unistd.h>
-#endif
-
-#if HAVE_SYS_STAT_H
-# include <sys/stat.h>
-#endif
-
-#if HAVE_FCNTL_H
-# include <fcntl.h>
-#endif
-
-#if HAVE_SIGNAL_H
-# include <signal.h>
-#endif
-
-#if HAVE_TIME_H
-# include <time.h>
-#endif
-
-#if HAVE_TERMIOS_H
-# include <termios.h>
-#endif
-
-#if HAVE_STRING_H
-# include <string.h>
-#endif
-
-#if HAVE_CTYPE_H
-# include <ctype.h>
-#endif
-
-#if HAVE_INTTYPES_H
-# include <inttypes.h>
-#else
-# if HAVE_STDINT_H
-#  include <stdint.h>
-# endif
-#endif
-
-#if HAVE_SYS_RESOURCE_H
-# include <sys/resource.h>
-#endif
-
-#include <stdlib.h>
-"; then :
-
-else
-  fptools_cv_htype_sup_unsigned_char=no
-fi
-
-
-            if test "$HTYPE_IS_SIGNED" -eq 0
-            then
-                fptools_cv_htype_unsigned_char="Word$HTYPE_SIZE"
-            else
-                fptools_cv_htype_unsigned_char="Int$HTYPE_SIZE"
-            fi
-        fi
-
-fi
-
-    if test "$fptools_cv_htype_sup_unsigned_char" = no
-    then
-
-        fptools_cv_htype_unsigned_char=NotReallyAType
-        { $as_echo "$as_me:${as_lineno-$LINENO}: result: not supported" >&5
-$as_echo "not supported" >&6; }
-
-    fi
-
-            if test "$fptools_cv_htype_sup_unsigned_char" = yes; then
-        { $as_echo "$as_me:${as_lineno-$LINENO}: result: $fptools_cv_htype_unsigned_char" >&5
-$as_echo "$fptools_cv_htype_unsigned_char" >&6; }
-
-cat >>confdefs.h <<_ACEOF
-#define HTYPE_UNSIGNED_CHAR $fptools_cv_htype_unsigned_char
-_ACEOF
-
-    fi
-
-
-
-
-
-
-
-
-
-
-    { $as_echo "$as_me:${as_lineno-$LINENO}: checking Haskell type for short" >&5
-$as_echo_n "checking Haskell type for short... " >&6; }
-    if ${fptools_cv_htype_short+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-
-        fptools_cv_htype_sup_short=yes
-        if ac_fn_c_compute_int "$LINENO" "(short)0.2 - (short)0.4 < 0 ? 0 : 1" "HTYPE_IS_INTEGRAL"        "
-#include <stdio.h>
-#include <stddef.h>
-
-#if HAVE_SYS_TYPES_H
-# include <sys/types.h>
-#endif
-
-#if HAVE_UNISTD_H
-# include <unistd.h>
-#endif
-
-#if HAVE_SYS_STAT_H
-# include <sys/stat.h>
-#endif
-
-#if HAVE_FCNTL_H
-# include <fcntl.h>
-#endif
-
-#if HAVE_SIGNAL_H
-# include <signal.h>
-#endif
-
-#if HAVE_TIME_H
-# include <time.h>
-#endif
-
-#if HAVE_TERMIOS_H
-# include <termios.h>
-#endif
-
-#if HAVE_STRING_H
-# include <string.h>
-#endif
-
-#if HAVE_CTYPE_H
-# include <ctype.h>
-#endif
-
-#if HAVE_INTTYPES_H
-# include <inttypes.h>
-#else
-# if HAVE_STDINT_H
-#  include <stdint.h>
-# endif
-#endif
-
-#if HAVE_SYS_RESOURCE_H
-# include <sys/resource.h>
-#endif
-
-#include <stdlib.h>
-"; then :
-
-else
-  HTYPE_IS_INTEGRAL=0
-fi
-
-
-
-        if test "$HTYPE_IS_INTEGRAL" -eq 0
-        then
-            if ac_fn_c_compute_int "$LINENO" "sizeof(short) == sizeof(float)" "HTYPE_IS_FLOAT"        "
-#include <stdio.h>
-#include <stddef.h>
-
-#if HAVE_SYS_TYPES_H
-# include <sys/types.h>
-#endif
-
-#if HAVE_UNISTD_H
-# include <unistd.h>
-#endif
-
-#if HAVE_SYS_STAT_H
-# include <sys/stat.h>
-#endif
-
-#if HAVE_FCNTL_H
-# include <fcntl.h>
-#endif
-
-#if HAVE_SIGNAL_H
-# include <signal.h>
-#endif
-
-#if HAVE_TIME_H
-# include <time.h>
-#endif
-
-#if HAVE_TERMIOS_H
-# include <termios.h>
-#endif
-
-#if HAVE_STRING_H
-# include <string.h>
-#endif
-
-#if HAVE_CTYPE_H
-# include <ctype.h>
-#endif
-
-#if HAVE_INTTYPES_H
-# include <inttypes.h>
-#else
-# if HAVE_STDINT_H
-#  include <stdint.h>
-# endif
-#endif
-
-#if HAVE_SYS_RESOURCE_H
-# include <sys/resource.h>
-#endif
-
-#include <stdlib.h>
-"; then :
-
-else
-  fptools_cv_htype_sup_short=no
-fi
-
-
-            if ac_fn_c_compute_int "$LINENO" "sizeof(short) == sizeof(double)" "HTYPE_IS_DOUBLE"        "
-#include <stdio.h>
-#include <stddef.h>
-
-#if HAVE_SYS_TYPES_H
-# include <sys/types.h>
-#endif
-
-#if HAVE_UNISTD_H
-# include <unistd.h>
-#endif
-
-#if HAVE_SYS_STAT_H
-# include <sys/stat.h>
-#endif
-
-#if HAVE_FCNTL_H
-# include <fcntl.h>
-#endif
-
-#if HAVE_SIGNAL_H
-# include <signal.h>
-#endif
-
-#if HAVE_TIME_H
-# include <time.h>
-#endif
-
-#if HAVE_TERMIOS_H
-# include <termios.h>
-#endif
-
-#if HAVE_STRING_H
-# include <string.h>
-#endif
-
-#if HAVE_CTYPE_H
-# include <ctype.h>
-#endif
-
-#if HAVE_INTTYPES_H
-# include <inttypes.h>
-#else
-# if HAVE_STDINT_H
-#  include <stdint.h>
-# endif
-#endif
-
-#if HAVE_SYS_RESOURCE_H
-# include <sys/resource.h>
-#endif
-
-#include <stdlib.h>
-"; then :
-
-else
-  fptools_cv_htype_sup_short=no
-fi
-
-
-            if ac_fn_c_compute_int "$LINENO" "sizeof(short) == sizeof(long double)" "HTYPE_IS_LDOUBLE"        "
-#include <stdio.h>
-#include <stddef.h>
-
-#if HAVE_SYS_TYPES_H
-# include <sys/types.h>
-#endif
-
-#if HAVE_UNISTD_H
-# include <unistd.h>
-#endif
-
-#if HAVE_SYS_STAT_H
-# include <sys/stat.h>
-#endif
-
-#if HAVE_FCNTL_H
-# include <fcntl.h>
-#endif
-
-#if HAVE_SIGNAL_H
-# include <signal.h>
-#endif
-
-#if HAVE_TIME_H
-# include <time.h>
-#endif
-
-#if HAVE_TERMIOS_H
-# include <termios.h>
-#endif
-
-#if HAVE_STRING_H
-# include <string.h>
-#endif
-
-#if HAVE_CTYPE_H
-# include <ctype.h>
-#endif
-
-#if HAVE_INTTYPES_H
-# include <inttypes.h>
-#else
-# if HAVE_STDINT_H
-#  include <stdint.h>
-# endif
-#endif
-
-#if HAVE_SYS_RESOURCE_H
-# include <sys/resource.h>
-#endif
-
-#include <stdlib.h>
-"; then :
-
-else
-  fptools_cv_htype_sup_short=no
-fi
-
-
-            if test "$HTYPE_IS_FLOAT" -eq 1
-            then
-                fptools_cv_htype_short=Float
-            elif test "$HTYPE_IS_DOUBLE" -eq 1
-            then
-                fptools_cv_htype_short=Double
-            elif test "$HTYPE_IS_LDOUBLE" -eq 1
-            then
-                fptools_cv_htype_short=LDouble
-            else
-                fptools_cv_htype_sup_short=no
-            fi
-        else
-            if ac_fn_c_compute_int "$LINENO" "((short)(-1)) < ((short)0)" "HTYPE_IS_SIGNED"        "
-#include <stdio.h>
-#include <stddef.h>
-
-#if HAVE_SYS_TYPES_H
-# include <sys/types.h>
-#endif
-
-#if HAVE_UNISTD_H
-# include <unistd.h>
-#endif
-
-#if HAVE_SYS_STAT_H
-# include <sys/stat.h>
-#endif
-
-#if HAVE_FCNTL_H
-# include <fcntl.h>
-#endif
-
-#if HAVE_SIGNAL_H
-# include <signal.h>
-#endif
-
-#if HAVE_TIME_H
-# include <time.h>
-#endif
-
-#if HAVE_TERMIOS_H
-# include <termios.h>
-#endif
-
-#if HAVE_STRING_H
-# include <string.h>
-#endif
-
-#if HAVE_CTYPE_H
-# include <ctype.h>
-#endif
-
-#if HAVE_INTTYPES_H
-# include <inttypes.h>
-#else
-# if HAVE_STDINT_H
-#  include <stdint.h>
-# endif
-#endif
-
-#if HAVE_SYS_RESOURCE_H
-# include <sys/resource.h>
-#endif
-
-#include <stdlib.h>
-"; then :
-
-else
-  fptools_cv_htype_sup_short=no
-fi
-
-
-            if ac_fn_c_compute_int "$LINENO" "sizeof(short) * 8" "HTYPE_SIZE"        "
-#include <stdio.h>
-#include <stddef.h>
-
-#if HAVE_SYS_TYPES_H
-# include <sys/types.h>
-#endif
-
-#if HAVE_UNISTD_H
-# include <unistd.h>
-#endif
-
-#if HAVE_SYS_STAT_H
-# include <sys/stat.h>
-#endif
-
-#if HAVE_FCNTL_H
-# include <fcntl.h>
-#endif
-
-#if HAVE_SIGNAL_H
-# include <signal.h>
-#endif
-
-#if HAVE_TIME_H
-# include <time.h>
-#endif
-
-#if HAVE_TERMIOS_H
-# include <termios.h>
-#endif
-
-#if HAVE_STRING_H
-# include <string.h>
-#endif
-
-#if HAVE_CTYPE_H
-# include <ctype.h>
-#endif
-
-#if HAVE_INTTYPES_H
-# include <inttypes.h>
-#else
-# if HAVE_STDINT_H
-#  include <stdint.h>
-# endif
-#endif
-
-#if HAVE_SYS_RESOURCE_H
-# include <sys/resource.h>
-#endif
-
-#include <stdlib.h>
-"; then :
-
-else
-  fptools_cv_htype_sup_short=no
-fi
-
-
-            if test "$HTYPE_IS_SIGNED" -eq 0
-            then
-                fptools_cv_htype_short="Word$HTYPE_SIZE"
-            else
-                fptools_cv_htype_short="Int$HTYPE_SIZE"
-            fi
-        fi
-
-fi
-
-    if test "$fptools_cv_htype_sup_short" = no
-    then
-
-        fptools_cv_htype_short=NotReallyAType
-        { $as_echo "$as_me:${as_lineno-$LINENO}: result: not supported" >&5
-$as_echo "not supported" >&6; }
-
-    fi
-
-            if test "$fptools_cv_htype_sup_short" = yes; then
-        { $as_echo "$as_me:${as_lineno-$LINENO}: result: $fptools_cv_htype_short" >&5
-$as_echo "$fptools_cv_htype_short" >&6; }
-
-cat >>confdefs.h <<_ACEOF
-#define HTYPE_SHORT $fptools_cv_htype_short
-_ACEOF
-
-    fi
-
-
-
-
-
-
-
-
-
-
-    { $as_echo "$as_me:${as_lineno-$LINENO}: checking Haskell type for unsigned short" >&5
-$as_echo_n "checking Haskell type for unsigned short... " >&6; }
-    if ${fptools_cv_htype_unsigned_short+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-
-        fptools_cv_htype_sup_unsigned_short=yes
-        if ac_fn_c_compute_int "$LINENO" "(unsigned short)0.2 - (unsigned short)0.4 < 0 ? 0 : 1" "HTYPE_IS_INTEGRAL"        "
-#include <stdio.h>
-#include <stddef.h>
-
-#if HAVE_SYS_TYPES_H
-# include <sys/types.h>
-#endif
-
-#if HAVE_UNISTD_H
-# include <unistd.h>
-#endif
-
-#if HAVE_SYS_STAT_H
-# include <sys/stat.h>
-#endif
-
-#if HAVE_FCNTL_H
-# include <fcntl.h>
-#endif
-
-#if HAVE_SIGNAL_H
-# include <signal.h>
-#endif
-
-#if HAVE_TIME_H
-# include <time.h>
-#endif
-
-#if HAVE_TERMIOS_H
-# include <termios.h>
-#endif
-
-#if HAVE_STRING_H
-# include <string.h>
-#endif
-
-#if HAVE_CTYPE_H
-# include <ctype.h>
-#endif
-
-#if HAVE_INTTYPES_H
-# include <inttypes.h>
-#else
-# if HAVE_STDINT_H
-#  include <stdint.h>
-# endif
-#endif
-
-#if HAVE_SYS_RESOURCE_H
-# include <sys/resource.h>
-#endif
-
-#include <stdlib.h>
-"; then :
-
-else
-  HTYPE_IS_INTEGRAL=0
-fi
-
-
-
-        if test "$HTYPE_IS_INTEGRAL" -eq 0
-        then
-            if ac_fn_c_compute_int "$LINENO" "sizeof(unsigned short) == sizeof(float)" "HTYPE_IS_FLOAT"        "
-#include <stdio.h>
-#include <stddef.h>
-
-#if HAVE_SYS_TYPES_H
-# include <sys/types.h>
-#endif
-
-#if HAVE_UNISTD_H
-# include <unistd.h>
-#endif
-
-#if HAVE_SYS_STAT_H
-# include <sys/stat.h>
-#endif
-
-#if HAVE_FCNTL_H
-# include <fcntl.h>
-#endif
-
-#if HAVE_SIGNAL_H
-# include <signal.h>
-#endif
-
-#if HAVE_TIME_H
-# include <time.h>
-#endif
-
-#if HAVE_TERMIOS_H
-# include <termios.h>
-#endif
-
-#if HAVE_STRING_H
-# include <string.h>
-#endif
-
-#if HAVE_CTYPE_H
-# include <ctype.h>
-#endif
-
-#if HAVE_INTTYPES_H
-# include <inttypes.h>
-#else
-# if HAVE_STDINT_H
-#  include <stdint.h>
-# endif
-#endif
-
-#if HAVE_SYS_RESOURCE_H
-# include <sys/resource.h>
-#endif
-
-#include <stdlib.h>
-"; then :
-
-else
-  fptools_cv_htype_sup_unsigned_short=no
-fi
-
-
-            if ac_fn_c_compute_int "$LINENO" "sizeof(unsigned short) == sizeof(double)" "HTYPE_IS_DOUBLE"        "
-#include <stdio.h>
-#include <stddef.h>
-
-#if HAVE_SYS_TYPES_H
-# include <sys/types.h>
-#endif
-
-#if HAVE_UNISTD_H
-# include <unistd.h>
-#endif
-
-#if HAVE_SYS_STAT_H
-# include <sys/stat.h>
-#endif
-
-#if HAVE_FCNTL_H
-# include <fcntl.h>
-#endif
-
-#if HAVE_SIGNAL_H
-# include <signal.h>
-#endif
-
-#if HAVE_TIME_H
-# include <time.h>
-#endif
-
-#if HAVE_TERMIOS_H
-# include <termios.h>
-#endif
-
-#if HAVE_STRING_H
-# include <string.h>
-#endif
-
-#if HAVE_CTYPE_H
-# include <ctype.h>
-#endif
-
-#if HAVE_INTTYPES_H
-# include <inttypes.h>
-#else
-# if HAVE_STDINT_H
-#  include <stdint.h>
-# endif
-#endif
-
-#if HAVE_SYS_RESOURCE_H
-# include <sys/resource.h>
-#endif
-
-#include <stdlib.h>
-"; then :
-
-else
-  fptools_cv_htype_sup_unsigned_short=no
-fi
-
-
-            if ac_fn_c_compute_int "$LINENO" "sizeof(unsigned short) == sizeof(long double)" "HTYPE_IS_LDOUBLE"        "
-#include <stdio.h>
-#include <stddef.h>
-
-#if HAVE_SYS_TYPES_H
-# include <sys/types.h>
-#endif
-
-#if HAVE_UNISTD_H
-# include <unistd.h>
-#endif
-
-#if HAVE_SYS_STAT_H
-# include <sys/stat.h>
-#endif
-
-#if HAVE_FCNTL_H
-# include <fcntl.h>
-#endif
-
-#if HAVE_SIGNAL_H
-# include <signal.h>
-#endif
-
-#if HAVE_TIME_H
-# include <time.h>
-#endif
-
-#if HAVE_TERMIOS_H
-# include <termios.h>
-#endif
-
-#if HAVE_STRING_H
-# include <string.h>
-#endif
-
-#if HAVE_CTYPE_H
-# include <ctype.h>
-#endif
-
-#if HAVE_INTTYPES_H
-# include <inttypes.h>
-#else
-# if HAVE_STDINT_H
-#  include <stdint.h>
-# endif
-#endif
-
-#if HAVE_SYS_RESOURCE_H
-# include <sys/resource.h>
-#endif
-
-#include <stdlib.h>
-"; then :
-
-else
-  fptools_cv_htype_sup_unsigned_short=no
-fi
-
-
-            if test "$HTYPE_IS_FLOAT" -eq 1
-            then
-                fptools_cv_htype_unsigned_short=Float
-            elif test "$HTYPE_IS_DOUBLE" -eq 1
-            then
-                fptools_cv_htype_unsigned_short=Double
-            elif test "$HTYPE_IS_LDOUBLE" -eq 1
-            then
-                fptools_cv_htype_unsigned_short=LDouble
-            else
-                fptools_cv_htype_sup_unsigned_short=no
-            fi
-        else
-            if ac_fn_c_compute_int "$LINENO" "((unsigned short)(-1)) < ((unsigned short)0)" "HTYPE_IS_SIGNED"        "
-#include <stdio.h>
-#include <stddef.h>
-
-#if HAVE_SYS_TYPES_H
-# include <sys/types.h>
-#endif
-
-#if HAVE_UNISTD_H
-# include <unistd.h>
-#endif
-
-#if HAVE_SYS_STAT_H
-# include <sys/stat.h>
-#endif
-
-#if HAVE_FCNTL_H
-# include <fcntl.h>
-#endif
-
-#if HAVE_SIGNAL_H
-# include <signal.h>
-#endif
-
-#if HAVE_TIME_H
-# include <time.h>
-#endif
-
-#if HAVE_TERMIOS_H
-# include <termios.h>
-#endif
-
-#if HAVE_STRING_H
-# include <string.h>
-#endif
-
-#if HAVE_CTYPE_H
-# include <ctype.h>
-#endif
-
-#if HAVE_INTTYPES_H
-# include <inttypes.h>
-#else
-# if HAVE_STDINT_H
-#  include <stdint.h>
-# endif
-#endif
-
-#if HAVE_SYS_RESOURCE_H
-# include <sys/resource.h>
-#endif
-
-#include <stdlib.h>
-"; then :
-
-else
-  fptools_cv_htype_sup_unsigned_short=no
-fi
-
-
-            if ac_fn_c_compute_int "$LINENO" "sizeof(unsigned short) * 8" "HTYPE_SIZE"        "
-#include <stdio.h>
-#include <stddef.h>
-
-#if HAVE_SYS_TYPES_H
-# include <sys/types.h>
-#endif
-
-#if HAVE_UNISTD_H
-# include <unistd.h>
-#endif
-
-#if HAVE_SYS_STAT_H
-# include <sys/stat.h>
-#endif
-
-#if HAVE_FCNTL_H
-# include <fcntl.h>
-#endif
-
-#if HAVE_SIGNAL_H
-# include <signal.h>
-#endif
-
-#if HAVE_TIME_H
-# include <time.h>
-#endif
-
-#if HAVE_TERMIOS_H
-# include <termios.h>
-#endif
-
-#if HAVE_STRING_H
-# include <string.h>
-#endif
-
-#if HAVE_CTYPE_H
-# include <ctype.h>
-#endif
-
-#if HAVE_INTTYPES_H
-# include <inttypes.h>
-#else
-# if HAVE_STDINT_H
-#  include <stdint.h>
-# endif
-#endif
-
-#if HAVE_SYS_RESOURCE_H
-# include <sys/resource.h>
-#endif
-
-#include <stdlib.h>
-"; then :
-
-else
-  fptools_cv_htype_sup_unsigned_short=no
-fi
-
-
-            if test "$HTYPE_IS_SIGNED" -eq 0
-            then
-                fptools_cv_htype_unsigned_short="Word$HTYPE_SIZE"
-            else
-                fptools_cv_htype_unsigned_short="Int$HTYPE_SIZE"
-            fi
-        fi
-
-fi
-
-    if test "$fptools_cv_htype_sup_unsigned_short" = no
-    then
-
-        fptools_cv_htype_unsigned_short=NotReallyAType
-        { $as_echo "$as_me:${as_lineno-$LINENO}: result: not supported" >&5
-$as_echo "not supported" >&6; }
-
-    fi
-
-            if test "$fptools_cv_htype_sup_unsigned_short" = yes; then
-        { $as_echo "$as_me:${as_lineno-$LINENO}: result: $fptools_cv_htype_unsigned_short" >&5
-$as_echo "$fptools_cv_htype_unsigned_short" >&6; }
-
-cat >>confdefs.h <<_ACEOF
-#define HTYPE_UNSIGNED_SHORT $fptools_cv_htype_unsigned_short
-_ACEOF
-
-    fi
-
-
-
-
-
-
-
-
-
-
-    { $as_echo "$as_me:${as_lineno-$LINENO}: checking Haskell type for int" >&5
-$as_echo_n "checking Haskell type for int... " >&6; }
-    if ${fptools_cv_htype_int+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-
-        fptools_cv_htype_sup_int=yes
-        if ac_fn_c_compute_int "$LINENO" "(int)0.2 - (int)0.4 < 0 ? 0 : 1" "HTYPE_IS_INTEGRAL"        "
-#include <stdio.h>
-#include <stddef.h>
-
-#if HAVE_SYS_TYPES_H
-# include <sys/types.h>
-#endif
-
-#if HAVE_UNISTD_H
-# include <unistd.h>
-#endif
-
-#if HAVE_SYS_STAT_H
-# include <sys/stat.h>
-#endif
-
-#if HAVE_FCNTL_H
-# include <fcntl.h>
-#endif
-
-#if HAVE_SIGNAL_H
-# include <signal.h>
-#endif
-
-#if HAVE_TIME_H
-# include <time.h>
-#endif
-
-#if HAVE_TERMIOS_H
-# include <termios.h>
-#endif
-
-#if HAVE_STRING_H
-# include <string.h>
-#endif
-
-#if HAVE_CTYPE_H
-# include <ctype.h>
-#endif
-
-#if HAVE_INTTYPES_H
-# include <inttypes.h>
-#else
-# if HAVE_STDINT_H
-#  include <stdint.h>
-# endif
-#endif
-
-#if HAVE_SYS_RESOURCE_H
-# include <sys/resource.h>
-#endif
-
-#include <stdlib.h>
-"; then :
-
-else
-  HTYPE_IS_INTEGRAL=0
-fi
-
-
-
-        if test "$HTYPE_IS_INTEGRAL" -eq 0
-        then
-            if ac_fn_c_compute_int "$LINENO" "sizeof(int) == sizeof(float)" "HTYPE_IS_FLOAT"        "
-#include <stdio.h>
-#include <stddef.h>
-
-#if HAVE_SYS_TYPES_H
-# include <sys/types.h>
-#endif
-
-#if HAVE_UNISTD_H
-# include <unistd.h>
-#endif
-
-#if HAVE_SYS_STAT_H
-# include <sys/stat.h>
-#endif
-
-#if HAVE_FCNTL_H
-# include <fcntl.h>
-#endif
-
-#if HAVE_SIGNAL_H
-# include <signal.h>
-#endif
-
-#if HAVE_TIME_H
-# include <time.h>
-#endif
-
-#if HAVE_TERMIOS_H
-# include <termios.h>
-#endif
-
-#if HAVE_STRING_H
-# include <string.h>
-#endif
-
-#if HAVE_CTYPE_H
-# include <ctype.h>
-#endif
-
-#if HAVE_INTTYPES_H
-# include <inttypes.h>
-#else
-# if HAVE_STDINT_H
-#  include <stdint.h>
-# endif
-#endif
-
-#if HAVE_SYS_RESOURCE_H
-# include <sys/resource.h>
-#endif
-
-#include <stdlib.h>
-"; then :
-
-else
-  fptools_cv_htype_sup_int=no
-fi
-
-
-            if ac_fn_c_compute_int "$LINENO" "sizeof(int) == sizeof(double)" "HTYPE_IS_DOUBLE"        "
-#include <stdio.h>
-#include <stddef.h>
-
-#if HAVE_SYS_TYPES_H
-# include <sys/types.h>
-#endif
-
-#if HAVE_UNISTD_H
-# include <unistd.h>
-#endif
-
-#if HAVE_SYS_STAT_H
-# include <sys/stat.h>
-#endif
-
-#if HAVE_FCNTL_H
-# include <fcntl.h>
-#endif
-
-#if HAVE_SIGNAL_H
-# include <signal.h>
-#endif
-
-#if HAVE_TIME_H
-# include <time.h>
-#endif
-
-#if HAVE_TERMIOS_H
-# include <termios.h>
-#endif
-
-#if HAVE_STRING_H
-# include <string.h>
-#endif
-
-#if HAVE_CTYPE_H
-# include <ctype.h>
-#endif
-
-#if HAVE_INTTYPES_H
-# include <inttypes.h>
-#else
-# if HAVE_STDINT_H
-#  include <stdint.h>
-# endif
-#endif
-
-#if HAVE_SYS_RESOURCE_H
-# include <sys/resource.h>
-#endif
-
-#include <stdlib.h>
-"; then :
-
-else
-  fptools_cv_htype_sup_int=no
-fi
-
-
-            if ac_fn_c_compute_int "$LINENO" "sizeof(int) == sizeof(long double)" "HTYPE_IS_LDOUBLE"        "
-#include <stdio.h>
-#include <stddef.h>
-
-#if HAVE_SYS_TYPES_H
-# include <sys/types.h>
-#endif
-
-#if HAVE_UNISTD_H
-# include <unistd.h>
-#endif
-
-#if HAVE_SYS_STAT_H
-# include <sys/stat.h>
-#endif
-
-#if HAVE_FCNTL_H
-# include <fcntl.h>
-#endif
-
-#if HAVE_SIGNAL_H
-# include <signal.h>
-#endif
-
-#if HAVE_TIME_H
-# include <time.h>
-#endif
-
-#if HAVE_TERMIOS_H
-# include <termios.h>
-#endif
-
-#if HAVE_STRING_H
-# include <string.h>
-#endif
-
-#if HAVE_CTYPE_H
-# include <ctype.h>
-#endif
-
-#if HAVE_INTTYPES_H
-# include <inttypes.h>
-#else
-# if HAVE_STDINT_H
-#  include <stdint.h>
-# endif
-#endif
-
-#if HAVE_SYS_RESOURCE_H
-# include <sys/resource.h>
-#endif
-
-#include <stdlib.h>
-"; then :
-
-else
-  fptools_cv_htype_sup_int=no
-fi
-
-
-            if test "$HTYPE_IS_FLOAT" -eq 1
-            then
-                fptools_cv_htype_int=Float
-            elif test "$HTYPE_IS_DOUBLE" -eq 1
-            then
-                fptools_cv_htype_int=Double
-            elif test "$HTYPE_IS_LDOUBLE" -eq 1
-            then
-                fptools_cv_htype_int=LDouble
-            else
-                fptools_cv_htype_sup_int=no
-            fi
-        else
-            if ac_fn_c_compute_int "$LINENO" "((int)(-1)) < ((int)0)" "HTYPE_IS_SIGNED"        "
-#include <stdio.h>
-#include <stddef.h>
-
-#if HAVE_SYS_TYPES_H
-# include <sys/types.h>
-#endif
-
-#if HAVE_UNISTD_H
-# include <unistd.h>
-#endif
-
-#if HAVE_SYS_STAT_H
-# include <sys/stat.h>
-#endif
-
-#if HAVE_FCNTL_H
-# include <fcntl.h>
-#endif
-
-#if HAVE_SIGNAL_H
-# include <signal.h>
-#endif
-
-#if HAVE_TIME_H
-# include <time.h>
-#endif
-
-#if HAVE_TERMIOS_H
-# include <termios.h>
-#endif
-
-#if HAVE_STRING_H
-# include <string.h>
-#endif
-
-#if HAVE_CTYPE_H
-# include <ctype.h>
-#endif
-
-#if HAVE_INTTYPES_H
-# include <inttypes.h>
-#else
-# if HAVE_STDINT_H
-#  include <stdint.h>
-# endif
-#endif
-
-#if HAVE_SYS_RESOURCE_H
-# include <sys/resource.h>
-#endif
-
-#include <stdlib.h>
-"; then :
-
-else
-  fptools_cv_htype_sup_int=no
-fi
-
-
-            if ac_fn_c_compute_int "$LINENO" "sizeof(int) * 8" "HTYPE_SIZE"        "
-#include <stdio.h>
-#include <stddef.h>
-
-#if HAVE_SYS_TYPES_H
-# include <sys/types.h>
-#endif
-
-#if HAVE_UNISTD_H
-# include <unistd.h>
-#endif
-
-#if HAVE_SYS_STAT_H
-# include <sys/stat.h>
-#endif
-
-#if HAVE_FCNTL_H
-# include <fcntl.h>
-#endif
-
-#if HAVE_SIGNAL_H
-# include <signal.h>
-#endif
-
-#if HAVE_TIME_H
-# include <time.h>
-#endif
-
-#if HAVE_TERMIOS_H
-# include <termios.h>
-#endif
-
-#if HAVE_STRING_H
-# include <string.h>
-#endif
-
-#if HAVE_CTYPE_H
-# include <ctype.h>
-#endif
-
-#if HAVE_INTTYPES_H
-# include <inttypes.h>
-#else
-# if HAVE_STDINT_H
-#  include <stdint.h>
-# endif
-#endif
-
-#if HAVE_SYS_RESOURCE_H
-# include <sys/resource.h>
-#endif
-
-#include <stdlib.h>
-"; then :
-
-else
-  fptools_cv_htype_sup_int=no
-fi
-
-
-            if test "$HTYPE_IS_SIGNED" -eq 0
-            then
-                fptools_cv_htype_int="Word$HTYPE_SIZE"
-            else
-                fptools_cv_htype_int="Int$HTYPE_SIZE"
-            fi
-        fi
-
-fi
-
-    if test "$fptools_cv_htype_sup_int" = no
-    then
-
-        fptools_cv_htype_int=NotReallyAType
-        { $as_echo "$as_me:${as_lineno-$LINENO}: result: not supported" >&5
-$as_echo "not supported" >&6; }
-
-    fi
-
-            if test "$fptools_cv_htype_sup_int" = yes; then
-        { $as_echo "$as_me:${as_lineno-$LINENO}: result: $fptools_cv_htype_int" >&5
-$as_echo "$fptools_cv_htype_int" >&6; }
-
-cat >>confdefs.h <<_ACEOF
-#define HTYPE_INT $fptools_cv_htype_int
-_ACEOF
-
-    fi
-
-
-
-
-
-
-
-
-
-
-    { $as_echo "$as_me:${as_lineno-$LINENO}: checking Haskell type for unsigned int" >&5
-$as_echo_n "checking Haskell type for unsigned int... " >&6; }
-    if ${fptools_cv_htype_unsigned_int+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-
-        fptools_cv_htype_sup_unsigned_int=yes
-        if ac_fn_c_compute_int "$LINENO" "(unsigned int)0.2 - (unsigned int)0.4 < 0 ? 0 : 1" "HTYPE_IS_INTEGRAL"        "
-#include <stdio.h>
-#include <stddef.h>
-
-#if HAVE_SYS_TYPES_H
-# include <sys/types.h>
-#endif
-
-#if HAVE_UNISTD_H
-# include <unistd.h>
-#endif
-
-#if HAVE_SYS_STAT_H
-# include <sys/stat.h>
-#endif
-
-#if HAVE_FCNTL_H
-# include <fcntl.h>
-#endif
-
-#if HAVE_SIGNAL_H
-# include <signal.h>
-#endif
-
-#if HAVE_TIME_H
-# include <time.h>
-#endif
-
-#if HAVE_TERMIOS_H
-# include <termios.h>
-#endif
-
-#if HAVE_STRING_H
-# include <string.h>
-#endif
-
-#if HAVE_CTYPE_H
-# include <ctype.h>
-#endif
-
-#if HAVE_INTTYPES_H
-# include <inttypes.h>
-#else
-# if HAVE_STDINT_H
-#  include <stdint.h>
-# endif
-#endif
-
-#if HAVE_SYS_RESOURCE_H
-# include <sys/resource.h>
-#endif
-
-#include <stdlib.h>
-"; then :
-
-else
-  HTYPE_IS_INTEGRAL=0
-fi
-
-
-
-        if test "$HTYPE_IS_INTEGRAL" -eq 0
-        then
-            if ac_fn_c_compute_int "$LINENO" "sizeof(unsigned int) == sizeof(float)" "HTYPE_IS_FLOAT"        "
-#include <stdio.h>
-#include <stddef.h>
-
-#if HAVE_SYS_TYPES_H
-# include <sys/types.h>
-#endif
-
-#if HAVE_UNISTD_H
-# include <unistd.h>
-#endif
-
-#if HAVE_SYS_STAT_H
-# include <sys/stat.h>
-#endif
-
-#if HAVE_FCNTL_H
-# include <fcntl.h>
-#endif
-
-#if HAVE_SIGNAL_H
-# include <signal.h>
-#endif
-
-#if HAVE_TIME_H
-# include <time.h>
-#endif
-
-#if HAVE_TERMIOS_H
-# include <termios.h>
-#endif
-
-#if HAVE_STRING_H
-# include <string.h>
-#endif
-
-#if HAVE_CTYPE_H
-# include <ctype.h>
-#endif
-
-#if HAVE_INTTYPES_H
-# include <inttypes.h>
-#else
-# if HAVE_STDINT_H
-#  include <stdint.h>
-# endif
-#endif
-
-#if HAVE_SYS_RESOURCE_H
-# include <sys/resource.h>
-#endif
-
-#include <stdlib.h>
-"; then :
-
-else
-  fptools_cv_htype_sup_unsigned_int=no
-fi
-
-
-            if ac_fn_c_compute_int "$LINENO" "sizeof(unsigned int) == sizeof(double)" "HTYPE_IS_DOUBLE"        "
-#include <stdio.h>
-#include <stddef.h>
-
-#if HAVE_SYS_TYPES_H
-# include <sys/types.h>
-#endif
-
-#if HAVE_UNISTD_H
-# include <unistd.h>
-#endif
-
-#if HAVE_SYS_STAT_H
-# include <sys/stat.h>
-#endif
-
-#if HAVE_FCNTL_H
-# include <fcntl.h>
-#endif
-
-#if HAVE_SIGNAL_H
-# include <signal.h>
-#endif
-
-#if HAVE_TIME_H
-# include <time.h>
-#endif
-
-#if HAVE_TERMIOS_H
-# include <termios.h>
-#endif
-
-#if HAVE_STRING_H
-# include <string.h>
-#endif
-
-#if HAVE_CTYPE_H
-# include <ctype.h>
-#endif
-
-#if HAVE_INTTYPES_H
-# include <inttypes.h>
-#else
-# if HAVE_STDINT_H
-#  include <stdint.h>
-# endif
-#endif
-
-#if HAVE_SYS_RESOURCE_H
-# include <sys/resource.h>
-#endif
-
-#include <stdlib.h>
-"; then :
-
-else
-  fptools_cv_htype_sup_unsigned_int=no
-fi
-
-
-            if ac_fn_c_compute_int "$LINENO" "sizeof(unsigned int) == sizeof(long double)" "HTYPE_IS_LDOUBLE"        "
-#include <stdio.h>
-#include <stddef.h>
-
-#if HAVE_SYS_TYPES_H
-# include <sys/types.h>
-#endif
-
-#if HAVE_UNISTD_H
-# include <unistd.h>
-#endif
-
-#if HAVE_SYS_STAT_H
-# include <sys/stat.h>
-#endif
-
-#if HAVE_FCNTL_H
-# include <fcntl.h>
-#endif
-
-#if HAVE_SIGNAL_H
-# include <signal.h>
-#endif
-
-#if HAVE_TIME_H
-# include <time.h>
-#endif
-
-#if HAVE_TERMIOS_H
-# include <termios.h>
-#endif
-
-#if HAVE_STRING_H
-# include <string.h>
-#endif
-
-#if HAVE_CTYPE_H
-# include <ctype.h>
-#endif
-
-#if HAVE_INTTYPES_H
-# include <inttypes.h>
-#else
-# if HAVE_STDINT_H
-#  include <stdint.h>
-# endif
-#endif
-
-#if HAVE_SYS_RESOURCE_H
-# include <sys/resource.h>
-#endif
-
-#include <stdlib.h>
-"; then :
-
-else
-  fptools_cv_htype_sup_unsigned_int=no
-fi
-
-
-            if test "$HTYPE_IS_FLOAT" -eq 1
-            then
-                fptools_cv_htype_unsigned_int=Float
-            elif test "$HTYPE_IS_DOUBLE" -eq 1
-            then
-                fptools_cv_htype_unsigned_int=Double
-            elif test "$HTYPE_IS_LDOUBLE" -eq 1
-            then
-                fptools_cv_htype_unsigned_int=LDouble
-            else
-                fptools_cv_htype_sup_unsigned_int=no
-            fi
-        else
-            if ac_fn_c_compute_int "$LINENO" "((unsigned int)(-1)) < ((unsigned int)0)" "HTYPE_IS_SIGNED"        "
-#include <stdio.h>
-#include <stddef.h>
-
-#if HAVE_SYS_TYPES_H
-# include <sys/types.h>
-#endif
-
-#if HAVE_UNISTD_H
-# include <unistd.h>
-#endif
-
-#if HAVE_SYS_STAT_H
-# include <sys/stat.h>
-#endif
-
-#if HAVE_FCNTL_H
-# include <fcntl.h>
-#endif
-
-#if HAVE_SIGNAL_H
-# include <signal.h>
-#endif
-
-#if HAVE_TIME_H
-# include <time.h>
-#endif
-
-#if HAVE_TERMIOS_H
-# include <termios.h>
-#endif
-
-#if HAVE_STRING_H
-# include <string.h>
-#endif
-
-#if HAVE_CTYPE_H
-# include <ctype.h>
-#endif
-
-#if HAVE_INTTYPES_H
-# include <inttypes.h>
-#else
-# if HAVE_STDINT_H
-#  include <stdint.h>
-# endif
-#endif
-
-#if HAVE_SYS_RESOURCE_H
-# include <sys/resource.h>
-#endif
-
-#include <stdlib.h>
-"; then :
-
-else
-  fptools_cv_htype_sup_unsigned_int=no
-fi
-
-
-            if ac_fn_c_compute_int "$LINENO" "sizeof(unsigned int) * 8" "HTYPE_SIZE"        "
-#include <stdio.h>
-#include <stddef.h>
-
-#if HAVE_SYS_TYPES_H
-# include <sys/types.h>
-#endif
-
-#if HAVE_UNISTD_H
-# include <unistd.h>
-#endif
-
-#if HAVE_SYS_STAT_H
-# include <sys/stat.h>
-#endif
-
-#if HAVE_FCNTL_H
-# include <fcntl.h>
-#endif
-
-#if HAVE_SIGNAL_H
-# include <signal.h>
-#endif
-
-#if HAVE_TIME_H
-# include <time.h>
-#endif
-
-#if HAVE_TERMIOS_H
-# include <termios.h>
-#endif
-
-#if HAVE_STRING_H
-# include <string.h>
-#endif
-
-#if HAVE_CTYPE_H
-# include <ctype.h>
-#endif
-
-#if HAVE_INTTYPES_H
-# include <inttypes.h>
-#else
-# if HAVE_STDINT_H
-#  include <stdint.h>
-# endif
-#endif
-
-#if HAVE_SYS_RESOURCE_H
-# include <sys/resource.h>
-#endif
-
-#include <stdlib.h>
-"; then :
-
-else
-  fptools_cv_htype_sup_unsigned_int=no
-fi
-
-
-            if test "$HTYPE_IS_SIGNED" -eq 0
-            then
-                fptools_cv_htype_unsigned_int="Word$HTYPE_SIZE"
-            else
-                fptools_cv_htype_unsigned_int="Int$HTYPE_SIZE"
-            fi
-        fi
-
-fi
-
-    if test "$fptools_cv_htype_sup_unsigned_int" = no
-    then
-
-        fptools_cv_htype_unsigned_int=NotReallyAType
-        { $as_echo "$as_me:${as_lineno-$LINENO}: result: not supported" >&5
-$as_echo "not supported" >&6; }
-
-    fi
-
-            if test "$fptools_cv_htype_sup_unsigned_int" = yes; then
-        { $as_echo "$as_me:${as_lineno-$LINENO}: result: $fptools_cv_htype_unsigned_int" >&5
-$as_echo "$fptools_cv_htype_unsigned_int" >&6; }
-
-cat >>confdefs.h <<_ACEOF
-#define HTYPE_UNSIGNED_INT $fptools_cv_htype_unsigned_int
-_ACEOF
-
-    fi
-
-
-
-
-
-
-
-
-
-
-    { $as_echo "$as_me:${as_lineno-$LINENO}: checking Haskell type for long" >&5
-$as_echo_n "checking Haskell type for long... " >&6; }
-    if ${fptools_cv_htype_long+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-
-        fptools_cv_htype_sup_long=yes
-        if ac_fn_c_compute_int "$LINENO" "(long)0.2 - (long)0.4 < 0 ? 0 : 1" "HTYPE_IS_INTEGRAL"        "
-#include <stdio.h>
-#include <stddef.h>
-
-#if HAVE_SYS_TYPES_H
-# include <sys/types.h>
-#endif
-
-#if HAVE_UNISTD_H
-# include <unistd.h>
-#endif
-
-#if HAVE_SYS_STAT_H
-# include <sys/stat.h>
-#endif
-
-#if HAVE_FCNTL_H
-# include <fcntl.h>
-#endif
-
-#if HAVE_SIGNAL_H
-# include <signal.h>
-#endif
-
-#if HAVE_TIME_H
-# include <time.h>
-#endif
-
-#if HAVE_TERMIOS_H
-# include <termios.h>
-#endif
-
-#if HAVE_STRING_H
-# include <string.h>
-#endif
-
-#if HAVE_CTYPE_H
-# include <ctype.h>
-#endif
-
-#if HAVE_INTTYPES_H
-# include <inttypes.h>
-#else
-# if HAVE_STDINT_H
-#  include <stdint.h>
-# endif
-#endif
-
-#if HAVE_SYS_RESOURCE_H
-# include <sys/resource.h>
-#endif
-
-#include <stdlib.h>
-"; then :
-
-else
-  HTYPE_IS_INTEGRAL=0
-fi
-
-
-
-        if test "$HTYPE_IS_INTEGRAL" -eq 0
-        then
-            if ac_fn_c_compute_int "$LINENO" "sizeof(long) == sizeof(float)" "HTYPE_IS_FLOAT"        "
-#include <stdio.h>
-#include <stddef.h>
-
-#if HAVE_SYS_TYPES_H
-# include <sys/types.h>
-#endif
-
-#if HAVE_UNISTD_H
-# include <unistd.h>
-#endif
-
-#if HAVE_SYS_STAT_H
-# include <sys/stat.h>
-#endif
-
-#if HAVE_FCNTL_H
-# include <fcntl.h>
-#endif
-
-#if HAVE_SIGNAL_H
-# include <signal.h>
-#endif
-
-#if HAVE_TIME_H
-# include <time.h>
-#endif
-
-#if HAVE_TERMIOS_H
-# include <termios.h>
-#endif
-
-#if HAVE_STRING_H
-# include <string.h>
-#endif
-
-#if HAVE_CTYPE_H
-# include <ctype.h>
-#endif
-
-#if HAVE_INTTYPES_H
-# include <inttypes.h>
-#else
-# if HAVE_STDINT_H
-#  include <stdint.h>
-# endif
-#endif
-
-#if HAVE_SYS_RESOURCE_H
-# include <sys/resource.h>
-#endif
-
-#include <stdlib.h>
-"; then :
-
-else
-  fptools_cv_htype_sup_long=no
-fi
-
-
-            if ac_fn_c_compute_int "$LINENO" "sizeof(long) == sizeof(double)" "HTYPE_IS_DOUBLE"        "
-#include <stdio.h>
-#include <stddef.h>
-
-#if HAVE_SYS_TYPES_H
-# include <sys/types.h>
-#endif
-
-#if HAVE_UNISTD_H
-# include <unistd.h>
-#endif
-
-#if HAVE_SYS_STAT_H
-# include <sys/stat.h>
-#endif
-
-#if HAVE_FCNTL_H
-# include <fcntl.h>
-#endif
-
-#if HAVE_SIGNAL_H
-# include <signal.h>
-#endif
-
-#if HAVE_TIME_H
-# include <time.h>
-#endif
-
-#if HAVE_TERMIOS_H
-# include <termios.h>
-#endif
-
-#if HAVE_STRING_H
-# include <string.h>
-#endif
-
-#if HAVE_CTYPE_H
-# include <ctype.h>
-#endif
-
-#if HAVE_INTTYPES_H
-# include <inttypes.h>
-#else
-# if HAVE_STDINT_H
-#  include <stdint.h>
-# endif
-#endif
-
-#if HAVE_SYS_RESOURCE_H
-# include <sys/resource.h>
-#endif
-
-#include <stdlib.h>
-"; then :
-
-else
-  fptools_cv_htype_sup_long=no
-fi
-
-
-            if ac_fn_c_compute_int "$LINENO" "sizeof(long) == sizeof(long double)" "HTYPE_IS_LDOUBLE"        "
-#include <stdio.h>
-#include <stddef.h>
-
-#if HAVE_SYS_TYPES_H
-# include <sys/types.h>
-#endif
-
-#if HAVE_UNISTD_H
-# include <unistd.h>
-#endif
-
-#if HAVE_SYS_STAT_H
-# include <sys/stat.h>
-#endif
-
-#if HAVE_FCNTL_H
-# include <fcntl.h>
-#endif
-
-#if HAVE_SIGNAL_H
-# include <signal.h>
-#endif
-
-#if HAVE_TIME_H
-# include <time.h>
-#endif
-
-#if HAVE_TERMIOS_H
-# include <termios.h>
-#endif
-
-#if HAVE_STRING_H
-# include <string.h>
-#endif
-
-#if HAVE_CTYPE_H
-# include <ctype.h>
-#endif
-
-#if HAVE_INTTYPES_H
-# include <inttypes.h>
-#else
-# if HAVE_STDINT_H
-#  include <stdint.h>
-# endif
-#endif
-
-#if HAVE_SYS_RESOURCE_H
-# include <sys/resource.h>
-#endif
-
-#include <stdlib.h>
-"; then :
-
-else
-  fptools_cv_htype_sup_long=no
-fi
-
-
-            if test "$HTYPE_IS_FLOAT" -eq 1
-            then
-                fptools_cv_htype_long=Float
-            elif test "$HTYPE_IS_DOUBLE" -eq 1
-            then
-                fptools_cv_htype_long=Double
-            elif test "$HTYPE_IS_LDOUBLE" -eq 1
-            then
-                fptools_cv_htype_long=LDouble
-            else
-                fptools_cv_htype_sup_long=no
-            fi
-        else
-            if ac_fn_c_compute_int "$LINENO" "((long)(-1)) < ((long)0)" "HTYPE_IS_SIGNED"        "
-#include <stdio.h>
-#include <stddef.h>
-
-#if HAVE_SYS_TYPES_H
-# include <sys/types.h>
-#endif
-
-#if HAVE_UNISTD_H
-# include <unistd.h>
-#endif
-
-#if HAVE_SYS_STAT_H
-# include <sys/stat.h>
-#endif
-
-#if HAVE_FCNTL_H
-# include <fcntl.h>
-#endif
-
-#if HAVE_SIGNAL_H
-# include <signal.h>
-#endif
-
-#if HAVE_TIME_H
-# include <time.h>
-#endif
-
-#if HAVE_TERMIOS_H
-# include <termios.h>
-#endif
-
-#if HAVE_STRING_H
-# include <string.h>
-#endif
-
-#if HAVE_CTYPE_H
-# include <ctype.h>
-#endif
-
-#if HAVE_INTTYPES_H
-# include <inttypes.h>
-#else
-# if HAVE_STDINT_H
-#  include <stdint.h>
-# endif
-#endif
-
-#if HAVE_SYS_RESOURCE_H
-# include <sys/resource.h>
-#endif
-
-#include <stdlib.h>
-"; then :
-
-else
-  fptools_cv_htype_sup_long=no
-fi
-
-
-            if ac_fn_c_compute_int "$LINENO" "sizeof(long) * 8" "HTYPE_SIZE"        "
-#include <stdio.h>
-#include <stddef.h>
-
-#if HAVE_SYS_TYPES_H
-# include <sys/types.h>
-#endif
-
-#if HAVE_UNISTD_H
-# include <unistd.h>
-#endif
-
-#if HAVE_SYS_STAT_H
-# include <sys/stat.h>
-#endif
-
-#if HAVE_FCNTL_H
-# include <fcntl.h>
-#endif
-
-#if HAVE_SIGNAL_H
-# include <signal.h>
-#endif
-
-#if HAVE_TIME_H
-# include <time.h>
-#endif
-
-#if HAVE_TERMIOS_H
-# include <termios.h>
-#endif
-
-#if HAVE_STRING_H
-# include <string.h>
-#endif
-
-#if HAVE_CTYPE_H
-# include <ctype.h>
-#endif
-
-#if HAVE_INTTYPES_H
-# include <inttypes.h>
-#else
-# if HAVE_STDINT_H
-#  include <stdint.h>
-# endif
-#endif
-
-#if HAVE_SYS_RESOURCE_H
-# include <sys/resource.h>
-#endif
-
-#include <stdlib.h>
-"; then :
-
-else
-  fptools_cv_htype_sup_long=no
-fi
-
-
-            if test "$HTYPE_IS_SIGNED" -eq 0
-            then
-                fptools_cv_htype_long="Word$HTYPE_SIZE"
-            else
-                fptools_cv_htype_long="Int$HTYPE_SIZE"
-            fi
-        fi
-
-fi
-
-    if test "$fptools_cv_htype_sup_long" = no
-    then
-
-        fptools_cv_htype_long=NotReallyAType
-        { $as_echo "$as_me:${as_lineno-$LINENO}: result: not supported" >&5
-$as_echo "not supported" >&6; }
-
-    fi
-
-            if test "$fptools_cv_htype_sup_long" = yes; then
-        { $as_echo "$as_me:${as_lineno-$LINENO}: result: $fptools_cv_htype_long" >&5
-$as_echo "$fptools_cv_htype_long" >&6; }
-
-cat >>confdefs.h <<_ACEOF
-#define HTYPE_LONG $fptools_cv_htype_long
-_ACEOF
-
-    fi
-
-
-
-
-
-
-
-
-
-
-    { $as_echo "$as_me:${as_lineno-$LINENO}: checking Haskell type for unsigned long" >&5
-$as_echo_n "checking Haskell type for unsigned long... " >&6; }
-    if ${fptools_cv_htype_unsigned_long+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-
-        fptools_cv_htype_sup_unsigned_long=yes
-        if ac_fn_c_compute_int "$LINENO" "(unsigned long)0.2 - (unsigned long)0.4 < 0 ? 0 : 1" "HTYPE_IS_INTEGRAL"        "
-#include <stdio.h>
-#include <stddef.h>
-
-#if HAVE_SYS_TYPES_H
-# include <sys/types.h>
-#endif
-
-#if HAVE_UNISTD_H
-# include <unistd.h>
-#endif
-
-#if HAVE_SYS_STAT_H
-# include <sys/stat.h>
-#endif
-
-#if HAVE_FCNTL_H
-# include <fcntl.h>
-#endif
-
-#if HAVE_SIGNAL_H
-# include <signal.h>
-#endif
-
-#if HAVE_TIME_H
-# include <time.h>
-#endif
-
-#if HAVE_TERMIOS_H
-# include <termios.h>
-#endif
-
-#if HAVE_STRING_H
-# include <string.h>
-#endif
-
-#if HAVE_CTYPE_H
-# include <ctype.h>
-#endif
-
-#if HAVE_INTTYPES_H
-# include <inttypes.h>
-#else
-# if HAVE_STDINT_H
-#  include <stdint.h>
-# endif
-#endif
-
-#if HAVE_SYS_RESOURCE_H
-# include <sys/resource.h>
-#endif
-
-#include <stdlib.h>
-"; then :
-
-else
-  HTYPE_IS_INTEGRAL=0
-fi
-
-
-
-        if test "$HTYPE_IS_INTEGRAL" -eq 0
-        then
-            if ac_fn_c_compute_int "$LINENO" "sizeof(unsigned long) == sizeof(float)" "HTYPE_IS_FLOAT"        "
-#include <stdio.h>
-#include <stddef.h>
-
-#if HAVE_SYS_TYPES_H
-# include <sys/types.h>
-#endif
-
-#if HAVE_UNISTD_H
-# include <unistd.h>
-#endif
-
-#if HAVE_SYS_STAT_H
-# include <sys/stat.h>
-#endif
-
-#if HAVE_FCNTL_H
-# include <fcntl.h>
-#endif
-
-#if HAVE_SIGNAL_H
-# include <signal.h>
-#endif
-
-#if HAVE_TIME_H
-# include <time.h>
-#endif
-
-#if HAVE_TERMIOS_H
-# include <termios.h>
-#endif
-
-#if HAVE_STRING_H
-# include <string.h>
-#endif
-
-#if HAVE_CTYPE_H
-# include <ctype.h>
-#endif
-
-#if HAVE_INTTYPES_H
-# include <inttypes.h>
-#else
-# if HAVE_STDINT_H
-#  include <stdint.h>
-# endif
-#endif
-
-#if HAVE_SYS_RESOURCE_H
-# include <sys/resource.h>
-#endif
-
-#include <stdlib.h>
-"; then :
-
-else
-  fptools_cv_htype_sup_unsigned_long=no
-fi
-
-
-            if ac_fn_c_compute_int "$LINENO" "sizeof(unsigned long) == sizeof(double)" "HTYPE_IS_DOUBLE"        "
-#include <stdio.h>
-#include <stddef.h>
-
-#if HAVE_SYS_TYPES_H
-# include <sys/types.h>
-#endif
-
-#if HAVE_UNISTD_H
-# include <unistd.h>
-#endif
-
-#if HAVE_SYS_STAT_H
-# include <sys/stat.h>
-#endif
-
-#if HAVE_FCNTL_H
-# include <fcntl.h>
-#endif
-
-#if HAVE_SIGNAL_H
-# include <signal.h>
-#endif
-
-#if HAVE_TIME_H
-# include <time.h>
-#endif
-
-#if HAVE_TERMIOS_H
-# include <termios.h>
-#endif
-
-#if HAVE_STRING_H
-# include <string.h>
-#endif
-
-#if HAVE_CTYPE_H
-# include <ctype.h>
-#endif
-
-#if HAVE_INTTYPES_H
-# include <inttypes.h>
-#else
-# if HAVE_STDINT_H
-#  include <stdint.h>
-# endif
-#endif
-
-#if HAVE_SYS_RESOURCE_H
-# include <sys/resource.h>
-#endif
-
-#include <stdlib.h>
-"; then :
-
-else
-  fptools_cv_htype_sup_unsigned_long=no
-fi
-
-
-            if ac_fn_c_compute_int "$LINENO" "sizeof(unsigned long) == sizeof(long double)" "HTYPE_IS_LDOUBLE"        "
-#include <stdio.h>
-#include <stddef.h>
-
-#if HAVE_SYS_TYPES_H
-# include <sys/types.h>
-#endif
-
-#if HAVE_UNISTD_H
-# include <unistd.h>
-#endif
-
-#if HAVE_SYS_STAT_H
-# include <sys/stat.h>
-#endif
-
-#if HAVE_FCNTL_H
-# include <fcntl.h>
-#endif
-
-#if HAVE_SIGNAL_H
-# include <signal.h>
-#endif
-
-#if HAVE_TIME_H
-# include <time.h>
-#endif
-
-#if HAVE_TERMIOS_H
-# include <termios.h>
-#endif
-
-#if HAVE_STRING_H
-# include <string.h>
-#endif
-
-#if HAVE_CTYPE_H
-# include <ctype.h>
-#endif
-
-#if HAVE_INTTYPES_H
-# include <inttypes.h>
-#else
-# if HAVE_STDINT_H
-#  include <stdint.h>
-# endif
-#endif
-
-#if HAVE_SYS_RESOURCE_H
-# include <sys/resource.h>
-#endif
-
-#include <stdlib.h>
-"; then :
-
-else
-  fptools_cv_htype_sup_unsigned_long=no
-fi
-
-
-            if test "$HTYPE_IS_FLOAT" -eq 1
-            then
-                fptools_cv_htype_unsigned_long=Float
-            elif test "$HTYPE_IS_DOUBLE" -eq 1
-            then
-                fptools_cv_htype_unsigned_long=Double
-            elif test "$HTYPE_IS_LDOUBLE" -eq 1
-            then
-                fptools_cv_htype_unsigned_long=LDouble
-            else
-                fptools_cv_htype_sup_unsigned_long=no
-            fi
-        else
-            if ac_fn_c_compute_int "$LINENO" "((unsigned long)(-1)) < ((unsigned long)0)" "HTYPE_IS_SIGNED"        "
-#include <stdio.h>
-#include <stddef.h>
-
-#if HAVE_SYS_TYPES_H
-# include <sys/types.h>
-#endif
-
-#if HAVE_UNISTD_H
-# include <unistd.h>
-#endif
-
-#if HAVE_SYS_STAT_H
-# include <sys/stat.h>
-#endif
-
-#if HAVE_FCNTL_H
-# include <fcntl.h>
-#endif
-
-#if HAVE_SIGNAL_H
-# include <signal.h>
-#endif
-
-#if HAVE_TIME_H
-# include <time.h>
-#endif
-
-#if HAVE_TERMIOS_H
-# include <termios.h>
-#endif
-
-#if HAVE_STRING_H
-# include <string.h>
-#endif
-
-#if HAVE_CTYPE_H
-# include <ctype.h>
-#endif
-
-#if HAVE_INTTYPES_H
-# include <inttypes.h>
-#else
-# if HAVE_STDINT_H
-#  include <stdint.h>
-# endif
-#endif
-
-#if HAVE_SYS_RESOURCE_H
-# include <sys/resource.h>
-#endif
-
-#include <stdlib.h>
-"; then :
-
-else
-  fptools_cv_htype_sup_unsigned_long=no
-fi
-
-
-            if ac_fn_c_compute_int "$LINENO" "sizeof(unsigned long) * 8" "HTYPE_SIZE"        "
-#include <stdio.h>
-#include <stddef.h>
-
-#if HAVE_SYS_TYPES_H
-# include <sys/types.h>
-#endif
-
-#if HAVE_UNISTD_H
-# include <unistd.h>
-#endif
-
-#if HAVE_SYS_STAT_H
-# include <sys/stat.h>
-#endif
-
-#if HAVE_FCNTL_H
-# include <fcntl.h>
-#endif
-
-#if HAVE_SIGNAL_H
-# include <signal.h>
-#endif
-
-#if HAVE_TIME_H
-# include <time.h>
-#endif
-
-#if HAVE_TERMIOS_H
-# include <termios.h>
-#endif
-
-#if HAVE_STRING_H
-# include <string.h>
-#endif
-
-#if HAVE_CTYPE_H
-# include <ctype.h>
-#endif
-
-#if HAVE_INTTYPES_H
-# include <inttypes.h>
-#else
-# if HAVE_STDINT_H
-#  include <stdint.h>
-# endif
-#endif
-
-#if HAVE_SYS_RESOURCE_H
-# include <sys/resource.h>
-#endif
-
-#include <stdlib.h>
-"; then :
-
-else
-  fptools_cv_htype_sup_unsigned_long=no
-fi
-
-
-            if test "$HTYPE_IS_SIGNED" -eq 0
-            then
-                fptools_cv_htype_unsigned_long="Word$HTYPE_SIZE"
-            else
-                fptools_cv_htype_unsigned_long="Int$HTYPE_SIZE"
-            fi
-        fi
-
-fi
-
-    if test "$fptools_cv_htype_sup_unsigned_long" = no
-    then
-
-        fptools_cv_htype_unsigned_long=NotReallyAType
-        { $as_echo "$as_me:${as_lineno-$LINENO}: result: not supported" >&5
-$as_echo "not supported" >&6; }
-
-    fi
-
-            if test "$fptools_cv_htype_sup_unsigned_long" = yes; then
-        { $as_echo "$as_me:${as_lineno-$LINENO}: result: $fptools_cv_htype_unsigned_long" >&5
-$as_echo "$fptools_cv_htype_unsigned_long" >&6; }
-
-cat >>confdefs.h <<_ACEOF
-#define HTYPE_UNSIGNED_LONG $fptools_cv_htype_unsigned_long
-_ACEOF
-
-    fi
-
-
-if test "$ac_cv_type_long_long" = yes; then
-
-
-
-
-
-
-
-
-    { $as_echo "$as_me:${as_lineno-$LINENO}: checking Haskell type for long long" >&5
-$as_echo_n "checking Haskell type for long long... " >&6; }
-    if ${fptools_cv_htype_long_long+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-
-        fptools_cv_htype_sup_long_long=yes
-        if ac_fn_c_compute_int "$LINENO" "(long long)0.2 - (long long)0.4 < 0 ? 0 : 1" "HTYPE_IS_INTEGRAL"        "
-#include <stdio.h>
-#include <stddef.h>
-
-#if HAVE_SYS_TYPES_H
-# include <sys/types.h>
-#endif
-
-#if HAVE_UNISTD_H
-# include <unistd.h>
-#endif
-
-#if HAVE_SYS_STAT_H
-# include <sys/stat.h>
-#endif
-
-#if HAVE_FCNTL_H
-# include <fcntl.h>
-#endif
-
-#if HAVE_SIGNAL_H
-# include <signal.h>
-#endif
-
-#if HAVE_TIME_H
-# include <time.h>
-#endif
-
-#if HAVE_TERMIOS_H
-# include <termios.h>
-#endif
-
-#if HAVE_STRING_H
-# include <string.h>
-#endif
-
-#if HAVE_CTYPE_H
-# include <ctype.h>
-#endif
-
-#if HAVE_INTTYPES_H
-# include <inttypes.h>
-#else
-# if HAVE_STDINT_H
-#  include <stdint.h>
-# endif
-#endif
-
-#if HAVE_SYS_RESOURCE_H
-# include <sys/resource.h>
-#endif
-
-#include <stdlib.h>
-"; then :
-
-else
-  HTYPE_IS_INTEGRAL=0
-fi
-
-
-
-        if test "$HTYPE_IS_INTEGRAL" -eq 0
-        then
-            if ac_fn_c_compute_int "$LINENO" "sizeof(long long) == sizeof(float)" "HTYPE_IS_FLOAT"        "
-#include <stdio.h>
-#include <stddef.h>
-
-#if HAVE_SYS_TYPES_H
-# include <sys/types.h>
-#endif
-
-#if HAVE_UNISTD_H
-# include <unistd.h>
-#endif
-
-#if HAVE_SYS_STAT_H
-# include <sys/stat.h>
-#endif
-
-#if HAVE_FCNTL_H
-# include <fcntl.h>
-#endif
-
-#if HAVE_SIGNAL_H
-# include <signal.h>
-#endif
-
-#if HAVE_TIME_H
-# include <time.h>
-#endif
-
-#if HAVE_TERMIOS_H
-# include <termios.h>
-#endif
-
-#if HAVE_STRING_H
-# include <string.h>
-#endif
-
-#if HAVE_CTYPE_H
-# include <ctype.h>
-#endif
-
-#if HAVE_INTTYPES_H
-# include <inttypes.h>
-#else
-# if HAVE_STDINT_H
-#  include <stdint.h>
-# endif
-#endif
-
-#if HAVE_SYS_RESOURCE_H
-# include <sys/resource.h>
-#endif
-
-#include <stdlib.h>
-"; then :
-
-else
-  fptools_cv_htype_sup_long_long=no
-fi
-
-
-            if ac_fn_c_compute_int "$LINENO" "sizeof(long long) == sizeof(double)" "HTYPE_IS_DOUBLE"        "
-#include <stdio.h>
-#include <stddef.h>
-
-#if HAVE_SYS_TYPES_H
-# include <sys/types.h>
-#endif
-
-#if HAVE_UNISTD_H
-# include <unistd.h>
-#endif
-
-#if HAVE_SYS_STAT_H
-# include <sys/stat.h>
-#endif
-
-#if HAVE_FCNTL_H
-# include <fcntl.h>
-#endif
-
-#if HAVE_SIGNAL_H
-# include <signal.h>
-#endif
-
-#if HAVE_TIME_H
-# include <time.h>
-#endif
-
-#if HAVE_TERMIOS_H
-# include <termios.h>
-#endif
-
-#if HAVE_STRING_H
-# include <string.h>
-#endif
-
-#if HAVE_CTYPE_H
-# include <ctype.h>
-#endif
-
-#if HAVE_INTTYPES_H
-# include <inttypes.h>
-#else
-# if HAVE_STDINT_H
-#  include <stdint.h>
-# endif
-#endif
-
-#if HAVE_SYS_RESOURCE_H
-# include <sys/resource.h>
-#endif
-
-#include <stdlib.h>
-"; then :
-
-else
-  fptools_cv_htype_sup_long_long=no
-fi
-
-
-            if ac_fn_c_compute_int "$LINENO" "sizeof(long long) == sizeof(long double)" "HTYPE_IS_LDOUBLE"        "
-#include <stdio.h>
-#include <stddef.h>
-
-#if HAVE_SYS_TYPES_H
-# include <sys/types.h>
-#endif
-
-#if HAVE_UNISTD_H
-# include <unistd.h>
-#endif
-
-#if HAVE_SYS_STAT_H
-# include <sys/stat.h>
-#endif
-
-#if HAVE_FCNTL_H
-# include <fcntl.h>
-#endif
-
-#if HAVE_SIGNAL_H
-# include <signal.h>
-#endif
-
-#if HAVE_TIME_H
-# include <time.h>
-#endif
-
-#if HAVE_TERMIOS_H
-# include <termios.h>
-#endif
-
-#if HAVE_STRING_H
-# include <string.h>
-#endif
-
-#if HAVE_CTYPE_H
-# include <ctype.h>
-#endif
-
-#if HAVE_INTTYPES_H
-# include <inttypes.h>
-#else
-# if HAVE_STDINT_H
-#  include <stdint.h>
-# endif
-#endif
-
-#if HAVE_SYS_RESOURCE_H
-# include <sys/resource.h>
-#endif
-
-#include <stdlib.h>
-"; then :
-
-else
-  fptools_cv_htype_sup_long_long=no
-fi
-
-
-            if test "$HTYPE_IS_FLOAT" -eq 1
-            then
-                fptools_cv_htype_long_long=Float
-            elif test "$HTYPE_IS_DOUBLE" -eq 1
-            then
-                fptools_cv_htype_long_long=Double
-            elif test "$HTYPE_IS_LDOUBLE" -eq 1
-            then
-                fptools_cv_htype_long_long=LDouble
-            else
-                fptools_cv_htype_sup_long_long=no
-            fi
-        else
-            if ac_fn_c_compute_int "$LINENO" "((long long)(-1)) < ((long long)0)" "HTYPE_IS_SIGNED"        "
-#include <stdio.h>
-#include <stddef.h>
-
-#if HAVE_SYS_TYPES_H
-# include <sys/types.h>
-#endif
-
-#if HAVE_UNISTD_H
-# include <unistd.h>
-#endif
-
-#if HAVE_SYS_STAT_H
-# include <sys/stat.h>
-#endif
-
-#if HAVE_FCNTL_H
-# include <fcntl.h>
-#endif
-
-#if HAVE_SIGNAL_H
-# include <signal.h>
-#endif
-
-#if HAVE_TIME_H
-# include <time.h>
-#endif
-
-#if HAVE_TERMIOS_H
-# include <termios.h>
-#endif
-
-#if HAVE_STRING_H
-# include <string.h>
-#endif
-
-#if HAVE_CTYPE_H
-# include <ctype.h>
-#endif
-
-#if HAVE_INTTYPES_H
-# include <inttypes.h>
-#else
-# if HAVE_STDINT_H
-#  include <stdint.h>
-# endif
-#endif
-
-#if HAVE_SYS_RESOURCE_H
-# include <sys/resource.h>
-#endif
-
-#include <stdlib.h>
-"; then :
-
-else
-  fptools_cv_htype_sup_long_long=no
-fi
-
-
-            if ac_fn_c_compute_int "$LINENO" "sizeof(long long) * 8" "HTYPE_SIZE"        "
-#include <stdio.h>
-#include <stddef.h>
-
-#if HAVE_SYS_TYPES_H
-# include <sys/types.h>
-#endif
-
-#if HAVE_UNISTD_H
-# include <unistd.h>
-#endif
-
-#if HAVE_SYS_STAT_H
-# include <sys/stat.h>
-#endif
-
-#if HAVE_FCNTL_H
-# include <fcntl.h>
-#endif
-
-#if HAVE_SIGNAL_H
-# include <signal.h>
-#endif
-
-#if HAVE_TIME_H
-# include <time.h>
-#endif
-
-#if HAVE_TERMIOS_H
-# include <termios.h>
-#endif
-
-#if HAVE_STRING_H
-# include <string.h>
-#endif
-
-#if HAVE_CTYPE_H
-# include <ctype.h>
-#endif
-
-#if HAVE_INTTYPES_H
-# include <inttypes.h>
-#else
-# if HAVE_STDINT_H
-#  include <stdint.h>
-# endif
-#endif
-
-#if HAVE_SYS_RESOURCE_H
-# include <sys/resource.h>
-#endif
-
-#include <stdlib.h>
-"; then :
-
-else
-  fptools_cv_htype_sup_long_long=no
-fi
-
-
-            if test "$HTYPE_IS_SIGNED" -eq 0
-            then
-                fptools_cv_htype_long_long="Word$HTYPE_SIZE"
-            else
-                fptools_cv_htype_long_long="Int$HTYPE_SIZE"
-            fi
-        fi
-
-fi
-
-    if test "$fptools_cv_htype_sup_long_long" = no
-    then
-
-        fptools_cv_htype_long_long=NotReallyAType
-        { $as_echo "$as_me:${as_lineno-$LINENO}: result: not supported" >&5
-$as_echo "not supported" >&6; }
-
-    fi
-
-            if test "$fptools_cv_htype_sup_long_long" = yes; then
-        { $as_echo "$as_me:${as_lineno-$LINENO}: result: $fptools_cv_htype_long_long" >&5
-$as_echo "$fptools_cv_htype_long_long" >&6; }
-
-cat >>confdefs.h <<_ACEOF
-#define HTYPE_LONG_LONG $fptools_cv_htype_long_long
-_ACEOF
-
-    fi
-
-
-
-
-
-
-
-
-
-
-    { $as_echo "$as_me:${as_lineno-$LINENO}: checking Haskell type for unsigned long long" >&5
-$as_echo_n "checking Haskell type for unsigned long long... " >&6; }
-    if ${fptools_cv_htype_unsigned_long_long+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-
-        fptools_cv_htype_sup_unsigned_long_long=yes
-        if ac_fn_c_compute_int "$LINENO" "(unsigned long long)0.2 - (unsigned long long)0.4 < 0 ? 0 : 1" "HTYPE_IS_INTEGRAL"        "
-#include <stdio.h>
-#include <stddef.h>
-
-#if HAVE_SYS_TYPES_H
-# include <sys/types.h>
-#endif
-
-#if HAVE_UNISTD_H
-# include <unistd.h>
-#endif
-
-#if HAVE_SYS_STAT_H
-# include <sys/stat.h>
-#endif
-
-#if HAVE_FCNTL_H
-# include <fcntl.h>
-#endif
-
-#if HAVE_SIGNAL_H
-# include <signal.h>
-#endif
-
-#if HAVE_TIME_H
-# include <time.h>
-#endif
-
-#if HAVE_TERMIOS_H
-# include <termios.h>
-#endif
-
-#if HAVE_STRING_H
-# include <string.h>
-#endif
-
-#if HAVE_CTYPE_H
-# include <ctype.h>
-#endif
-
-#if HAVE_INTTYPES_H
-# include <inttypes.h>
-#else
-# if HAVE_STDINT_H
-#  include <stdint.h>
-# endif
-#endif
-
-#if HAVE_SYS_RESOURCE_H
-# include <sys/resource.h>
-#endif
-
-#include <stdlib.h>
-"; then :
-
-else
-  HTYPE_IS_INTEGRAL=0
-fi
-
-
-
-        if test "$HTYPE_IS_INTEGRAL" -eq 0
-        then
-            if ac_fn_c_compute_int "$LINENO" "sizeof(unsigned long long) == sizeof(float)" "HTYPE_IS_FLOAT"        "
-#include <stdio.h>
-#include <stddef.h>
-
-#if HAVE_SYS_TYPES_H
-# include <sys/types.h>
-#endif
-
-#if HAVE_UNISTD_H
-# include <unistd.h>
-#endif
-
-#if HAVE_SYS_STAT_H
-# include <sys/stat.h>
-#endif
-
-#if HAVE_FCNTL_H
-# include <fcntl.h>
-#endif
-
-#if HAVE_SIGNAL_H
-# include <signal.h>
-#endif
-
-#if HAVE_TIME_H
-# include <time.h>
-#endif
-
-#if HAVE_TERMIOS_H
-# include <termios.h>
-#endif
-
-#if HAVE_STRING_H
-# include <string.h>
-#endif
-
-#if HAVE_CTYPE_H
-# include <ctype.h>
-#endif
-
-#if HAVE_INTTYPES_H
-# include <inttypes.h>
-#else
-# if HAVE_STDINT_H
-#  include <stdint.h>
-# endif
-#endif
-
-#if HAVE_SYS_RESOURCE_H
-# include <sys/resource.h>
-#endif
-
-#include <stdlib.h>
-"; then :
-
-else
-  fptools_cv_htype_sup_unsigned_long_long=no
-fi
-
-
-            if ac_fn_c_compute_int "$LINENO" "sizeof(unsigned long long) == sizeof(double)" "HTYPE_IS_DOUBLE"        "
-#include <stdio.h>
-#include <stddef.h>
-
-#if HAVE_SYS_TYPES_H
-# include <sys/types.h>
-#endif
-
-#if HAVE_UNISTD_H
-# include <unistd.h>
-#endif
-
-#if HAVE_SYS_STAT_H
-# include <sys/stat.h>
-#endif
-
-#if HAVE_FCNTL_H
-# include <fcntl.h>
-#endif
-
-#if HAVE_SIGNAL_H
-# include <signal.h>
-#endif
-
-#if HAVE_TIME_H
-# include <time.h>
-#endif
-
-#if HAVE_TERMIOS_H
-# include <termios.h>
-#endif
-
-#if HAVE_STRING_H
-# include <string.h>
-#endif
-
-#if HAVE_CTYPE_H
-# include <ctype.h>
-#endif
-
-#if HAVE_INTTYPES_H
-# include <inttypes.h>
-#else
-# if HAVE_STDINT_H
-#  include <stdint.h>
-# endif
-#endif
-
-#if HAVE_SYS_RESOURCE_H
-# include <sys/resource.h>
-#endif
-
-#include <stdlib.h>
-"; then :
-
-else
-  fptools_cv_htype_sup_unsigned_long_long=no
-fi
-
-
-            if ac_fn_c_compute_int "$LINENO" "sizeof(unsigned long long) == sizeof(long double)" "HTYPE_IS_LDOUBLE"        "
-#include <stdio.h>
-#include <stddef.h>
-
-#if HAVE_SYS_TYPES_H
-# include <sys/types.h>
-#endif
-
-#if HAVE_UNISTD_H
-# include <unistd.h>
-#endif
-
-#if HAVE_SYS_STAT_H
-# include <sys/stat.h>
-#endif
-
-#if HAVE_FCNTL_H
-# include <fcntl.h>
-#endif
-
-#if HAVE_SIGNAL_H
-# include <signal.h>
-#endif
-
-#if HAVE_TIME_H
-# include <time.h>
-#endif
-
-#if HAVE_TERMIOS_H
-# include <termios.h>
-#endif
-
-#if HAVE_STRING_H
-# include <string.h>
-#endif
-
-#if HAVE_CTYPE_H
-# include <ctype.h>
-#endif
-
-#if HAVE_INTTYPES_H
-# include <inttypes.h>
-#else
-# if HAVE_STDINT_H
-#  include <stdint.h>
-# endif
-#endif
-
-#if HAVE_SYS_RESOURCE_H
-# include <sys/resource.h>
-#endif
-
-#include <stdlib.h>
-"; then :
-
-else
-  fptools_cv_htype_sup_unsigned_long_long=no
-fi
-
-
-            if test "$HTYPE_IS_FLOAT" -eq 1
-            then
-                fptools_cv_htype_unsigned_long_long=Float
-            elif test "$HTYPE_IS_DOUBLE" -eq 1
-            then
-                fptools_cv_htype_unsigned_long_long=Double
-            elif test "$HTYPE_IS_LDOUBLE" -eq 1
-            then
-                fptools_cv_htype_unsigned_long_long=LDouble
-            else
-                fptools_cv_htype_sup_unsigned_long_long=no
-            fi
-        else
-            if ac_fn_c_compute_int "$LINENO" "((unsigned long long)(-1)) < ((unsigned long long)0)" "HTYPE_IS_SIGNED"        "
-#include <stdio.h>
-#include <stddef.h>
-
-#if HAVE_SYS_TYPES_H
-# include <sys/types.h>
-#endif
-
-#if HAVE_UNISTD_H
-# include <unistd.h>
-#endif
-
-#if HAVE_SYS_STAT_H
-# include <sys/stat.h>
-#endif
-
-#if HAVE_FCNTL_H
-# include <fcntl.h>
-#endif
-
-#if HAVE_SIGNAL_H
-# include <signal.h>
-#endif
-
-#if HAVE_TIME_H
-# include <time.h>
-#endif
-
-#if HAVE_TERMIOS_H
-# include <termios.h>
-#endif
-
-#if HAVE_STRING_H
-# include <string.h>
-#endif
-
-#if HAVE_CTYPE_H
-# include <ctype.h>
-#endif
-
-#if HAVE_INTTYPES_H
-# include <inttypes.h>
-#else
-# if HAVE_STDINT_H
-#  include <stdint.h>
-# endif
-#endif
-
-#if HAVE_SYS_RESOURCE_H
-# include <sys/resource.h>
-#endif
-
-#include <stdlib.h>
-"; then :
-
-else
-  fptools_cv_htype_sup_unsigned_long_long=no
-fi
-
-
-            if ac_fn_c_compute_int "$LINENO" "sizeof(unsigned long long) * 8" "HTYPE_SIZE"        "
-#include <stdio.h>
-#include <stddef.h>
-
-#if HAVE_SYS_TYPES_H
-# include <sys/types.h>
-#endif
-
-#if HAVE_UNISTD_H
-# include <unistd.h>
-#endif
-
-#if HAVE_SYS_STAT_H
-# include <sys/stat.h>
-#endif
-
-#if HAVE_FCNTL_H
-# include <fcntl.h>
-#endif
-
-#if HAVE_SIGNAL_H
-# include <signal.h>
-#endif
-
-#if HAVE_TIME_H
-# include <time.h>
-#endif
-
-#if HAVE_TERMIOS_H
-# include <termios.h>
-#endif
-
-#if HAVE_STRING_H
-# include <string.h>
-#endif
-
-#if HAVE_CTYPE_H
-# include <ctype.h>
-#endif
-
-#if HAVE_INTTYPES_H
-# include <inttypes.h>
-#else
-# if HAVE_STDINT_H
-#  include <stdint.h>
-# endif
-#endif
-
-#if HAVE_SYS_RESOURCE_H
-# include <sys/resource.h>
-#endif
-
-#include <stdlib.h>
-"; then :
-
-else
-  fptools_cv_htype_sup_unsigned_long_long=no
-fi
-
-
-            if test "$HTYPE_IS_SIGNED" -eq 0
-            then
-                fptools_cv_htype_unsigned_long_long="Word$HTYPE_SIZE"
-            else
-                fptools_cv_htype_unsigned_long_long="Int$HTYPE_SIZE"
-            fi
-        fi
-
-fi
-
-    if test "$fptools_cv_htype_sup_unsigned_long_long" = no
-    then
-
-        fptools_cv_htype_unsigned_long_long=NotReallyAType
-        { $as_echo "$as_me:${as_lineno-$LINENO}: result: not supported" >&5
-$as_echo "not supported" >&6; }
-
-    fi
-
-            if test "$fptools_cv_htype_sup_unsigned_long_long" = yes; then
-        { $as_echo "$as_me:${as_lineno-$LINENO}: result: $fptools_cv_htype_unsigned_long_long" >&5
-$as_echo "$fptools_cv_htype_unsigned_long_long" >&6; }
-
-cat >>confdefs.h <<_ACEOF
-#define HTYPE_UNSIGNED_LONG_LONG $fptools_cv_htype_unsigned_long_long
-_ACEOF
-
-    fi
-
-
-fi
-
-
-
-
-
-
-
-
-    { $as_echo "$as_me:${as_lineno-$LINENO}: checking Haskell type for float" >&5
-$as_echo_n "checking Haskell type for float... " >&6; }
-    if ${fptools_cv_htype_float+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-
-        fptools_cv_htype_sup_float=yes
-        if ac_fn_c_compute_int "$LINENO" "(float)0.2 - (float)0.4 < 0 ? 0 : 1" "HTYPE_IS_INTEGRAL"        "
-#include <stdio.h>
-#include <stddef.h>
-
-#if HAVE_SYS_TYPES_H
-# include <sys/types.h>
-#endif
-
-#if HAVE_UNISTD_H
-# include <unistd.h>
-#endif
-
-#if HAVE_SYS_STAT_H
-# include <sys/stat.h>
-#endif
-
-#if HAVE_FCNTL_H
-# include <fcntl.h>
-#endif
-
-#if HAVE_SIGNAL_H
-# include <signal.h>
-#endif
-
-#if HAVE_TIME_H
-# include <time.h>
-#endif
-
-#if HAVE_TERMIOS_H
-# include <termios.h>
-#endif
-
-#if HAVE_STRING_H
-# include <string.h>
-#endif
-
-#if HAVE_CTYPE_H
-# include <ctype.h>
-#endif
-
-#if HAVE_INTTYPES_H
-# include <inttypes.h>
-#else
-# if HAVE_STDINT_H
-#  include <stdint.h>
-# endif
-#endif
-
-#if HAVE_SYS_RESOURCE_H
-# include <sys/resource.h>
-#endif
-
-#include <stdlib.h>
-"; then :
-
-else
-  HTYPE_IS_INTEGRAL=0
-fi
-
-
-
-        if test "$HTYPE_IS_INTEGRAL" -eq 0
-        then
-            if ac_fn_c_compute_int "$LINENO" "sizeof(float) == sizeof(float)" "HTYPE_IS_FLOAT"        "
-#include <stdio.h>
-#include <stddef.h>
-
-#if HAVE_SYS_TYPES_H
-# include <sys/types.h>
-#endif
-
-#if HAVE_UNISTD_H
-# include <unistd.h>
-#endif
-
-#if HAVE_SYS_STAT_H
-# include <sys/stat.h>
-#endif
-
-#if HAVE_FCNTL_H
-# include <fcntl.h>
-#endif
-
-#if HAVE_SIGNAL_H
-# include <signal.h>
-#endif
-
-#if HAVE_TIME_H
-# include <time.h>
-#endif
-
-#if HAVE_TERMIOS_H
-# include <termios.h>
-#endif
-
-#if HAVE_STRING_H
-# include <string.h>
-#endif
-
-#if HAVE_CTYPE_H
-# include <ctype.h>
-#endif
-
-#if HAVE_INTTYPES_H
-# include <inttypes.h>
-#else
-# if HAVE_STDINT_H
-#  include <stdint.h>
-# endif
-#endif
-
-#if HAVE_SYS_RESOURCE_H
-# include <sys/resource.h>
-#endif
-
-#include <stdlib.h>
-"; then :
-
-else
-  fptools_cv_htype_sup_float=no
-fi
-
-
-            if ac_fn_c_compute_int "$LINENO" "sizeof(float) == sizeof(double)" "HTYPE_IS_DOUBLE"        "
-#include <stdio.h>
-#include <stddef.h>
-
-#if HAVE_SYS_TYPES_H
-# include <sys/types.h>
-#endif
-
-#if HAVE_UNISTD_H
-# include <unistd.h>
-#endif
-
-#if HAVE_SYS_STAT_H
-# include <sys/stat.h>
-#endif
-
-#if HAVE_FCNTL_H
-# include <fcntl.h>
-#endif
-
-#if HAVE_SIGNAL_H
-# include <signal.h>
-#endif
-
-#if HAVE_TIME_H
-# include <time.h>
-#endif
-
-#if HAVE_TERMIOS_H
-# include <termios.h>
-#endif
-
-#if HAVE_STRING_H
-# include <string.h>
-#endif
-
-#if HAVE_CTYPE_H
-# include <ctype.h>
-#endif
-
-#if HAVE_INTTYPES_H
-# include <inttypes.h>
-#else
-# if HAVE_STDINT_H
-#  include <stdint.h>
-# endif
-#endif
-
-#if HAVE_SYS_RESOURCE_H
-# include <sys/resource.h>
-#endif
-
-#include <stdlib.h>
-"; then :
-
-else
-  fptools_cv_htype_sup_float=no
-fi
-
-
-            if ac_fn_c_compute_int "$LINENO" "sizeof(float) == sizeof(long double)" "HTYPE_IS_LDOUBLE"        "
-#include <stdio.h>
-#include <stddef.h>
-
-#if HAVE_SYS_TYPES_H
-# include <sys/types.h>
-#endif
-
-#if HAVE_UNISTD_H
-# include <unistd.h>
-#endif
-
-#if HAVE_SYS_STAT_H
-# include <sys/stat.h>
-#endif
-
-#if HAVE_FCNTL_H
-# include <fcntl.h>
-#endif
-
-#if HAVE_SIGNAL_H
-# include <signal.h>
-#endif
-
-#if HAVE_TIME_H
-# include <time.h>
-#endif
-
-#if HAVE_TERMIOS_H
-# include <termios.h>
-#endif
-
-#if HAVE_STRING_H
-# include <string.h>
-#endif
-
-#if HAVE_CTYPE_H
-# include <ctype.h>
-#endif
-
-#if HAVE_INTTYPES_H
-# include <inttypes.h>
-#else
-# if HAVE_STDINT_H
-#  include <stdint.h>
-# endif
-#endif
-
-#if HAVE_SYS_RESOURCE_H
-# include <sys/resource.h>
-#endif
-
-#include <stdlib.h>
-"; then :
-
-else
-  fptools_cv_htype_sup_float=no
-fi
-
-
-            if test "$HTYPE_IS_FLOAT" -eq 1
-            then
-                fptools_cv_htype_float=Float
-            elif test "$HTYPE_IS_DOUBLE" -eq 1
-            then
-                fptools_cv_htype_float=Double
-            elif test "$HTYPE_IS_LDOUBLE" -eq 1
-            then
-                fptools_cv_htype_float=LDouble
-            else
-                fptools_cv_htype_sup_float=no
-            fi
-        else
-            if ac_fn_c_compute_int "$LINENO" "((float)(-1)) < ((float)0)" "HTYPE_IS_SIGNED"        "
-#include <stdio.h>
-#include <stddef.h>
-
-#if HAVE_SYS_TYPES_H
-# include <sys/types.h>
-#endif
-
-#if HAVE_UNISTD_H
-# include <unistd.h>
-#endif
-
-#if HAVE_SYS_STAT_H
-# include <sys/stat.h>
-#endif
-
-#if HAVE_FCNTL_H
-# include <fcntl.h>
-#endif
-
-#if HAVE_SIGNAL_H
-# include <signal.h>
-#endif
-
-#if HAVE_TIME_H
-# include <time.h>
-#endif
-
-#if HAVE_TERMIOS_H
-# include <termios.h>
-#endif
-
-#if HAVE_STRING_H
-# include <string.h>
-#endif
-
-#if HAVE_CTYPE_H
-# include <ctype.h>
-#endif
-
-#if HAVE_INTTYPES_H
-# include <inttypes.h>
-#else
-# if HAVE_STDINT_H
-#  include <stdint.h>
-# endif
-#endif
-
-#if HAVE_SYS_RESOURCE_H
-# include <sys/resource.h>
-#endif
-
-#include <stdlib.h>
-"; then :
-
-else
-  fptools_cv_htype_sup_float=no
-fi
-
-
-            if ac_fn_c_compute_int "$LINENO" "sizeof(float) * 8" "HTYPE_SIZE"        "
-#include <stdio.h>
-#include <stddef.h>
-
-#if HAVE_SYS_TYPES_H
-# include <sys/types.h>
-#endif
-
-#if HAVE_UNISTD_H
-# include <unistd.h>
-#endif
-
-#if HAVE_SYS_STAT_H
-# include <sys/stat.h>
-#endif
-
-#if HAVE_FCNTL_H
-# include <fcntl.h>
-#endif
-
-#if HAVE_SIGNAL_H
-# include <signal.h>
-#endif
-
-#if HAVE_TIME_H
-# include <time.h>
-#endif
-
-#if HAVE_TERMIOS_H
-# include <termios.h>
-#endif
-
-#if HAVE_STRING_H
-# include <string.h>
-#endif
-
-#if HAVE_CTYPE_H
-# include <ctype.h>
-#endif
-
-#if HAVE_INTTYPES_H
-# include <inttypes.h>
-#else
-# if HAVE_STDINT_H
-#  include <stdint.h>
-# endif
-#endif
-
-#if HAVE_SYS_RESOURCE_H
-# include <sys/resource.h>
-#endif
-
-#include <stdlib.h>
-"; then :
-
-else
-  fptools_cv_htype_sup_float=no
-fi
-
-
-            if test "$HTYPE_IS_SIGNED" -eq 0
-            then
-                fptools_cv_htype_float="Word$HTYPE_SIZE"
-            else
-                fptools_cv_htype_float="Int$HTYPE_SIZE"
-            fi
-        fi
-
-fi
-
-    if test "$fptools_cv_htype_sup_float" = no
-    then
-
-        fptools_cv_htype_float=NotReallyAType
-        { $as_echo "$as_me:${as_lineno-$LINENO}: result: not supported" >&5
-$as_echo "not supported" >&6; }
-
-    fi
-
-            if test "$fptools_cv_htype_sup_float" = yes; then
-        { $as_echo "$as_me:${as_lineno-$LINENO}: result: $fptools_cv_htype_float" >&5
-$as_echo "$fptools_cv_htype_float" >&6; }
-
-cat >>confdefs.h <<_ACEOF
-#define HTYPE_FLOAT $fptools_cv_htype_float
-_ACEOF
-
-    fi
-
-
-
-
-
-
-
-
-
-
-    { $as_echo "$as_me:${as_lineno-$LINENO}: checking Haskell type for double" >&5
-$as_echo_n "checking Haskell type for double... " >&6; }
-    if ${fptools_cv_htype_double+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-
-        fptools_cv_htype_sup_double=yes
-        if ac_fn_c_compute_int "$LINENO" "(double)0.2 - (double)0.4 < 0 ? 0 : 1" "HTYPE_IS_INTEGRAL"        "
-#include <stdio.h>
-#include <stddef.h>
-
-#if HAVE_SYS_TYPES_H
-# include <sys/types.h>
-#endif
-
-#if HAVE_UNISTD_H
-# include <unistd.h>
-#endif
-
-#if HAVE_SYS_STAT_H
-# include <sys/stat.h>
-#endif
-
-#if HAVE_FCNTL_H
-# include <fcntl.h>
-#endif
-
-#if HAVE_SIGNAL_H
-# include <signal.h>
-#endif
-
-#if HAVE_TIME_H
-# include <time.h>
-#endif
-
-#if HAVE_TERMIOS_H
-# include <termios.h>
-#endif
-
-#if HAVE_STRING_H
-# include <string.h>
-#endif
-
-#if HAVE_CTYPE_H
-# include <ctype.h>
-#endif
-
-#if HAVE_INTTYPES_H
-# include <inttypes.h>
-#else
-# if HAVE_STDINT_H
-#  include <stdint.h>
-# endif
-#endif
-
-#if HAVE_SYS_RESOURCE_H
-# include <sys/resource.h>
-#endif
-
-#include <stdlib.h>
-"; then :
-
-else
-  HTYPE_IS_INTEGRAL=0
-fi
-
-
-
-        if test "$HTYPE_IS_INTEGRAL" -eq 0
-        then
-            if ac_fn_c_compute_int "$LINENO" "sizeof(double) == sizeof(float)" "HTYPE_IS_FLOAT"        "
-#include <stdio.h>
-#include <stddef.h>
-
-#if HAVE_SYS_TYPES_H
-# include <sys/types.h>
-#endif
-
-#if HAVE_UNISTD_H
-# include <unistd.h>
-#endif
-
-#if HAVE_SYS_STAT_H
-# include <sys/stat.h>
-#endif
-
-#if HAVE_FCNTL_H
-# include <fcntl.h>
-#endif
-
-#if HAVE_SIGNAL_H
-# include <signal.h>
-#endif
-
-#if HAVE_TIME_H
-# include <time.h>
-#endif
-
-#if HAVE_TERMIOS_H
-# include <termios.h>
-#endif
-
-#if HAVE_STRING_H
-# include <string.h>
-#endif
-
-#if HAVE_CTYPE_H
-# include <ctype.h>
-#endif
-
-#if HAVE_INTTYPES_H
-# include <inttypes.h>
-#else
-# if HAVE_STDINT_H
-#  include <stdint.h>
-# endif
-#endif
-
-#if HAVE_SYS_RESOURCE_H
-# include <sys/resource.h>
-#endif
-
-#include <stdlib.h>
-"; then :
-
-else
-  fptools_cv_htype_sup_double=no
-fi
-
-
-            if ac_fn_c_compute_int "$LINENO" "sizeof(double) == sizeof(double)" "HTYPE_IS_DOUBLE"        "
-#include <stdio.h>
-#include <stddef.h>
-
-#if HAVE_SYS_TYPES_H
-# include <sys/types.h>
-#endif
-
-#if HAVE_UNISTD_H
-# include <unistd.h>
-#endif
-
-#if HAVE_SYS_STAT_H
-# include <sys/stat.h>
-#endif
-
-#if HAVE_FCNTL_H
-# include <fcntl.h>
-#endif
-
-#if HAVE_SIGNAL_H
-# include <signal.h>
-#endif
-
-#if HAVE_TIME_H
-# include <time.h>
-#endif
-
-#if HAVE_TERMIOS_H
-# include <termios.h>
-#endif
-
-#if HAVE_STRING_H
-# include <string.h>
-#endif
-
-#if HAVE_CTYPE_H
-# include <ctype.h>
-#endif
-
-#if HAVE_INTTYPES_H
-# include <inttypes.h>
-#else
-# if HAVE_STDINT_H
-#  include <stdint.h>
-# endif
-#endif
-
-#if HAVE_SYS_RESOURCE_H
-# include <sys/resource.h>
-#endif
-
-#include <stdlib.h>
-"; then :
-
-else
-  fptools_cv_htype_sup_double=no
-fi
-
-
-            if ac_fn_c_compute_int "$LINENO" "sizeof(double) == sizeof(long double)" "HTYPE_IS_LDOUBLE"        "
-#include <stdio.h>
-#include <stddef.h>
-
-#if HAVE_SYS_TYPES_H
-# include <sys/types.h>
-#endif
-
-#if HAVE_UNISTD_H
-# include <unistd.h>
-#endif
-
-#if HAVE_SYS_STAT_H
-# include <sys/stat.h>
-#endif
-
-#if HAVE_FCNTL_H
-# include <fcntl.h>
-#endif
-
-#if HAVE_SIGNAL_H
-# include <signal.h>
-#endif
-
-#if HAVE_TIME_H
-# include <time.h>
-#endif
-
-#if HAVE_TERMIOS_H
-# include <termios.h>
-#endif
-
-#if HAVE_STRING_H
-# include <string.h>
-#endif
-
-#if HAVE_CTYPE_H
-# include <ctype.h>
-#endif
-
-#if HAVE_INTTYPES_H
-# include <inttypes.h>
-#else
-# if HAVE_STDINT_H
-#  include <stdint.h>
-# endif
-#endif
-
-#if HAVE_SYS_RESOURCE_H
-# include <sys/resource.h>
-#endif
-
-#include <stdlib.h>
-"; then :
-
-else
-  fptools_cv_htype_sup_double=no
-fi
-
-
-            if test "$HTYPE_IS_FLOAT" -eq 1
-            then
-                fptools_cv_htype_double=Float
-            elif test "$HTYPE_IS_DOUBLE" -eq 1
-            then
-                fptools_cv_htype_double=Double
-            elif test "$HTYPE_IS_LDOUBLE" -eq 1
-            then
-                fptools_cv_htype_double=LDouble
-            else
-                fptools_cv_htype_sup_double=no
-            fi
-        else
-            if ac_fn_c_compute_int "$LINENO" "((double)(-1)) < ((double)0)" "HTYPE_IS_SIGNED"        "
-#include <stdio.h>
-#include <stddef.h>
-
-#if HAVE_SYS_TYPES_H
-# include <sys/types.h>
-#endif
-
-#if HAVE_UNISTD_H
-# include <unistd.h>
-#endif
-
-#if HAVE_SYS_STAT_H
-# include <sys/stat.h>
-#endif
-
-#if HAVE_FCNTL_H
-# include <fcntl.h>
-#endif
-
-#if HAVE_SIGNAL_H
-# include <signal.h>
-#endif
-
-#if HAVE_TIME_H
-# include <time.h>
-#endif
-
-#if HAVE_TERMIOS_H
-# include <termios.h>
-#endif
-
-#if HAVE_STRING_H
-# include <string.h>
-#endif
-
-#if HAVE_CTYPE_H
-# include <ctype.h>
-#endif
-
-#if HAVE_INTTYPES_H
-# include <inttypes.h>
-#else
-# if HAVE_STDINT_H
-#  include <stdint.h>
-# endif
-#endif
-
-#if HAVE_SYS_RESOURCE_H
-# include <sys/resource.h>
-#endif
-
-#include <stdlib.h>
-"; then :
-
-else
-  fptools_cv_htype_sup_double=no
-fi
-
-
-            if ac_fn_c_compute_int "$LINENO" "sizeof(double) * 8" "HTYPE_SIZE"        "
-#include <stdio.h>
-#include <stddef.h>
-
-#if HAVE_SYS_TYPES_H
-# include <sys/types.h>
-#endif
-
-#if HAVE_UNISTD_H
-# include <unistd.h>
-#endif
-
-#if HAVE_SYS_STAT_H
-# include <sys/stat.h>
-#endif
-
-#if HAVE_FCNTL_H
-# include <fcntl.h>
-#endif
-
-#if HAVE_SIGNAL_H
-# include <signal.h>
-#endif
-
-#if HAVE_TIME_H
-# include <time.h>
-#endif
-
-#if HAVE_TERMIOS_H
-# include <termios.h>
-#endif
-
-#if HAVE_STRING_H
-# include <string.h>
-#endif
-
-#if HAVE_CTYPE_H
-# include <ctype.h>
-#endif
-
-#if HAVE_INTTYPES_H
-# include <inttypes.h>
-#else
-# if HAVE_STDINT_H
-#  include <stdint.h>
-# endif
-#endif
-
-#if HAVE_SYS_RESOURCE_H
-# include <sys/resource.h>
-#endif
-
-#include <stdlib.h>
-"; then :
-
-else
-  fptools_cv_htype_sup_double=no
-fi
-
-
-            if test "$HTYPE_IS_SIGNED" -eq 0
-            then
-                fptools_cv_htype_double="Word$HTYPE_SIZE"
-            else
-                fptools_cv_htype_double="Int$HTYPE_SIZE"
-            fi
-        fi
-
-fi
-
-    if test "$fptools_cv_htype_sup_double" = no
-    then
-
-        fptools_cv_htype_double=NotReallyAType
-        { $as_echo "$as_me:${as_lineno-$LINENO}: result: not supported" >&5
-$as_echo "not supported" >&6; }
-
-    fi
-
-            if test "$fptools_cv_htype_sup_double" = yes; then
-        { $as_echo "$as_me:${as_lineno-$LINENO}: result: $fptools_cv_htype_double" >&5
-$as_echo "$fptools_cv_htype_double" >&6; }
-
-cat >>confdefs.h <<_ACEOF
-#define HTYPE_DOUBLE $fptools_cv_htype_double
-_ACEOF
-
-    fi
-
-
-
-
-
-
-
-
-
-
-    { $as_echo "$as_me:${as_lineno-$LINENO}: checking Haskell type for ptrdiff_t" >&5
-$as_echo_n "checking Haskell type for ptrdiff_t... " >&6; }
-    if ${fptools_cv_htype_ptrdiff_t+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-
-        fptools_cv_htype_sup_ptrdiff_t=yes
-        if ac_fn_c_compute_int "$LINENO" "(ptrdiff_t)0.2 - (ptrdiff_t)0.4 < 0 ? 0 : 1" "HTYPE_IS_INTEGRAL"        "
-#include <stdio.h>
-#include <stddef.h>
-
-#if HAVE_SYS_TYPES_H
-# include <sys/types.h>
-#endif
-
-#if HAVE_UNISTD_H
-# include <unistd.h>
-#endif
-
-#if HAVE_SYS_STAT_H
-# include <sys/stat.h>
-#endif
-
-#if HAVE_FCNTL_H
-# include <fcntl.h>
-#endif
-
-#if HAVE_SIGNAL_H
-# include <signal.h>
-#endif
-
-#if HAVE_TIME_H
-# include <time.h>
-#endif
-
-#if HAVE_TERMIOS_H
-# include <termios.h>
-#endif
-
-#if HAVE_STRING_H
-# include <string.h>
-#endif
-
-#if HAVE_CTYPE_H
-# include <ctype.h>
-#endif
-
-#if HAVE_INTTYPES_H
-# include <inttypes.h>
-#else
-# if HAVE_STDINT_H
-#  include <stdint.h>
-# endif
-#endif
-
-#if HAVE_SYS_RESOURCE_H
-# include <sys/resource.h>
-#endif
-
-#include <stdlib.h>
-"; then :
-
-else
-  HTYPE_IS_INTEGRAL=0
-fi
-
-
-
-        if test "$HTYPE_IS_INTEGRAL" -eq 0
-        then
-            if ac_fn_c_compute_int "$LINENO" "sizeof(ptrdiff_t) == sizeof(float)" "HTYPE_IS_FLOAT"        "
-#include <stdio.h>
-#include <stddef.h>
-
-#if HAVE_SYS_TYPES_H
-# include <sys/types.h>
-#endif
-
-#if HAVE_UNISTD_H
-# include <unistd.h>
-#endif
-
-#if HAVE_SYS_STAT_H
-# include <sys/stat.h>
-#endif
-
-#if HAVE_FCNTL_H
-# include <fcntl.h>
-#endif
-
-#if HAVE_SIGNAL_H
-# include <signal.h>
-#endif
-
-#if HAVE_TIME_H
-# include <time.h>
-#endif
-
-#if HAVE_TERMIOS_H
-# include <termios.h>
-#endif
-
-#if HAVE_STRING_H
-# include <string.h>
-#endif
-
-#if HAVE_CTYPE_H
-# include <ctype.h>
-#endif
-
-#if HAVE_INTTYPES_H
-# include <inttypes.h>
-#else
-# if HAVE_STDINT_H
-#  include <stdint.h>
-# endif
-#endif
-
-#if HAVE_SYS_RESOURCE_H
-# include <sys/resource.h>
-#endif
-
-#include <stdlib.h>
-"; then :
-
-else
-  fptools_cv_htype_sup_ptrdiff_t=no
-fi
-
-
-            if ac_fn_c_compute_int "$LINENO" "sizeof(ptrdiff_t) == sizeof(double)" "HTYPE_IS_DOUBLE"        "
-#include <stdio.h>
-#include <stddef.h>
-
-#if HAVE_SYS_TYPES_H
-# include <sys/types.h>
-#endif
-
-#if HAVE_UNISTD_H
-# include <unistd.h>
-#endif
-
-#if HAVE_SYS_STAT_H
-# include <sys/stat.h>
-#endif
-
-#if HAVE_FCNTL_H
-# include <fcntl.h>
-#endif
-
-#if HAVE_SIGNAL_H
-# include <signal.h>
-#endif
-
-#if HAVE_TIME_H
-# include <time.h>
-#endif
-
-#if HAVE_TERMIOS_H
-# include <termios.h>
-#endif
-
-#if HAVE_STRING_H
-# include <string.h>
-#endif
-
-#if HAVE_CTYPE_H
-# include <ctype.h>
-#endif
-
-#if HAVE_INTTYPES_H
-# include <inttypes.h>
-#else
-# if HAVE_STDINT_H
-#  include <stdint.h>
-# endif
-#endif
-
-#if HAVE_SYS_RESOURCE_H
-# include <sys/resource.h>
-#endif
-
-#include <stdlib.h>
-"; then :
-
-else
-  fptools_cv_htype_sup_ptrdiff_t=no
-fi
-
-
-            if ac_fn_c_compute_int "$LINENO" "sizeof(ptrdiff_t) == sizeof(long double)" "HTYPE_IS_LDOUBLE"        "
-#include <stdio.h>
-#include <stddef.h>
-
-#if HAVE_SYS_TYPES_H
-# include <sys/types.h>
-#endif
-
-#if HAVE_UNISTD_H
-# include <unistd.h>
-#endif
-
-#if HAVE_SYS_STAT_H
-# include <sys/stat.h>
-#endif
-
-#if HAVE_FCNTL_H
-# include <fcntl.h>
-#endif
-
-#if HAVE_SIGNAL_H
-# include <signal.h>
-#endif
-
-#if HAVE_TIME_H
-# include <time.h>
-#endif
-
-#if HAVE_TERMIOS_H
-# include <termios.h>
-#endif
-
-#if HAVE_STRING_H
-# include <string.h>
-#endif
-
-#if HAVE_CTYPE_H
-# include <ctype.h>
-#endif
-
-#if HAVE_INTTYPES_H
-# include <inttypes.h>
-#else
-# if HAVE_STDINT_H
-#  include <stdint.h>
-# endif
-#endif
-
-#if HAVE_SYS_RESOURCE_H
-# include <sys/resource.h>
-#endif
-
-#include <stdlib.h>
-"; then :
-
-else
-  fptools_cv_htype_sup_ptrdiff_t=no
-fi
-
-
-            if test "$HTYPE_IS_FLOAT" -eq 1
-            then
-                fptools_cv_htype_ptrdiff_t=Float
-            elif test "$HTYPE_IS_DOUBLE" -eq 1
-            then
-                fptools_cv_htype_ptrdiff_t=Double
-            elif test "$HTYPE_IS_LDOUBLE" -eq 1
-            then
-                fptools_cv_htype_ptrdiff_t=LDouble
-            else
-                fptools_cv_htype_sup_ptrdiff_t=no
-            fi
-        else
-            if ac_fn_c_compute_int "$LINENO" "((ptrdiff_t)(-1)) < ((ptrdiff_t)0)" "HTYPE_IS_SIGNED"        "
-#include <stdio.h>
-#include <stddef.h>
-
-#if HAVE_SYS_TYPES_H
-# include <sys/types.h>
-#endif
-
-#if HAVE_UNISTD_H
-# include <unistd.h>
-#endif
-
-#if HAVE_SYS_STAT_H
-# include <sys/stat.h>
-#endif
-
-#if HAVE_FCNTL_H
-# include <fcntl.h>
-#endif
-
-#if HAVE_SIGNAL_H
-# include <signal.h>
-#endif
-
-#if HAVE_TIME_H
-# include <time.h>
-#endif
-
-#if HAVE_TERMIOS_H
-# include <termios.h>
-#endif
-
-#if HAVE_STRING_H
-# include <string.h>
-#endif
-
-#if HAVE_CTYPE_H
-# include <ctype.h>
-#endif
-
-#if HAVE_INTTYPES_H
-# include <inttypes.h>
-#else
-# if HAVE_STDINT_H
-#  include <stdint.h>
-# endif
-#endif
-
-#if HAVE_SYS_RESOURCE_H
-# include <sys/resource.h>
-#endif
-
-#include <stdlib.h>
-"; then :
-
-else
-  fptools_cv_htype_sup_ptrdiff_t=no
-fi
-
-
-            if ac_fn_c_compute_int "$LINENO" "sizeof(ptrdiff_t) * 8" "HTYPE_SIZE"        "
-#include <stdio.h>
-#include <stddef.h>
-
-#if HAVE_SYS_TYPES_H
-# include <sys/types.h>
-#endif
-
-#if HAVE_UNISTD_H
-# include <unistd.h>
-#endif
-
-#if HAVE_SYS_STAT_H
-# include <sys/stat.h>
-#endif
-
-#if HAVE_FCNTL_H
-# include <fcntl.h>
-#endif
-
-#if HAVE_SIGNAL_H
-# include <signal.h>
-#endif
-
-#if HAVE_TIME_H
-# include <time.h>
-#endif
-
-#if HAVE_TERMIOS_H
-# include <termios.h>
-#endif
-
-#if HAVE_STRING_H
-# include <string.h>
-#endif
-
-#if HAVE_CTYPE_H
-# include <ctype.h>
-#endif
-
-#if HAVE_INTTYPES_H
-# include <inttypes.h>
-#else
-# if HAVE_STDINT_H
-#  include <stdint.h>
-# endif
-#endif
-
-#if HAVE_SYS_RESOURCE_H
-# include <sys/resource.h>
-#endif
-
-#include <stdlib.h>
-"; then :
-
-else
-  fptools_cv_htype_sup_ptrdiff_t=no
-fi
-
-
-            if test "$HTYPE_IS_SIGNED" -eq 0
-            then
-                fptools_cv_htype_ptrdiff_t="Word$HTYPE_SIZE"
-            else
-                fptools_cv_htype_ptrdiff_t="Int$HTYPE_SIZE"
-            fi
-        fi
-
-fi
-
-    if test "$fptools_cv_htype_sup_ptrdiff_t" = no
-    then
-
-        fptools_cv_htype_ptrdiff_t=NotReallyAType
-        { $as_echo "$as_me:${as_lineno-$LINENO}: result: not supported" >&5
-$as_echo "not supported" >&6; }
-
-    fi
-
-            if test "$fptools_cv_htype_sup_ptrdiff_t" = yes; then
-        { $as_echo "$as_me:${as_lineno-$LINENO}: result: $fptools_cv_htype_ptrdiff_t" >&5
-$as_echo "$fptools_cv_htype_ptrdiff_t" >&6; }
-
-cat >>confdefs.h <<_ACEOF
-#define HTYPE_PTRDIFF_T $fptools_cv_htype_ptrdiff_t
-_ACEOF
-
-    fi
-
-
-
-
-
-
-
-
-
-
-    { $as_echo "$as_me:${as_lineno-$LINENO}: checking Haskell type for size_t" >&5
-$as_echo_n "checking Haskell type for size_t... " >&6; }
-    if ${fptools_cv_htype_size_t+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-
-        fptools_cv_htype_sup_size_t=yes
-        if ac_fn_c_compute_int "$LINENO" "(size_t)0.2 - (size_t)0.4 < 0 ? 0 : 1" "HTYPE_IS_INTEGRAL"        "
-#include <stdio.h>
-#include <stddef.h>
-
-#if HAVE_SYS_TYPES_H
-# include <sys/types.h>
-#endif
-
-#if HAVE_UNISTD_H
-# include <unistd.h>
-#endif
-
-#if HAVE_SYS_STAT_H
-# include <sys/stat.h>
-#endif
-
-#if HAVE_FCNTL_H
-# include <fcntl.h>
-#endif
-
-#if HAVE_SIGNAL_H
-# include <signal.h>
-#endif
-
-#if HAVE_TIME_H
-# include <time.h>
-#endif
-
-#if HAVE_TERMIOS_H
-# include <termios.h>
-#endif
-
-#if HAVE_STRING_H
-# include <string.h>
-#endif
-
-#if HAVE_CTYPE_H
-# include <ctype.h>
-#endif
-
-#if HAVE_INTTYPES_H
-# include <inttypes.h>
-#else
-# if HAVE_STDINT_H
-#  include <stdint.h>
-# endif
-#endif
-
-#if HAVE_SYS_RESOURCE_H
-# include <sys/resource.h>
-#endif
-
-#include <stdlib.h>
-"; then :
-
-else
-  HTYPE_IS_INTEGRAL=0
-fi
-
-
-
-        if test "$HTYPE_IS_INTEGRAL" -eq 0
-        then
-            if ac_fn_c_compute_int "$LINENO" "sizeof(size_t) == sizeof(float)" "HTYPE_IS_FLOAT"        "
-#include <stdio.h>
-#include <stddef.h>
-
-#if HAVE_SYS_TYPES_H
-# include <sys/types.h>
-#endif
-
-#if HAVE_UNISTD_H
-# include <unistd.h>
-#endif
-
-#if HAVE_SYS_STAT_H
-# include <sys/stat.h>
-#endif
-
-#if HAVE_FCNTL_H
-# include <fcntl.h>
-#endif
-
-#if HAVE_SIGNAL_H
-# include <signal.h>
-#endif
-
-#if HAVE_TIME_H
-# include <time.h>
-#endif
-
-#if HAVE_TERMIOS_H
-# include <termios.h>
-#endif
-
-#if HAVE_STRING_H
-# include <string.h>
-#endif
-
-#if HAVE_CTYPE_H
-# include <ctype.h>
-#endif
-
-#if HAVE_INTTYPES_H
-# include <inttypes.h>
-#else
-# if HAVE_STDINT_H
-#  include <stdint.h>
-# endif
-#endif
-
-#if HAVE_SYS_RESOURCE_H
-# include <sys/resource.h>
-#endif
-
-#include <stdlib.h>
-"; then :
-
-else
-  fptools_cv_htype_sup_size_t=no
-fi
-
-
-            if ac_fn_c_compute_int "$LINENO" "sizeof(size_t) == sizeof(double)" "HTYPE_IS_DOUBLE"        "
-#include <stdio.h>
-#include <stddef.h>
-
-#if HAVE_SYS_TYPES_H
-# include <sys/types.h>
-#endif
-
-#if HAVE_UNISTD_H
-# include <unistd.h>
-#endif
-
-#if HAVE_SYS_STAT_H
-# include <sys/stat.h>
-#endif
-
-#if HAVE_FCNTL_H
-# include <fcntl.h>
-#endif
-
-#if HAVE_SIGNAL_H
-# include <signal.h>
-#endif
-
-#if HAVE_TIME_H
-# include <time.h>
-#endif
-
-#if HAVE_TERMIOS_H
-# include <termios.h>
-#endif
-
-#if HAVE_STRING_H
-# include <string.h>
-#endif
-
-#if HAVE_CTYPE_H
-# include <ctype.h>
-#endif
-
-#if HAVE_INTTYPES_H
-# include <inttypes.h>
-#else
-# if HAVE_STDINT_H
-#  include <stdint.h>
-# endif
-#endif
-
-#if HAVE_SYS_RESOURCE_H
-# include <sys/resource.h>
-#endif
-
-#include <stdlib.h>
-"; then :
-
-else
-  fptools_cv_htype_sup_size_t=no
-fi
-
-
-            if ac_fn_c_compute_int "$LINENO" "sizeof(size_t) == sizeof(long double)" "HTYPE_IS_LDOUBLE"        "
-#include <stdio.h>
-#include <stddef.h>
-
-#if HAVE_SYS_TYPES_H
-# include <sys/types.h>
-#endif
-
-#if HAVE_UNISTD_H
-# include <unistd.h>
-#endif
-
-#if HAVE_SYS_STAT_H
-# include <sys/stat.h>
-#endif
-
-#if HAVE_FCNTL_H
-# include <fcntl.h>
-#endif
-
-#if HAVE_SIGNAL_H
-# include <signal.h>
-#endif
-
-#if HAVE_TIME_H
-# include <time.h>
-#endif
-
-#if HAVE_TERMIOS_H
-# include <termios.h>
-#endif
-
-#if HAVE_STRING_H
-# include <string.h>
-#endif
-
-#if HAVE_CTYPE_H
-# include <ctype.h>
-#endif
-
-#if HAVE_INTTYPES_H
-# include <inttypes.h>
-#else
-# if HAVE_STDINT_H
-#  include <stdint.h>
-# endif
-#endif
-
-#if HAVE_SYS_RESOURCE_H
-# include <sys/resource.h>
-#endif
-
-#include <stdlib.h>
-"; then :
-
-else
-  fptools_cv_htype_sup_size_t=no
-fi
-
-
-            if test "$HTYPE_IS_FLOAT" -eq 1
-            then
-                fptools_cv_htype_size_t=Float
-            elif test "$HTYPE_IS_DOUBLE" -eq 1
-            then
-                fptools_cv_htype_size_t=Double
-            elif test "$HTYPE_IS_LDOUBLE" -eq 1
-            then
-                fptools_cv_htype_size_t=LDouble
-            else
-                fptools_cv_htype_sup_size_t=no
-            fi
-        else
-            if ac_fn_c_compute_int "$LINENO" "((size_t)(-1)) < ((size_t)0)" "HTYPE_IS_SIGNED"        "
-#include <stdio.h>
-#include <stddef.h>
-
-#if HAVE_SYS_TYPES_H
-# include <sys/types.h>
-#endif
-
-#if HAVE_UNISTD_H
-# include <unistd.h>
-#endif
-
-#if HAVE_SYS_STAT_H
-# include <sys/stat.h>
-#endif
-
-#if HAVE_FCNTL_H
-# include <fcntl.h>
-#endif
-
-#if HAVE_SIGNAL_H
-# include <signal.h>
-#endif
-
-#if HAVE_TIME_H
-# include <time.h>
-#endif
-
-#if HAVE_TERMIOS_H
-# include <termios.h>
-#endif
-
-#if HAVE_STRING_H
-# include <string.h>
-#endif
-
-#if HAVE_CTYPE_H
-# include <ctype.h>
-#endif
-
-#if HAVE_INTTYPES_H
-# include <inttypes.h>
-#else
-# if HAVE_STDINT_H
-#  include <stdint.h>
-# endif
-#endif
-
-#if HAVE_SYS_RESOURCE_H
-# include <sys/resource.h>
-#endif
-
-#include <stdlib.h>
-"; then :
-
-else
-  fptools_cv_htype_sup_size_t=no
-fi
-
-
-            if ac_fn_c_compute_int "$LINENO" "sizeof(size_t) * 8" "HTYPE_SIZE"        "
-#include <stdio.h>
-#include <stddef.h>
-
-#if HAVE_SYS_TYPES_H
-# include <sys/types.h>
-#endif
-
-#if HAVE_UNISTD_H
-# include <unistd.h>
-#endif
-
-#if HAVE_SYS_STAT_H
-# include <sys/stat.h>
-#endif
-
-#if HAVE_FCNTL_H
-# include <fcntl.h>
-#endif
-
-#if HAVE_SIGNAL_H
-# include <signal.h>
-#endif
-
-#if HAVE_TIME_H
-# include <time.h>
-#endif
-
-#if HAVE_TERMIOS_H
-# include <termios.h>
-#endif
-
-#if HAVE_STRING_H
-# include <string.h>
-#endif
-
-#if HAVE_CTYPE_H
-# include <ctype.h>
-#endif
-
-#if HAVE_INTTYPES_H
-# include <inttypes.h>
-#else
-# if HAVE_STDINT_H
-#  include <stdint.h>
-# endif
-#endif
-
-#if HAVE_SYS_RESOURCE_H
-# include <sys/resource.h>
-#endif
-
-#include <stdlib.h>
-"; then :
-
-else
-  fptools_cv_htype_sup_size_t=no
-fi
-
-
-            if test "$HTYPE_IS_SIGNED" -eq 0
-            then
-                fptools_cv_htype_size_t="Word$HTYPE_SIZE"
-            else
-                fptools_cv_htype_size_t="Int$HTYPE_SIZE"
-            fi
-        fi
-
-fi
-
-    if test "$fptools_cv_htype_sup_size_t" = no
-    then
-
-        fptools_cv_htype_size_t=NotReallyAType
-        { $as_echo "$as_me:${as_lineno-$LINENO}: result: not supported" >&5
-$as_echo "not supported" >&6; }
-
-    fi
-
-            if test "$fptools_cv_htype_sup_size_t" = yes; then
-        { $as_echo "$as_me:${as_lineno-$LINENO}: result: $fptools_cv_htype_size_t" >&5
-$as_echo "$fptools_cv_htype_size_t" >&6; }
-
-cat >>confdefs.h <<_ACEOF
-#define HTYPE_SIZE_T $fptools_cv_htype_size_t
-_ACEOF
-
-    fi
-
-
-
-
-
-
-
-
-
-
-    { $as_echo "$as_me:${as_lineno-$LINENO}: checking Haskell type for wchar_t" >&5
-$as_echo_n "checking Haskell type for wchar_t... " >&6; }
-    if ${fptools_cv_htype_wchar_t+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-
-        fptools_cv_htype_sup_wchar_t=yes
-        if ac_fn_c_compute_int "$LINENO" "(wchar_t)0.2 - (wchar_t)0.4 < 0 ? 0 : 1" "HTYPE_IS_INTEGRAL"        "
-#include <stdio.h>
-#include <stddef.h>
-
-#if HAVE_SYS_TYPES_H
-# include <sys/types.h>
-#endif
-
-#if HAVE_UNISTD_H
-# include <unistd.h>
-#endif
-
-#if HAVE_SYS_STAT_H
-# include <sys/stat.h>
-#endif
-
-#if HAVE_FCNTL_H
-# include <fcntl.h>
-#endif
-
-#if HAVE_SIGNAL_H
-# include <signal.h>
-#endif
-
-#if HAVE_TIME_H
-# include <time.h>
-#endif
-
-#if HAVE_TERMIOS_H
-# include <termios.h>
-#endif
-
-#if HAVE_STRING_H
-# include <string.h>
-#endif
-
-#if HAVE_CTYPE_H
-# include <ctype.h>
-#endif
-
-#if HAVE_INTTYPES_H
-# include <inttypes.h>
-#else
-# if HAVE_STDINT_H
-#  include <stdint.h>
-# endif
-#endif
-
-#if HAVE_SYS_RESOURCE_H
-# include <sys/resource.h>
-#endif
-
-#include <stdlib.h>
-"; then :
-
-else
-  HTYPE_IS_INTEGRAL=0
-fi
-
-
-
-        if test "$HTYPE_IS_INTEGRAL" -eq 0
-        then
-            if ac_fn_c_compute_int "$LINENO" "sizeof(wchar_t) == sizeof(float)" "HTYPE_IS_FLOAT"        "
-#include <stdio.h>
-#include <stddef.h>
-
-#if HAVE_SYS_TYPES_H
-# include <sys/types.h>
-#endif
-
-#if HAVE_UNISTD_H
-# include <unistd.h>
-#endif
-
-#if HAVE_SYS_STAT_H
-# include <sys/stat.h>
-#endif
-
-#if HAVE_FCNTL_H
-# include <fcntl.h>
-#endif
-
-#if HAVE_SIGNAL_H
-# include <signal.h>
-#endif
-
-#if HAVE_TIME_H
-# include <time.h>
-#endif
-
-#if HAVE_TERMIOS_H
-# include <termios.h>
-#endif
-
-#if HAVE_STRING_H
-# include <string.h>
-#endif
-
-#if HAVE_CTYPE_H
-# include <ctype.h>
-#endif
-
-#if HAVE_INTTYPES_H
-# include <inttypes.h>
-#else
-# if HAVE_STDINT_H
-#  include <stdint.h>
-# endif
-#endif
-
-#if HAVE_SYS_RESOURCE_H
-# include <sys/resource.h>
-#endif
-
-#include <stdlib.h>
-"; then :
-
-else
-  fptools_cv_htype_sup_wchar_t=no
-fi
-
-
-            if ac_fn_c_compute_int "$LINENO" "sizeof(wchar_t) == sizeof(double)" "HTYPE_IS_DOUBLE"        "
-#include <stdio.h>
-#include <stddef.h>
-
-#if HAVE_SYS_TYPES_H
-# include <sys/types.h>
-#endif
-
-#if HAVE_UNISTD_H
-# include <unistd.h>
-#endif
-
-#if HAVE_SYS_STAT_H
-# include <sys/stat.h>
-#endif
-
-#if HAVE_FCNTL_H
-# include <fcntl.h>
-#endif
-
-#if HAVE_SIGNAL_H
-# include <signal.h>
-#endif
-
-#if HAVE_TIME_H
-# include <time.h>
-#endif
-
-#if HAVE_TERMIOS_H
-# include <termios.h>
-#endif
-
-#if HAVE_STRING_H
-# include <string.h>
-#endif
-
-#if HAVE_CTYPE_H
-# include <ctype.h>
-#endif
-
-#if HAVE_INTTYPES_H
-# include <inttypes.h>
-#else
-# if HAVE_STDINT_H
-#  include <stdint.h>
-# endif
-#endif
-
-#if HAVE_SYS_RESOURCE_H
-# include <sys/resource.h>
-#endif
-
-#include <stdlib.h>
-"; then :
-
-else
-  fptools_cv_htype_sup_wchar_t=no
-fi
-
-
-            if ac_fn_c_compute_int "$LINENO" "sizeof(wchar_t) == sizeof(long double)" "HTYPE_IS_LDOUBLE"        "
-#include <stdio.h>
-#include <stddef.h>
-
-#if HAVE_SYS_TYPES_H
-# include <sys/types.h>
-#endif
-
-#if HAVE_UNISTD_H
-# include <unistd.h>
-#endif
-
-#if HAVE_SYS_STAT_H
-# include <sys/stat.h>
-#endif
-
-#if HAVE_FCNTL_H
-# include <fcntl.h>
-#endif
-
-#if HAVE_SIGNAL_H
-# include <signal.h>
-#endif
-
-#if HAVE_TIME_H
-# include <time.h>
-#endif
-
-#if HAVE_TERMIOS_H
-# include <termios.h>
-#endif
-
-#if HAVE_STRING_H
-# include <string.h>
-#endif
-
-#if HAVE_CTYPE_H
-# include <ctype.h>
-#endif
-
-#if HAVE_INTTYPES_H
-# include <inttypes.h>
-#else
-# if HAVE_STDINT_H
-#  include <stdint.h>
-# endif
-#endif
-
-#if HAVE_SYS_RESOURCE_H
-# include <sys/resource.h>
-#endif
-
-#include <stdlib.h>
-"; then :
-
-else
-  fptools_cv_htype_sup_wchar_t=no
-fi
-
-
-            if test "$HTYPE_IS_FLOAT" -eq 1
-            then
-                fptools_cv_htype_wchar_t=Float
-            elif test "$HTYPE_IS_DOUBLE" -eq 1
-            then
-                fptools_cv_htype_wchar_t=Double
-            elif test "$HTYPE_IS_LDOUBLE" -eq 1
-            then
-                fptools_cv_htype_wchar_t=LDouble
-            else
-                fptools_cv_htype_sup_wchar_t=no
-            fi
-        else
-            if ac_fn_c_compute_int "$LINENO" "((wchar_t)(-1)) < ((wchar_t)0)" "HTYPE_IS_SIGNED"        "
-#include <stdio.h>
-#include <stddef.h>
-
-#if HAVE_SYS_TYPES_H
-# include <sys/types.h>
-#endif
-
-#if HAVE_UNISTD_H
-# include <unistd.h>
-#endif
-
-#if HAVE_SYS_STAT_H
-# include <sys/stat.h>
-#endif
-
-#if HAVE_FCNTL_H
-# include <fcntl.h>
-#endif
-
-#if HAVE_SIGNAL_H
-# include <signal.h>
-#endif
-
-#if HAVE_TIME_H
-# include <time.h>
-#endif
-
-#if HAVE_TERMIOS_H
-# include <termios.h>
-#endif
-
-#if HAVE_STRING_H
-# include <string.h>
-#endif
-
-#if HAVE_CTYPE_H
-# include <ctype.h>
-#endif
-
-#if HAVE_INTTYPES_H
-# include <inttypes.h>
-#else
-# if HAVE_STDINT_H
-#  include <stdint.h>
-# endif
-#endif
-
-#if HAVE_SYS_RESOURCE_H
-# include <sys/resource.h>
-#endif
-
-#include <stdlib.h>
-"; then :
-
-else
-  fptools_cv_htype_sup_wchar_t=no
-fi
-
-
-            if ac_fn_c_compute_int "$LINENO" "sizeof(wchar_t) * 8" "HTYPE_SIZE"        "
-#include <stdio.h>
-#include <stddef.h>
-
-#if HAVE_SYS_TYPES_H
-# include <sys/types.h>
-#endif
-
-#if HAVE_UNISTD_H
-# include <unistd.h>
-#endif
-
-#if HAVE_SYS_STAT_H
-# include <sys/stat.h>
-#endif
-
-#if HAVE_FCNTL_H
-# include <fcntl.h>
-#endif
-
-#if HAVE_SIGNAL_H
-# include <signal.h>
-#endif
-
-#if HAVE_TIME_H
-# include <time.h>
-#endif
-
-#if HAVE_TERMIOS_H
-# include <termios.h>
-#endif
-
-#if HAVE_STRING_H
-# include <string.h>
-#endif
-
-#if HAVE_CTYPE_H
-# include <ctype.h>
-#endif
-
-#if HAVE_INTTYPES_H
-# include <inttypes.h>
-#else
-# if HAVE_STDINT_H
-#  include <stdint.h>
-# endif
-#endif
-
-#if HAVE_SYS_RESOURCE_H
-# include <sys/resource.h>
-#endif
-
-#include <stdlib.h>
-"; then :
-
-else
-  fptools_cv_htype_sup_wchar_t=no
-fi
-
-
-            if test "$HTYPE_IS_SIGNED" -eq 0
-            then
-                fptools_cv_htype_wchar_t="Word$HTYPE_SIZE"
-            else
-                fptools_cv_htype_wchar_t="Int$HTYPE_SIZE"
-            fi
-        fi
-
-fi
-
-    if test "$fptools_cv_htype_sup_wchar_t" = no
-    then
-
-        fptools_cv_htype_wchar_t=NotReallyAType
-        { $as_echo "$as_me:${as_lineno-$LINENO}: result: not supported" >&5
-$as_echo "not supported" >&6; }
-
-    fi
-
-            if test "$fptools_cv_htype_sup_wchar_t" = yes; then
-        { $as_echo "$as_me:${as_lineno-$LINENO}: result: $fptools_cv_htype_wchar_t" >&5
-$as_echo "$fptools_cv_htype_wchar_t" >&6; }
-
-cat >>confdefs.h <<_ACEOF
-#define HTYPE_WCHAR_T $fptools_cv_htype_wchar_t
-_ACEOF
-
-    fi
-
-
-
-
-
-
-
-
-
-
-    { $as_echo "$as_me:${as_lineno-$LINENO}: checking Haskell type for sig_atomic_t" >&5
-$as_echo_n "checking Haskell type for sig_atomic_t... " >&6; }
-    if ${fptools_cv_htype_sig_atomic_t+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-
-        fptools_cv_htype_sup_sig_atomic_t=yes
-        if ac_fn_c_compute_int "$LINENO" "(sig_atomic_t)0.2 - (sig_atomic_t)0.4 < 0 ? 0 : 1" "HTYPE_IS_INTEGRAL"        "
-#include <stdio.h>
-#include <stddef.h>
-
-#if HAVE_SYS_TYPES_H
-# include <sys/types.h>
-#endif
-
-#if HAVE_UNISTD_H
-# include <unistd.h>
-#endif
-
-#if HAVE_SYS_STAT_H
-# include <sys/stat.h>
-#endif
-
-#if HAVE_FCNTL_H
-# include <fcntl.h>
-#endif
-
-#if HAVE_SIGNAL_H
-# include <signal.h>
-#endif
-
-#if HAVE_TIME_H
-# include <time.h>
-#endif
-
-#if HAVE_TERMIOS_H
-# include <termios.h>
-#endif
-
-#if HAVE_STRING_H
-# include <string.h>
-#endif
-
-#if HAVE_CTYPE_H
-# include <ctype.h>
-#endif
-
-#if HAVE_INTTYPES_H
-# include <inttypes.h>
-#else
-# if HAVE_STDINT_H
-#  include <stdint.h>
-# endif
-#endif
-
-#if HAVE_SYS_RESOURCE_H
-# include <sys/resource.h>
-#endif
-
-#include <stdlib.h>
-"; then :
-
-else
-  HTYPE_IS_INTEGRAL=0
-fi
-
-
-
-        if test "$HTYPE_IS_INTEGRAL" -eq 0
-        then
-            if ac_fn_c_compute_int "$LINENO" "sizeof(sig_atomic_t) == sizeof(float)" "HTYPE_IS_FLOAT"        "
-#include <stdio.h>
-#include <stddef.h>
-
-#if HAVE_SYS_TYPES_H
-# include <sys/types.h>
-#endif
-
-#if HAVE_UNISTD_H
-# include <unistd.h>
-#endif
-
-#if HAVE_SYS_STAT_H
-# include <sys/stat.h>
-#endif
-
-#if HAVE_FCNTL_H
-# include <fcntl.h>
-#endif
-
-#if HAVE_SIGNAL_H
-# include <signal.h>
-#endif
-
-#if HAVE_TIME_H
-# include <time.h>
-#endif
-
-#if HAVE_TERMIOS_H
-# include <termios.h>
-#endif
-
-#if HAVE_STRING_H
-# include <string.h>
-#endif
-
-#if HAVE_CTYPE_H
-# include <ctype.h>
-#endif
-
-#if HAVE_INTTYPES_H
-# include <inttypes.h>
-#else
-# if HAVE_STDINT_H
-#  include <stdint.h>
-# endif
-#endif
-
-#if HAVE_SYS_RESOURCE_H
-# include <sys/resource.h>
-#endif
-
-#include <stdlib.h>
-"; then :
-
-else
-  fptools_cv_htype_sup_sig_atomic_t=no
-fi
-
-
-            if ac_fn_c_compute_int "$LINENO" "sizeof(sig_atomic_t) == sizeof(double)" "HTYPE_IS_DOUBLE"        "
-#include <stdio.h>
-#include <stddef.h>
-
-#if HAVE_SYS_TYPES_H
-# include <sys/types.h>
-#endif
-
-#if HAVE_UNISTD_H
-# include <unistd.h>
-#endif
-
-#if HAVE_SYS_STAT_H
-# include <sys/stat.h>
-#endif
-
-#if HAVE_FCNTL_H
-# include <fcntl.h>
-#endif
-
-#if HAVE_SIGNAL_H
-# include <signal.h>
-#endif
-
-#if HAVE_TIME_H
-# include <time.h>
-#endif
-
-#if HAVE_TERMIOS_H
-# include <termios.h>
-#endif
-
-#if HAVE_STRING_H
-# include <string.h>
-#endif
-
-#if HAVE_CTYPE_H
-# include <ctype.h>
-#endif
-
-#if HAVE_INTTYPES_H
-# include <inttypes.h>
-#else
-# if HAVE_STDINT_H
-#  include <stdint.h>
-# endif
-#endif
-
-#if HAVE_SYS_RESOURCE_H
-# include <sys/resource.h>
-#endif
-
-#include <stdlib.h>
-"; then :
-
-else
-  fptools_cv_htype_sup_sig_atomic_t=no
-fi
-
-
-            if ac_fn_c_compute_int "$LINENO" "sizeof(sig_atomic_t) == sizeof(long double)" "HTYPE_IS_LDOUBLE"        "
-#include <stdio.h>
-#include <stddef.h>
-
-#if HAVE_SYS_TYPES_H
-# include <sys/types.h>
-#endif
-
-#if HAVE_UNISTD_H
-# include <unistd.h>
-#endif
-
-#if HAVE_SYS_STAT_H
-# include <sys/stat.h>
-#endif
-
-#if HAVE_FCNTL_H
-# include <fcntl.h>
-#endif
-
-#if HAVE_SIGNAL_H
-# include <signal.h>
-#endif
-
-#if HAVE_TIME_H
-# include <time.h>
-#endif
-
-#if HAVE_TERMIOS_H
-# include <termios.h>
-#endif
-
-#if HAVE_STRING_H
-# include <string.h>
-#endif
-
-#if HAVE_CTYPE_H
-# include <ctype.h>
-#endif
-
-#if HAVE_INTTYPES_H
-# include <inttypes.h>
-#else
-# if HAVE_STDINT_H
-#  include <stdint.h>
-# endif
-#endif
-
-#if HAVE_SYS_RESOURCE_H
-# include <sys/resource.h>
-#endif
-
-#include <stdlib.h>
-"; then :
-
-else
-  fptools_cv_htype_sup_sig_atomic_t=no
-fi
-
-
-            if test "$HTYPE_IS_FLOAT" -eq 1
-            then
-                fptools_cv_htype_sig_atomic_t=Float
-            elif test "$HTYPE_IS_DOUBLE" -eq 1
-            then
-                fptools_cv_htype_sig_atomic_t=Double
-            elif test "$HTYPE_IS_LDOUBLE" -eq 1
-            then
-                fptools_cv_htype_sig_atomic_t=LDouble
-            else
-                fptools_cv_htype_sup_sig_atomic_t=no
-            fi
-        else
-            if ac_fn_c_compute_int "$LINENO" "((sig_atomic_t)(-1)) < ((sig_atomic_t)0)" "HTYPE_IS_SIGNED"        "
-#include <stdio.h>
-#include <stddef.h>
-
-#if HAVE_SYS_TYPES_H
-# include <sys/types.h>
-#endif
-
-#if HAVE_UNISTD_H
-# include <unistd.h>
-#endif
-
-#if HAVE_SYS_STAT_H
-# include <sys/stat.h>
-#endif
-
-#if HAVE_FCNTL_H
-# include <fcntl.h>
-#endif
-
-#if HAVE_SIGNAL_H
-# include <signal.h>
-#endif
-
-#if HAVE_TIME_H
-# include <time.h>
-#endif
-
-#if HAVE_TERMIOS_H
-# include <termios.h>
-#endif
-
-#if HAVE_STRING_H
-# include <string.h>
-#endif
-
-#if HAVE_CTYPE_H
-# include <ctype.h>
-#endif
-
-#if HAVE_INTTYPES_H
-# include <inttypes.h>
-#else
-# if HAVE_STDINT_H
-#  include <stdint.h>
-# endif
-#endif
-
-#if HAVE_SYS_RESOURCE_H
-# include <sys/resource.h>
-#endif
-
-#include <stdlib.h>
-"; then :
-
-else
-  fptools_cv_htype_sup_sig_atomic_t=no
-fi
-
-
-            if ac_fn_c_compute_int "$LINENO" "sizeof(sig_atomic_t) * 8" "HTYPE_SIZE"        "
-#include <stdio.h>
-#include <stddef.h>
-
-#if HAVE_SYS_TYPES_H
-# include <sys/types.h>
-#endif
-
-#if HAVE_UNISTD_H
-# include <unistd.h>
-#endif
-
-#if HAVE_SYS_STAT_H
-# include <sys/stat.h>
-#endif
-
-#if HAVE_FCNTL_H
-# include <fcntl.h>
-#endif
-
-#if HAVE_SIGNAL_H
-# include <signal.h>
-#endif
-
-#if HAVE_TIME_H
-# include <time.h>
-#endif
-
-#if HAVE_TERMIOS_H
-# include <termios.h>
-#endif
-
-#if HAVE_STRING_H
-# include <string.h>
-#endif
-
-#if HAVE_CTYPE_H
-# include <ctype.h>
-#endif
-
-#if HAVE_INTTYPES_H
-# include <inttypes.h>
-#else
-# if HAVE_STDINT_H
-#  include <stdint.h>
-# endif
-#endif
-
-#if HAVE_SYS_RESOURCE_H
-# include <sys/resource.h>
-#endif
-
-#include <stdlib.h>
-"; then :
-
-else
-  fptools_cv_htype_sup_sig_atomic_t=no
-fi
-
-
-            if test "$HTYPE_IS_SIGNED" -eq 0
-            then
-                fptools_cv_htype_sig_atomic_t="Word$HTYPE_SIZE"
-            else
-                fptools_cv_htype_sig_atomic_t="Int$HTYPE_SIZE"
-            fi
-        fi
-
-fi
-
-    if test "$fptools_cv_htype_sup_sig_atomic_t" = no
-    then
-
-        fptools_cv_htype_sig_atomic_t=NotReallyAType
-        { $as_echo "$as_me:${as_lineno-$LINENO}: result: not supported" >&5
-$as_echo "not supported" >&6; }
-
-    fi
-
-            if test "$fptools_cv_htype_sup_sig_atomic_t" = yes; then
-        { $as_echo "$as_me:${as_lineno-$LINENO}: result: $fptools_cv_htype_sig_atomic_t" >&5
-$as_echo "$fptools_cv_htype_sig_atomic_t" >&6; }
-
-cat >>confdefs.h <<_ACEOF
-#define HTYPE_SIG_ATOMIC_T $fptools_cv_htype_sig_atomic_t
-_ACEOF
-
-    fi
-
-
-
-
-
-
-
-
-
-
-    { $as_echo "$as_me:${as_lineno-$LINENO}: checking Haskell type for clock_t" >&5
-$as_echo_n "checking Haskell type for clock_t... " >&6; }
-    if ${fptools_cv_htype_clock_t+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-
-        fptools_cv_htype_sup_clock_t=yes
-        if ac_fn_c_compute_int "$LINENO" "(clock_t)0.2 - (clock_t)0.4 < 0 ? 0 : 1" "HTYPE_IS_INTEGRAL"        "
-#include <stdio.h>
-#include <stddef.h>
-
-#if HAVE_SYS_TYPES_H
-# include <sys/types.h>
-#endif
-
-#if HAVE_UNISTD_H
-# include <unistd.h>
-#endif
-
-#if HAVE_SYS_STAT_H
-# include <sys/stat.h>
-#endif
-
-#if HAVE_FCNTL_H
-# include <fcntl.h>
-#endif
-
-#if HAVE_SIGNAL_H
-# include <signal.h>
-#endif
-
-#if HAVE_TIME_H
-# include <time.h>
-#endif
-
-#if HAVE_TERMIOS_H
-# include <termios.h>
-#endif
-
-#if HAVE_STRING_H
-# include <string.h>
-#endif
-
-#if HAVE_CTYPE_H
-# include <ctype.h>
-#endif
-
-#if HAVE_INTTYPES_H
-# include <inttypes.h>
-#else
-# if HAVE_STDINT_H
-#  include <stdint.h>
-# endif
-#endif
-
-#if HAVE_SYS_RESOURCE_H
-# include <sys/resource.h>
-#endif
-
-#include <stdlib.h>
-"; then :
-
-else
-  HTYPE_IS_INTEGRAL=0
-fi
-
-
-
-        if test "$HTYPE_IS_INTEGRAL" -eq 0
-        then
-            if ac_fn_c_compute_int "$LINENO" "sizeof(clock_t) == sizeof(float)" "HTYPE_IS_FLOAT"        "
-#include <stdio.h>
-#include <stddef.h>
-
-#if HAVE_SYS_TYPES_H
-# include <sys/types.h>
-#endif
-
-#if HAVE_UNISTD_H
-# include <unistd.h>
-#endif
-
-#if HAVE_SYS_STAT_H
-# include <sys/stat.h>
-#endif
-
-#if HAVE_FCNTL_H
-# include <fcntl.h>
-#endif
-
-#if HAVE_SIGNAL_H
-# include <signal.h>
-#endif
-
-#if HAVE_TIME_H
-# include <time.h>
-#endif
-
-#if HAVE_TERMIOS_H
-# include <termios.h>
-#endif
-
-#if HAVE_STRING_H
-# include <string.h>
-#endif
-
-#if HAVE_CTYPE_H
-# include <ctype.h>
-#endif
-
-#if HAVE_INTTYPES_H
-# include <inttypes.h>
-#else
-# if HAVE_STDINT_H
-#  include <stdint.h>
-# endif
-#endif
-
-#if HAVE_SYS_RESOURCE_H
-# include <sys/resource.h>
-#endif
-
-#include <stdlib.h>
-"; then :
-
-else
-  fptools_cv_htype_sup_clock_t=no
-fi
-
-
-            if ac_fn_c_compute_int "$LINENO" "sizeof(clock_t) == sizeof(double)" "HTYPE_IS_DOUBLE"        "
-#include <stdio.h>
-#include <stddef.h>
-
-#if HAVE_SYS_TYPES_H
-# include <sys/types.h>
-#endif
-
-#if HAVE_UNISTD_H
-# include <unistd.h>
-#endif
-
-#if HAVE_SYS_STAT_H
-# include <sys/stat.h>
-#endif
-
-#if HAVE_FCNTL_H
-# include <fcntl.h>
-#endif
-
-#if HAVE_SIGNAL_H
-# include <signal.h>
-#endif
-
-#if HAVE_TIME_H
-# include <time.h>
-#endif
-
-#if HAVE_TERMIOS_H
-# include <termios.h>
-#endif
-
-#if HAVE_STRING_H
-# include <string.h>
-#endif
-
-#if HAVE_CTYPE_H
-# include <ctype.h>
-#endif
-
-#if HAVE_INTTYPES_H
-# include <inttypes.h>
-#else
-# if HAVE_STDINT_H
-#  include <stdint.h>
-# endif
-#endif
-
-#if HAVE_SYS_RESOURCE_H
-# include <sys/resource.h>
-#endif
-
-#include <stdlib.h>
-"; then :
-
-else
-  fptools_cv_htype_sup_clock_t=no
-fi
-
-
-            if ac_fn_c_compute_int "$LINENO" "sizeof(clock_t) == sizeof(long double)" "HTYPE_IS_LDOUBLE"        "
-#include <stdio.h>
-#include <stddef.h>
-
-#if HAVE_SYS_TYPES_H
-# include <sys/types.h>
-#endif
-
-#if HAVE_UNISTD_H
-# include <unistd.h>
-#endif
-
-#if HAVE_SYS_STAT_H
-# include <sys/stat.h>
-#endif
-
-#if HAVE_FCNTL_H
-# include <fcntl.h>
-#endif
-
-#if HAVE_SIGNAL_H
-# include <signal.h>
-#endif
-
-#if HAVE_TIME_H
-# include <time.h>
-#endif
-
-#if HAVE_TERMIOS_H
-# include <termios.h>
-#endif
-
-#if HAVE_STRING_H
-# include <string.h>
-#endif
-
-#if HAVE_CTYPE_H
-# include <ctype.h>
-#endif
-
-#if HAVE_INTTYPES_H
-# include <inttypes.h>
-#else
-# if HAVE_STDINT_H
-#  include <stdint.h>
-# endif
-#endif
-
-#if HAVE_SYS_RESOURCE_H
-# include <sys/resource.h>
-#endif
-
-#include <stdlib.h>
-"; then :
-
-else
-  fptools_cv_htype_sup_clock_t=no
-fi
-
-
-            if test "$HTYPE_IS_FLOAT" -eq 1
-            then
-                fptools_cv_htype_clock_t=Float
-            elif test "$HTYPE_IS_DOUBLE" -eq 1
-            then
-                fptools_cv_htype_clock_t=Double
-            elif test "$HTYPE_IS_LDOUBLE" -eq 1
-            then
-                fptools_cv_htype_clock_t=LDouble
-            else
-                fptools_cv_htype_sup_clock_t=no
-            fi
-        else
-            if ac_fn_c_compute_int "$LINENO" "((clock_t)(-1)) < ((clock_t)0)" "HTYPE_IS_SIGNED"        "
-#include <stdio.h>
-#include <stddef.h>
-
-#if HAVE_SYS_TYPES_H
-# include <sys/types.h>
-#endif
-
-#if HAVE_UNISTD_H
-# include <unistd.h>
-#endif
-
-#if HAVE_SYS_STAT_H
-# include <sys/stat.h>
-#endif
-
-#if HAVE_FCNTL_H
-# include <fcntl.h>
-#endif
-
-#if HAVE_SIGNAL_H
-# include <signal.h>
-#endif
-
-#if HAVE_TIME_H
-# include <time.h>
-#endif
-
-#if HAVE_TERMIOS_H
-# include <termios.h>
-#endif
-
-#if HAVE_STRING_H
-# include <string.h>
-#endif
-
-#if HAVE_CTYPE_H
-# include <ctype.h>
-#endif
-
-#if HAVE_INTTYPES_H
-# include <inttypes.h>
-#else
-# if HAVE_STDINT_H
-#  include <stdint.h>
-# endif
-#endif
-
-#if HAVE_SYS_RESOURCE_H
-# include <sys/resource.h>
-#endif
-
-#include <stdlib.h>
-"; then :
-
-else
-  fptools_cv_htype_sup_clock_t=no
-fi
-
-
-            if ac_fn_c_compute_int "$LINENO" "sizeof(clock_t) * 8" "HTYPE_SIZE"        "
-#include <stdio.h>
-#include <stddef.h>
-
-#if HAVE_SYS_TYPES_H
-# include <sys/types.h>
-#endif
-
-#if HAVE_UNISTD_H
-# include <unistd.h>
-#endif
-
-#if HAVE_SYS_STAT_H
-# include <sys/stat.h>
-#endif
-
-#if HAVE_FCNTL_H
-# include <fcntl.h>
-#endif
-
-#if HAVE_SIGNAL_H
-# include <signal.h>
-#endif
-
-#if HAVE_TIME_H
-# include <time.h>
-#endif
-
-#if HAVE_TERMIOS_H
-# include <termios.h>
-#endif
-
-#if HAVE_STRING_H
-# include <string.h>
-#endif
-
-#if HAVE_CTYPE_H
-# include <ctype.h>
-#endif
-
-#if HAVE_INTTYPES_H
-# include <inttypes.h>
-#else
-# if HAVE_STDINT_H
-#  include <stdint.h>
-# endif
-#endif
-
-#if HAVE_SYS_RESOURCE_H
-# include <sys/resource.h>
-#endif
-
-#include <stdlib.h>
-"; then :
-
-else
-  fptools_cv_htype_sup_clock_t=no
-fi
-
-
-            if test "$HTYPE_IS_SIGNED" -eq 0
-            then
-                fptools_cv_htype_clock_t="Word$HTYPE_SIZE"
-            else
-                fptools_cv_htype_clock_t="Int$HTYPE_SIZE"
-            fi
-        fi
-
-fi
-
-    if test "$fptools_cv_htype_sup_clock_t" = no
-    then
-
-        fptools_cv_htype_clock_t=NotReallyAType
-        { $as_echo "$as_me:${as_lineno-$LINENO}: result: not supported" >&5
-$as_echo "not supported" >&6; }
-
-    fi
-
-            if test "$fptools_cv_htype_sup_clock_t" = yes; then
-        { $as_echo "$as_me:${as_lineno-$LINENO}: result: $fptools_cv_htype_clock_t" >&5
-$as_echo "$fptools_cv_htype_clock_t" >&6; }
-
-cat >>confdefs.h <<_ACEOF
-#define HTYPE_CLOCK_T $fptools_cv_htype_clock_t
-_ACEOF
-
-    fi
-
-
-
-
-
-
-
-
-
-
-    { $as_echo "$as_me:${as_lineno-$LINENO}: checking Haskell type for time_t" >&5
-$as_echo_n "checking Haskell type for time_t... " >&6; }
-    if ${fptools_cv_htype_time_t+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-
-        fptools_cv_htype_sup_time_t=yes
-        if ac_fn_c_compute_int "$LINENO" "(time_t)0.2 - (time_t)0.4 < 0 ? 0 : 1" "HTYPE_IS_INTEGRAL"        "
-#include <stdio.h>
-#include <stddef.h>
-
-#if HAVE_SYS_TYPES_H
-# include <sys/types.h>
-#endif
-
-#if HAVE_UNISTD_H
-# include <unistd.h>
-#endif
-
-#if HAVE_SYS_STAT_H
-# include <sys/stat.h>
-#endif
-
-#if HAVE_FCNTL_H
-# include <fcntl.h>
-#endif
-
-#if HAVE_SIGNAL_H
-# include <signal.h>
-#endif
-
-#if HAVE_TIME_H
-# include <time.h>
-#endif
-
-#if HAVE_TERMIOS_H
-# include <termios.h>
-#endif
-
-#if HAVE_STRING_H
-# include <string.h>
-#endif
-
-#if HAVE_CTYPE_H
-# include <ctype.h>
-#endif
-
-#if HAVE_INTTYPES_H
-# include <inttypes.h>
-#else
-# if HAVE_STDINT_H
-#  include <stdint.h>
-# endif
-#endif
-
-#if HAVE_SYS_RESOURCE_H
-# include <sys/resource.h>
-#endif
-
-#include <stdlib.h>
-"; then :
-
-else
-  HTYPE_IS_INTEGRAL=0
-fi
-
-
-
-        if test "$HTYPE_IS_INTEGRAL" -eq 0
-        then
-            if ac_fn_c_compute_int "$LINENO" "sizeof(time_t) == sizeof(float)" "HTYPE_IS_FLOAT"        "
-#include <stdio.h>
-#include <stddef.h>
-
-#if HAVE_SYS_TYPES_H
-# include <sys/types.h>
-#endif
-
-#if HAVE_UNISTD_H
-# include <unistd.h>
-#endif
-
-#if HAVE_SYS_STAT_H
-# include <sys/stat.h>
-#endif
-
-#if HAVE_FCNTL_H
-# include <fcntl.h>
-#endif
-
-#if HAVE_SIGNAL_H
-# include <signal.h>
-#endif
-
-#if HAVE_TIME_H
-# include <time.h>
-#endif
-
-#if HAVE_TERMIOS_H
-# include <termios.h>
-#endif
-
-#if HAVE_STRING_H
-# include <string.h>
-#endif
-
-#if HAVE_CTYPE_H
-# include <ctype.h>
-#endif
-
-#if HAVE_INTTYPES_H
-# include <inttypes.h>
-#else
-# if HAVE_STDINT_H
-#  include <stdint.h>
-# endif
-#endif
-
-#if HAVE_SYS_RESOURCE_H
-# include <sys/resource.h>
-#endif
-
-#include <stdlib.h>
-"; then :
-
-else
-  fptools_cv_htype_sup_time_t=no
-fi
-
-
-            if ac_fn_c_compute_int "$LINENO" "sizeof(time_t) == sizeof(double)" "HTYPE_IS_DOUBLE"        "
-#include <stdio.h>
-#include <stddef.h>
-
-#if HAVE_SYS_TYPES_H
-# include <sys/types.h>
-#endif
-
-#if HAVE_UNISTD_H
-# include <unistd.h>
-#endif
-
-#if HAVE_SYS_STAT_H
-# include <sys/stat.h>
-#endif
-
-#if HAVE_FCNTL_H
-# include <fcntl.h>
-#endif
-
-#if HAVE_SIGNAL_H
-# include <signal.h>
-#endif
-
-#if HAVE_TIME_H
-# include <time.h>
-#endif
-
-#if HAVE_TERMIOS_H
-# include <termios.h>
-#endif
-
-#if HAVE_STRING_H
-# include <string.h>
-#endif
-
-#if HAVE_CTYPE_H
-# include <ctype.h>
-#endif
-
-#if HAVE_INTTYPES_H
-# include <inttypes.h>
-#else
-# if HAVE_STDINT_H
-#  include <stdint.h>
-# endif
-#endif
-
-#if HAVE_SYS_RESOURCE_H
-# include <sys/resource.h>
-#endif
-
-#include <stdlib.h>
-"; then :
-
-else
-  fptools_cv_htype_sup_time_t=no
-fi
-
-
-            if ac_fn_c_compute_int "$LINENO" "sizeof(time_t) == sizeof(long double)" "HTYPE_IS_LDOUBLE"        "
-#include <stdio.h>
-#include <stddef.h>
-
-#if HAVE_SYS_TYPES_H
-# include <sys/types.h>
-#endif
-
-#if HAVE_UNISTD_H
-# include <unistd.h>
-#endif
-
-#if HAVE_SYS_STAT_H
-# include <sys/stat.h>
-#endif
-
-#if HAVE_FCNTL_H
-# include <fcntl.h>
-#endif
-
-#if HAVE_SIGNAL_H
-# include <signal.h>
-#endif
-
-#if HAVE_TIME_H
-# include <time.h>
-#endif
-
-#if HAVE_TERMIOS_H
-# include <termios.h>
-#endif
-
-#if HAVE_STRING_H
-# include <string.h>
-#endif
-
-#if HAVE_CTYPE_H
-# include <ctype.h>
-#endif
-
-#if HAVE_INTTYPES_H
-# include <inttypes.h>
-#else
-# if HAVE_STDINT_H
-#  include <stdint.h>
-# endif
-#endif
-
-#if HAVE_SYS_RESOURCE_H
-# include <sys/resource.h>
-#endif
-
-#include <stdlib.h>
-"; then :
-
-else
-  fptools_cv_htype_sup_time_t=no
-fi
-
-
-            if test "$HTYPE_IS_FLOAT" -eq 1
-            then
-                fptools_cv_htype_time_t=Float
-            elif test "$HTYPE_IS_DOUBLE" -eq 1
-            then
-                fptools_cv_htype_time_t=Double
-            elif test "$HTYPE_IS_LDOUBLE" -eq 1
-            then
-                fptools_cv_htype_time_t=LDouble
-            else
-                fptools_cv_htype_sup_time_t=no
-            fi
-        else
-            if ac_fn_c_compute_int "$LINENO" "((time_t)(-1)) < ((time_t)0)" "HTYPE_IS_SIGNED"        "
-#include <stdio.h>
-#include <stddef.h>
-
-#if HAVE_SYS_TYPES_H
-# include <sys/types.h>
-#endif
-
-#if HAVE_UNISTD_H
-# include <unistd.h>
-#endif
-
-#if HAVE_SYS_STAT_H
-# include <sys/stat.h>
-#endif
-
-#if HAVE_FCNTL_H
-# include <fcntl.h>
-#endif
-
-#if HAVE_SIGNAL_H
-# include <signal.h>
-#endif
-
-#if HAVE_TIME_H
-# include <time.h>
-#endif
-
-#if HAVE_TERMIOS_H
-# include <termios.h>
-#endif
-
-#if HAVE_STRING_H
-# include <string.h>
-#endif
-
-#if HAVE_CTYPE_H
-# include <ctype.h>
-#endif
-
-#if HAVE_INTTYPES_H
-# include <inttypes.h>
-#else
-# if HAVE_STDINT_H
-#  include <stdint.h>
-# endif
-#endif
-
-#if HAVE_SYS_RESOURCE_H
-# include <sys/resource.h>
-#endif
-
-#include <stdlib.h>
-"; then :
-
-else
-  fptools_cv_htype_sup_time_t=no
-fi
-
-
-            if ac_fn_c_compute_int "$LINENO" "sizeof(time_t) * 8" "HTYPE_SIZE"        "
-#include <stdio.h>
-#include <stddef.h>
-
-#if HAVE_SYS_TYPES_H
-# include <sys/types.h>
-#endif
-
-#if HAVE_UNISTD_H
-# include <unistd.h>
-#endif
-
-#if HAVE_SYS_STAT_H
-# include <sys/stat.h>
-#endif
-
-#if HAVE_FCNTL_H
-# include <fcntl.h>
-#endif
-
-#if HAVE_SIGNAL_H
-# include <signal.h>
-#endif
-
-#if HAVE_TIME_H
-# include <time.h>
-#endif
-
-#if HAVE_TERMIOS_H
-# include <termios.h>
-#endif
-
-#if HAVE_STRING_H
-# include <string.h>
-#endif
-
-#if HAVE_CTYPE_H
-# include <ctype.h>
-#endif
-
-#if HAVE_INTTYPES_H
-# include <inttypes.h>
-#else
-# if HAVE_STDINT_H
-#  include <stdint.h>
-# endif
-#endif
-
-#if HAVE_SYS_RESOURCE_H
-# include <sys/resource.h>
-#endif
-
-#include <stdlib.h>
-"; then :
-
-else
-  fptools_cv_htype_sup_time_t=no
-fi
-
-
-            if test "$HTYPE_IS_SIGNED" -eq 0
-            then
-                fptools_cv_htype_time_t="Word$HTYPE_SIZE"
-            else
-                fptools_cv_htype_time_t="Int$HTYPE_SIZE"
-            fi
-        fi
-
-fi
-
-    if test "$fptools_cv_htype_sup_time_t" = no
-    then
-
-        fptools_cv_htype_time_t=NotReallyAType
-        { $as_echo "$as_me:${as_lineno-$LINENO}: result: not supported" >&5
-$as_echo "not supported" >&6; }
-
-    fi
-
-            if test "$fptools_cv_htype_sup_time_t" = yes; then
-        { $as_echo "$as_me:${as_lineno-$LINENO}: result: $fptools_cv_htype_time_t" >&5
-$as_echo "$fptools_cv_htype_time_t" >&6; }
-
-cat >>confdefs.h <<_ACEOF
-#define HTYPE_TIME_T $fptools_cv_htype_time_t
-_ACEOF
-
-    fi
-
-
-
-
-
-
-
-
-
-
-    { $as_echo "$as_me:${as_lineno-$LINENO}: checking Haskell type for useconds_t" >&5
-$as_echo_n "checking Haskell type for useconds_t... " >&6; }
-    if ${fptools_cv_htype_useconds_t+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-
-        fptools_cv_htype_sup_useconds_t=yes
-        if ac_fn_c_compute_int "$LINENO" "(useconds_t)0.2 - (useconds_t)0.4 < 0 ? 0 : 1" "HTYPE_IS_INTEGRAL"        "
-#include <stdio.h>
-#include <stddef.h>
-
-#if HAVE_SYS_TYPES_H
-# include <sys/types.h>
-#endif
-
-#if HAVE_UNISTD_H
-# include <unistd.h>
-#endif
-
-#if HAVE_SYS_STAT_H
-# include <sys/stat.h>
-#endif
-
-#if HAVE_FCNTL_H
-# include <fcntl.h>
-#endif
-
-#if HAVE_SIGNAL_H
-# include <signal.h>
-#endif
-
-#if HAVE_TIME_H
-# include <time.h>
-#endif
-
-#if HAVE_TERMIOS_H
-# include <termios.h>
-#endif
-
-#if HAVE_STRING_H
-# include <string.h>
-#endif
-
-#if HAVE_CTYPE_H
-# include <ctype.h>
-#endif
-
-#if HAVE_INTTYPES_H
-# include <inttypes.h>
-#else
-# if HAVE_STDINT_H
-#  include <stdint.h>
-# endif
-#endif
-
-#if HAVE_SYS_RESOURCE_H
-# include <sys/resource.h>
-#endif
-
-#include <stdlib.h>
-"; then :
-
-else
-  HTYPE_IS_INTEGRAL=0
-fi
-
-
-
-        if test "$HTYPE_IS_INTEGRAL" -eq 0
-        then
-            if ac_fn_c_compute_int "$LINENO" "sizeof(useconds_t) == sizeof(float)" "HTYPE_IS_FLOAT"        "
-#include <stdio.h>
-#include <stddef.h>
-
-#if HAVE_SYS_TYPES_H
-# include <sys/types.h>
-#endif
-
-#if HAVE_UNISTD_H
-# include <unistd.h>
-#endif
-
-#if HAVE_SYS_STAT_H
-# include <sys/stat.h>
-#endif
-
-#if HAVE_FCNTL_H
-# include <fcntl.h>
-#endif
-
-#if HAVE_SIGNAL_H
-# include <signal.h>
-#endif
-
-#if HAVE_TIME_H
-# include <time.h>
-#endif
-
-#if HAVE_TERMIOS_H
-# include <termios.h>
-#endif
-
-#if HAVE_STRING_H
-# include <string.h>
-#endif
-
-#if HAVE_CTYPE_H
-# include <ctype.h>
-#endif
-
-#if HAVE_INTTYPES_H
-# include <inttypes.h>
-#else
-# if HAVE_STDINT_H
-#  include <stdint.h>
-# endif
-#endif
-
-#if HAVE_SYS_RESOURCE_H
-# include <sys/resource.h>
-#endif
-
-#include <stdlib.h>
-"; then :
-
-else
-  fptools_cv_htype_sup_useconds_t=no
-fi
-
-
-            if ac_fn_c_compute_int "$LINENO" "sizeof(useconds_t) == sizeof(double)" "HTYPE_IS_DOUBLE"        "
-#include <stdio.h>
-#include <stddef.h>
-
-#if HAVE_SYS_TYPES_H
-# include <sys/types.h>
-#endif
-
-#if HAVE_UNISTD_H
-# include <unistd.h>
-#endif
-
-#if HAVE_SYS_STAT_H
-# include <sys/stat.h>
-#endif
-
-#if HAVE_FCNTL_H
-# include <fcntl.h>
-#endif
-
-#if HAVE_SIGNAL_H
-# include <signal.h>
-#endif
-
-#if HAVE_TIME_H
-# include <time.h>
-#endif
-
-#if HAVE_TERMIOS_H
-# include <termios.h>
-#endif
-
-#if HAVE_STRING_H
-# include <string.h>
-#endif
-
-#if HAVE_CTYPE_H
-# include <ctype.h>
-#endif
-
-#if HAVE_INTTYPES_H
-# include <inttypes.h>
-#else
-# if HAVE_STDINT_H
-#  include <stdint.h>
-# endif
-#endif
-
-#if HAVE_SYS_RESOURCE_H
-# include <sys/resource.h>
-#endif
-
-#include <stdlib.h>
-"; then :
-
-else
-  fptools_cv_htype_sup_useconds_t=no
-fi
-
-
-            if ac_fn_c_compute_int "$LINENO" "sizeof(useconds_t) == sizeof(long double)" "HTYPE_IS_LDOUBLE"        "
-#include <stdio.h>
-#include <stddef.h>
-
-#if HAVE_SYS_TYPES_H
-# include <sys/types.h>
-#endif
-
-#if HAVE_UNISTD_H
-# include <unistd.h>
-#endif
-
-#if HAVE_SYS_STAT_H
-# include <sys/stat.h>
-#endif
-
-#if HAVE_FCNTL_H
-# include <fcntl.h>
-#endif
-
-#if HAVE_SIGNAL_H
-# include <signal.h>
-#endif
-
-#if HAVE_TIME_H
-# include <time.h>
-#endif
-
-#if HAVE_TERMIOS_H
-# include <termios.h>
-#endif
-
-#if HAVE_STRING_H
-# include <string.h>
-#endif
-
-#if HAVE_CTYPE_H
-# include <ctype.h>
-#endif
-
-#if HAVE_INTTYPES_H
-# include <inttypes.h>
-#else
-# if HAVE_STDINT_H
-#  include <stdint.h>
-# endif
-#endif
-
-#if HAVE_SYS_RESOURCE_H
-# include <sys/resource.h>
-#endif
-
-#include <stdlib.h>
-"; then :
-
-else
-  fptools_cv_htype_sup_useconds_t=no
-fi
-
-
-            if test "$HTYPE_IS_FLOAT" -eq 1
-            then
-                fptools_cv_htype_useconds_t=Float
-            elif test "$HTYPE_IS_DOUBLE" -eq 1
-            then
-                fptools_cv_htype_useconds_t=Double
-            elif test "$HTYPE_IS_LDOUBLE" -eq 1
-            then
-                fptools_cv_htype_useconds_t=LDouble
-            else
-                fptools_cv_htype_sup_useconds_t=no
-            fi
-        else
-            if ac_fn_c_compute_int "$LINENO" "((useconds_t)(-1)) < ((useconds_t)0)" "HTYPE_IS_SIGNED"        "
-#include <stdio.h>
-#include <stddef.h>
-
-#if HAVE_SYS_TYPES_H
-# include <sys/types.h>
-#endif
-
-#if HAVE_UNISTD_H
-# include <unistd.h>
-#endif
-
-#if HAVE_SYS_STAT_H
-# include <sys/stat.h>
-#endif
-
-#if HAVE_FCNTL_H
-# include <fcntl.h>
-#endif
-
-#if HAVE_SIGNAL_H
-# include <signal.h>
-#endif
-
-#if HAVE_TIME_H
-# include <time.h>
-#endif
-
-#if HAVE_TERMIOS_H
-# include <termios.h>
-#endif
-
-#if HAVE_STRING_H
-# include <string.h>
-#endif
-
-#if HAVE_CTYPE_H
-# include <ctype.h>
-#endif
-
-#if HAVE_INTTYPES_H
-# include <inttypes.h>
-#else
-# if HAVE_STDINT_H
-#  include <stdint.h>
-# endif
-#endif
-
-#if HAVE_SYS_RESOURCE_H
-# include <sys/resource.h>
-#endif
-
-#include <stdlib.h>
-"; then :
-
-else
-  fptools_cv_htype_sup_useconds_t=no
-fi
-
-
-            if ac_fn_c_compute_int "$LINENO" "sizeof(useconds_t) * 8" "HTYPE_SIZE"        "
-#include <stdio.h>
-#include <stddef.h>
-
-#if HAVE_SYS_TYPES_H
-# include <sys/types.h>
-#endif
-
-#if HAVE_UNISTD_H
-# include <unistd.h>
-#endif
-
-#if HAVE_SYS_STAT_H
-# include <sys/stat.h>
-#endif
-
-#if HAVE_FCNTL_H
-# include <fcntl.h>
-#endif
-
-#if HAVE_SIGNAL_H
-# include <signal.h>
-#endif
-
-#if HAVE_TIME_H
-# include <time.h>
-#endif
-
-#if HAVE_TERMIOS_H
-# include <termios.h>
-#endif
-
-#if HAVE_STRING_H
-# include <string.h>
-#endif
-
-#if HAVE_CTYPE_H
-# include <ctype.h>
-#endif
-
-#if HAVE_INTTYPES_H
-# include <inttypes.h>
-#else
-# if HAVE_STDINT_H
-#  include <stdint.h>
-# endif
-#endif
-
-#if HAVE_SYS_RESOURCE_H
-# include <sys/resource.h>
-#endif
-
-#include <stdlib.h>
-"; then :
-
-else
-  fptools_cv_htype_sup_useconds_t=no
-fi
-
-
-            if test "$HTYPE_IS_SIGNED" -eq 0
-            then
-                fptools_cv_htype_useconds_t="Word$HTYPE_SIZE"
-            else
-                fptools_cv_htype_useconds_t="Int$HTYPE_SIZE"
-            fi
-        fi
-
-fi
-
-    if test "$fptools_cv_htype_sup_useconds_t" = no
-    then
-
-        fptools_cv_htype_useconds_t=NotReallyAType
-        { $as_echo "$as_me:${as_lineno-$LINENO}: result: not supported" >&5
-$as_echo "not supported" >&6; }
-
-    fi
-
-            if test "$fptools_cv_htype_sup_useconds_t" = yes; then
-        { $as_echo "$as_me:${as_lineno-$LINENO}: result: $fptools_cv_htype_useconds_t" >&5
-$as_echo "$fptools_cv_htype_useconds_t" >&6; }
-
-cat >>confdefs.h <<_ACEOF
-#define HTYPE_USECONDS_T $fptools_cv_htype_useconds_t
-_ACEOF
-
-    fi
-
-
-
-
-
-
-
-
-
-    { $as_echo "$as_me:${as_lineno-$LINENO}: checking Haskell type for suseconds_t" >&5
-$as_echo_n "checking Haskell type for suseconds_t... " >&6; }
-    if ${fptools_cv_htype_suseconds_t+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-
-        fptools_cv_htype_sup_suseconds_t=yes
-        if ac_fn_c_compute_int "$LINENO" "(suseconds_t)0.2 - (suseconds_t)0.4 < 0 ? 0 : 1" "HTYPE_IS_INTEGRAL"        "
-#include <stdio.h>
-#include <stddef.h>
-
-#if HAVE_SYS_TYPES_H
-# include <sys/types.h>
-#endif
-
-#if HAVE_UNISTD_H
-# include <unistd.h>
-#endif
-
-#if HAVE_SYS_STAT_H
-# include <sys/stat.h>
-#endif
-
-#if HAVE_FCNTL_H
-# include <fcntl.h>
-#endif
-
-#if HAVE_SIGNAL_H
-# include <signal.h>
-#endif
-
-#if HAVE_TIME_H
-# include <time.h>
-#endif
-
-#if HAVE_TERMIOS_H
-# include <termios.h>
-#endif
-
-#if HAVE_STRING_H
-# include <string.h>
-#endif
-
-#if HAVE_CTYPE_H
-# include <ctype.h>
-#endif
-
-#if HAVE_INTTYPES_H
-# include <inttypes.h>
-#else
-# if HAVE_STDINT_H
-#  include <stdint.h>
-# endif
-#endif
-
-#if HAVE_SYS_RESOURCE_H
-# include <sys/resource.h>
-#endif
-
-#include <stdlib.h>
-"; then :
-
-else
-  HTYPE_IS_INTEGRAL=0
-fi
-
-
-
-        if test "$HTYPE_IS_INTEGRAL" -eq 0
-        then
-            if ac_fn_c_compute_int "$LINENO" "sizeof(suseconds_t) == sizeof(float)" "HTYPE_IS_FLOAT"        "
-#include <stdio.h>
-#include <stddef.h>
-
-#if HAVE_SYS_TYPES_H
-# include <sys/types.h>
-#endif
-
-#if HAVE_UNISTD_H
-# include <unistd.h>
-#endif
-
-#if HAVE_SYS_STAT_H
-# include <sys/stat.h>
-#endif
-
-#if HAVE_FCNTL_H
-# include <fcntl.h>
-#endif
-
-#if HAVE_SIGNAL_H
-# include <signal.h>
-#endif
-
-#if HAVE_TIME_H
-# include <time.h>
-#endif
-
-#if HAVE_TERMIOS_H
-# include <termios.h>
-#endif
-
-#if HAVE_STRING_H
-# include <string.h>
-#endif
-
-#if HAVE_CTYPE_H
-# include <ctype.h>
-#endif
-
-#if HAVE_INTTYPES_H
-# include <inttypes.h>
-#else
-# if HAVE_STDINT_H
-#  include <stdint.h>
-# endif
-#endif
-
-#if HAVE_SYS_RESOURCE_H
-# include <sys/resource.h>
-#endif
-
-#include <stdlib.h>
-"; then :
-
-else
-  fptools_cv_htype_sup_suseconds_t=no
-fi
-
-
-            if ac_fn_c_compute_int "$LINENO" "sizeof(suseconds_t) == sizeof(double)" "HTYPE_IS_DOUBLE"        "
-#include <stdio.h>
-#include <stddef.h>
-
-#if HAVE_SYS_TYPES_H
-# include <sys/types.h>
-#endif
-
-#if HAVE_UNISTD_H
-# include <unistd.h>
-#endif
-
-#if HAVE_SYS_STAT_H
-# include <sys/stat.h>
-#endif
-
-#if HAVE_FCNTL_H
-# include <fcntl.h>
-#endif
-
-#if HAVE_SIGNAL_H
-# include <signal.h>
-#endif
-
-#if HAVE_TIME_H
-# include <time.h>
-#endif
-
-#if HAVE_TERMIOS_H
-# include <termios.h>
-#endif
-
-#if HAVE_STRING_H
-# include <string.h>
-#endif
-
-#if HAVE_CTYPE_H
-# include <ctype.h>
-#endif
-
-#if HAVE_INTTYPES_H
-# include <inttypes.h>
-#else
-# if HAVE_STDINT_H
-#  include <stdint.h>
-# endif
-#endif
-
-#if HAVE_SYS_RESOURCE_H
-# include <sys/resource.h>
-#endif
-
-#include <stdlib.h>
-"; then :
-
-else
-  fptools_cv_htype_sup_suseconds_t=no
-fi
-
-
-            if ac_fn_c_compute_int "$LINENO" "sizeof(suseconds_t) == sizeof(long double)" "HTYPE_IS_LDOUBLE"        "
-#include <stdio.h>
-#include <stddef.h>
-
-#if HAVE_SYS_TYPES_H
-# include <sys/types.h>
-#endif
-
-#if HAVE_UNISTD_H
-# include <unistd.h>
-#endif
-
-#if HAVE_SYS_STAT_H
-# include <sys/stat.h>
-#endif
-
-#if HAVE_FCNTL_H
-# include <fcntl.h>
-#endif
-
-#if HAVE_SIGNAL_H
-# include <signal.h>
-#endif
-
-#if HAVE_TIME_H
-# include <time.h>
-#endif
-
-#if HAVE_TERMIOS_H
-# include <termios.h>
-#endif
-
-#if HAVE_STRING_H
-# include <string.h>
-#endif
-
-#if HAVE_CTYPE_H
-# include <ctype.h>
-#endif
-
-#if HAVE_INTTYPES_H
-# include <inttypes.h>
-#else
-# if HAVE_STDINT_H
-#  include <stdint.h>
-# endif
-#endif
-
-#if HAVE_SYS_RESOURCE_H
-# include <sys/resource.h>
-#endif
-
-#include <stdlib.h>
-"; then :
-
-else
-  fptools_cv_htype_sup_suseconds_t=no
-fi
-
-
-            if test "$HTYPE_IS_FLOAT" -eq 1
-            then
-                fptools_cv_htype_suseconds_t=Float
-            elif test "$HTYPE_IS_DOUBLE" -eq 1
-            then
-                fptools_cv_htype_suseconds_t=Double
-            elif test "$HTYPE_IS_LDOUBLE" -eq 1
-            then
-                fptools_cv_htype_suseconds_t=LDouble
-            else
-                fptools_cv_htype_sup_suseconds_t=no
-            fi
-        else
-            if ac_fn_c_compute_int "$LINENO" "((suseconds_t)(-1)) < ((suseconds_t)0)" "HTYPE_IS_SIGNED"        "
-#include <stdio.h>
-#include <stddef.h>
-
-#if HAVE_SYS_TYPES_H
-# include <sys/types.h>
-#endif
-
-#if HAVE_UNISTD_H
-# include <unistd.h>
-#endif
-
-#if HAVE_SYS_STAT_H
-# include <sys/stat.h>
-#endif
-
-#if HAVE_FCNTL_H
-# include <fcntl.h>
-#endif
-
-#if HAVE_SIGNAL_H
-# include <signal.h>
-#endif
-
-#if HAVE_TIME_H
-# include <time.h>
-#endif
-
-#if HAVE_TERMIOS_H
-# include <termios.h>
-#endif
-
-#if HAVE_STRING_H
-# include <string.h>
-#endif
-
-#if HAVE_CTYPE_H
-# include <ctype.h>
-#endif
-
-#if HAVE_INTTYPES_H
-# include <inttypes.h>
-#else
-# if HAVE_STDINT_H
-#  include <stdint.h>
-# endif
-#endif
-
-#if HAVE_SYS_RESOURCE_H
-# include <sys/resource.h>
-#endif
-
-#include <stdlib.h>
-"; then :
-
-else
-  fptools_cv_htype_sup_suseconds_t=no
-fi
-
-
-            if ac_fn_c_compute_int "$LINENO" "sizeof(suseconds_t) * 8" "HTYPE_SIZE"        "
-#include <stdio.h>
-#include <stddef.h>
-
-#if HAVE_SYS_TYPES_H
-# include <sys/types.h>
-#endif
-
-#if HAVE_UNISTD_H
-# include <unistd.h>
-#endif
-
-#if HAVE_SYS_STAT_H
-# include <sys/stat.h>
-#endif
-
-#if HAVE_FCNTL_H
-# include <fcntl.h>
-#endif
-
-#if HAVE_SIGNAL_H
-# include <signal.h>
-#endif
-
-#if HAVE_TIME_H
-# include <time.h>
-#endif
-
-#if HAVE_TERMIOS_H
-# include <termios.h>
-#endif
-
-#if HAVE_STRING_H
-# include <string.h>
-#endif
-
-#if HAVE_CTYPE_H
-# include <ctype.h>
-#endif
-
-#if HAVE_INTTYPES_H
-# include <inttypes.h>
-#else
-# if HAVE_STDINT_H
-#  include <stdint.h>
-# endif
-#endif
-
-#if HAVE_SYS_RESOURCE_H
-# include <sys/resource.h>
-#endif
-
-#include <stdlib.h>
-"; then :
-
-else
-  fptools_cv_htype_sup_suseconds_t=no
-fi
-
-
-            if test "$HTYPE_IS_SIGNED" -eq 0
-            then
-                fptools_cv_htype_suseconds_t="Word$HTYPE_SIZE"
-            else
-                fptools_cv_htype_suseconds_t="Int$HTYPE_SIZE"
-            fi
-        fi
-
-fi
-
-    if test "$fptools_cv_htype_sup_suseconds_t" = no
-    then
-        if test "$WINDOWS" = "YES"
-                          then
-                              fptools_cv_htype_suseconds_t=Int32
-                              fptools_cv_htype_sup_suseconds_t=yes
-                          else
-                              as_fn_error $? "type not found" "$LINENO" 5
-                          fi
-    fi
-
-            if test "$fptools_cv_htype_sup_suseconds_t" = yes; then
-        { $as_echo "$as_me:${as_lineno-$LINENO}: result: $fptools_cv_htype_suseconds_t" >&5
-$as_echo "$fptools_cv_htype_suseconds_t" >&6; }
-
-cat >>confdefs.h <<_ACEOF
-#define HTYPE_SUSECONDS_T $fptools_cv_htype_suseconds_t
-_ACEOF
-
-    fi
-
-
-
-
-
-
-
-
-
-    { $as_echo "$as_me:${as_lineno-$LINENO}: checking Haskell type for dev_t" >&5
-$as_echo_n "checking Haskell type for dev_t... " >&6; }
-    if ${fptools_cv_htype_dev_t+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-
-        fptools_cv_htype_sup_dev_t=yes
-        if ac_fn_c_compute_int "$LINENO" "(dev_t)0.2 - (dev_t)0.4 < 0 ? 0 : 1" "HTYPE_IS_INTEGRAL"        "
-#include <stdio.h>
-#include <stddef.h>
-
-#if HAVE_SYS_TYPES_H
-# include <sys/types.h>
-#endif
-
-#if HAVE_UNISTD_H
-# include <unistd.h>
-#endif
-
-#if HAVE_SYS_STAT_H
-# include <sys/stat.h>
-#endif
-
-#if HAVE_FCNTL_H
-# include <fcntl.h>
-#endif
-
-#if HAVE_SIGNAL_H
-# include <signal.h>
-#endif
-
-#if HAVE_TIME_H
-# include <time.h>
-#endif
-
-#if HAVE_TERMIOS_H
-# include <termios.h>
-#endif
-
-#if HAVE_STRING_H
-# include <string.h>
-#endif
-
-#if HAVE_CTYPE_H
-# include <ctype.h>
-#endif
-
-#if HAVE_INTTYPES_H
-# include <inttypes.h>
-#else
-# if HAVE_STDINT_H
-#  include <stdint.h>
-# endif
-#endif
-
-#if HAVE_SYS_RESOURCE_H
-# include <sys/resource.h>
-#endif
-
-#include <stdlib.h>
-"; then :
-
-else
-  HTYPE_IS_INTEGRAL=0
-fi
-
-
-
-        if test "$HTYPE_IS_INTEGRAL" -eq 0
-        then
-            if ac_fn_c_compute_int "$LINENO" "sizeof(dev_t) == sizeof(float)" "HTYPE_IS_FLOAT"        "
-#include <stdio.h>
-#include <stddef.h>
-
-#if HAVE_SYS_TYPES_H
-# include <sys/types.h>
-#endif
-
-#if HAVE_UNISTD_H
-# include <unistd.h>
-#endif
-
-#if HAVE_SYS_STAT_H
-# include <sys/stat.h>
-#endif
-
-#if HAVE_FCNTL_H
-# include <fcntl.h>
-#endif
-
-#if HAVE_SIGNAL_H
-# include <signal.h>
-#endif
-
-#if HAVE_TIME_H
-# include <time.h>
-#endif
-
-#if HAVE_TERMIOS_H
-# include <termios.h>
-#endif
-
-#if HAVE_STRING_H
-# include <string.h>
-#endif
-
-#if HAVE_CTYPE_H
-# include <ctype.h>
-#endif
-
-#if HAVE_INTTYPES_H
-# include <inttypes.h>
-#else
-# if HAVE_STDINT_H
-#  include <stdint.h>
-# endif
-#endif
-
-#if HAVE_SYS_RESOURCE_H
-# include <sys/resource.h>
-#endif
-
-#include <stdlib.h>
-"; then :
-
-else
-  fptools_cv_htype_sup_dev_t=no
-fi
-
-
-            if ac_fn_c_compute_int "$LINENO" "sizeof(dev_t) == sizeof(double)" "HTYPE_IS_DOUBLE"        "
-#include <stdio.h>
-#include <stddef.h>
-
-#if HAVE_SYS_TYPES_H
-# include <sys/types.h>
-#endif
-
-#if HAVE_UNISTD_H
-# include <unistd.h>
-#endif
-
-#if HAVE_SYS_STAT_H
-# include <sys/stat.h>
-#endif
-
-#if HAVE_FCNTL_H
-# include <fcntl.h>
-#endif
-
-#if HAVE_SIGNAL_H
-# include <signal.h>
-#endif
-
-#if HAVE_TIME_H
-# include <time.h>
-#endif
-
-#if HAVE_TERMIOS_H
-# include <termios.h>
-#endif
-
-#if HAVE_STRING_H
-# include <string.h>
-#endif
-
-#if HAVE_CTYPE_H
-# include <ctype.h>
-#endif
-
-#if HAVE_INTTYPES_H
-# include <inttypes.h>
-#else
-# if HAVE_STDINT_H
-#  include <stdint.h>
-# endif
-#endif
-
-#if HAVE_SYS_RESOURCE_H
-# include <sys/resource.h>
-#endif
-
-#include <stdlib.h>
-"; then :
-
-else
-  fptools_cv_htype_sup_dev_t=no
-fi
-
-
-            if ac_fn_c_compute_int "$LINENO" "sizeof(dev_t) == sizeof(long double)" "HTYPE_IS_LDOUBLE"        "
-#include <stdio.h>
-#include <stddef.h>
-
-#if HAVE_SYS_TYPES_H
-# include <sys/types.h>
-#endif
-
-#if HAVE_UNISTD_H
-# include <unistd.h>
-#endif
-
-#if HAVE_SYS_STAT_H
-# include <sys/stat.h>
-#endif
-
-#if HAVE_FCNTL_H
-# include <fcntl.h>
-#endif
-
-#if HAVE_SIGNAL_H
-# include <signal.h>
-#endif
-
-#if HAVE_TIME_H
-# include <time.h>
-#endif
-
-#if HAVE_TERMIOS_H
-# include <termios.h>
-#endif
-
-#if HAVE_STRING_H
-# include <string.h>
-#endif
-
-#if HAVE_CTYPE_H
-# include <ctype.h>
-#endif
-
-#if HAVE_INTTYPES_H
-# include <inttypes.h>
-#else
-# if HAVE_STDINT_H
-#  include <stdint.h>
-# endif
-#endif
-
-#if HAVE_SYS_RESOURCE_H
-# include <sys/resource.h>
-#endif
-
-#include <stdlib.h>
-"; then :
-
-else
-  fptools_cv_htype_sup_dev_t=no
-fi
-
-
-            if test "$HTYPE_IS_FLOAT" -eq 1
-            then
-                fptools_cv_htype_dev_t=Float
-            elif test "$HTYPE_IS_DOUBLE" -eq 1
-            then
-                fptools_cv_htype_dev_t=Double
-            elif test "$HTYPE_IS_LDOUBLE" -eq 1
-            then
-                fptools_cv_htype_dev_t=LDouble
-            else
-                fptools_cv_htype_sup_dev_t=no
-            fi
-        else
-            if ac_fn_c_compute_int "$LINENO" "((dev_t)(-1)) < ((dev_t)0)" "HTYPE_IS_SIGNED"        "
-#include <stdio.h>
-#include <stddef.h>
-
-#if HAVE_SYS_TYPES_H
-# include <sys/types.h>
-#endif
-
-#if HAVE_UNISTD_H
-# include <unistd.h>
-#endif
-
-#if HAVE_SYS_STAT_H
-# include <sys/stat.h>
-#endif
-
-#if HAVE_FCNTL_H
-# include <fcntl.h>
-#endif
-
-#if HAVE_SIGNAL_H
-# include <signal.h>
-#endif
-
-#if HAVE_TIME_H
-# include <time.h>
-#endif
-
-#if HAVE_TERMIOS_H
-# include <termios.h>
-#endif
-
-#if HAVE_STRING_H
-# include <string.h>
-#endif
-
-#if HAVE_CTYPE_H
-# include <ctype.h>
-#endif
-
-#if HAVE_INTTYPES_H
-# include <inttypes.h>
-#else
-# if HAVE_STDINT_H
-#  include <stdint.h>
-# endif
-#endif
-
-#if HAVE_SYS_RESOURCE_H
-# include <sys/resource.h>
-#endif
-
-#include <stdlib.h>
-"; then :
-
-else
-  fptools_cv_htype_sup_dev_t=no
-fi
-
-
-            if ac_fn_c_compute_int "$LINENO" "sizeof(dev_t) * 8" "HTYPE_SIZE"        "
-#include <stdio.h>
-#include <stddef.h>
-
-#if HAVE_SYS_TYPES_H
-# include <sys/types.h>
-#endif
-
-#if HAVE_UNISTD_H
-# include <unistd.h>
-#endif
-
-#if HAVE_SYS_STAT_H
-# include <sys/stat.h>
-#endif
-
-#if HAVE_FCNTL_H
-# include <fcntl.h>
-#endif
-
-#if HAVE_SIGNAL_H
-# include <signal.h>
-#endif
-
-#if HAVE_TIME_H
-# include <time.h>
-#endif
-
-#if HAVE_TERMIOS_H
-# include <termios.h>
-#endif
-
-#if HAVE_STRING_H
-# include <string.h>
-#endif
-
-#if HAVE_CTYPE_H
-# include <ctype.h>
-#endif
-
-#if HAVE_INTTYPES_H
-# include <inttypes.h>
-#else
-# if HAVE_STDINT_H
-#  include <stdint.h>
-# endif
-#endif
-
-#if HAVE_SYS_RESOURCE_H
-# include <sys/resource.h>
-#endif
-
-#include <stdlib.h>
-"; then :
-
-else
-  fptools_cv_htype_sup_dev_t=no
-fi
-
-
-            if test "$HTYPE_IS_SIGNED" -eq 0
-            then
-                fptools_cv_htype_dev_t="Word$HTYPE_SIZE"
-            else
-                fptools_cv_htype_dev_t="Int$HTYPE_SIZE"
-            fi
-        fi
-
-fi
-
-    if test "$fptools_cv_htype_sup_dev_t" = no
-    then
-
-        fptools_cv_htype_dev_t=NotReallyAType
-        { $as_echo "$as_me:${as_lineno-$LINENO}: result: not supported" >&5
-$as_echo "not supported" >&6; }
-
-    fi
-
-            if test "$fptools_cv_htype_sup_dev_t" = yes; then
-        { $as_echo "$as_me:${as_lineno-$LINENO}: result: $fptools_cv_htype_dev_t" >&5
-$as_echo "$fptools_cv_htype_dev_t" >&6; }
-
-cat >>confdefs.h <<_ACEOF
-#define HTYPE_DEV_T $fptools_cv_htype_dev_t
-_ACEOF
-
-    fi
-
-
-
-
-
-
-
-
-
-
-    { $as_echo "$as_me:${as_lineno-$LINENO}: checking Haskell type for ino_t" >&5
-$as_echo_n "checking Haskell type for ino_t... " >&6; }
-    if ${fptools_cv_htype_ino_t+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-
-        fptools_cv_htype_sup_ino_t=yes
-        if ac_fn_c_compute_int "$LINENO" "(ino_t)0.2 - (ino_t)0.4 < 0 ? 0 : 1" "HTYPE_IS_INTEGRAL"        "
-#include <stdio.h>
-#include <stddef.h>
-
-#if HAVE_SYS_TYPES_H
-# include <sys/types.h>
-#endif
-
-#if HAVE_UNISTD_H
-# include <unistd.h>
-#endif
-
-#if HAVE_SYS_STAT_H
-# include <sys/stat.h>
-#endif
-
-#if HAVE_FCNTL_H
-# include <fcntl.h>
-#endif
-
-#if HAVE_SIGNAL_H
-# include <signal.h>
-#endif
-
-#if HAVE_TIME_H
-# include <time.h>
-#endif
-
-#if HAVE_TERMIOS_H
-# include <termios.h>
-#endif
-
-#if HAVE_STRING_H
-# include <string.h>
-#endif
-
-#if HAVE_CTYPE_H
-# include <ctype.h>
-#endif
-
-#if HAVE_INTTYPES_H
-# include <inttypes.h>
-#else
-# if HAVE_STDINT_H
-#  include <stdint.h>
-# endif
-#endif
-
-#if HAVE_SYS_RESOURCE_H
-# include <sys/resource.h>
-#endif
-
-#include <stdlib.h>
-"; then :
-
-else
-  HTYPE_IS_INTEGRAL=0
-fi
-
-
-
-        if test "$HTYPE_IS_INTEGRAL" -eq 0
-        then
-            if ac_fn_c_compute_int "$LINENO" "sizeof(ino_t) == sizeof(float)" "HTYPE_IS_FLOAT"        "
-#include <stdio.h>
-#include <stddef.h>
-
-#if HAVE_SYS_TYPES_H
-# include <sys/types.h>
-#endif
-
-#if HAVE_UNISTD_H
-# include <unistd.h>
-#endif
-
-#if HAVE_SYS_STAT_H
-# include <sys/stat.h>
-#endif
-
-#if HAVE_FCNTL_H
-# include <fcntl.h>
-#endif
-
-#if HAVE_SIGNAL_H
-# include <signal.h>
-#endif
-
-#if HAVE_TIME_H
-# include <time.h>
-#endif
-
-#if HAVE_TERMIOS_H
-# include <termios.h>
-#endif
-
-#if HAVE_STRING_H
-# include <string.h>
-#endif
-
-#if HAVE_CTYPE_H
-# include <ctype.h>
-#endif
-
-#if HAVE_INTTYPES_H
-# include <inttypes.h>
-#else
-# if HAVE_STDINT_H
-#  include <stdint.h>
-# endif
-#endif
-
-#if HAVE_SYS_RESOURCE_H
-# include <sys/resource.h>
-#endif
-
-#include <stdlib.h>
-"; then :
-
-else
-  fptools_cv_htype_sup_ino_t=no
-fi
-
-
-            if ac_fn_c_compute_int "$LINENO" "sizeof(ino_t) == sizeof(double)" "HTYPE_IS_DOUBLE"        "
-#include <stdio.h>
-#include <stddef.h>
-
-#if HAVE_SYS_TYPES_H
-# include <sys/types.h>
-#endif
-
-#if HAVE_UNISTD_H
-# include <unistd.h>
-#endif
-
-#if HAVE_SYS_STAT_H
-# include <sys/stat.h>
-#endif
-
-#if HAVE_FCNTL_H
-# include <fcntl.h>
-#endif
-
-#if HAVE_SIGNAL_H
-# include <signal.h>
-#endif
-
-#if HAVE_TIME_H
-# include <time.h>
-#endif
-
-#if HAVE_TERMIOS_H
-# include <termios.h>
-#endif
-
-#if HAVE_STRING_H
-# include <string.h>
-#endif
-
-#if HAVE_CTYPE_H
-# include <ctype.h>
-#endif
-
-#if HAVE_INTTYPES_H
-# include <inttypes.h>
-#else
-# if HAVE_STDINT_H
-#  include <stdint.h>
-# endif
-#endif
-
-#if HAVE_SYS_RESOURCE_H
-# include <sys/resource.h>
-#endif
-
-#include <stdlib.h>
-"; then :
-
-else
-  fptools_cv_htype_sup_ino_t=no
-fi
-
-
-            if ac_fn_c_compute_int "$LINENO" "sizeof(ino_t) == sizeof(long double)" "HTYPE_IS_LDOUBLE"        "
-#include <stdio.h>
-#include <stddef.h>
-
-#if HAVE_SYS_TYPES_H
-# include <sys/types.h>
-#endif
-
-#if HAVE_UNISTD_H
-# include <unistd.h>
-#endif
-
-#if HAVE_SYS_STAT_H
-# include <sys/stat.h>
-#endif
-
-#if HAVE_FCNTL_H
-# include <fcntl.h>
-#endif
-
-#if HAVE_SIGNAL_H
-# include <signal.h>
-#endif
-
-#if HAVE_TIME_H
-# include <time.h>
-#endif
-
-#if HAVE_TERMIOS_H
-# include <termios.h>
-#endif
-
-#if HAVE_STRING_H
-# include <string.h>
-#endif
-
-#if HAVE_CTYPE_H
-# include <ctype.h>
-#endif
-
-#if HAVE_INTTYPES_H
-# include <inttypes.h>
-#else
-# if HAVE_STDINT_H
-#  include <stdint.h>
-# endif
-#endif
-
-#if HAVE_SYS_RESOURCE_H
-# include <sys/resource.h>
-#endif
-
-#include <stdlib.h>
-"; then :
-
-else
-  fptools_cv_htype_sup_ino_t=no
-fi
-
-
-            if test "$HTYPE_IS_FLOAT" -eq 1
-            then
-                fptools_cv_htype_ino_t=Float
-            elif test "$HTYPE_IS_DOUBLE" -eq 1
-            then
-                fptools_cv_htype_ino_t=Double
-            elif test "$HTYPE_IS_LDOUBLE" -eq 1
-            then
-                fptools_cv_htype_ino_t=LDouble
-            else
-                fptools_cv_htype_sup_ino_t=no
-            fi
-        else
-            if ac_fn_c_compute_int "$LINENO" "((ino_t)(-1)) < ((ino_t)0)" "HTYPE_IS_SIGNED"        "
-#include <stdio.h>
-#include <stddef.h>
-
-#if HAVE_SYS_TYPES_H
-# include <sys/types.h>
-#endif
-
-#if HAVE_UNISTD_H
-# include <unistd.h>
-#endif
-
-#if HAVE_SYS_STAT_H
-# include <sys/stat.h>
-#endif
-
-#if HAVE_FCNTL_H
-# include <fcntl.h>
-#endif
-
-#if HAVE_SIGNAL_H
-# include <signal.h>
-#endif
-
-#if HAVE_TIME_H
-# include <time.h>
-#endif
-
-#if HAVE_TERMIOS_H
-# include <termios.h>
-#endif
-
-#if HAVE_STRING_H
-# include <string.h>
-#endif
-
-#if HAVE_CTYPE_H
-# include <ctype.h>
-#endif
-
-#if HAVE_INTTYPES_H
-# include <inttypes.h>
-#else
-# if HAVE_STDINT_H
-#  include <stdint.h>
-# endif
-#endif
-
-#if HAVE_SYS_RESOURCE_H
-# include <sys/resource.h>
-#endif
-
-#include <stdlib.h>
-"; then :
-
-else
-  fptools_cv_htype_sup_ino_t=no
-fi
-
-
-            if ac_fn_c_compute_int "$LINENO" "sizeof(ino_t) * 8" "HTYPE_SIZE"        "
-#include <stdio.h>
-#include <stddef.h>
-
-#if HAVE_SYS_TYPES_H
-# include <sys/types.h>
-#endif
-
-#if HAVE_UNISTD_H
-# include <unistd.h>
-#endif
-
-#if HAVE_SYS_STAT_H
-# include <sys/stat.h>
-#endif
-
-#if HAVE_FCNTL_H
-# include <fcntl.h>
-#endif
-
-#if HAVE_SIGNAL_H
-# include <signal.h>
-#endif
-
-#if HAVE_TIME_H
-# include <time.h>
-#endif
-
-#if HAVE_TERMIOS_H
-# include <termios.h>
-#endif
-
-#if HAVE_STRING_H
-# include <string.h>
-#endif
-
-#if HAVE_CTYPE_H
-# include <ctype.h>
-#endif
-
-#if HAVE_INTTYPES_H
-# include <inttypes.h>
-#else
-# if HAVE_STDINT_H
-#  include <stdint.h>
-# endif
-#endif
-
-#if HAVE_SYS_RESOURCE_H
-# include <sys/resource.h>
-#endif
-
-#include <stdlib.h>
-"; then :
-
-else
-  fptools_cv_htype_sup_ino_t=no
-fi
-
-
-            if test "$HTYPE_IS_SIGNED" -eq 0
-            then
-                fptools_cv_htype_ino_t="Word$HTYPE_SIZE"
-            else
-                fptools_cv_htype_ino_t="Int$HTYPE_SIZE"
-            fi
-        fi
-
-fi
-
-    if test "$fptools_cv_htype_sup_ino_t" = no
-    then
-
-        fptools_cv_htype_ino_t=NotReallyAType
-        { $as_echo "$as_me:${as_lineno-$LINENO}: result: not supported" >&5
-$as_echo "not supported" >&6; }
-
-    fi
-
-            if test "$fptools_cv_htype_sup_ino_t" = yes; then
-        { $as_echo "$as_me:${as_lineno-$LINENO}: result: $fptools_cv_htype_ino_t" >&5
-$as_echo "$fptools_cv_htype_ino_t" >&6; }
-
-cat >>confdefs.h <<_ACEOF
-#define HTYPE_INO_T $fptools_cv_htype_ino_t
-_ACEOF
-
-    fi
-
-
-
-
-
-
-
-
-
-
-    { $as_echo "$as_me:${as_lineno-$LINENO}: checking Haskell type for mode_t" >&5
-$as_echo_n "checking Haskell type for mode_t... " >&6; }
-    if ${fptools_cv_htype_mode_t+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-
-        fptools_cv_htype_sup_mode_t=yes
-        if ac_fn_c_compute_int "$LINENO" "(mode_t)0.2 - (mode_t)0.4 < 0 ? 0 : 1" "HTYPE_IS_INTEGRAL"        "
-#include <stdio.h>
-#include <stddef.h>
-
-#if HAVE_SYS_TYPES_H
-# include <sys/types.h>
-#endif
-
-#if HAVE_UNISTD_H
-# include <unistd.h>
-#endif
-
-#if HAVE_SYS_STAT_H
-# include <sys/stat.h>
-#endif
-
-#if HAVE_FCNTL_H
-# include <fcntl.h>
-#endif
-
-#if HAVE_SIGNAL_H
-# include <signal.h>
-#endif
-
-#if HAVE_TIME_H
-# include <time.h>
-#endif
-
-#if HAVE_TERMIOS_H
-# include <termios.h>
-#endif
-
-#if HAVE_STRING_H
-# include <string.h>
-#endif
-
-#if HAVE_CTYPE_H
-# include <ctype.h>
-#endif
-
-#if HAVE_INTTYPES_H
-# include <inttypes.h>
-#else
-# if HAVE_STDINT_H
-#  include <stdint.h>
-# endif
-#endif
-
-#if HAVE_SYS_RESOURCE_H
-# include <sys/resource.h>
-#endif
-
-#include <stdlib.h>
-"; then :
-
-else
-  HTYPE_IS_INTEGRAL=0
-fi
-
-
-
-        if test "$HTYPE_IS_INTEGRAL" -eq 0
-        then
-            if ac_fn_c_compute_int "$LINENO" "sizeof(mode_t) == sizeof(float)" "HTYPE_IS_FLOAT"        "
-#include <stdio.h>
-#include <stddef.h>
-
-#if HAVE_SYS_TYPES_H
-# include <sys/types.h>
-#endif
-
-#if HAVE_UNISTD_H
-# include <unistd.h>
-#endif
-
-#if HAVE_SYS_STAT_H
-# include <sys/stat.h>
-#endif
-
-#if HAVE_FCNTL_H
-# include <fcntl.h>
-#endif
-
-#if HAVE_SIGNAL_H
-# include <signal.h>
-#endif
-
-#if HAVE_TIME_H
-# include <time.h>
-#endif
-
-#if HAVE_TERMIOS_H
-# include <termios.h>
-#endif
-
-#if HAVE_STRING_H
-# include <string.h>
-#endif
-
-#if HAVE_CTYPE_H
-# include <ctype.h>
-#endif
-
-#if HAVE_INTTYPES_H
-# include <inttypes.h>
-#else
-# if HAVE_STDINT_H
-#  include <stdint.h>
-# endif
-#endif
-
-#if HAVE_SYS_RESOURCE_H
-# include <sys/resource.h>
-#endif
-
-#include <stdlib.h>
-"; then :
-
-else
-  fptools_cv_htype_sup_mode_t=no
-fi
-
-
-            if ac_fn_c_compute_int "$LINENO" "sizeof(mode_t) == sizeof(double)" "HTYPE_IS_DOUBLE"        "
-#include <stdio.h>
-#include <stddef.h>
-
-#if HAVE_SYS_TYPES_H
-# include <sys/types.h>
-#endif
-
-#if HAVE_UNISTD_H
-# include <unistd.h>
-#endif
-
-#if HAVE_SYS_STAT_H
-# include <sys/stat.h>
-#endif
-
-#if HAVE_FCNTL_H
-# include <fcntl.h>
-#endif
-
-#if HAVE_SIGNAL_H
-# include <signal.h>
-#endif
-
-#if HAVE_TIME_H
-# include <time.h>
-#endif
-
-#if HAVE_TERMIOS_H
-# include <termios.h>
-#endif
-
-#if HAVE_STRING_H
-# include <string.h>
-#endif
-
-#if HAVE_CTYPE_H
-# include <ctype.h>
-#endif
-
-#if HAVE_INTTYPES_H
-# include <inttypes.h>
-#else
-# if HAVE_STDINT_H
-#  include <stdint.h>
-# endif
-#endif
-
-#if HAVE_SYS_RESOURCE_H
-# include <sys/resource.h>
-#endif
-
-#include <stdlib.h>
-"; then :
-
-else
-  fptools_cv_htype_sup_mode_t=no
-fi
-
-
-            if ac_fn_c_compute_int "$LINENO" "sizeof(mode_t) == sizeof(long double)" "HTYPE_IS_LDOUBLE"        "
-#include <stdio.h>
-#include <stddef.h>
-
-#if HAVE_SYS_TYPES_H
-# include <sys/types.h>
-#endif
-
-#if HAVE_UNISTD_H
-# include <unistd.h>
-#endif
-
-#if HAVE_SYS_STAT_H
-# include <sys/stat.h>
-#endif
-
-#if HAVE_FCNTL_H
-# include <fcntl.h>
-#endif
-
-#if HAVE_SIGNAL_H
-# include <signal.h>
-#endif
-
-#if HAVE_TIME_H
-# include <time.h>
-#endif
-
-#if HAVE_TERMIOS_H
-# include <termios.h>
-#endif
-
-#if HAVE_STRING_H
-# include <string.h>
-#endif
-
-#if HAVE_CTYPE_H
-# include <ctype.h>
-#endif
-
-#if HAVE_INTTYPES_H
-# include <inttypes.h>
-#else
-# if HAVE_STDINT_H
-#  include <stdint.h>
-# endif
-#endif
-
-#if HAVE_SYS_RESOURCE_H
-# include <sys/resource.h>
-#endif
-
-#include <stdlib.h>
-"; then :
-
-else
-  fptools_cv_htype_sup_mode_t=no
-fi
-
-
-            if test "$HTYPE_IS_FLOAT" -eq 1
-            then
-                fptools_cv_htype_mode_t=Float
-            elif test "$HTYPE_IS_DOUBLE" -eq 1
-            then
-                fptools_cv_htype_mode_t=Double
-            elif test "$HTYPE_IS_LDOUBLE" -eq 1
-            then
-                fptools_cv_htype_mode_t=LDouble
-            else
-                fptools_cv_htype_sup_mode_t=no
-            fi
-        else
-            if ac_fn_c_compute_int "$LINENO" "((mode_t)(-1)) < ((mode_t)0)" "HTYPE_IS_SIGNED"        "
-#include <stdio.h>
-#include <stddef.h>
-
-#if HAVE_SYS_TYPES_H
-# include <sys/types.h>
-#endif
-
-#if HAVE_UNISTD_H
-# include <unistd.h>
-#endif
-
-#if HAVE_SYS_STAT_H
-# include <sys/stat.h>
-#endif
-
-#if HAVE_FCNTL_H
-# include <fcntl.h>
-#endif
-
-#if HAVE_SIGNAL_H
-# include <signal.h>
-#endif
-
-#if HAVE_TIME_H
-# include <time.h>
-#endif
-
-#if HAVE_TERMIOS_H
-# include <termios.h>
-#endif
-
-#if HAVE_STRING_H
-# include <string.h>
-#endif
-
-#if HAVE_CTYPE_H
-# include <ctype.h>
-#endif
-
-#if HAVE_INTTYPES_H
-# include <inttypes.h>
-#else
-# if HAVE_STDINT_H
-#  include <stdint.h>
-# endif
-#endif
-
-#if HAVE_SYS_RESOURCE_H
-# include <sys/resource.h>
-#endif
-
-#include <stdlib.h>
-"; then :
-
-else
-  fptools_cv_htype_sup_mode_t=no
-fi
-
-
-            if ac_fn_c_compute_int "$LINENO" "sizeof(mode_t) * 8" "HTYPE_SIZE"        "
-#include <stdio.h>
-#include <stddef.h>
-
-#if HAVE_SYS_TYPES_H
-# include <sys/types.h>
-#endif
-
-#if HAVE_UNISTD_H
-# include <unistd.h>
-#endif
-
-#if HAVE_SYS_STAT_H
-# include <sys/stat.h>
-#endif
-
-#if HAVE_FCNTL_H
-# include <fcntl.h>
-#endif
-
-#if HAVE_SIGNAL_H
-# include <signal.h>
-#endif
-
-#if HAVE_TIME_H
-# include <time.h>
-#endif
-
-#if HAVE_TERMIOS_H
-# include <termios.h>
-#endif
-
-#if HAVE_STRING_H
-# include <string.h>
-#endif
-
-#if HAVE_CTYPE_H
-# include <ctype.h>
-#endif
-
-#if HAVE_INTTYPES_H
-# include <inttypes.h>
-#else
-# if HAVE_STDINT_H
-#  include <stdint.h>
-# endif
-#endif
-
-#if HAVE_SYS_RESOURCE_H
-# include <sys/resource.h>
-#endif
-
-#include <stdlib.h>
-"; then :
-
-else
-  fptools_cv_htype_sup_mode_t=no
-fi
-
-
-            if test "$HTYPE_IS_SIGNED" -eq 0
-            then
-                fptools_cv_htype_mode_t="Word$HTYPE_SIZE"
-            else
-                fptools_cv_htype_mode_t="Int$HTYPE_SIZE"
-            fi
-        fi
-
-fi
-
-    if test "$fptools_cv_htype_sup_mode_t" = no
-    then
-
-        fptools_cv_htype_mode_t=NotReallyAType
-        { $as_echo "$as_me:${as_lineno-$LINENO}: result: not supported" >&5
-$as_echo "not supported" >&6; }
-
-    fi
-
-            if test "$fptools_cv_htype_sup_mode_t" = yes; then
-        { $as_echo "$as_me:${as_lineno-$LINENO}: result: $fptools_cv_htype_mode_t" >&5
-$as_echo "$fptools_cv_htype_mode_t" >&6; }
-
-cat >>confdefs.h <<_ACEOF
-#define HTYPE_MODE_T $fptools_cv_htype_mode_t
-_ACEOF
-
-    fi
-
-
-
-
-
-
-
-
-
-
-    { $as_echo "$as_me:${as_lineno-$LINENO}: checking Haskell type for off_t" >&5
-$as_echo_n "checking Haskell type for off_t... " >&6; }
-    if ${fptools_cv_htype_off_t+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-
-        fptools_cv_htype_sup_off_t=yes
-        if ac_fn_c_compute_int "$LINENO" "(off_t)0.2 - (off_t)0.4 < 0 ? 0 : 1" "HTYPE_IS_INTEGRAL"        "
-#include <stdio.h>
-#include <stddef.h>
-
-#if HAVE_SYS_TYPES_H
-# include <sys/types.h>
-#endif
-
-#if HAVE_UNISTD_H
-# include <unistd.h>
-#endif
-
-#if HAVE_SYS_STAT_H
-# include <sys/stat.h>
-#endif
-
-#if HAVE_FCNTL_H
-# include <fcntl.h>
-#endif
-
-#if HAVE_SIGNAL_H
-# include <signal.h>
-#endif
-
-#if HAVE_TIME_H
-# include <time.h>
-#endif
-
-#if HAVE_TERMIOS_H
-# include <termios.h>
-#endif
-
-#if HAVE_STRING_H
-# include <string.h>
-#endif
-
-#if HAVE_CTYPE_H
-# include <ctype.h>
-#endif
-
-#if HAVE_INTTYPES_H
-# include <inttypes.h>
-#else
-# if HAVE_STDINT_H
-#  include <stdint.h>
-# endif
-#endif
-
-#if HAVE_SYS_RESOURCE_H
-# include <sys/resource.h>
-#endif
-
-#include <stdlib.h>
-"; then :
-
-else
-  HTYPE_IS_INTEGRAL=0
-fi
-
-
-
-        if test "$HTYPE_IS_INTEGRAL" -eq 0
-        then
-            if ac_fn_c_compute_int "$LINENO" "sizeof(off_t) == sizeof(float)" "HTYPE_IS_FLOAT"        "
-#include <stdio.h>
-#include <stddef.h>
-
-#if HAVE_SYS_TYPES_H
-# include <sys/types.h>
-#endif
-
-#if HAVE_UNISTD_H
-# include <unistd.h>
-#endif
-
-#if HAVE_SYS_STAT_H
-# include <sys/stat.h>
-#endif
-
-#if HAVE_FCNTL_H
-# include <fcntl.h>
-#endif
-
-#if HAVE_SIGNAL_H
-# include <signal.h>
-#endif
-
-#if HAVE_TIME_H
-# include <time.h>
-#endif
-
-#if HAVE_TERMIOS_H
-# include <termios.h>
-#endif
-
-#if HAVE_STRING_H
-# include <string.h>
-#endif
-
-#if HAVE_CTYPE_H
-# include <ctype.h>
-#endif
-
-#if HAVE_INTTYPES_H
-# include <inttypes.h>
-#else
-# if HAVE_STDINT_H
-#  include <stdint.h>
-# endif
-#endif
-
-#if HAVE_SYS_RESOURCE_H
-# include <sys/resource.h>
-#endif
-
-#include <stdlib.h>
-"; then :
-
-else
-  fptools_cv_htype_sup_off_t=no
-fi
-
-
-            if ac_fn_c_compute_int "$LINENO" "sizeof(off_t) == sizeof(double)" "HTYPE_IS_DOUBLE"        "
-#include <stdio.h>
-#include <stddef.h>
-
-#if HAVE_SYS_TYPES_H
-# include <sys/types.h>
-#endif
-
-#if HAVE_UNISTD_H
-# include <unistd.h>
-#endif
-
-#if HAVE_SYS_STAT_H
-# include <sys/stat.h>
-#endif
-
-#if HAVE_FCNTL_H
-# include <fcntl.h>
-#endif
-
-#if HAVE_SIGNAL_H
-# include <signal.h>
-#endif
-
-#if HAVE_TIME_H
-# include <time.h>
-#endif
-
-#if HAVE_TERMIOS_H
-# include <termios.h>
-#endif
-
-#if HAVE_STRING_H
-# include <string.h>
-#endif
-
-#if HAVE_CTYPE_H
-# include <ctype.h>
-#endif
-
-#if HAVE_INTTYPES_H
-# include <inttypes.h>
-#else
-# if HAVE_STDINT_H
-#  include <stdint.h>
-# endif
-#endif
-
-#if HAVE_SYS_RESOURCE_H
-# include <sys/resource.h>
-#endif
-
-#include <stdlib.h>
-"; then :
-
-else
-  fptools_cv_htype_sup_off_t=no
-fi
-
-
-            if ac_fn_c_compute_int "$LINENO" "sizeof(off_t) == sizeof(long double)" "HTYPE_IS_LDOUBLE"        "
-#include <stdio.h>
-#include <stddef.h>
-
-#if HAVE_SYS_TYPES_H
-# include <sys/types.h>
-#endif
-
-#if HAVE_UNISTD_H
-# include <unistd.h>
-#endif
-
-#if HAVE_SYS_STAT_H
-# include <sys/stat.h>
-#endif
-
-#if HAVE_FCNTL_H
-# include <fcntl.h>
-#endif
-
-#if HAVE_SIGNAL_H
-# include <signal.h>
-#endif
-
-#if HAVE_TIME_H
-# include <time.h>
-#endif
-
-#if HAVE_TERMIOS_H
-# include <termios.h>
-#endif
-
-#if HAVE_STRING_H
-# include <string.h>
-#endif
-
-#if HAVE_CTYPE_H
-# include <ctype.h>
-#endif
-
-#if HAVE_INTTYPES_H
-# include <inttypes.h>
-#else
-# if HAVE_STDINT_H
-#  include <stdint.h>
-# endif
-#endif
-
-#if HAVE_SYS_RESOURCE_H
-# include <sys/resource.h>
-#endif
-
-#include <stdlib.h>
-"; then :
-
-else
-  fptools_cv_htype_sup_off_t=no
-fi
-
-
-            if test "$HTYPE_IS_FLOAT" -eq 1
-            then
-                fptools_cv_htype_off_t=Float
-            elif test "$HTYPE_IS_DOUBLE" -eq 1
-            then
-                fptools_cv_htype_off_t=Double
-            elif test "$HTYPE_IS_LDOUBLE" -eq 1
-            then
-                fptools_cv_htype_off_t=LDouble
-            else
-                fptools_cv_htype_sup_off_t=no
-            fi
-        else
-            if ac_fn_c_compute_int "$LINENO" "((off_t)(-1)) < ((off_t)0)" "HTYPE_IS_SIGNED"        "
-#include <stdio.h>
-#include <stddef.h>
-
-#if HAVE_SYS_TYPES_H
-# include <sys/types.h>
-#endif
-
-#if HAVE_UNISTD_H
-# include <unistd.h>
-#endif
-
-#if HAVE_SYS_STAT_H
-# include <sys/stat.h>
-#endif
-
-#if HAVE_FCNTL_H
-# include <fcntl.h>
-#endif
-
-#if HAVE_SIGNAL_H
-# include <signal.h>
-#endif
-
-#if HAVE_TIME_H
-# include <time.h>
-#endif
-
-#if HAVE_TERMIOS_H
-# include <termios.h>
-#endif
-
-#if HAVE_STRING_H
-# include <string.h>
-#endif
-
-#if HAVE_CTYPE_H
-# include <ctype.h>
-#endif
-
-#if HAVE_INTTYPES_H
-# include <inttypes.h>
-#else
-# if HAVE_STDINT_H
-#  include <stdint.h>
-# endif
-#endif
-
-#if HAVE_SYS_RESOURCE_H
-# include <sys/resource.h>
-#endif
-
-#include <stdlib.h>
-"; then :
-
-else
-  fptools_cv_htype_sup_off_t=no
-fi
-
-
-            if ac_fn_c_compute_int "$LINENO" "sizeof(off_t) * 8" "HTYPE_SIZE"        "
-#include <stdio.h>
-#include <stddef.h>
-
-#if HAVE_SYS_TYPES_H
-# include <sys/types.h>
-#endif
-
-#if HAVE_UNISTD_H
-# include <unistd.h>
-#endif
-
-#if HAVE_SYS_STAT_H
-# include <sys/stat.h>
-#endif
-
-#if HAVE_FCNTL_H
-# include <fcntl.h>
-#endif
-
-#if HAVE_SIGNAL_H
-# include <signal.h>
-#endif
-
-#if HAVE_TIME_H
-# include <time.h>
-#endif
-
-#if HAVE_TERMIOS_H
-# include <termios.h>
-#endif
-
-#if HAVE_STRING_H
-# include <string.h>
-#endif
-
-#if HAVE_CTYPE_H
-# include <ctype.h>
-#endif
-
-#if HAVE_INTTYPES_H
-# include <inttypes.h>
-#else
-# if HAVE_STDINT_H
-#  include <stdint.h>
-# endif
-#endif
-
-#if HAVE_SYS_RESOURCE_H
-# include <sys/resource.h>
-#endif
-
-#include <stdlib.h>
-"; then :
-
-else
-  fptools_cv_htype_sup_off_t=no
-fi
-
-
-            if test "$HTYPE_IS_SIGNED" -eq 0
-            then
-                fptools_cv_htype_off_t="Word$HTYPE_SIZE"
-            else
-                fptools_cv_htype_off_t="Int$HTYPE_SIZE"
-            fi
-        fi
-
-fi
-
-    if test "$fptools_cv_htype_sup_off_t" = no
-    then
-
-        fptools_cv_htype_off_t=NotReallyAType
-        { $as_echo "$as_me:${as_lineno-$LINENO}: result: not supported" >&5
-$as_echo "not supported" >&6; }
-
-    fi
-
-            if test "$fptools_cv_htype_sup_off_t" = yes; then
-        { $as_echo "$as_me:${as_lineno-$LINENO}: result: $fptools_cv_htype_off_t" >&5
-$as_echo "$fptools_cv_htype_off_t" >&6; }
-
-cat >>confdefs.h <<_ACEOF
-#define HTYPE_OFF_T $fptools_cv_htype_off_t
-_ACEOF
-
-    fi
-
-
-
-
-
-
-
-
-
-
-    { $as_echo "$as_me:${as_lineno-$LINENO}: checking Haskell type for pid_t" >&5
-$as_echo_n "checking Haskell type for pid_t... " >&6; }
-    if ${fptools_cv_htype_pid_t+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-
-        fptools_cv_htype_sup_pid_t=yes
-        if ac_fn_c_compute_int "$LINENO" "(pid_t)0.2 - (pid_t)0.4 < 0 ? 0 : 1" "HTYPE_IS_INTEGRAL"        "
-#include <stdio.h>
-#include <stddef.h>
-
-#if HAVE_SYS_TYPES_H
-# include <sys/types.h>
-#endif
-
-#if HAVE_UNISTD_H
-# include <unistd.h>
-#endif
-
-#if HAVE_SYS_STAT_H
-# include <sys/stat.h>
-#endif
-
-#if HAVE_FCNTL_H
-# include <fcntl.h>
-#endif
-
-#if HAVE_SIGNAL_H
-# include <signal.h>
-#endif
-
-#if HAVE_TIME_H
-# include <time.h>
-#endif
-
-#if HAVE_TERMIOS_H
-# include <termios.h>
-#endif
-
-#if HAVE_STRING_H
-# include <string.h>
-#endif
-
-#if HAVE_CTYPE_H
-# include <ctype.h>
-#endif
-
-#if HAVE_INTTYPES_H
-# include <inttypes.h>
-#else
-# if HAVE_STDINT_H
-#  include <stdint.h>
-# endif
-#endif
-
-#if HAVE_SYS_RESOURCE_H
-# include <sys/resource.h>
-#endif
-
-#include <stdlib.h>
-"; then :
-
-else
-  HTYPE_IS_INTEGRAL=0
-fi
-
-
-
-        if test "$HTYPE_IS_INTEGRAL" -eq 0
-        then
-            if ac_fn_c_compute_int "$LINENO" "sizeof(pid_t) == sizeof(float)" "HTYPE_IS_FLOAT"        "
-#include <stdio.h>
-#include <stddef.h>
-
-#if HAVE_SYS_TYPES_H
-# include <sys/types.h>
-#endif
-
-#if HAVE_UNISTD_H
-# include <unistd.h>
-#endif
-
-#if HAVE_SYS_STAT_H
-# include <sys/stat.h>
-#endif
-
-#if HAVE_FCNTL_H
-# include <fcntl.h>
-#endif
-
-#if HAVE_SIGNAL_H
-# include <signal.h>
-#endif
-
-#if HAVE_TIME_H
-# include <time.h>
-#endif
-
-#if HAVE_TERMIOS_H
-# include <termios.h>
-#endif
-
-#if HAVE_STRING_H
-# include <string.h>
-#endif
-
-#if HAVE_CTYPE_H
-# include <ctype.h>
-#endif
-
-#if HAVE_INTTYPES_H
-# include <inttypes.h>
-#else
-# if HAVE_STDINT_H
-#  include <stdint.h>
-# endif
-#endif
-
-#if HAVE_SYS_RESOURCE_H
-# include <sys/resource.h>
-#endif
-
-#include <stdlib.h>
-"; then :
-
-else
-  fptools_cv_htype_sup_pid_t=no
-fi
-
-
-            if ac_fn_c_compute_int "$LINENO" "sizeof(pid_t) == sizeof(double)" "HTYPE_IS_DOUBLE"        "
-#include <stdio.h>
-#include <stddef.h>
-
-#if HAVE_SYS_TYPES_H
-# include <sys/types.h>
-#endif
-
-#if HAVE_UNISTD_H
-# include <unistd.h>
-#endif
-
-#if HAVE_SYS_STAT_H
-# include <sys/stat.h>
-#endif
-
-#if HAVE_FCNTL_H
-# include <fcntl.h>
-#endif
-
-#if HAVE_SIGNAL_H
-# include <signal.h>
-#endif
-
-#if HAVE_TIME_H
-# include <time.h>
-#endif
-
-#if HAVE_TERMIOS_H
-# include <termios.h>
-#endif
-
-#if HAVE_STRING_H
-# include <string.h>
-#endif
-
-#if HAVE_CTYPE_H
-# include <ctype.h>
-#endif
-
-#if HAVE_INTTYPES_H
-# include <inttypes.h>
-#else
-# if HAVE_STDINT_H
-#  include <stdint.h>
-# endif
-#endif
-
-#if HAVE_SYS_RESOURCE_H
-# include <sys/resource.h>
-#endif
-
-#include <stdlib.h>
-"; then :
-
-else
-  fptools_cv_htype_sup_pid_t=no
-fi
-
-
-            if ac_fn_c_compute_int "$LINENO" "sizeof(pid_t) == sizeof(long double)" "HTYPE_IS_LDOUBLE"        "
-#include <stdio.h>
-#include <stddef.h>
-
-#if HAVE_SYS_TYPES_H
-# include <sys/types.h>
-#endif
-
-#if HAVE_UNISTD_H
-# include <unistd.h>
-#endif
-
-#if HAVE_SYS_STAT_H
-# include <sys/stat.h>
-#endif
-
-#if HAVE_FCNTL_H
-# include <fcntl.h>
-#endif
-
-#if HAVE_SIGNAL_H
-# include <signal.h>
-#endif
-
-#if HAVE_TIME_H
-# include <time.h>
-#endif
-
-#if HAVE_TERMIOS_H
-# include <termios.h>
-#endif
-
-#if HAVE_STRING_H
-# include <string.h>
-#endif
-
-#if HAVE_CTYPE_H
-# include <ctype.h>
-#endif
-
-#if HAVE_INTTYPES_H
-# include <inttypes.h>
-#else
-# if HAVE_STDINT_H
-#  include <stdint.h>
-# endif
-#endif
-
-#if HAVE_SYS_RESOURCE_H
-# include <sys/resource.h>
-#endif
-
-#include <stdlib.h>
-"; then :
-
-else
-  fptools_cv_htype_sup_pid_t=no
-fi
-
-
-            if test "$HTYPE_IS_FLOAT" -eq 1
-            then
-                fptools_cv_htype_pid_t=Float
-            elif test "$HTYPE_IS_DOUBLE" -eq 1
-            then
-                fptools_cv_htype_pid_t=Double
-            elif test "$HTYPE_IS_LDOUBLE" -eq 1
-            then
-                fptools_cv_htype_pid_t=LDouble
-            else
-                fptools_cv_htype_sup_pid_t=no
-            fi
-        else
-            if ac_fn_c_compute_int "$LINENO" "((pid_t)(-1)) < ((pid_t)0)" "HTYPE_IS_SIGNED"        "
-#include <stdio.h>
-#include <stddef.h>
-
-#if HAVE_SYS_TYPES_H
-# include <sys/types.h>
-#endif
-
-#if HAVE_UNISTD_H
-# include <unistd.h>
-#endif
-
-#if HAVE_SYS_STAT_H
-# include <sys/stat.h>
-#endif
-
-#if HAVE_FCNTL_H
-# include <fcntl.h>
-#endif
-
-#if HAVE_SIGNAL_H
-# include <signal.h>
-#endif
-
-#if HAVE_TIME_H
-# include <time.h>
-#endif
-
-#if HAVE_TERMIOS_H
-# include <termios.h>
-#endif
-
-#if HAVE_STRING_H
-# include <string.h>
-#endif
-
-#if HAVE_CTYPE_H
-# include <ctype.h>
-#endif
-
-#if HAVE_INTTYPES_H
-# include <inttypes.h>
-#else
-# if HAVE_STDINT_H
-#  include <stdint.h>
-# endif
-#endif
-
-#if HAVE_SYS_RESOURCE_H
-# include <sys/resource.h>
-#endif
-
-#include <stdlib.h>
-"; then :
-
-else
-  fptools_cv_htype_sup_pid_t=no
-fi
-
-
-            if ac_fn_c_compute_int "$LINENO" "sizeof(pid_t) * 8" "HTYPE_SIZE"        "
-#include <stdio.h>
-#include <stddef.h>
-
-#if HAVE_SYS_TYPES_H
-# include <sys/types.h>
-#endif
-
-#if HAVE_UNISTD_H
-# include <unistd.h>
-#endif
-
-#if HAVE_SYS_STAT_H
-# include <sys/stat.h>
-#endif
-
-#if HAVE_FCNTL_H
-# include <fcntl.h>
-#endif
-
-#if HAVE_SIGNAL_H
-# include <signal.h>
-#endif
-
-#if HAVE_TIME_H
-# include <time.h>
-#endif
-
-#if HAVE_TERMIOS_H
-# include <termios.h>
-#endif
-
-#if HAVE_STRING_H
-# include <string.h>
-#endif
-
-#if HAVE_CTYPE_H
-# include <ctype.h>
-#endif
-
-#if HAVE_INTTYPES_H
-# include <inttypes.h>
-#else
-# if HAVE_STDINT_H
-#  include <stdint.h>
-# endif
-#endif
-
-#if HAVE_SYS_RESOURCE_H
-# include <sys/resource.h>
-#endif
-
-#include <stdlib.h>
-"; then :
-
-else
-  fptools_cv_htype_sup_pid_t=no
-fi
-
-
-            if test "$HTYPE_IS_SIGNED" -eq 0
-            then
-                fptools_cv_htype_pid_t="Word$HTYPE_SIZE"
-            else
-                fptools_cv_htype_pid_t="Int$HTYPE_SIZE"
-            fi
-        fi
-
-fi
-
-    if test "$fptools_cv_htype_sup_pid_t" = no
-    then
-
-        fptools_cv_htype_pid_t=NotReallyAType
-        { $as_echo "$as_me:${as_lineno-$LINENO}: result: not supported" >&5
-$as_echo "not supported" >&6; }
-
-    fi
-
-            if test "$fptools_cv_htype_sup_pid_t" = yes; then
-        { $as_echo "$as_me:${as_lineno-$LINENO}: result: $fptools_cv_htype_pid_t" >&5
-$as_echo "$fptools_cv_htype_pid_t" >&6; }
-
-cat >>confdefs.h <<_ACEOF
-#define HTYPE_PID_T $fptools_cv_htype_pid_t
-_ACEOF
-
-    fi
-
-
-
-
-
-
-
-
-
-
-    { $as_echo "$as_me:${as_lineno-$LINENO}: checking Haskell type for gid_t" >&5
-$as_echo_n "checking Haskell type for gid_t... " >&6; }
-    if ${fptools_cv_htype_gid_t+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-
-        fptools_cv_htype_sup_gid_t=yes
-        if ac_fn_c_compute_int "$LINENO" "(gid_t)0.2 - (gid_t)0.4 < 0 ? 0 : 1" "HTYPE_IS_INTEGRAL"        "
-#include <stdio.h>
-#include <stddef.h>
-
-#if HAVE_SYS_TYPES_H
-# include <sys/types.h>
-#endif
-
-#if HAVE_UNISTD_H
-# include <unistd.h>
-#endif
-
-#if HAVE_SYS_STAT_H
-# include <sys/stat.h>
-#endif
-
-#if HAVE_FCNTL_H
-# include <fcntl.h>
-#endif
-
-#if HAVE_SIGNAL_H
-# include <signal.h>
-#endif
-
-#if HAVE_TIME_H
-# include <time.h>
-#endif
-
-#if HAVE_TERMIOS_H
-# include <termios.h>
-#endif
-
-#if HAVE_STRING_H
-# include <string.h>
-#endif
-
-#if HAVE_CTYPE_H
-# include <ctype.h>
-#endif
-
-#if HAVE_INTTYPES_H
-# include <inttypes.h>
-#else
-# if HAVE_STDINT_H
-#  include <stdint.h>
-# endif
-#endif
-
-#if HAVE_SYS_RESOURCE_H
-# include <sys/resource.h>
-#endif
-
-#include <stdlib.h>
-"; then :
-
-else
-  HTYPE_IS_INTEGRAL=0
-fi
-
-
-
-        if test "$HTYPE_IS_INTEGRAL" -eq 0
-        then
-            if ac_fn_c_compute_int "$LINENO" "sizeof(gid_t) == sizeof(float)" "HTYPE_IS_FLOAT"        "
-#include <stdio.h>
-#include <stddef.h>
-
-#if HAVE_SYS_TYPES_H
-# include <sys/types.h>
-#endif
-
-#if HAVE_UNISTD_H
-# include <unistd.h>
-#endif
-
-#if HAVE_SYS_STAT_H
-# include <sys/stat.h>
-#endif
-
-#if HAVE_FCNTL_H
-# include <fcntl.h>
-#endif
-
-#if HAVE_SIGNAL_H
-# include <signal.h>
-#endif
-
-#if HAVE_TIME_H
-# include <time.h>
-#endif
-
-#if HAVE_TERMIOS_H
-# include <termios.h>
-#endif
-
-#if HAVE_STRING_H
-# include <string.h>
-#endif
-
-#if HAVE_CTYPE_H
-# include <ctype.h>
-#endif
-
-#if HAVE_INTTYPES_H
-# include <inttypes.h>
-#else
-# if HAVE_STDINT_H
-#  include <stdint.h>
-# endif
-#endif
-
-#if HAVE_SYS_RESOURCE_H
-# include <sys/resource.h>
-#endif
-
-#include <stdlib.h>
-"; then :
-
-else
-  fptools_cv_htype_sup_gid_t=no
-fi
-
-
-            if ac_fn_c_compute_int "$LINENO" "sizeof(gid_t) == sizeof(double)" "HTYPE_IS_DOUBLE"        "
-#include <stdio.h>
-#include <stddef.h>
-
-#if HAVE_SYS_TYPES_H
-# include <sys/types.h>
-#endif
-
-#if HAVE_UNISTD_H
-# include <unistd.h>
-#endif
-
-#if HAVE_SYS_STAT_H
-# include <sys/stat.h>
-#endif
-
-#if HAVE_FCNTL_H
-# include <fcntl.h>
-#endif
-
-#if HAVE_SIGNAL_H
-# include <signal.h>
-#endif
-
-#if HAVE_TIME_H
-# include <time.h>
-#endif
-
-#if HAVE_TERMIOS_H
-# include <termios.h>
-#endif
-
-#if HAVE_STRING_H
-# include <string.h>
-#endif
-
-#if HAVE_CTYPE_H
-# include <ctype.h>
-#endif
-
-#if HAVE_INTTYPES_H
-# include <inttypes.h>
-#else
-# if HAVE_STDINT_H
-#  include <stdint.h>
-# endif
-#endif
-
-#if HAVE_SYS_RESOURCE_H
-# include <sys/resource.h>
-#endif
-
-#include <stdlib.h>
-"; then :
-
-else
-  fptools_cv_htype_sup_gid_t=no
-fi
-
-
-            if ac_fn_c_compute_int "$LINENO" "sizeof(gid_t) == sizeof(long double)" "HTYPE_IS_LDOUBLE"        "
-#include <stdio.h>
-#include <stddef.h>
-
-#if HAVE_SYS_TYPES_H
-# include <sys/types.h>
-#endif
-
-#if HAVE_UNISTD_H
-# include <unistd.h>
-#endif
-
-#if HAVE_SYS_STAT_H
-# include <sys/stat.h>
-#endif
-
-#if HAVE_FCNTL_H
-# include <fcntl.h>
-#endif
-
-#if HAVE_SIGNAL_H
-# include <signal.h>
-#endif
-
-#if HAVE_TIME_H
-# include <time.h>
-#endif
-
-#if HAVE_TERMIOS_H
-# include <termios.h>
-#endif
-
-#if HAVE_STRING_H
-# include <string.h>
-#endif
-
-#if HAVE_CTYPE_H
-# include <ctype.h>
-#endif
-
-#if HAVE_INTTYPES_H
-# include <inttypes.h>
-#else
-# if HAVE_STDINT_H
-#  include <stdint.h>
-# endif
-#endif
-
-#if HAVE_SYS_RESOURCE_H
-# include <sys/resource.h>
-#endif
-
-#include <stdlib.h>
-"; then :
-
-else
-  fptools_cv_htype_sup_gid_t=no
-fi
-
-
-            if test "$HTYPE_IS_FLOAT" -eq 1
-            then
-                fptools_cv_htype_gid_t=Float
-            elif test "$HTYPE_IS_DOUBLE" -eq 1
-            then
-                fptools_cv_htype_gid_t=Double
-            elif test "$HTYPE_IS_LDOUBLE" -eq 1
-            then
-                fptools_cv_htype_gid_t=LDouble
-            else
-                fptools_cv_htype_sup_gid_t=no
-            fi
-        else
-            if ac_fn_c_compute_int "$LINENO" "((gid_t)(-1)) < ((gid_t)0)" "HTYPE_IS_SIGNED"        "
-#include <stdio.h>
-#include <stddef.h>
-
-#if HAVE_SYS_TYPES_H
-# include <sys/types.h>
-#endif
-
-#if HAVE_UNISTD_H
-# include <unistd.h>
-#endif
-
-#if HAVE_SYS_STAT_H
-# include <sys/stat.h>
-#endif
-
-#if HAVE_FCNTL_H
-# include <fcntl.h>
-#endif
-
-#if HAVE_SIGNAL_H
-# include <signal.h>
-#endif
-
-#if HAVE_TIME_H
-# include <time.h>
-#endif
-
-#if HAVE_TERMIOS_H
-# include <termios.h>
-#endif
-
-#if HAVE_STRING_H
-# include <string.h>
-#endif
-
-#if HAVE_CTYPE_H
-# include <ctype.h>
-#endif
-
-#if HAVE_INTTYPES_H
-# include <inttypes.h>
-#else
-# if HAVE_STDINT_H
-#  include <stdint.h>
-# endif
-#endif
-
-#if HAVE_SYS_RESOURCE_H
-# include <sys/resource.h>
-#endif
-
-#include <stdlib.h>
-"; then :
-
-else
-  fptools_cv_htype_sup_gid_t=no
-fi
-
-
-            if ac_fn_c_compute_int "$LINENO" "sizeof(gid_t) * 8" "HTYPE_SIZE"        "
-#include <stdio.h>
-#include <stddef.h>
-
-#if HAVE_SYS_TYPES_H
-# include <sys/types.h>
-#endif
-
-#if HAVE_UNISTD_H
-# include <unistd.h>
-#endif
-
-#if HAVE_SYS_STAT_H
-# include <sys/stat.h>
-#endif
-
-#if HAVE_FCNTL_H
-# include <fcntl.h>
-#endif
-
-#if HAVE_SIGNAL_H
-# include <signal.h>
-#endif
-
-#if HAVE_TIME_H
-# include <time.h>
-#endif
-
-#if HAVE_TERMIOS_H
-# include <termios.h>
-#endif
-
-#if HAVE_STRING_H
-# include <string.h>
-#endif
-
-#if HAVE_CTYPE_H
-# include <ctype.h>
-#endif
-
-#if HAVE_INTTYPES_H
-# include <inttypes.h>
-#else
-# if HAVE_STDINT_H
-#  include <stdint.h>
-# endif
-#endif
-
-#if HAVE_SYS_RESOURCE_H
-# include <sys/resource.h>
-#endif
-
-#include <stdlib.h>
-"; then :
-
-else
-  fptools_cv_htype_sup_gid_t=no
-fi
-
-
-            if test "$HTYPE_IS_SIGNED" -eq 0
-            then
-                fptools_cv_htype_gid_t="Word$HTYPE_SIZE"
-            else
-                fptools_cv_htype_gid_t="Int$HTYPE_SIZE"
-            fi
-        fi
-
-fi
-
-    if test "$fptools_cv_htype_sup_gid_t" = no
-    then
-
-        fptools_cv_htype_gid_t=NotReallyAType
-        { $as_echo "$as_me:${as_lineno-$LINENO}: result: not supported" >&5
-$as_echo "not supported" >&6; }
-
-    fi
-
-            if test "$fptools_cv_htype_sup_gid_t" = yes; then
-        { $as_echo "$as_me:${as_lineno-$LINENO}: result: $fptools_cv_htype_gid_t" >&5
-$as_echo "$fptools_cv_htype_gid_t" >&6; }
-
-cat >>confdefs.h <<_ACEOF
-#define HTYPE_GID_T $fptools_cv_htype_gid_t
-_ACEOF
-
-    fi
-
-
-
-
-
-
-
-
-
-
-    { $as_echo "$as_me:${as_lineno-$LINENO}: checking Haskell type for uid_t" >&5
-$as_echo_n "checking Haskell type for uid_t... " >&6; }
-    if ${fptools_cv_htype_uid_t+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-
-        fptools_cv_htype_sup_uid_t=yes
-        if ac_fn_c_compute_int "$LINENO" "(uid_t)0.2 - (uid_t)0.4 < 0 ? 0 : 1" "HTYPE_IS_INTEGRAL"        "
-#include <stdio.h>
-#include <stddef.h>
-
-#if HAVE_SYS_TYPES_H
-# include <sys/types.h>
-#endif
-
-#if HAVE_UNISTD_H
-# include <unistd.h>
-#endif
-
-#if HAVE_SYS_STAT_H
-# include <sys/stat.h>
-#endif
-
-#if HAVE_FCNTL_H
-# include <fcntl.h>
-#endif
-
-#if HAVE_SIGNAL_H
-# include <signal.h>
-#endif
-
-#if HAVE_TIME_H
-# include <time.h>
-#endif
-
-#if HAVE_TERMIOS_H
-# include <termios.h>
-#endif
-
-#if HAVE_STRING_H
-# include <string.h>
-#endif
-
-#if HAVE_CTYPE_H
-# include <ctype.h>
-#endif
-
-#if HAVE_INTTYPES_H
-# include <inttypes.h>
-#else
-# if HAVE_STDINT_H
-#  include <stdint.h>
-# endif
-#endif
-
-#if HAVE_SYS_RESOURCE_H
-# include <sys/resource.h>
-#endif
-
-#include <stdlib.h>
-"; then :
-
-else
-  HTYPE_IS_INTEGRAL=0
-fi
-
-
-
-        if test "$HTYPE_IS_INTEGRAL" -eq 0
-        then
-            if ac_fn_c_compute_int "$LINENO" "sizeof(uid_t) == sizeof(float)" "HTYPE_IS_FLOAT"        "
-#include <stdio.h>
-#include <stddef.h>
-
-#if HAVE_SYS_TYPES_H
-# include <sys/types.h>
-#endif
-
-#if HAVE_UNISTD_H
-# include <unistd.h>
-#endif
-
-#if HAVE_SYS_STAT_H
-# include <sys/stat.h>
-#endif
-
-#if HAVE_FCNTL_H
-# include <fcntl.h>
-#endif
-
-#if HAVE_SIGNAL_H
-# include <signal.h>
-#endif
-
-#if HAVE_TIME_H
-# include <time.h>
-#endif
-
-#if HAVE_TERMIOS_H
-# include <termios.h>
-#endif
-
-#if HAVE_STRING_H
-# include <string.h>
-#endif
-
-#if HAVE_CTYPE_H
-# include <ctype.h>
-#endif
-
-#if HAVE_INTTYPES_H
-# include <inttypes.h>
-#else
-# if HAVE_STDINT_H
-#  include <stdint.h>
-# endif
-#endif
-
-#if HAVE_SYS_RESOURCE_H
-# include <sys/resource.h>
-#endif
-
-#include <stdlib.h>
-"; then :
-
-else
-  fptools_cv_htype_sup_uid_t=no
-fi
-
-
-            if ac_fn_c_compute_int "$LINENO" "sizeof(uid_t) == sizeof(double)" "HTYPE_IS_DOUBLE"        "
-#include <stdio.h>
-#include <stddef.h>
-
-#if HAVE_SYS_TYPES_H
-# include <sys/types.h>
-#endif
-
-#if HAVE_UNISTD_H
-# include <unistd.h>
-#endif
-
-#if HAVE_SYS_STAT_H
-# include <sys/stat.h>
-#endif
-
-#if HAVE_FCNTL_H
-# include <fcntl.h>
-#endif
-
-#if HAVE_SIGNAL_H
-# include <signal.h>
-#endif
-
-#if HAVE_TIME_H
-# include <time.h>
-#endif
-
-#if HAVE_TERMIOS_H
-# include <termios.h>
-#endif
-
-#if HAVE_STRING_H
-# include <string.h>
-#endif
-
-#if HAVE_CTYPE_H
-# include <ctype.h>
-#endif
-
-#if HAVE_INTTYPES_H
-# include <inttypes.h>
-#else
-# if HAVE_STDINT_H
-#  include <stdint.h>
-# endif
-#endif
-
-#if HAVE_SYS_RESOURCE_H
-# include <sys/resource.h>
-#endif
-
-#include <stdlib.h>
-"; then :
-
-else
-  fptools_cv_htype_sup_uid_t=no
-fi
-
-
-            if ac_fn_c_compute_int "$LINENO" "sizeof(uid_t) == sizeof(long double)" "HTYPE_IS_LDOUBLE"        "
-#include <stdio.h>
-#include <stddef.h>
-
-#if HAVE_SYS_TYPES_H
-# include <sys/types.h>
-#endif
-
-#if HAVE_UNISTD_H
-# include <unistd.h>
-#endif
-
-#if HAVE_SYS_STAT_H
-# include <sys/stat.h>
-#endif
-
-#if HAVE_FCNTL_H
-# include <fcntl.h>
-#endif
-
-#if HAVE_SIGNAL_H
-# include <signal.h>
-#endif
-
-#if HAVE_TIME_H
-# include <time.h>
-#endif
-
-#if HAVE_TERMIOS_H
-# include <termios.h>
-#endif
-
-#if HAVE_STRING_H
-# include <string.h>
-#endif
-
-#if HAVE_CTYPE_H
-# include <ctype.h>
-#endif
-
-#if HAVE_INTTYPES_H
-# include <inttypes.h>
-#else
-# if HAVE_STDINT_H
-#  include <stdint.h>
-# endif
-#endif
-
-#if HAVE_SYS_RESOURCE_H
-# include <sys/resource.h>
-#endif
-
-#include <stdlib.h>
-"; then :
-
-else
-  fptools_cv_htype_sup_uid_t=no
-fi
-
-
-            if test "$HTYPE_IS_FLOAT" -eq 1
-            then
-                fptools_cv_htype_uid_t=Float
-            elif test "$HTYPE_IS_DOUBLE" -eq 1
-            then
-                fptools_cv_htype_uid_t=Double
-            elif test "$HTYPE_IS_LDOUBLE" -eq 1
-            then
-                fptools_cv_htype_uid_t=LDouble
-            else
-                fptools_cv_htype_sup_uid_t=no
-            fi
-        else
-            if ac_fn_c_compute_int "$LINENO" "((uid_t)(-1)) < ((uid_t)0)" "HTYPE_IS_SIGNED"        "
-#include <stdio.h>
-#include <stddef.h>
-
-#if HAVE_SYS_TYPES_H
-# include <sys/types.h>
-#endif
-
-#if HAVE_UNISTD_H
-# include <unistd.h>
-#endif
-
-#if HAVE_SYS_STAT_H
-# include <sys/stat.h>
-#endif
-
-#if HAVE_FCNTL_H
-# include <fcntl.h>
-#endif
-
-#if HAVE_SIGNAL_H
-# include <signal.h>
-#endif
-
-#if HAVE_TIME_H
-# include <time.h>
-#endif
-
-#if HAVE_TERMIOS_H
-# include <termios.h>
-#endif
-
-#if HAVE_STRING_H
-# include <string.h>
-#endif
-
-#if HAVE_CTYPE_H
-# include <ctype.h>
-#endif
-
-#if HAVE_INTTYPES_H
-# include <inttypes.h>
-#else
-# if HAVE_STDINT_H
-#  include <stdint.h>
-# endif
-#endif
-
-#if HAVE_SYS_RESOURCE_H
-# include <sys/resource.h>
-#endif
-
-#include <stdlib.h>
-"; then :
-
-else
-  fptools_cv_htype_sup_uid_t=no
-fi
-
-
-            if ac_fn_c_compute_int "$LINENO" "sizeof(uid_t) * 8" "HTYPE_SIZE"        "
-#include <stdio.h>
-#include <stddef.h>
-
-#if HAVE_SYS_TYPES_H
-# include <sys/types.h>
-#endif
-
-#if HAVE_UNISTD_H
-# include <unistd.h>
-#endif
-
-#if HAVE_SYS_STAT_H
-# include <sys/stat.h>
-#endif
-
-#if HAVE_FCNTL_H
-# include <fcntl.h>
-#endif
-
-#if HAVE_SIGNAL_H
-# include <signal.h>
-#endif
-
-#if HAVE_TIME_H
-# include <time.h>
-#endif
-
-#if HAVE_TERMIOS_H
-# include <termios.h>
-#endif
-
-#if HAVE_STRING_H
-# include <string.h>
-#endif
-
-#if HAVE_CTYPE_H
-# include <ctype.h>
-#endif
-
-#if HAVE_INTTYPES_H
-# include <inttypes.h>
-#else
-# if HAVE_STDINT_H
-#  include <stdint.h>
-# endif
-#endif
-
-#if HAVE_SYS_RESOURCE_H
-# include <sys/resource.h>
-#endif
-
-#include <stdlib.h>
-"; then :
-
-else
-  fptools_cv_htype_sup_uid_t=no
-fi
-
-
-            if test "$HTYPE_IS_SIGNED" -eq 0
-            then
-                fptools_cv_htype_uid_t="Word$HTYPE_SIZE"
-            else
-                fptools_cv_htype_uid_t="Int$HTYPE_SIZE"
-            fi
-        fi
-
-fi
-
-    if test "$fptools_cv_htype_sup_uid_t" = no
-    then
-
-        fptools_cv_htype_uid_t=NotReallyAType
-        { $as_echo "$as_me:${as_lineno-$LINENO}: result: not supported" >&5
-$as_echo "not supported" >&6; }
-
-    fi
-
-            if test "$fptools_cv_htype_sup_uid_t" = yes; then
-        { $as_echo "$as_me:${as_lineno-$LINENO}: result: $fptools_cv_htype_uid_t" >&5
-$as_echo "$fptools_cv_htype_uid_t" >&6; }
-
-cat >>confdefs.h <<_ACEOF
-#define HTYPE_UID_T $fptools_cv_htype_uid_t
-_ACEOF
-
-    fi
-
-
-
-
-
-
-
-
-
-
-    { $as_echo "$as_me:${as_lineno-$LINENO}: checking Haskell type for cc_t" >&5
-$as_echo_n "checking Haskell type for cc_t... " >&6; }
-    if ${fptools_cv_htype_cc_t+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-
-        fptools_cv_htype_sup_cc_t=yes
-        if ac_fn_c_compute_int "$LINENO" "(cc_t)0.2 - (cc_t)0.4 < 0 ? 0 : 1" "HTYPE_IS_INTEGRAL"        "
-#include <stdio.h>
-#include <stddef.h>
-
-#if HAVE_SYS_TYPES_H
-# include <sys/types.h>
-#endif
-
-#if HAVE_UNISTD_H
-# include <unistd.h>
-#endif
-
-#if HAVE_SYS_STAT_H
-# include <sys/stat.h>
-#endif
-
-#if HAVE_FCNTL_H
-# include <fcntl.h>
-#endif
-
-#if HAVE_SIGNAL_H
-# include <signal.h>
-#endif
-
-#if HAVE_TIME_H
-# include <time.h>
-#endif
-
-#if HAVE_TERMIOS_H
-# include <termios.h>
-#endif
-
-#if HAVE_STRING_H
-# include <string.h>
-#endif
-
-#if HAVE_CTYPE_H
-# include <ctype.h>
-#endif
-
-#if HAVE_INTTYPES_H
-# include <inttypes.h>
-#else
-# if HAVE_STDINT_H
-#  include <stdint.h>
-# endif
-#endif
-
-#if HAVE_SYS_RESOURCE_H
-# include <sys/resource.h>
-#endif
-
-#include <stdlib.h>
-"; then :
-
-else
-  HTYPE_IS_INTEGRAL=0
-fi
-
-
-
-        if test "$HTYPE_IS_INTEGRAL" -eq 0
-        then
-            if ac_fn_c_compute_int "$LINENO" "sizeof(cc_t) == sizeof(float)" "HTYPE_IS_FLOAT"        "
-#include <stdio.h>
-#include <stddef.h>
-
-#if HAVE_SYS_TYPES_H
-# include <sys/types.h>
-#endif
-
-#if HAVE_UNISTD_H
-# include <unistd.h>
-#endif
-
-#if HAVE_SYS_STAT_H
-# include <sys/stat.h>
-#endif
-
-#if HAVE_FCNTL_H
-# include <fcntl.h>
-#endif
-
-#if HAVE_SIGNAL_H
-# include <signal.h>
-#endif
-
-#if HAVE_TIME_H
-# include <time.h>
-#endif
-
-#if HAVE_TERMIOS_H
-# include <termios.h>
-#endif
-
-#if HAVE_STRING_H
-# include <string.h>
-#endif
-
-#if HAVE_CTYPE_H
-# include <ctype.h>
-#endif
-
-#if HAVE_INTTYPES_H
-# include <inttypes.h>
-#else
-# if HAVE_STDINT_H
-#  include <stdint.h>
-# endif
-#endif
-
-#if HAVE_SYS_RESOURCE_H
-# include <sys/resource.h>
-#endif
-
-#include <stdlib.h>
-"; then :
-
-else
-  fptools_cv_htype_sup_cc_t=no
-fi
-
-
-            if ac_fn_c_compute_int "$LINENO" "sizeof(cc_t) == sizeof(double)" "HTYPE_IS_DOUBLE"        "
-#include <stdio.h>
-#include <stddef.h>
-
-#if HAVE_SYS_TYPES_H
-# include <sys/types.h>
-#endif
-
-#if HAVE_UNISTD_H
-# include <unistd.h>
-#endif
-
-#if HAVE_SYS_STAT_H
-# include <sys/stat.h>
-#endif
-
-#if HAVE_FCNTL_H
-# include <fcntl.h>
-#endif
-
-#if HAVE_SIGNAL_H
-# include <signal.h>
-#endif
-
-#if HAVE_TIME_H
-# include <time.h>
-#endif
-
-#if HAVE_TERMIOS_H
-# include <termios.h>
-#endif
-
-#if HAVE_STRING_H
-# include <string.h>
-#endif
-
-#if HAVE_CTYPE_H
-# include <ctype.h>
-#endif
-
-#if HAVE_INTTYPES_H
-# include <inttypes.h>
-#else
-# if HAVE_STDINT_H
-#  include <stdint.h>
-# endif
-#endif
-
-#if HAVE_SYS_RESOURCE_H
-# include <sys/resource.h>
-#endif
-
-#include <stdlib.h>
-"; then :
-
-else
-  fptools_cv_htype_sup_cc_t=no
-fi
-
-
-            if ac_fn_c_compute_int "$LINENO" "sizeof(cc_t) == sizeof(long double)" "HTYPE_IS_LDOUBLE"        "
-#include <stdio.h>
-#include <stddef.h>
-
-#if HAVE_SYS_TYPES_H
-# include <sys/types.h>
-#endif
-
-#if HAVE_UNISTD_H
-# include <unistd.h>
-#endif
-
-#if HAVE_SYS_STAT_H
-# include <sys/stat.h>
-#endif
-
-#if HAVE_FCNTL_H
-# include <fcntl.h>
-#endif
-
-#if HAVE_SIGNAL_H
-# include <signal.h>
-#endif
-
-#if HAVE_TIME_H
-# include <time.h>
-#endif
-
-#if HAVE_TERMIOS_H
-# include <termios.h>
-#endif
-
-#if HAVE_STRING_H
-# include <string.h>
-#endif
-
-#if HAVE_CTYPE_H
-# include <ctype.h>
-#endif
-
-#if HAVE_INTTYPES_H
-# include <inttypes.h>
-#else
-# if HAVE_STDINT_H
-#  include <stdint.h>
-# endif
-#endif
-
-#if HAVE_SYS_RESOURCE_H
-# include <sys/resource.h>
-#endif
-
-#include <stdlib.h>
-"; then :
-
-else
-  fptools_cv_htype_sup_cc_t=no
-fi
-
-
-            if test "$HTYPE_IS_FLOAT" -eq 1
-            then
-                fptools_cv_htype_cc_t=Float
-            elif test "$HTYPE_IS_DOUBLE" -eq 1
-            then
-                fptools_cv_htype_cc_t=Double
-            elif test "$HTYPE_IS_LDOUBLE" -eq 1
-            then
-                fptools_cv_htype_cc_t=LDouble
-            else
-                fptools_cv_htype_sup_cc_t=no
-            fi
-        else
-            if ac_fn_c_compute_int "$LINENO" "((cc_t)(-1)) < ((cc_t)0)" "HTYPE_IS_SIGNED"        "
-#include <stdio.h>
-#include <stddef.h>
-
-#if HAVE_SYS_TYPES_H
-# include <sys/types.h>
-#endif
-
-#if HAVE_UNISTD_H
-# include <unistd.h>
-#endif
-
-#if HAVE_SYS_STAT_H
-# include <sys/stat.h>
-#endif
-
-#if HAVE_FCNTL_H
-# include <fcntl.h>
-#endif
-
-#if HAVE_SIGNAL_H
-# include <signal.h>
-#endif
-
-#if HAVE_TIME_H
-# include <time.h>
-#endif
-
-#if HAVE_TERMIOS_H
-# include <termios.h>
-#endif
-
-#if HAVE_STRING_H
-# include <string.h>
-#endif
-
-#if HAVE_CTYPE_H
-# include <ctype.h>
-#endif
-
-#if HAVE_INTTYPES_H
-# include <inttypes.h>
-#else
-# if HAVE_STDINT_H
-#  include <stdint.h>
-# endif
-#endif
-
-#if HAVE_SYS_RESOURCE_H
-# include <sys/resource.h>
-#endif
-
-#include <stdlib.h>
-"; then :
-
-else
-  fptools_cv_htype_sup_cc_t=no
-fi
-
-
-            if ac_fn_c_compute_int "$LINENO" "sizeof(cc_t) * 8" "HTYPE_SIZE"        "
-#include <stdio.h>
-#include <stddef.h>
-
-#if HAVE_SYS_TYPES_H
-# include <sys/types.h>
-#endif
-
-#if HAVE_UNISTD_H
-# include <unistd.h>
-#endif
-
-#if HAVE_SYS_STAT_H
-# include <sys/stat.h>
-#endif
-
-#if HAVE_FCNTL_H
-# include <fcntl.h>
-#endif
-
-#if HAVE_SIGNAL_H
-# include <signal.h>
-#endif
-
-#if HAVE_TIME_H
-# include <time.h>
-#endif
-
-#if HAVE_TERMIOS_H
-# include <termios.h>
-#endif
-
-#if HAVE_STRING_H
-# include <string.h>
-#endif
-
-#if HAVE_CTYPE_H
-# include <ctype.h>
-#endif
-
-#if HAVE_INTTYPES_H
-# include <inttypes.h>
-#else
-# if HAVE_STDINT_H
-#  include <stdint.h>
-# endif
-#endif
-
-#if HAVE_SYS_RESOURCE_H
-# include <sys/resource.h>
-#endif
-
-#include <stdlib.h>
-"; then :
-
-else
-  fptools_cv_htype_sup_cc_t=no
-fi
-
-
-            if test "$HTYPE_IS_SIGNED" -eq 0
-            then
-                fptools_cv_htype_cc_t="Word$HTYPE_SIZE"
-            else
-                fptools_cv_htype_cc_t="Int$HTYPE_SIZE"
-            fi
-        fi
-
-fi
-
-    if test "$fptools_cv_htype_sup_cc_t" = no
-    then
-
-        fptools_cv_htype_cc_t=NotReallyAType
-        { $as_echo "$as_me:${as_lineno-$LINENO}: result: not supported" >&5
-$as_echo "not supported" >&6; }
-
-    fi
-
-            if test "$fptools_cv_htype_sup_cc_t" = yes; then
-        { $as_echo "$as_me:${as_lineno-$LINENO}: result: $fptools_cv_htype_cc_t" >&5
-$as_echo "$fptools_cv_htype_cc_t" >&6; }
-
-cat >>confdefs.h <<_ACEOF
-#define HTYPE_CC_T $fptools_cv_htype_cc_t
-_ACEOF
-
-    fi
-
-
-
-
-
-
-
-
-
-
-    { $as_echo "$as_me:${as_lineno-$LINENO}: checking Haskell type for speed_t" >&5
-$as_echo_n "checking Haskell type for speed_t... " >&6; }
-    if ${fptools_cv_htype_speed_t+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-
-        fptools_cv_htype_sup_speed_t=yes
-        if ac_fn_c_compute_int "$LINENO" "(speed_t)0.2 - (speed_t)0.4 < 0 ? 0 : 1" "HTYPE_IS_INTEGRAL"        "
-#include <stdio.h>
-#include <stddef.h>
-
-#if HAVE_SYS_TYPES_H
-# include <sys/types.h>
-#endif
-
-#if HAVE_UNISTD_H
-# include <unistd.h>
-#endif
-
-#if HAVE_SYS_STAT_H
-# include <sys/stat.h>
-#endif
-
-#if HAVE_FCNTL_H
-# include <fcntl.h>
-#endif
-
-#if HAVE_SIGNAL_H
-# include <signal.h>
-#endif
-
-#if HAVE_TIME_H
-# include <time.h>
-#endif
-
-#if HAVE_TERMIOS_H
-# include <termios.h>
-#endif
-
-#if HAVE_STRING_H
-# include <string.h>
-#endif
-
-#if HAVE_CTYPE_H
-# include <ctype.h>
-#endif
-
-#if HAVE_INTTYPES_H
-# include <inttypes.h>
-#else
-# if HAVE_STDINT_H
-#  include <stdint.h>
-# endif
-#endif
-
-#if HAVE_SYS_RESOURCE_H
-# include <sys/resource.h>
-#endif
-
-#include <stdlib.h>
-"; then :
-
-else
-  HTYPE_IS_INTEGRAL=0
-fi
-
-
-
-        if test "$HTYPE_IS_INTEGRAL" -eq 0
-        then
-            if ac_fn_c_compute_int "$LINENO" "sizeof(speed_t) == sizeof(float)" "HTYPE_IS_FLOAT"        "
-#include <stdio.h>
-#include <stddef.h>
-
-#if HAVE_SYS_TYPES_H
-# include <sys/types.h>
-#endif
-
-#if HAVE_UNISTD_H
-# include <unistd.h>
-#endif
-
-#if HAVE_SYS_STAT_H
-# include <sys/stat.h>
-#endif
-
-#if HAVE_FCNTL_H
-# include <fcntl.h>
-#endif
-
-#if HAVE_SIGNAL_H
-# include <signal.h>
-#endif
-
-#if HAVE_TIME_H
-# include <time.h>
-#endif
-
-#if HAVE_TERMIOS_H
-# include <termios.h>
-#endif
-
-#if HAVE_STRING_H
-# include <string.h>
-#endif
-
-#if HAVE_CTYPE_H
-# include <ctype.h>
-#endif
-
-#if HAVE_INTTYPES_H
-# include <inttypes.h>
-#else
-# if HAVE_STDINT_H
-#  include <stdint.h>
-# endif
-#endif
-
-#if HAVE_SYS_RESOURCE_H
-# include <sys/resource.h>
-#endif
-
-#include <stdlib.h>
-"; then :
-
-else
-  fptools_cv_htype_sup_speed_t=no
-fi
-
-
-            if ac_fn_c_compute_int "$LINENO" "sizeof(speed_t) == sizeof(double)" "HTYPE_IS_DOUBLE"        "
-#include <stdio.h>
-#include <stddef.h>
-
-#if HAVE_SYS_TYPES_H
-# include <sys/types.h>
-#endif
-
-#if HAVE_UNISTD_H
-# include <unistd.h>
-#endif
-
-#if HAVE_SYS_STAT_H
-# include <sys/stat.h>
-#endif
-
-#if HAVE_FCNTL_H
-# include <fcntl.h>
-#endif
-
-#if HAVE_SIGNAL_H
-# include <signal.h>
-#endif
-
-#if HAVE_TIME_H
-# include <time.h>
-#endif
-
-#if HAVE_TERMIOS_H
-# include <termios.h>
-#endif
-
-#if HAVE_STRING_H
-# include <string.h>
-#endif
-
-#if HAVE_CTYPE_H
-# include <ctype.h>
-#endif
-
-#if HAVE_INTTYPES_H
-# include <inttypes.h>
-#else
-# if HAVE_STDINT_H
-#  include <stdint.h>
-# endif
-#endif
-
-#if HAVE_SYS_RESOURCE_H
-# include <sys/resource.h>
-#endif
-
-#include <stdlib.h>
-"; then :
-
-else
-  fptools_cv_htype_sup_speed_t=no
-fi
-
-
-            if ac_fn_c_compute_int "$LINENO" "sizeof(speed_t) == sizeof(long double)" "HTYPE_IS_LDOUBLE"        "
-#include <stdio.h>
-#include <stddef.h>
-
-#if HAVE_SYS_TYPES_H
-# include <sys/types.h>
-#endif
-
-#if HAVE_UNISTD_H
-# include <unistd.h>
-#endif
-
-#if HAVE_SYS_STAT_H
-# include <sys/stat.h>
-#endif
-
-#if HAVE_FCNTL_H
-# include <fcntl.h>
-#endif
-
-#if HAVE_SIGNAL_H
-# include <signal.h>
-#endif
-
-#if HAVE_TIME_H
-# include <time.h>
-#endif
-
-#if HAVE_TERMIOS_H
-# include <termios.h>
-#endif
-
-#if HAVE_STRING_H
-# include <string.h>
-#endif
-
-#if HAVE_CTYPE_H
-# include <ctype.h>
-#endif
-
-#if HAVE_INTTYPES_H
-# include <inttypes.h>
-#else
-# if HAVE_STDINT_H
-#  include <stdint.h>
-# endif
-#endif
-
-#if HAVE_SYS_RESOURCE_H
-# include <sys/resource.h>
-#endif
-
-#include <stdlib.h>
-"; then :
-
-else
-  fptools_cv_htype_sup_speed_t=no
-fi
-
-
-            if test "$HTYPE_IS_FLOAT" -eq 1
-            then
-                fptools_cv_htype_speed_t=Float
-            elif test "$HTYPE_IS_DOUBLE" -eq 1
-            then
-                fptools_cv_htype_speed_t=Double
-            elif test "$HTYPE_IS_LDOUBLE" -eq 1
-            then
-                fptools_cv_htype_speed_t=LDouble
-            else
-                fptools_cv_htype_sup_speed_t=no
-            fi
-        else
-            if ac_fn_c_compute_int "$LINENO" "((speed_t)(-1)) < ((speed_t)0)" "HTYPE_IS_SIGNED"        "
-#include <stdio.h>
-#include <stddef.h>
-
-#if HAVE_SYS_TYPES_H
-# include <sys/types.h>
-#endif
-
-#if HAVE_UNISTD_H
-# include <unistd.h>
-#endif
-
-#if HAVE_SYS_STAT_H
-# include <sys/stat.h>
-#endif
-
-#if HAVE_FCNTL_H
-# include <fcntl.h>
-#endif
-
-#if HAVE_SIGNAL_H
-# include <signal.h>
-#endif
-
-#if HAVE_TIME_H
-# include <time.h>
-#endif
-
-#if HAVE_TERMIOS_H
-# include <termios.h>
-#endif
-
-#if HAVE_STRING_H
-# include <string.h>
-#endif
-
-#if HAVE_CTYPE_H
-# include <ctype.h>
-#endif
-
-#if HAVE_INTTYPES_H
-# include <inttypes.h>
-#else
-# if HAVE_STDINT_H
-#  include <stdint.h>
-# endif
-#endif
-
-#if HAVE_SYS_RESOURCE_H
-# include <sys/resource.h>
-#endif
-
-#include <stdlib.h>
-"; then :
-
-else
-  fptools_cv_htype_sup_speed_t=no
-fi
-
-
-            if ac_fn_c_compute_int "$LINENO" "sizeof(speed_t) * 8" "HTYPE_SIZE"        "
-#include <stdio.h>
-#include <stddef.h>
-
-#if HAVE_SYS_TYPES_H
-# include <sys/types.h>
-#endif
-
-#if HAVE_UNISTD_H
-# include <unistd.h>
-#endif
-
-#if HAVE_SYS_STAT_H
-# include <sys/stat.h>
-#endif
-
-#if HAVE_FCNTL_H
-# include <fcntl.h>
-#endif
-
-#if HAVE_SIGNAL_H
-# include <signal.h>
-#endif
-
-#if HAVE_TIME_H
-# include <time.h>
-#endif
-
-#if HAVE_TERMIOS_H
-# include <termios.h>
-#endif
-
-#if HAVE_STRING_H
-# include <string.h>
-#endif
-
-#if HAVE_CTYPE_H
-# include <ctype.h>
-#endif
-
-#if HAVE_INTTYPES_H
-# include <inttypes.h>
-#else
-# if HAVE_STDINT_H
-#  include <stdint.h>
-# endif
-#endif
-
-#if HAVE_SYS_RESOURCE_H
-# include <sys/resource.h>
-#endif
-
-#include <stdlib.h>
-"; then :
-
-else
-  fptools_cv_htype_sup_speed_t=no
-fi
-
-
-            if test "$HTYPE_IS_SIGNED" -eq 0
-            then
-                fptools_cv_htype_speed_t="Word$HTYPE_SIZE"
-            else
-                fptools_cv_htype_speed_t="Int$HTYPE_SIZE"
-            fi
-        fi
-
-fi
-
-    if test "$fptools_cv_htype_sup_speed_t" = no
-    then
-
-        fptools_cv_htype_speed_t=NotReallyAType
-        { $as_echo "$as_me:${as_lineno-$LINENO}: result: not supported" >&5
-$as_echo "not supported" >&6; }
-
-    fi
-
-            if test "$fptools_cv_htype_sup_speed_t" = yes; then
-        { $as_echo "$as_me:${as_lineno-$LINENO}: result: $fptools_cv_htype_speed_t" >&5
-$as_echo "$fptools_cv_htype_speed_t" >&6; }
-
-cat >>confdefs.h <<_ACEOF
-#define HTYPE_SPEED_T $fptools_cv_htype_speed_t
-_ACEOF
-
-    fi
-
-
-
-
-
-
-
-
-
-
-    { $as_echo "$as_me:${as_lineno-$LINENO}: checking Haskell type for tcflag_t" >&5
-$as_echo_n "checking Haskell type for tcflag_t... " >&6; }
-    if ${fptools_cv_htype_tcflag_t+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-
-        fptools_cv_htype_sup_tcflag_t=yes
-        if ac_fn_c_compute_int "$LINENO" "(tcflag_t)0.2 - (tcflag_t)0.4 < 0 ? 0 : 1" "HTYPE_IS_INTEGRAL"        "
-#include <stdio.h>
-#include <stddef.h>
-
-#if HAVE_SYS_TYPES_H
-# include <sys/types.h>
-#endif
-
-#if HAVE_UNISTD_H
-# include <unistd.h>
-#endif
-
-#if HAVE_SYS_STAT_H
-# include <sys/stat.h>
-#endif
-
-#if HAVE_FCNTL_H
-# include <fcntl.h>
-#endif
-
-#if HAVE_SIGNAL_H
-# include <signal.h>
-#endif
-
-#if HAVE_TIME_H
-# include <time.h>
-#endif
-
-#if HAVE_TERMIOS_H
-# include <termios.h>
-#endif
-
-#if HAVE_STRING_H
-# include <string.h>
-#endif
-
-#if HAVE_CTYPE_H
-# include <ctype.h>
-#endif
-
-#if HAVE_INTTYPES_H
-# include <inttypes.h>
-#else
-# if HAVE_STDINT_H
-#  include <stdint.h>
-# endif
-#endif
-
-#if HAVE_SYS_RESOURCE_H
-# include <sys/resource.h>
-#endif
-
-#include <stdlib.h>
-"; then :
-
-else
-  HTYPE_IS_INTEGRAL=0
-fi
-
-
-
-        if test "$HTYPE_IS_INTEGRAL" -eq 0
-        then
-            if ac_fn_c_compute_int "$LINENO" "sizeof(tcflag_t) == sizeof(float)" "HTYPE_IS_FLOAT"        "
-#include <stdio.h>
-#include <stddef.h>
-
-#if HAVE_SYS_TYPES_H
-# include <sys/types.h>
-#endif
-
-#if HAVE_UNISTD_H
-# include <unistd.h>
-#endif
-
-#if HAVE_SYS_STAT_H
-# include <sys/stat.h>
-#endif
-
-#if HAVE_FCNTL_H
-# include <fcntl.h>
-#endif
-
-#if HAVE_SIGNAL_H
-# include <signal.h>
-#endif
-
-#if HAVE_TIME_H
-# include <time.h>
-#endif
-
-#if HAVE_TERMIOS_H
-# include <termios.h>
-#endif
-
-#if HAVE_STRING_H
-# include <string.h>
-#endif
-
-#if HAVE_CTYPE_H
-# include <ctype.h>
-#endif
-
-#if HAVE_INTTYPES_H
-# include <inttypes.h>
-#else
-# if HAVE_STDINT_H
-#  include <stdint.h>
-# endif
-#endif
-
-#if HAVE_SYS_RESOURCE_H
-# include <sys/resource.h>
-#endif
-
-#include <stdlib.h>
-"; then :
-
-else
-  fptools_cv_htype_sup_tcflag_t=no
-fi
-
-
-            if ac_fn_c_compute_int "$LINENO" "sizeof(tcflag_t) == sizeof(double)" "HTYPE_IS_DOUBLE"        "
-#include <stdio.h>
-#include <stddef.h>
-
-#if HAVE_SYS_TYPES_H
-# include <sys/types.h>
-#endif
-
-#if HAVE_UNISTD_H
-# include <unistd.h>
-#endif
-
-#if HAVE_SYS_STAT_H
-# include <sys/stat.h>
-#endif
-
-#if HAVE_FCNTL_H
-# include <fcntl.h>
-#endif
-
-#if HAVE_SIGNAL_H
-# include <signal.h>
-#endif
-
-#if HAVE_TIME_H
-# include <time.h>
-#endif
-
-#if HAVE_TERMIOS_H
-# include <termios.h>
-#endif
-
-#if HAVE_STRING_H
-# include <string.h>
-#endif
-
-#if HAVE_CTYPE_H
-# include <ctype.h>
-#endif
-
-#if HAVE_INTTYPES_H
-# include <inttypes.h>
-#else
-# if HAVE_STDINT_H
-#  include <stdint.h>
-# endif
-#endif
-
-#if HAVE_SYS_RESOURCE_H
-# include <sys/resource.h>
-#endif
-
-#include <stdlib.h>
-"; then :
-
-else
-  fptools_cv_htype_sup_tcflag_t=no
-fi
-
-
-            if ac_fn_c_compute_int "$LINENO" "sizeof(tcflag_t) == sizeof(long double)" "HTYPE_IS_LDOUBLE"        "
-#include <stdio.h>
-#include <stddef.h>
-
-#if HAVE_SYS_TYPES_H
-# include <sys/types.h>
-#endif
-
-#if HAVE_UNISTD_H
-# include <unistd.h>
-#endif
-
-#if HAVE_SYS_STAT_H
-# include <sys/stat.h>
-#endif
-
-#if HAVE_FCNTL_H
-# include <fcntl.h>
-#endif
-
-#if HAVE_SIGNAL_H
-# include <signal.h>
-#endif
-
-#if HAVE_TIME_H
-# include <time.h>
-#endif
-
-#if HAVE_TERMIOS_H
-# include <termios.h>
-#endif
-
-#if HAVE_STRING_H
-# include <string.h>
-#endif
-
-#if HAVE_CTYPE_H
-# include <ctype.h>
-#endif
-
-#if HAVE_INTTYPES_H
-# include <inttypes.h>
-#else
-# if HAVE_STDINT_H
-#  include <stdint.h>
-# endif
-#endif
-
-#if HAVE_SYS_RESOURCE_H
-# include <sys/resource.h>
-#endif
-
-#include <stdlib.h>
-"; then :
-
-else
-  fptools_cv_htype_sup_tcflag_t=no
-fi
-
-
-            if test "$HTYPE_IS_FLOAT" -eq 1
-            then
-                fptools_cv_htype_tcflag_t=Float
-            elif test "$HTYPE_IS_DOUBLE" -eq 1
-            then
-                fptools_cv_htype_tcflag_t=Double
-            elif test "$HTYPE_IS_LDOUBLE" -eq 1
-            then
-                fptools_cv_htype_tcflag_t=LDouble
-            else
-                fptools_cv_htype_sup_tcflag_t=no
-            fi
-        else
-            if ac_fn_c_compute_int "$LINENO" "((tcflag_t)(-1)) < ((tcflag_t)0)" "HTYPE_IS_SIGNED"        "
-#include <stdio.h>
-#include <stddef.h>
-
-#if HAVE_SYS_TYPES_H
-# include <sys/types.h>
-#endif
-
-#if HAVE_UNISTD_H
-# include <unistd.h>
-#endif
-
-#if HAVE_SYS_STAT_H
-# include <sys/stat.h>
-#endif
-
-#if HAVE_FCNTL_H
-# include <fcntl.h>
-#endif
-
-#if HAVE_SIGNAL_H
-# include <signal.h>
-#endif
-
-#if HAVE_TIME_H
-# include <time.h>
-#endif
-
-#if HAVE_TERMIOS_H
-# include <termios.h>
-#endif
-
-#if HAVE_STRING_H
-# include <string.h>
-#endif
-
-#if HAVE_CTYPE_H
-# include <ctype.h>
-#endif
-
-#if HAVE_INTTYPES_H
-# include <inttypes.h>
-#else
-# if HAVE_STDINT_H
-#  include <stdint.h>
-# endif
-#endif
-
-#if HAVE_SYS_RESOURCE_H
-# include <sys/resource.h>
-#endif
-
-#include <stdlib.h>
-"; then :
-
-else
-  fptools_cv_htype_sup_tcflag_t=no
-fi
-
-
-            if ac_fn_c_compute_int "$LINENO" "sizeof(tcflag_t) * 8" "HTYPE_SIZE"        "
-#include <stdio.h>
-#include <stddef.h>
-
-#if HAVE_SYS_TYPES_H
-# include <sys/types.h>
-#endif
-
-#if HAVE_UNISTD_H
-# include <unistd.h>
-#endif
-
-#if HAVE_SYS_STAT_H
-# include <sys/stat.h>
-#endif
-
-#if HAVE_FCNTL_H
-# include <fcntl.h>
-#endif
-
-#if HAVE_SIGNAL_H
-# include <signal.h>
-#endif
-
-#if HAVE_TIME_H
-# include <time.h>
-#endif
-
-#if HAVE_TERMIOS_H
-# include <termios.h>
-#endif
-
-#if HAVE_STRING_H
-# include <string.h>
-#endif
-
-#if HAVE_CTYPE_H
-# include <ctype.h>
-#endif
-
-#if HAVE_INTTYPES_H
-# include <inttypes.h>
-#else
-# if HAVE_STDINT_H
-#  include <stdint.h>
-# endif
-#endif
-
-#if HAVE_SYS_RESOURCE_H
-# include <sys/resource.h>
-#endif
-
-#include <stdlib.h>
-"; then :
-
-else
-  fptools_cv_htype_sup_tcflag_t=no
-fi
-
-
-            if test "$HTYPE_IS_SIGNED" -eq 0
-            then
-                fptools_cv_htype_tcflag_t="Word$HTYPE_SIZE"
-            else
-                fptools_cv_htype_tcflag_t="Int$HTYPE_SIZE"
-            fi
-        fi
-
-fi
-
-    if test "$fptools_cv_htype_sup_tcflag_t" = no
-    then
-
-        fptools_cv_htype_tcflag_t=NotReallyAType
-        { $as_echo "$as_me:${as_lineno-$LINENO}: result: not supported" >&5
-$as_echo "not supported" >&6; }
-
-    fi
-
-            if test "$fptools_cv_htype_sup_tcflag_t" = yes; then
-        { $as_echo "$as_me:${as_lineno-$LINENO}: result: $fptools_cv_htype_tcflag_t" >&5
-$as_echo "$fptools_cv_htype_tcflag_t" >&6; }
-
-cat >>confdefs.h <<_ACEOF
-#define HTYPE_TCFLAG_T $fptools_cv_htype_tcflag_t
-_ACEOF
-
-    fi
-
-
-
-
-
-
-
-
-
-
-    { $as_echo "$as_me:${as_lineno-$LINENO}: checking Haskell type for nlink_t" >&5
-$as_echo_n "checking Haskell type for nlink_t... " >&6; }
-    if ${fptools_cv_htype_nlink_t+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-
-        fptools_cv_htype_sup_nlink_t=yes
-        if ac_fn_c_compute_int "$LINENO" "(nlink_t)0.2 - (nlink_t)0.4 < 0 ? 0 : 1" "HTYPE_IS_INTEGRAL"        "
-#include <stdio.h>
-#include <stddef.h>
-
-#if HAVE_SYS_TYPES_H
-# include <sys/types.h>
-#endif
-
-#if HAVE_UNISTD_H
-# include <unistd.h>
-#endif
-
-#if HAVE_SYS_STAT_H
-# include <sys/stat.h>
-#endif
-
-#if HAVE_FCNTL_H
-# include <fcntl.h>
-#endif
-
-#if HAVE_SIGNAL_H
-# include <signal.h>
-#endif
-
-#if HAVE_TIME_H
-# include <time.h>
-#endif
-
-#if HAVE_TERMIOS_H
-# include <termios.h>
-#endif
-
-#if HAVE_STRING_H
-# include <string.h>
-#endif
-
-#if HAVE_CTYPE_H
-# include <ctype.h>
-#endif
-
-#if HAVE_INTTYPES_H
-# include <inttypes.h>
-#else
-# if HAVE_STDINT_H
-#  include <stdint.h>
-# endif
-#endif
-
-#if HAVE_SYS_RESOURCE_H
-# include <sys/resource.h>
-#endif
-
-#include <stdlib.h>
-"; then :
-
-else
-  HTYPE_IS_INTEGRAL=0
-fi
-
-
-
-        if test "$HTYPE_IS_INTEGRAL" -eq 0
-        then
-            if ac_fn_c_compute_int "$LINENO" "sizeof(nlink_t) == sizeof(float)" "HTYPE_IS_FLOAT"        "
-#include <stdio.h>
-#include <stddef.h>
-
-#if HAVE_SYS_TYPES_H
-# include <sys/types.h>
-#endif
-
-#if HAVE_UNISTD_H
-# include <unistd.h>
-#endif
-
-#if HAVE_SYS_STAT_H
-# include <sys/stat.h>
-#endif
-
-#if HAVE_FCNTL_H
-# include <fcntl.h>
-#endif
-
-#if HAVE_SIGNAL_H
-# include <signal.h>
-#endif
-
-#if HAVE_TIME_H
-# include <time.h>
-#endif
-
-#if HAVE_TERMIOS_H
-# include <termios.h>
-#endif
-
-#if HAVE_STRING_H
-# include <string.h>
-#endif
-
-#if HAVE_CTYPE_H
-# include <ctype.h>
-#endif
-
-#if HAVE_INTTYPES_H
-# include <inttypes.h>
-#else
-# if HAVE_STDINT_H
-#  include <stdint.h>
-# endif
-#endif
-
-#if HAVE_SYS_RESOURCE_H
-# include <sys/resource.h>
-#endif
-
-#include <stdlib.h>
-"; then :
-
-else
-  fptools_cv_htype_sup_nlink_t=no
-fi
-
-
-            if ac_fn_c_compute_int "$LINENO" "sizeof(nlink_t) == sizeof(double)" "HTYPE_IS_DOUBLE"        "
-#include <stdio.h>
-#include <stddef.h>
-
-#if HAVE_SYS_TYPES_H
-# include <sys/types.h>
-#endif
-
-#if HAVE_UNISTD_H
-# include <unistd.h>
-#endif
-
-#if HAVE_SYS_STAT_H
-# include <sys/stat.h>
-#endif
-
-#if HAVE_FCNTL_H
-# include <fcntl.h>
-#endif
-
-#if HAVE_SIGNAL_H
-# include <signal.h>
-#endif
-
-#if HAVE_TIME_H
-# include <time.h>
-#endif
-
-#if HAVE_TERMIOS_H
-# include <termios.h>
-#endif
-
-#if HAVE_STRING_H
-# include <string.h>
-#endif
-
-#if HAVE_CTYPE_H
-# include <ctype.h>
-#endif
-
-#if HAVE_INTTYPES_H
-# include <inttypes.h>
-#else
-# if HAVE_STDINT_H
-#  include <stdint.h>
-# endif
-#endif
-
-#if HAVE_SYS_RESOURCE_H
-# include <sys/resource.h>
-#endif
-
-#include <stdlib.h>
-"; then :
-
-else
-  fptools_cv_htype_sup_nlink_t=no
-fi
-
-
-            if ac_fn_c_compute_int "$LINENO" "sizeof(nlink_t) == sizeof(long double)" "HTYPE_IS_LDOUBLE"        "
-#include <stdio.h>
-#include <stddef.h>
-
-#if HAVE_SYS_TYPES_H
-# include <sys/types.h>
-#endif
-
-#if HAVE_UNISTD_H
-# include <unistd.h>
-#endif
-
-#if HAVE_SYS_STAT_H
-# include <sys/stat.h>
-#endif
-
-#if HAVE_FCNTL_H
-# include <fcntl.h>
-#endif
-
-#if HAVE_SIGNAL_H
-# include <signal.h>
-#endif
-
-#if HAVE_TIME_H
-# include <time.h>
-#endif
-
-#if HAVE_TERMIOS_H
-# include <termios.h>
-#endif
-
-#if HAVE_STRING_H
-# include <string.h>
-#endif
-
-#if HAVE_CTYPE_H
-# include <ctype.h>
-#endif
-
-#if HAVE_INTTYPES_H
-# include <inttypes.h>
-#else
-# if HAVE_STDINT_H
-#  include <stdint.h>
-# endif
-#endif
-
-#if HAVE_SYS_RESOURCE_H
-# include <sys/resource.h>
-#endif
-
-#include <stdlib.h>
-"; then :
-
-else
-  fptools_cv_htype_sup_nlink_t=no
-fi
-
-
-            if test "$HTYPE_IS_FLOAT" -eq 1
-            then
-                fptools_cv_htype_nlink_t=Float
-            elif test "$HTYPE_IS_DOUBLE" -eq 1
-            then
-                fptools_cv_htype_nlink_t=Double
-            elif test "$HTYPE_IS_LDOUBLE" -eq 1
-            then
-                fptools_cv_htype_nlink_t=LDouble
-            else
-                fptools_cv_htype_sup_nlink_t=no
-            fi
-        else
-            if ac_fn_c_compute_int "$LINENO" "((nlink_t)(-1)) < ((nlink_t)0)" "HTYPE_IS_SIGNED"        "
-#include <stdio.h>
-#include <stddef.h>
-
-#if HAVE_SYS_TYPES_H
-# include <sys/types.h>
-#endif
-
-#if HAVE_UNISTD_H
-# include <unistd.h>
-#endif
-
-#if HAVE_SYS_STAT_H
-# include <sys/stat.h>
-#endif
-
-#if HAVE_FCNTL_H
-# include <fcntl.h>
-#endif
-
-#if HAVE_SIGNAL_H
-# include <signal.h>
-#endif
-
-#if HAVE_TIME_H
-# include <time.h>
-#endif
-
-#if HAVE_TERMIOS_H
-# include <termios.h>
-#endif
-
-#if HAVE_STRING_H
-# include <string.h>
-#endif
-
-#if HAVE_CTYPE_H
-# include <ctype.h>
-#endif
-
-#if HAVE_INTTYPES_H
-# include <inttypes.h>
-#else
-# if HAVE_STDINT_H
-#  include <stdint.h>
-# endif
-#endif
-
-#if HAVE_SYS_RESOURCE_H
-# include <sys/resource.h>
-#endif
-
-#include <stdlib.h>
-"; then :
-
-else
-  fptools_cv_htype_sup_nlink_t=no
-fi
-
-
-            if ac_fn_c_compute_int "$LINENO" "sizeof(nlink_t) * 8" "HTYPE_SIZE"        "
-#include <stdio.h>
-#include <stddef.h>
-
-#if HAVE_SYS_TYPES_H
-# include <sys/types.h>
-#endif
-
-#if HAVE_UNISTD_H
-# include <unistd.h>
-#endif
-
-#if HAVE_SYS_STAT_H
-# include <sys/stat.h>
-#endif
-
-#if HAVE_FCNTL_H
-# include <fcntl.h>
-#endif
-
-#if HAVE_SIGNAL_H
-# include <signal.h>
-#endif
-
-#if HAVE_TIME_H
-# include <time.h>
-#endif
-
-#if HAVE_TERMIOS_H
-# include <termios.h>
-#endif
-
-#if HAVE_STRING_H
-# include <string.h>
-#endif
-
-#if HAVE_CTYPE_H
-# include <ctype.h>
-#endif
-
-#if HAVE_INTTYPES_H
-# include <inttypes.h>
-#else
-# if HAVE_STDINT_H
-#  include <stdint.h>
-# endif
-#endif
-
-#if HAVE_SYS_RESOURCE_H
-# include <sys/resource.h>
-#endif
-
-#include <stdlib.h>
-"; then :
-
-else
-  fptools_cv_htype_sup_nlink_t=no
-fi
-
-
-            if test "$HTYPE_IS_SIGNED" -eq 0
-            then
-                fptools_cv_htype_nlink_t="Word$HTYPE_SIZE"
-            else
-                fptools_cv_htype_nlink_t="Int$HTYPE_SIZE"
-            fi
-        fi
-
-fi
-
-    if test "$fptools_cv_htype_sup_nlink_t" = no
-    then
-
-        fptools_cv_htype_nlink_t=NotReallyAType
-        { $as_echo "$as_me:${as_lineno-$LINENO}: result: not supported" >&5
-$as_echo "not supported" >&6; }
-
-    fi
-
-            if test "$fptools_cv_htype_sup_nlink_t" = yes; then
-        { $as_echo "$as_me:${as_lineno-$LINENO}: result: $fptools_cv_htype_nlink_t" >&5
-$as_echo "$fptools_cv_htype_nlink_t" >&6; }
-
-cat >>confdefs.h <<_ACEOF
-#define HTYPE_NLINK_T $fptools_cv_htype_nlink_t
-_ACEOF
-
-    fi
-
-
-
-
-
-
-
-
-
-
-    { $as_echo "$as_me:${as_lineno-$LINENO}: checking Haskell type for ssize_t" >&5
-$as_echo_n "checking Haskell type for ssize_t... " >&6; }
-    if ${fptools_cv_htype_ssize_t+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-
-        fptools_cv_htype_sup_ssize_t=yes
-        if ac_fn_c_compute_int "$LINENO" "(ssize_t)0.2 - (ssize_t)0.4 < 0 ? 0 : 1" "HTYPE_IS_INTEGRAL"        "
-#include <stdio.h>
-#include <stddef.h>
-
-#if HAVE_SYS_TYPES_H
-# include <sys/types.h>
-#endif
-
-#if HAVE_UNISTD_H
-# include <unistd.h>
-#endif
-
-#if HAVE_SYS_STAT_H
-# include <sys/stat.h>
-#endif
-
-#if HAVE_FCNTL_H
-# include <fcntl.h>
-#endif
-
-#if HAVE_SIGNAL_H
-# include <signal.h>
-#endif
-
-#if HAVE_TIME_H
-# include <time.h>
-#endif
-
-#if HAVE_TERMIOS_H
-# include <termios.h>
-#endif
-
-#if HAVE_STRING_H
-# include <string.h>
-#endif
-
-#if HAVE_CTYPE_H
-# include <ctype.h>
-#endif
-
-#if HAVE_INTTYPES_H
-# include <inttypes.h>
-#else
-# if HAVE_STDINT_H
-#  include <stdint.h>
-# endif
-#endif
-
-#if HAVE_SYS_RESOURCE_H
-# include <sys/resource.h>
-#endif
-
-#include <stdlib.h>
-"; then :
-
-else
-  HTYPE_IS_INTEGRAL=0
-fi
-
-
-
-        if test "$HTYPE_IS_INTEGRAL" -eq 0
-        then
-            if ac_fn_c_compute_int "$LINENO" "sizeof(ssize_t) == sizeof(float)" "HTYPE_IS_FLOAT"        "
-#include <stdio.h>
-#include <stddef.h>
-
-#if HAVE_SYS_TYPES_H
-# include <sys/types.h>
-#endif
-
-#if HAVE_UNISTD_H
-# include <unistd.h>
-#endif
-
-#if HAVE_SYS_STAT_H
-# include <sys/stat.h>
-#endif
-
-#if HAVE_FCNTL_H
-# include <fcntl.h>
-#endif
-
-#if HAVE_SIGNAL_H
-# include <signal.h>
-#endif
-
-#if HAVE_TIME_H
-# include <time.h>
-#endif
-
-#if HAVE_TERMIOS_H
-# include <termios.h>
-#endif
-
-#if HAVE_STRING_H
-# include <string.h>
-#endif
-
-#if HAVE_CTYPE_H
-# include <ctype.h>
-#endif
-
-#if HAVE_INTTYPES_H
-# include <inttypes.h>
-#else
-# if HAVE_STDINT_H
-#  include <stdint.h>
-# endif
-#endif
-
-#if HAVE_SYS_RESOURCE_H
-# include <sys/resource.h>
-#endif
-
-#include <stdlib.h>
-"; then :
-
-else
-  fptools_cv_htype_sup_ssize_t=no
-fi
-
-
-            if ac_fn_c_compute_int "$LINENO" "sizeof(ssize_t) == sizeof(double)" "HTYPE_IS_DOUBLE"        "
-#include <stdio.h>
-#include <stddef.h>
-
-#if HAVE_SYS_TYPES_H
-# include <sys/types.h>
-#endif
-
-#if HAVE_UNISTD_H
-# include <unistd.h>
-#endif
-
-#if HAVE_SYS_STAT_H
-# include <sys/stat.h>
-#endif
-
-#if HAVE_FCNTL_H
-# include <fcntl.h>
-#endif
-
-#if HAVE_SIGNAL_H
-# include <signal.h>
-#endif
-
-#if HAVE_TIME_H
-# include <time.h>
-#endif
-
-#if HAVE_TERMIOS_H
-# include <termios.h>
-#endif
-
-#if HAVE_STRING_H
-# include <string.h>
-#endif
-
-#if HAVE_CTYPE_H
-# include <ctype.h>
-#endif
-
-#if HAVE_INTTYPES_H
-# include <inttypes.h>
-#else
-# if HAVE_STDINT_H
-#  include <stdint.h>
-# endif
-#endif
-
-#if HAVE_SYS_RESOURCE_H
-# include <sys/resource.h>
-#endif
-
-#include <stdlib.h>
-"; then :
-
-else
-  fptools_cv_htype_sup_ssize_t=no
-fi
-
-
-            if ac_fn_c_compute_int "$LINENO" "sizeof(ssize_t) == sizeof(long double)" "HTYPE_IS_LDOUBLE"        "
-#include <stdio.h>
-#include <stddef.h>
-
-#if HAVE_SYS_TYPES_H
-# include <sys/types.h>
-#endif
-
-#if HAVE_UNISTD_H
-# include <unistd.h>
-#endif
-
-#if HAVE_SYS_STAT_H
-# include <sys/stat.h>
-#endif
-
-#if HAVE_FCNTL_H
-# include <fcntl.h>
-#endif
-
-#if HAVE_SIGNAL_H
-# include <signal.h>
-#endif
-
-#if HAVE_TIME_H
-# include <time.h>
-#endif
-
-#if HAVE_TERMIOS_H
-# include <termios.h>
-#endif
-
-#if HAVE_STRING_H
-# include <string.h>
-#endif
-
-#if HAVE_CTYPE_H
-# include <ctype.h>
-#endif
-
-#if HAVE_INTTYPES_H
-# include <inttypes.h>
-#else
-# if HAVE_STDINT_H
-#  include <stdint.h>
-# endif
-#endif
-
-#if HAVE_SYS_RESOURCE_H
-# include <sys/resource.h>
-#endif
-
-#include <stdlib.h>
-"; then :
-
-else
-  fptools_cv_htype_sup_ssize_t=no
-fi
-
-
-            if test "$HTYPE_IS_FLOAT" -eq 1
-            then
-                fptools_cv_htype_ssize_t=Float
-            elif test "$HTYPE_IS_DOUBLE" -eq 1
-            then
-                fptools_cv_htype_ssize_t=Double
-            elif test "$HTYPE_IS_LDOUBLE" -eq 1
-            then
-                fptools_cv_htype_ssize_t=LDouble
-            else
-                fptools_cv_htype_sup_ssize_t=no
-            fi
-        else
-            if ac_fn_c_compute_int "$LINENO" "((ssize_t)(-1)) < ((ssize_t)0)" "HTYPE_IS_SIGNED"        "
-#include <stdio.h>
-#include <stddef.h>
-
-#if HAVE_SYS_TYPES_H
-# include <sys/types.h>
-#endif
-
-#if HAVE_UNISTD_H
-# include <unistd.h>
-#endif
-
-#if HAVE_SYS_STAT_H
-# include <sys/stat.h>
-#endif
-
-#if HAVE_FCNTL_H
-# include <fcntl.h>
-#endif
-
-#if HAVE_SIGNAL_H
-# include <signal.h>
-#endif
-
-#if HAVE_TIME_H
-# include <time.h>
-#endif
-
-#if HAVE_TERMIOS_H
-# include <termios.h>
-#endif
-
-#if HAVE_STRING_H
-# include <string.h>
-#endif
-
-#if HAVE_CTYPE_H
-# include <ctype.h>
-#endif
-
-#if HAVE_INTTYPES_H
-# include <inttypes.h>
-#else
-# if HAVE_STDINT_H
-#  include <stdint.h>
-# endif
-#endif
-
-#if HAVE_SYS_RESOURCE_H
-# include <sys/resource.h>
-#endif
-
-#include <stdlib.h>
-"; then :
-
-else
-  fptools_cv_htype_sup_ssize_t=no
-fi
-
-
-            if ac_fn_c_compute_int "$LINENO" "sizeof(ssize_t) * 8" "HTYPE_SIZE"        "
-#include <stdio.h>
-#include <stddef.h>
-
-#if HAVE_SYS_TYPES_H
-# include <sys/types.h>
-#endif
-
-#if HAVE_UNISTD_H
-# include <unistd.h>
-#endif
-
-#if HAVE_SYS_STAT_H
-# include <sys/stat.h>
-#endif
-
-#if HAVE_FCNTL_H
-# include <fcntl.h>
-#endif
-
-#if HAVE_SIGNAL_H
-# include <signal.h>
-#endif
-
-#if HAVE_TIME_H
-# include <time.h>
-#endif
-
-#if HAVE_TERMIOS_H
-# include <termios.h>
-#endif
-
-#if HAVE_STRING_H
-# include <string.h>
-#endif
-
-#if HAVE_CTYPE_H
-# include <ctype.h>
-#endif
-
-#if HAVE_INTTYPES_H
-# include <inttypes.h>
-#else
-# if HAVE_STDINT_H
-#  include <stdint.h>
-# endif
-#endif
-
-#if HAVE_SYS_RESOURCE_H
-# include <sys/resource.h>
-#endif
-
-#include <stdlib.h>
-"; then :
-
-else
-  fptools_cv_htype_sup_ssize_t=no
-fi
-
-
-            if test "$HTYPE_IS_SIGNED" -eq 0
-            then
-                fptools_cv_htype_ssize_t="Word$HTYPE_SIZE"
-            else
-                fptools_cv_htype_ssize_t="Int$HTYPE_SIZE"
-            fi
-        fi
-
-fi
-
-    if test "$fptools_cv_htype_sup_ssize_t" = no
-    then
-
-        fptools_cv_htype_ssize_t=NotReallyAType
-        { $as_echo "$as_me:${as_lineno-$LINENO}: result: not supported" >&5
-$as_echo "not supported" >&6; }
-
-    fi
-
-            if test "$fptools_cv_htype_sup_ssize_t" = yes; then
-        { $as_echo "$as_me:${as_lineno-$LINENO}: result: $fptools_cv_htype_ssize_t" >&5
-$as_echo "$fptools_cv_htype_ssize_t" >&6; }
-
-cat >>confdefs.h <<_ACEOF
-#define HTYPE_SSIZE_T $fptools_cv_htype_ssize_t
-_ACEOF
-
-    fi
-
-
-
-
-
-
-
-
-
-
-    { $as_echo "$as_me:${as_lineno-$LINENO}: checking Haskell type for rlim_t" >&5
-$as_echo_n "checking Haskell type for rlim_t... " >&6; }
-    if ${fptools_cv_htype_rlim_t+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-
-        fptools_cv_htype_sup_rlim_t=yes
-        if ac_fn_c_compute_int "$LINENO" "(rlim_t)0.2 - (rlim_t)0.4 < 0 ? 0 : 1" "HTYPE_IS_INTEGRAL"        "
-#include <stdio.h>
-#include <stddef.h>
-
-#if HAVE_SYS_TYPES_H
-# include <sys/types.h>
-#endif
-
-#if HAVE_UNISTD_H
-# include <unistd.h>
-#endif
-
-#if HAVE_SYS_STAT_H
-# include <sys/stat.h>
-#endif
-
-#if HAVE_FCNTL_H
-# include <fcntl.h>
-#endif
-
-#if HAVE_SIGNAL_H
-# include <signal.h>
-#endif
-
-#if HAVE_TIME_H
-# include <time.h>
-#endif
-
-#if HAVE_TERMIOS_H
-# include <termios.h>
-#endif
-
-#if HAVE_STRING_H
-# include <string.h>
-#endif
-
-#if HAVE_CTYPE_H
-# include <ctype.h>
-#endif
-
-#if HAVE_INTTYPES_H
-# include <inttypes.h>
-#else
-# if HAVE_STDINT_H
-#  include <stdint.h>
-# endif
-#endif
-
-#if HAVE_SYS_RESOURCE_H
-# include <sys/resource.h>
-#endif
-
-#include <stdlib.h>
-"; then :
-
-else
-  HTYPE_IS_INTEGRAL=0
-fi
-
-
-
-        if test "$HTYPE_IS_INTEGRAL" -eq 0
-        then
-            if ac_fn_c_compute_int "$LINENO" "sizeof(rlim_t) == sizeof(float)" "HTYPE_IS_FLOAT"        "
-#include <stdio.h>
-#include <stddef.h>
-
-#if HAVE_SYS_TYPES_H
-# include <sys/types.h>
-#endif
-
-#if HAVE_UNISTD_H
-# include <unistd.h>
-#endif
-
-#if HAVE_SYS_STAT_H
-# include <sys/stat.h>
-#endif
-
-#if HAVE_FCNTL_H
-# include <fcntl.h>
-#endif
-
-#if HAVE_SIGNAL_H
-# include <signal.h>
-#endif
-
-#if HAVE_TIME_H
-# include <time.h>
-#endif
-
-#if HAVE_TERMIOS_H
-# include <termios.h>
-#endif
-
-#if HAVE_STRING_H
-# include <string.h>
-#endif
-
-#if HAVE_CTYPE_H
-# include <ctype.h>
-#endif
-
-#if HAVE_INTTYPES_H
-# include <inttypes.h>
-#else
-# if HAVE_STDINT_H
-#  include <stdint.h>
-# endif
-#endif
-
-#if HAVE_SYS_RESOURCE_H
-# include <sys/resource.h>
-#endif
-
-#include <stdlib.h>
-"; then :
-
-else
-  fptools_cv_htype_sup_rlim_t=no
-fi
-
-
-            if ac_fn_c_compute_int "$LINENO" "sizeof(rlim_t) == sizeof(double)" "HTYPE_IS_DOUBLE"        "
-#include <stdio.h>
-#include <stddef.h>
-
-#if HAVE_SYS_TYPES_H
-# include <sys/types.h>
-#endif
-
-#if HAVE_UNISTD_H
-# include <unistd.h>
-#endif
-
-#if HAVE_SYS_STAT_H
-# include <sys/stat.h>
-#endif
-
-#if HAVE_FCNTL_H
-# include <fcntl.h>
-#endif
-
-#if HAVE_SIGNAL_H
-# include <signal.h>
-#endif
-
-#if HAVE_TIME_H
-# include <time.h>
-#endif
-
-#if HAVE_TERMIOS_H
-# include <termios.h>
-#endif
-
-#if HAVE_STRING_H
-# include <string.h>
-#endif
-
-#if HAVE_CTYPE_H
-# include <ctype.h>
-#endif
-
-#if HAVE_INTTYPES_H
-# include <inttypes.h>
-#else
-# if HAVE_STDINT_H
-#  include <stdint.h>
-# endif
-#endif
-
-#if HAVE_SYS_RESOURCE_H
-# include <sys/resource.h>
-#endif
-
-#include <stdlib.h>
-"; then :
-
-else
-  fptools_cv_htype_sup_rlim_t=no
-fi
-
-
-            if ac_fn_c_compute_int "$LINENO" "sizeof(rlim_t) == sizeof(long double)" "HTYPE_IS_LDOUBLE"        "
-#include <stdio.h>
-#include <stddef.h>
-
-#if HAVE_SYS_TYPES_H
-# include <sys/types.h>
-#endif
-
-#if HAVE_UNISTD_H
-# include <unistd.h>
-#endif
-
-#if HAVE_SYS_STAT_H
-# include <sys/stat.h>
-#endif
-
-#if HAVE_FCNTL_H
-# include <fcntl.h>
-#endif
-
-#if HAVE_SIGNAL_H
-# include <signal.h>
-#endif
-
-#if HAVE_TIME_H
-# include <time.h>
-#endif
-
-#if HAVE_TERMIOS_H
-# include <termios.h>
-#endif
-
-#if HAVE_STRING_H
-# include <string.h>
-#endif
-
-#if HAVE_CTYPE_H
-# include <ctype.h>
-#endif
-
-#if HAVE_INTTYPES_H
-# include <inttypes.h>
-#else
-# if HAVE_STDINT_H
-#  include <stdint.h>
-# endif
-#endif
-
-#if HAVE_SYS_RESOURCE_H
-# include <sys/resource.h>
-#endif
-
-#include <stdlib.h>
-"; then :
-
-else
-  fptools_cv_htype_sup_rlim_t=no
-fi
-
-
-            if test "$HTYPE_IS_FLOAT" -eq 1
-            then
-                fptools_cv_htype_rlim_t=Float
-            elif test "$HTYPE_IS_DOUBLE" -eq 1
-            then
-                fptools_cv_htype_rlim_t=Double
-            elif test "$HTYPE_IS_LDOUBLE" -eq 1
-            then
-                fptools_cv_htype_rlim_t=LDouble
-            else
-                fptools_cv_htype_sup_rlim_t=no
-            fi
-        else
-            if ac_fn_c_compute_int "$LINENO" "((rlim_t)(-1)) < ((rlim_t)0)" "HTYPE_IS_SIGNED"        "
-#include <stdio.h>
-#include <stddef.h>
-
-#if HAVE_SYS_TYPES_H
-# include <sys/types.h>
-#endif
-
-#if HAVE_UNISTD_H
-# include <unistd.h>
-#endif
-
-#if HAVE_SYS_STAT_H
-# include <sys/stat.h>
-#endif
-
-#if HAVE_FCNTL_H
-# include <fcntl.h>
-#endif
-
-#if HAVE_SIGNAL_H
-# include <signal.h>
-#endif
-
-#if HAVE_TIME_H
-# include <time.h>
-#endif
-
-#if HAVE_TERMIOS_H
-# include <termios.h>
-#endif
-
-#if HAVE_STRING_H
-# include <string.h>
-#endif
-
-#if HAVE_CTYPE_H
-# include <ctype.h>
-#endif
-
-#if HAVE_INTTYPES_H
-# include <inttypes.h>
-#else
-# if HAVE_STDINT_H
-#  include <stdint.h>
-# endif
-#endif
-
-#if HAVE_SYS_RESOURCE_H
-# include <sys/resource.h>
-#endif
-
-#include <stdlib.h>
-"; then :
-
-else
-  fptools_cv_htype_sup_rlim_t=no
-fi
-
-
-            if ac_fn_c_compute_int "$LINENO" "sizeof(rlim_t) * 8" "HTYPE_SIZE"        "
-#include <stdio.h>
-#include <stddef.h>
-
-#if HAVE_SYS_TYPES_H
-# include <sys/types.h>
-#endif
-
-#if HAVE_UNISTD_H
-# include <unistd.h>
-#endif
-
-#if HAVE_SYS_STAT_H
-# include <sys/stat.h>
-#endif
-
-#if HAVE_FCNTL_H
-# include <fcntl.h>
-#endif
-
-#if HAVE_SIGNAL_H
-# include <signal.h>
-#endif
-
-#if HAVE_TIME_H
-# include <time.h>
-#endif
-
-#if HAVE_TERMIOS_H
-# include <termios.h>
-#endif
-
-#if HAVE_STRING_H
-# include <string.h>
-#endif
-
-#if HAVE_CTYPE_H
-# include <ctype.h>
-#endif
-
-#if HAVE_INTTYPES_H
-# include <inttypes.h>
-#else
-# if HAVE_STDINT_H
-#  include <stdint.h>
-# endif
-#endif
-
-#if HAVE_SYS_RESOURCE_H
-# include <sys/resource.h>
-#endif
-
-#include <stdlib.h>
-"; then :
-
-else
-  fptools_cv_htype_sup_rlim_t=no
-fi
-
-
-            if test "$HTYPE_IS_SIGNED" -eq 0
-            then
-                fptools_cv_htype_rlim_t="Word$HTYPE_SIZE"
-            else
-                fptools_cv_htype_rlim_t="Int$HTYPE_SIZE"
-            fi
-        fi
-
-fi
-
-    if test "$fptools_cv_htype_sup_rlim_t" = no
-    then
-
-        fptools_cv_htype_rlim_t=NotReallyAType
-        { $as_echo "$as_me:${as_lineno-$LINENO}: result: not supported" >&5
-$as_echo "not supported" >&6; }
-
-    fi
-
-            if test "$fptools_cv_htype_sup_rlim_t" = yes; then
-        { $as_echo "$as_me:${as_lineno-$LINENO}: result: $fptools_cv_htype_rlim_t" >&5
-$as_echo "$fptools_cv_htype_rlim_t" >&6; }
-
-cat >>confdefs.h <<_ACEOF
-#define HTYPE_RLIM_T $fptools_cv_htype_rlim_t
-_ACEOF
-
-    fi
-
-
-
-
-
-
-
-
-
-
-
-    { $as_echo "$as_me:${as_lineno-$LINENO}: checking Haskell type for intptr_t" >&5
-$as_echo_n "checking Haskell type for intptr_t... " >&6; }
-    if ${fptools_cv_htype_intptr_t+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-
-        fptools_cv_htype_sup_intptr_t=yes
-        if ac_fn_c_compute_int "$LINENO" "(intptr_t)0.2 - (intptr_t)0.4 < 0 ? 0 : 1" "HTYPE_IS_INTEGRAL"        "
-#include <stdio.h>
-#include <stddef.h>
-
-#if HAVE_SYS_TYPES_H
-# include <sys/types.h>
-#endif
-
-#if HAVE_UNISTD_H
-# include <unistd.h>
-#endif
-
-#if HAVE_SYS_STAT_H
-# include <sys/stat.h>
-#endif
-
-#if HAVE_FCNTL_H
-# include <fcntl.h>
-#endif
-
-#if HAVE_SIGNAL_H
-# include <signal.h>
-#endif
-
-#if HAVE_TIME_H
-# include <time.h>
-#endif
-
-#if HAVE_TERMIOS_H
-# include <termios.h>
-#endif
-
-#if HAVE_STRING_H
-# include <string.h>
-#endif
-
-#if HAVE_CTYPE_H
-# include <ctype.h>
-#endif
-
-#if HAVE_INTTYPES_H
-# include <inttypes.h>
-#else
-# if HAVE_STDINT_H
-#  include <stdint.h>
-# endif
-#endif
-
-#if HAVE_SYS_RESOURCE_H
-# include <sys/resource.h>
-#endif
-
-#include <stdlib.h>
-"; then :
-
-else
-  HTYPE_IS_INTEGRAL=0
-fi
-
-
-
-        if test "$HTYPE_IS_INTEGRAL" -eq 0
-        then
-            if ac_fn_c_compute_int "$LINENO" "sizeof(intptr_t) == sizeof(float)" "HTYPE_IS_FLOAT"        "
-#include <stdio.h>
-#include <stddef.h>
-
-#if HAVE_SYS_TYPES_H
-# include <sys/types.h>
-#endif
-
-#if HAVE_UNISTD_H
-# include <unistd.h>
-#endif
-
-#if HAVE_SYS_STAT_H
-# include <sys/stat.h>
-#endif
-
-#if HAVE_FCNTL_H
-# include <fcntl.h>
-#endif
-
-#if HAVE_SIGNAL_H
-# include <signal.h>
-#endif
-
-#if HAVE_TIME_H
-# include <time.h>
-#endif
-
-#if HAVE_TERMIOS_H
-# include <termios.h>
-#endif
-
-#if HAVE_STRING_H
-# include <string.h>
-#endif
-
-#if HAVE_CTYPE_H
-# include <ctype.h>
-#endif
-
-#if HAVE_INTTYPES_H
-# include <inttypes.h>
-#else
-# if HAVE_STDINT_H
-#  include <stdint.h>
-# endif
-#endif
-
-#if HAVE_SYS_RESOURCE_H
-# include <sys/resource.h>
-#endif
-
-#include <stdlib.h>
-"; then :
-
-else
-  fptools_cv_htype_sup_intptr_t=no
-fi
-
-
-            if ac_fn_c_compute_int "$LINENO" "sizeof(intptr_t) == sizeof(double)" "HTYPE_IS_DOUBLE"        "
-#include <stdio.h>
-#include <stddef.h>
-
-#if HAVE_SYS_TYPES_H
-# include <sys/types.h>
-#endif
-
-#if HAVE_UNISTD_H
-# include <unistd.h>
-#endif
-
-#if HAVE_SYS_STAT_H
-# include <sys/stat.h>
-#endif
-
-#if HAVE_FCNTL_H
-# include <fcntl.h>
-#endif
-
-#if HAVE_SIGNAL_H
-# include <signal.h>
-#endif
-
-#if HAVE_TIME_H
-# include <time.h>
-#endif
-
-#if HAVE_TERMIOS_H
-# include <termios.h>
-#endif
-
-#if HAVE_STRING_H
-# include <string.h>
-#endif
-
-#if HAVE_CTYPE_H
-# include <ctype.h>
-#endif
-
-#if HAVE_INTTYPES_H
-# include <inttypes.h>
-#else
-# if HAVE_STDINT_H
-#  include <stdint.h>
-# endif
-#endif
-
-#if HAVE_SYS_RESOURCE_H
-# include <sys/resource.h>
-#endif
-
-#include <stdlib.h>
-"; then :
-
-else
-  fptools_cv_htype_sup_intptr_t=no
-fi
-
-
-            if ac_fn_c_compute_int "$LINENO" "sizeof(intptr_t) == sizeof(long double)" "HTYPE_IS_LDOUBLE"        "
-#include <stdio.h>
-#include <stddef.h>
-
-#if HAVE_SYS_TYPES_H
-# include <sys/types.h>
-#endif
-
-#if HAVE_UNISTD_H
-# include <unistd.h>
-#endif
-
-#if HAVE_SYS_STAT_H
-# include <sys/stat.h>
-#endif
-
-#if HAVE_FCNTL_H
-# include <fcntl.h>
-#endif
-
-#if HAVE_SIGNAL_H
-# include <signal.h>
-#endif
-
-#if HAVE_TIME_H
-# include <time.h>
-#endif
-
-#if HAVE_TERMIOS_H
-# include <termios.h>
-#endif
-
-#if HAVE_STRING_H
-# include <string.h>
-#endif
-
-#if HAVE_CTYPE_H
-# include <ctype.h>
-#endif
-
-#if HAVE_INTTYPES_H
-# include <inttypes.h>
-#else
-# if HAVE_STDINT_H
-#  include <stdint.h>
-# endif
-#endif
-
-#if HAVE_SYS_RESOURCE_H
-# include <sys/resource.h>
-#endif
-
-#include <stdlib.h>
-"; then :
-
-else
-  fptools_cv_htype_sup_intptr_t=no
-fi
-
-
-            if test "$HTYPE_IS_FLOAT" -eq 1
-            then
-                fptools_cv_htype_intptr_t=Float
-            elif test "$HTYPE_IS_DOUBLE" -eq 1
-            then
-                fptools_cv_htype_intptr_t=Double
-            elif test "$HTYPE_IS_LDOUBLE" -eq 1
-            then
-                fptools_cv_htype_intptr_t=LDouble
-            else
-                fptools_cv_htype_sup_intptr_t=no
-            fi
-        else
-            if ac_fn_c_compute_int "$LINENO" "((intptr_t)(-1)) < ((intptr_t)0)" "HTYPE_IS_SIGNED"        "
-#include <stdio.h>
-#include <stddef.h>
-
-#if HAVE_SYS_TYPES_H
-# include <sys/types.h>
-#endif
-
-#if HAVE_UNISTD_H
-# include <unistd.h>
-#endif
-
-#if HAVE_SYS_STAT_H
-# include <sys/stat.h>
-#endif
-
-#if HAVE_FCNTL_H
-# include <fcntl.h>
-#endif
-
-#if HAVE_SIGNAL_H
-# include <signal.h>
-#endif
-
-#if HAVE_TIME_H
-# include <time.h>
-#endif
-
-#if HAVE_TERMIOS_H
-# include <termios.h>
-#endif
-
-#if HAVE_STRING_H
-# include <string.h>
-#endif
-
-#if HAVE_CTYPE_H
-# include <ctype.h>
-#endif
-
-#if HAVE_INTTYPES_H
-# include <inttypes.h>
-#else
-# if HAVE_STDINT_H
-#  include <stdint.h>
-# endif
-#endif
-
-#if HAVE_SYS_RESOURCE_H
-# include <sys/resource.h>
-#endif
-
-#include <stdlib.h>
-"; then :
-
-else
-  fptools_cv_htype_sup_intptr_t=no
-fi
-
-
-            if ac_fn_c_compute_int "$LINENO" "sizeof(intptr_t) * 8" "HTYPE_SIZE"        "
-#include <stdio.h>
-#include <stddef.h>
-
-#if HAVE_SYS_TYPES_H
-# include <sys/types.h>
-#endif
-
-#if HAVE_UNISTD_H
-# include <unistd.h>
-#endif
-
-#if HAVE_SYS_STAT_H
-# include <sys/stat.h>
-#endif
-
-#if HAVE_FCNTL_H
-# include <fcntl.h>
-#endif
-
-#if HAVE_SIGNAL_H
-# include <signal.h>
-#endif
-
-#if HAVE_TIME_H
-# include <time.h>
-#endif
-
-#if HAVE_TERMIOS_H
-# include <termios.h>
-#endif
-
-#if HAVE_STRING_H
-# include <string.h>
-#endif
-
-#if HAVE_CTYPE_H
-# include <ctype.h>
-#endif
-
-#if HAVE_INTTYPES_H
-# include <inttypes.h>
-#else
-# if HAVE_STDINT_H
-#  include <stdint.h>
-# endif
-#endif
-
-#if HAVE_SYS_RESOURCE_H
-# include <sys/resource.h>
-#endif
-
-#include <stdlib.h>
-"; then :
-
-else
-  fptools_cv_htype_sup_intptr_t=no
-fi
-
-
-            if test "$HTYPE_IS_SIGNED" -eq 0
-            then
-                fptools_cv_htype_intptr_t="Word$HTYPE_SIZE"
-            else
-                fptools_cv_htype_intptr_t="Int$HTYPE_SIZE"
-            fi
-        fi
-
-fi
-
-    if test "$fptools_cv_htype_sup_intptr_t" = no
-    then
-
-        fptools_cv_htype_intptr_t=NotReallyAType
-        { $as_echo "$as_me:${as_lineno-$LINENO}: result: not supported" >&5
-$as_echo "not supported" >&6; }
-
-    fi
-
-            if test "$fptools_cv_htype_sup_intptr_t" = yes; then
-        { $as_echo "$as_me:${as_lineno-$LINENO}: result: $fptools_cv_htype_intptr_t" >&5
-$as_echo "$fptools_cv_htype_intptr_t" >&6; }
-
-cat >>confdefs.h <<_ACEOF
-#define HTYPE_INTPTR_T $fptools_cv_htype_intptr_t
-_ACEOF
-
-    fi
-
-
-
-
-
-
-
-
-
-
-    { $as_echo "$as_me:${as_lineno-$LINENO}: checking Haskell type for uintptr_t" >&5
-$as_echo_n "checking Haskell type for uintptr_t... " >&6; }
-    if ${fptools_cv_htype_uintptr_t+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-
-        fptools_cv_htype_sup_uintptr_t=yes
-        if ac_fn_c_compute_int "$LINENO" "(uintptr_t)0.2 - (uintptr_t)0.4 < 0 ? 0 : 1" "HTYPE_IS_INTEGRAL"        "
-#include <stdio.h>
-#include <stddef.h>
-
-#if HAVE_SYS_TYPES_H
-# include <sys/types.h>
-#endif
-
-#if HAVE_UNISTD_H
-# include <unistd.h>
-#endif
-
-#if HAVE_SYS_STAT_H
-# include <sys/stat.h>
-#endif
-
-#if HAVE_FCNTL_H
-# include <fcntl.h>
-#endif
-
-#if HAVE_SIGNAL_H
-# include <signal.h>
-#endif
-
-#if HAVE_TIME_H
-# include <time.h>
-#endif
-
-#if HAVE_TERMIOS_H
-# include <termios.h>
-#endif
-
-#if HAVE_STRING_H
-# include <string.h>
-#endif
-
-#if HAVE_CTYPE_H
-# include <ctype.h>
-#endif
-
-#if HAVE_INTTYPES_H
-# include <inttypes.h>
-#else
-# if HAVE_STDINT_H
-#  include <stdint.h>
-# endif
-#endif
-
-#if HAVE_SYS_RESOURCE_H
-# include <sys/resource.h>
-#endif
-
-#include <stdlib.h>
-"; then :
-
-else
-  HTYPE_IS_INTEGRAL=0
-fi
-
-
-
-        if test "$HTYPE_IS_INTEGRAL" -eq 0
-        then
-            if ac_fn_c_compute_int "$LINENO" "sizeof(uintptr_t) == sizeof(float)" "HTYPE_IS_FLOAT"        "
-#include <stdio.h>
-#include <stddef.h>
-
-#if HAVE_SYS_TYPES_H
-# include <sys/types.h>
-#endif
-
-#if HAVE_UNISTD_H
-# include <unistd.h>
-#endif
-
-#if HAVE_SYS_STAT_H
-# include <sys/stat.h>
-#endif
-
-#if HAVE_FCNTL_H
-# include <fcntl.h>
-#endif
-
-#if HAVE_SIGNAL_H
-# include <signal.h>
-#endif
-
-#if HAVE_TIME_H
-# include <time.h>
-#endif
-
-#if HAVE_TERMIOS_H
-# include <termios.h>
-#endif
-
-#if HAVE_STRING_H
-# include <string.h>
-#endif
-
-#if HAVE_CTYPE_H
-# include <ctype.h>
-#endif
-
-#if HAVE_INTTYPES_H
-# include <inttypes.h>
-#else
-# if HAVE_STDINT_H
-#  include <stdint.h>
-# endif
-#endif
-
-#if HAVE_SYS_RESOURCE_H
-# include <sys/resource.h>
-#endif
-
-#include <stdlib.h>
-"; then :
-
-else
-  fptools_cv_htype_sup_uintptr_t=no
-fi
-
-
-            if ac_fn_c_compute_int "$LINENO" "sizeof(uintptr_t) == sizeof(double)" "HTYPE_IS_DOUBLE"        "
-#include <stdio.h>
-#include <stddef.h>
-
-#if HAVE_SYS_TYPES_H
-# include <sys/types.h>
-#endif
-
-#if HAVE_UNISTD_H
-# include <unistd.h>
-#endif
-
-#if HAVE_SYS_STAT_H
-# include <sys/stat.h>
-#endif
-
-#if HAVE_FCNTL_H
-# include <fcntl.h>
-#endif
-
-#if HAVE_SIGNAL_H
-# include <signal.h>
-#endif
-
-#if HAVE_TIME_H
-# include <time.h>
-#endif
-
-#if HAVE_TERMIOS_H
-# include <termios.h>
-#endif
-
-#if HAVE_STRING_H
-# include <string.h>
-#endif
-
-#if HAVE_CTYPE_H
-# include <ctype.h>
-#endif
-
-#if HAVE_INTTYPES_H
-# include <inttypes.h>
-#else
-# if HAVE_STDINT_H
-#  include <stdint.h>
-# endif
-#endif
-
-#if HAVE_SYS_RESOURCE_H
-# include <sys/resource.h>
-#endif
-
-#include <stdlib.h>
-"; then :
-
-else
-  fptools_cv_htype_sup_uintptr_t=no
-fi
-
-
-            if ac_fn_c_compute_int "$LINENO" "sizeof(uintptr_t) == sizeof(long double)" "HTYPE_IS_LDOUBLE"        "
-#include <stdio.h>
-#include <stddef.h>
-
-#if HAVE_SYS_TYPES_H
-# include <sys/types.h>
-#endif
-
-#if HAVE_UNISTD_H
-# include <unistd.h>
-#endif
-
-#if HAVE_SYS_STAT_H
-# include <sys/stat.h>
-#endif
-
-#if HAVE_FCNTL_H
-# include <fcntl.h>
-#endif
-
-#if HAVE_SIGNAL_H
-# include <signal.h>
-#endif
-
-#if HAVE_TIME_H
-# include <time.h>
-#endif
-
-#if HAVE_TERMIOS_H
-# include <termios.h>
-#endif
-
-#if HAVE_STRING_H
-# include <string.h>
-#endif
-
-#if HAVE_CTYPE_H
-# include <ctype.h>
-#endif
-
-#if HAVE_INTTYPES_H
-# include <inttypes.h>
-#else
-# if HAVE_STDINT_H
-#  include <stdint.h>
-# endif
-#endif
-
-#if HAVE_SYS_RESOURCE_H
-# include <sys/resource.h>
-#endif
-
-#include <stdlib.h>
-"; then :
-
-else
-  fptools_cv_htype_sup_uintptr_t=no
-fi
-
-
-            if test "$HTYPE_IS_FLOAT" -eq 1
-            then
-                fptools_cv_htype_uintptr_t=Float
-            elif test "$HTYPE_IS_DOUBLE" -eq 1
-            then
-                fptools_cv_htype_uintptr_t=Double
-            elif test "$HTYPE_IS_LDOUBLE" -eq 1
-            then
-                fptools_cv_htype_uintptr_t=LDouble
-            else
-                fptools_cv_htype_sup_uintptr_t=no
-            fi
-        else
-            if ac_fn_c_compute_int "$LINENO" "((uintptr_t)(-1)) < ((uintptr_t)0)" "HTYPE_IS_SIGNED"        "
-#include <stdio.h>
-#include <stddef.h>
-
-#if HAVE_SYS_TYPES_H
-# include <sys/types.h>
-#endif
-
-#if HAVE_UNISTD_H
-# include <unistd.h>
-#endif
-
-#if HAVE_SYS_STAT_H
-# include <sys/stat.h>
-#endif
-
-#if HAVE_FCNTL_H
-# include <fcntl.h>
-#endif
-
-#if HAVE_SIGNAL_H
-# include <signal.h>
-#endif
-
-#if HAVE_TIME_H
-# include <time.h>
-#endif
-
-#if HAVE_TERMIOS_H
-# include <termios.h>
-#endif
-
-#if HAVE_STRING_H
-# include <string.h>
-#endif
-
-#if HAVE_CTYPE_H
-# include <ctype.h>
-#endif
-
-#if HAVE_INTTYPES_H
-# include <inttypes.h>
-#else
-# if HAVE_STDINT_H
-#  include <stdint.h>
-# endif
-#endif
-
-#if HAVE_SYS_RESOURCE_H
-# include <sys/resource.h>
-#endif
-
-#include <stdlib.h>
-"; then :
-
-else
-  fptools_cv_htype_sup_uintptr_t=no
-fi
-
-
-            if ac_fn_c_compute_int "$LINENO" "sizeof(uintptr_t) * 8" "HTYPE_SIZE"        "
-#include <stdio.h>
-#include <stddef.h>
-
-#if HAVE_SYS_TYPES_H
-# include <sys/types.h>
-#endif
-
-#if HAVE_UNISTD_H
-# include <unistd.h>
-#endif
-
-#if HAVE_SYS_STAT_H
-# include <sys/stat.h>
-#endif
-
-#if HAVE_FCNTL_H
-# include <fcntl.h>
-#endif
-
-#if HAVE_SIGNAL_H
-# include <signal.h>
-#endif
-
-#if HAVE_TIME_H
-# include <time.h>
-#endif
-
-#if HAVE_TERMIOS_H
-# include <termios.h>
-#endif
-
-#if HAVE_STRING_H
-# include <string.h>
-#endif
-
-#if HAVE_CTYPE_H
-# include <ctype.h>
-#endif
-
-#if HAVE_INTTYPES_H
-# include <inttypes.h>
-#else
-# if HAVE_STDINT_H
-#  include <stdint.h>
-# endif
-#endif
-
-#if HAVE_SYS_RESOURCE_H
-# include <sys/resource.h>
-#endif
-
-#include <stdlib.h>
-"; then :
-
-else
-  fptools_cv_htype_sup_uintptr_t=no
-fi
-
-
-            if test "$HTYPE_IS_SIGNED" -eq 0
-            then
-                fptools_cv_htype_uintptr_t="Word$HTYPE_SIZE"
-            else
-                fptools_cv_htype_uintptr_t="Int$HTYPE_SIZE"
-            fi
-        fi
-
-fi
-
-    if test "$fptools_cv_htype_sup_uintptr_t" = no
-    then
-
-        fptools_cv_htype_uintptr_t=NotReallyAType
-        { $as_echo "$as_me:${as_lineno-$LINENO}: result: not supported" >&5
-$as_echo "not supported" >&6; }
-
-    fi
-
-            if test "$fptools_cv_htype_sup_uintptr_t" = yes; then
-        { $as_echo "$as_me:${as_lineno-$LINENO}: result: $fptools_cv_htype_uintptr_t" >&5
-$as_echo "$fptools_cv_htype_uintptr_t" >&6; }
-
-cat >>confdefs.h <<_ACEOF
-#define HTYPE_UINTPTR_T $fptools_cv_htype_uintptr_t
-_ACEOF
-
-    fi
-
-
-
-
-
-
-
-
-
-
-    { $as_echo "$as_me:${as_lineno-$LINENO}: checking Haskell type for intmax_t" >&5
-$as_echo_n "checking Haskell type for intmax_t... " >&6; }
-    if ${fptools_cv_htype_intmax_t+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-
-        fptools_cv_htype_sup_intmax_t=yes
-        if ac_fn_c_compute_int "$LINENO" "(intmax_t)0.2 - (intmax_t)0.4 < 0 ? 0 : 1" "HTYPE_IS_INTEGRAL"        "
-#include <stdio.h>
-#include <stddef.h>
-
-#if HAVE_SYS_TYPES_H
-# include <sys/types.h>
-#endif
-
-#if HAVE_UNISTD_H
-# include <unistd.h>
-#endif
-
-#if HAVE_SYS_STAT_H
-# include <sys/stat.h>
-#endif
-
-#if HAVE_FCNTL_H
-# include <fcntl.h>
-#endif
-
-#if HAVE_SIGNAL_H
-# include <signal.h>
-#endif
-
-#if HAVE_TIME_H
-# include <time.h>
-#endif
-
-#if HAVE_TERMIOS_H
-# include <termios.h>
-#endif
-
-#if HAVE_STRING_H
-# include <string.h>
-#endif
-
-#if HAVE_CTYPE_H
-# include <ctype.h>
-#endif
-
-#if HAVE_INTTYPES_H
-# include <inttypes.h>
-#else
-# if HAVE_STDINT_H
-#  include <stdint.h>
-# endif
-#endif
-
-#if HAVE_SYS_RESOURCE_H
-# include <sys/resource.h>
-#endif
-
-#include <stdlib.h>
-"; then :
-
-else
-  HTYPE_IS_INTEGRAL=0
-fi
-
-
-
-        if test "$HTYPE_IS_INTEGRAL" -eq 0
-        then
-            if ac_fn_c_compute_int "$LINENO" "sizeof(intmax_t) == sizeof(float)" "HTYPE_IS_FLOAT"        "
-#include <stdio.h>
-#include <stddef.h>
-
-#if HAVE_SYS_TYPES_H
-# include <sys/types.h>
-#endif
-
-#if HAVE_UNISTD_H
-# include <unistd.h>
-#endif
-
-#if HAVE_SYS_STAT_H
-# include <sys/stat.h>
-#endif
-
-#if HAVE_FCNTL_H
-# include <fcntl.h>
-#endif
-
-#if HAVE_SIGNAL_H
-# include <signal.h>
-#endif
-
-#if HAVE_TIME_H
-# include <time.h>
-#endif
-
-#if HAVE_TERMIOS_H
-# include <termios.h>
-#endif
-
-#if HAVE_STRING_H
-# include <string.h>
-#endif
-
-#if HAVE_CTYPE_H
-# include <ctype.h>
-#endif
-
-#if HAVE_INTTYPES_H
-# include <inttypes.h>
-#else
-# if HAVE_STDINT_H
-#  include <stdint.h>
-# endif
-#endif
-
-#if HAVE_SYS_RESOURCE_H
-# include <sys/resource.h>
-#endif
-
-#include <stdlib.h>
-"; then :
-
-else
-  fptools_cv_htype_sup_intmax_t=no
-fi
-
-
-            if ac_fn_c_compute_int "$LINENO" "sizeof(intmax_t) == sizeof(double)" "HTYPE_IS_DOUBLE"        "
-#include <stdio.h>
-#include <stddef.h>
-
-#if HAVE_SYS_TYPES_H
-# include <sys/types.h>
-#endif
-
-#if HAVE_UNISTD_H
-# include <unistd.h>
-#endif
-
-#if HAVE_SYS_STAT_H
-# include <sys/stat.h>
-#endif
-
-#if HAVE_FCNTL_H
-# include <fcntl.h>
-#endif
-
-#if HAVE_SIGNAL_H
-# include <signal.h>
-#endif
-
-#if HAVE_TIME_H
-# include <time.h>
-#endif
-
-#if HAVE_TERMIOS_H
-# include <termios.h>
-#endif
-
-#if HAVE_STRING_H
-# include <string.h>
-#endif
-
-#if HAVE_CTYPE_H
-# include <ctype.h>
-#endif
-
-#if HAVE_INTTYPES_H
-# include <inttypes.h>
-#else
-# if HAVE_STDINT_H
-#  include <stdint.h>
-# endif
-#endif
-
-#if HAVE_SYS_RESOURCE_H
-# include <sys/resource.h>
-#endif
-
-#include <stdlib.h>
-"; then :
-
-else
-  fptools_cv_htype_sup_intmax_t=no
-fi
-
-
-            if ac_fn_c_compute_int "$LINENO" "sizeof(intmax_t) == sizeof(long double)" "HTYPE_IS_LDOUBLE"        "
-#include <stdio.h>
-#include <stddef.h>
-
-#if HAVE_SYS_TYPES_H
-# include <sys/types.h>
-#endif
-
-#if HAVE_UNISTD_H
-# include <unistd.h>
-#endif
-
-#if HAVE_SYS_STAT_H
-# include <sys/stat.h>
-#endif
-
-#if HAVE_FCNTL_H
-# include <fcntl.h>
-#endif
-
-#if HAVE_SIGNAL_H
-# include <signal.h>
-#endif
-
-#if HAVE_TIME_H
-# include <time.h>
-#endif
-
-#if HAVE_TERMIOS_H
-# include <termios.h>
-#endif
-
-#if HAVE_STRING_H
-# include <string.h>
-#endif
-
-#if HAVE_CTYPE_H
-# include <ctype.h>
-#endif
-
-#if HAVE_INTTYPES_H
-# include <inttypes.h>
-#else
-# if HAVE_STDINT_H
-#  include <stdint.h>
-# endif
-#endif
-
-#if HAVE_SYS_RESOURCE_H
-# include <sys/resource.h>
-#endif
-
-#include <stdlib.h>
-"; then :
-
-else
-  fptools_cv_htype_sup_intmax_t=no
-fi
-
-
-            if test "$HTYPE_IS_FLOAT" -eq 1
-            then
-                fptools_cv_htype_intmax_t=Float
-            elif test "$HTYPE_IS_DOUBLE" -eq 1
-            then
-                fptools_cv_htype_intmax_t=Double
-            elif test "$HTYPE_IS_LDOUBLE" -eq 1
-            then
-                fptools_cv_htype_intmax_t=LDouble
-            else
-                fptools_cv_htype_sup_intmax_t=no
-            fi
-        else
-            if ac_fn_c_compute_int "$LINENO" "((intmax_t)(-1)) < ((intmax_t)0)" "HTYPE_IS_SIGNED"        "
-#include <stdio.h>
-#include <stddef.h>
-
-#if HAVE_SYS_TYPES_H
-# include <sys/types.h>
-#endif
-
-#if HAVE_UNISTD_H
-# include <unistd.h>
-#endif
-
-#if HAVE_SYS_STAT_H
-# include <sys/stat.h>
-#endif
-
-#if HAVE_FCNTL_H
-# include <fcntl.h>
-#endif
-
-#if HAVE_SIGNAL_H
-# include <signal.h>
-#endif
-
-#if HAVE_TIME_H
-# include <time.h>
-#endif
-
-#if HAVE_TERMIOS_H
-# include <termios.h>
-#endif
-
-#if HAVE_STRING_H
-# include <string.h>
-#endif
-
-#if HAVE_CTYPE_H
-# include <ctype.h>
-#endif
-
-#if HAVE_INTTYPES_H
-# include <inttypes.h>
-#else
-# if HAVE_STDINT_H
-#  include <stdint.h>
-# endif
-#endif
-
-#if HAVE_SYS_RESOURCE_H
-# include <sys/resource.h>
-#endif
-
-#include <stdlib.h>
-"; then :
-
-else
-  fptools_cv_htype_sup_intmax_t=no
-fi
-
-
-            if ac_fn_c_compute_int "$LINENO" "sizeof(intmax_t) * 8" "HTYPE_SIZE"        "
-#include <stdio.h>
-#include <stddef.h>
-
-#if HAVE_SYS_TYPES_H
-# include <sys/types.h>
-#endif
-
-#if HAVE_UNISTD_H
-# include <unistd.h>
-#endif
-
-#if HAVE_SYS_STAT_H
-# include <sys/stat.h>
-#endif
-
-#if HAVE_FCNTL_H
-# include <fcntl.h>
-#endif
-
-#if HAVE_SIGNAL_H
-# include <signal.h>
-#endif
-
-#if HAVE_TIME_H
-# include <time.h>
-#endif
-
-#if HAVE_TERMIOS_H
-# include <termios.h>
-#endif
-
-#if HAVE_STRING_H
-# include <string.h>
-#endif
-
-#if HAVE_CTYPE_H
-# include <ctype.h>
-#endif
-
-#if HAVE_INTTYPES_H
-# include <inttypes.h>
-#else
-# if HAVE_STDINT_H
-#  include <stdint.h>
-# endif
-#endif
-
-#if HAVE_SYS_RESOURCE_H
-# include <sys/resource.h>
-#endif
-
-#include <stdlib.h>
-"; then :
-
-else
-  fptools_cv_htype_sup_intmax_t=no
-fi
-
-
-            if test "$HTYPE_IS_SIGNED" -eq 0
-            then
-                fptools_cv_htype_intmax_t="Word$HTYPE_SIZE"
-            else
-                fptools_cv_htype_intmax_t="Int$HTYPE_SIZE"
-            fi
-        fi
-
-fi
-
-    if test "$fptools_cv_htype_sup_intmax_t" = no
-    then
-
-        fptools_cv_htype_intmax_t=NotReallyAType
-        { $as_echo "$as_me:${as_lineno-$LINENO}: result: not supported" >&5
-$as_echo "not supported" >&6; }
-
-    fi
-
-            if test "$fptools_cv_htype_sup_intmax_t" = yes; then
-        { $as_echo "$as_me:${as_lineno-$LINENO}: result: $fptools_cv_htype_intmax_t" >&5
-$as_echo "$fptools_cv_htype_intmax_t" >&6; }
-
-cat >>confdefs.h <<_ACEOF
-#define HTYPE_INTMAX_T $fptools_cv_htype_intmax_t
-_ACEOF
-
-    fi
-
-
-
-
-
-
-
-
-
-
-    { $as_echo "$as_me:${as_lineno-$LINENO}: checking Haskell type for uintmax_t" >&5
-$as_echo_n "checking Haskell type for uintmax_t... " >&6; }
-    if ${fptools_cv_htype_uintmax_t+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-
-        fptools_cv_htype_sup_uintmax_t=yes
-        if ac_fn_c_compute_int "$LINENO" "(uintmax_t)0.2 - (uintmax_t)0.4 < 0 ? 0 : 1" "HTYPE_IS_INTEGRAL"        "
-#include <stdio.h>
-#include <stddef.h>
-
-#if HAVE_SYS_TYPES_H
-# include <sys/types.h>
-#endif
-
-#if HAVE_UNISTD_H
-# include <unistd.h>
-#endif
-
-#if HAVE_SYS_STAT_H
-# include <sys/stat.h>
-#endif
-
-#if HAVE_FCNTL_H
-# include <fcntl.h>
-#endif
-
-#if HAVE_SIGNAL_H
-# include <signal.h>
-#endif
-
-#if HAVE_TIME_H
-# include <time.h>
-#endif
-
-#if HAVE_TERMIOS_H
-# include <termios.h>
-#endif
-
-#if HAVE_STRING_H
-# include <string.h>
-#endif
-
-#if HAVE_CTYPE_H
-# include <ctype.h>
-#endif
-
-#if HAVE_INTTYPES_H
-# include <inttypes.h>
-#else
-# if HAVE_STDINT_H
-#  include <stdint.h>
-# endif
-#endif
-
-#if HAVE_SYS_RESOURCE_H
-# include <sys/resource.h>
-#endif
-
-#include <stdlib.h>
-"; then :
-
-else
-  HTYPE_IS_INTEGRAL=0
-fi
-
-
-
-        if test "$HTYPE_IS_INTEGRAL" -eq 0
-        then
-            if ac_fn_c_compute_int "$LINENO" "sizeof(uintmax_t) == sizeof(float)" "HTYPE_IS_FLOAT"        "
-#include <stdio.h>
-#include <stddef.h>
-
-#if HAVE_SYS_TYPES_H
-# include <sys/types.h>
-#endif
-
-#if HAVE_UNISTD_H
-# include <unistd.h>
-#endif
-
-#if HAVE_SYS_STAT_H
-# include <sys/stat.h>
-#endif
-
-#if HAVE_FCNTL_H
-# include <fcntl.h>
-#endif
-
-#if HAVE_SIGNAL_H
-# include <signal.h>
-#endif
-
-#if HAVE_TIME_H
-# include <time.h>
-#endif
-
-#if HAVE_TERMIOS_H
-# include <termios.h>
-#endif
-
-#if HAVE_STRING_H
-# include <string.h>
-#endif
-
-#if HAVE_CTYPE_H
-# include <ctype.h>
-#endif
-
-#if HAVE_INTTYPES_H
-# include <inttypes.h>
-#else
-# if HAVE_STDINT_H
-#  include <stdint.h>
-# endif
-#endif
-
-#if HAVE_SYS_RESOURCE_H
-# include <sys/resource.h>
-#endif
-
-#include <stdlib.h>
-"; then :
-
-else
-  fptools_cv_htype_sup_uintmax_t=no
-fi
-
-
-            if ac_fn_c_compute_int "$LINENO" "sizeof(uintmax_t) == sizeof(double)" "HTYPE_IS_DOUBLE"        "
-#include <stdio.h>
-#include <stddef.h>
-
-#if HAVE_SYS_TYPES_H
-# include <sys/types.h>
-#endif
-
-#if HAVE_UNISTD_H
-# include <unistd.h>
-#endif
-
-#if HAVE_SYS_STAT_H
-# include <sys/stat.h>
-#endif
-
-#if HAVE_FCNTL_H
-# include <fcntl.h>
-#endif
-
-#if HAVE_SIGNAL_H
-# include <signal.h>
-#endif
-
-#if HAVE_TIME_H
-# include <time.h>
-#endif
-
-#if HAVE_TERMIOS_H
-# include <termios.h>
-#endif
-
-#if HAVE_STRING_H
-# include <string.h>
-#endif
-
-#if HAVE_CTYPE_H
-# include <ctype.h>
-#endif
-
-#if HAVE_INTTYPES_H
-# include <inttypes.h>
-#else
-# if HAVE_STDINT_H
-#  include <stdint.h>
-# endif
-#endif
-
-#if HAVE_SYS_RESOURCE_H
-# include <sys/resource.h>
-#endif
-
-#include <stdlib.h>
-"; then :
-
-else
-  fptools_cv_htype_sup_uintmax_t=no
-fi
-
-
-            if ac_fn_c_compute_int "$LINENO" "sizeof(uintmax_t) == sizeof(long double)" "HTYPE_IS_LDOUBLE"        "
-#include <stdio.h>
-#include <stddef.h>
-
-#if HAVE_SYS_TYPES_H
-# include <sys/types.h>
-#endif
-
-#if HAVE_UNISTD_H
-# include <unistd.h>
-#endif
-
-#if HAVE_SYS_STAT_H
-# include <sys/stat.h>
-#endif
-
-#if HAVE_FCNTL_H
-# include <fcntl.h>
-#endif
-
-#if HAVE_SIGNAL_H
-# include <signal.h>
-#endif
-
-#if HAVE_TIME_H
-# include <time.h>
-#endif
-
-#if HAVE_TERMIOS_H
-# include <termios.h>
-#endif
-
-#if HAVE_STRING_H
-# include <string.h>
-#endif
-
-#if HAVE_CTYPE_H
-# include <ctype.h>
-#endif
-
-#if HAVE_INTTYPES_H
-# include <inttypes.h>
-#else
-# if HAVE_STDINT_H
-#  include <stdint.h>
-# endif
-#endif
-
-#if HAVE_SYS_RESOURCE_H
-# include <sys/resource.h>
-#endif
-
-#include <stdlib.h>
-"; then :
-
-else
-  fptools_cv_htype_sup_uintmax_t=no
-fi
-
-
-            if test "$HTYPE_IS_FLOAT" -eq 1
-            then
-                fptools_cv_htype_uintmax_t=Float
-            elif test "$HTYPE_IS_DOUBLE" -eq 1
-            then
-                fptools_cv_htype_uintmax_t=Double
-            elif test "$HTYPE_IS_LDOUBLE" -eq 1
-            then
-                fptools_cv_htype_uintmax_t=LDouble
-            else
-                fptools_cv_htype_sup_uintmax_t=no
-            fi
-        else
-            if ac_fn_c_compute_int "$LINENO" "((uintmax_t)(-1)) < ((uintmax_t)0)" "HTYPE_IS_SIGNED"        "
-#include <stdio.h>
-#include <stddef.h>
-
-#if HAVE_SYS_TYPES_H
-# include <sys/types.h>
-#endif
-
-#if HAVE_UNISTD_H
-# include <unistd.h>
-#endif
-
-#if HAVE_SYS_STAT_H
-# include <sys/stat.h>
-#endif
-
-#if HAVE_FCNTL_H
-# include <fcntl.h>
-#endif
-
-#if HAVE_SIGNAL_H
-# include <signal.h>
-#endif
-
-#if HAVE_TIME_H
-# include <time.h>
-#endif
-
-#if HAVE_TERMIOS_H
-# include <termios.h>
-#endif
-
-#if HAVE_STRING_H
-# include <string.h>
-#endif
-
-#if HAVE_CTYPE_H
-# include <ctype.h>
-#endif
-
-#if HAVE_INTTYPES_H
-# include <inttypes.h>
-#else
-# if HAVE_STDINT_H
-#  include <stdint.h>
-# endif
-#endif
-
-#if HAVE_SYS_RESOURCE_H
-# include <sys/resource.h>
-#endif
-
-#include <stdlib.h>
-"; then :
-
-else
-  fptools_cv_htype_sup_uintmax_t=no
-fi
-
-
-            if ac_fn_c_compute_int "$LINENO" "sizeof(uintmax_t) * 8" "HTYPE_SIZE"        "
-#include <stdio.h>
-#include <stddef.h>
-
-#if HAVE_SYS_TYPES_H
-# include <sys/types.h>
-#endif
-
-#if HAVE_UNISTD_H
-# include <unistd.h>
-#endif
-
-#if HAVE_SYS_STAT_H
-# include <sys/stat.h>
-#endif
-
-#if HAVE_FCNTL_H
-# include <fcntl.h>
-#endif
-
-#if HAVE_SIGNAL_H
-# include <signal.h>
-#endif
-
-#if HAVE_TIME_H
-# include <time.h>
-#endif
-
-#if HAVE_TERMIOS_H
-# include <termios.h>
-#endif
-
-#if HAVE_STRING_H
-# include <string.h>
-#endif
-
-#if HAVE_CTYPE_H
-# include <ctype.h>
-#endif
-
-#if HAVE_INTTYPES_H
-# include <inttypes.h>
-#else
-# if HAVE_STDINT_H
-#  include <stdint.h>
-# endif
-#endif
-
-#if HAVE_SYS_RESOURCE_H
-# include <sys/resource.h>
-#endif
-
-#include <stdlib.h>
-"; then :
-
-else
-  fptools_cv_htype_sup_uintmax_t=no
-fi
-
-
-            if test "$HTYPE_IS_SIGNED" -eq 0
-            then
-                fptools_cv_htype_uintmax_t="Word$HTYPE_SIZE"
-            else
-                fptools_cv_htype_uintmax_t="Int$HTYPE_SIZE"
-            fi
-        fi
-
-fi
-
-    if test "$fptools_cv_htype_sup_uintmax_t" = no
-    then
-
-        fptools_cv_htype_uintmax_t=NotReallyAType
-        { $as_echo "$as_me:${as_lineno-$LINENO}: result: not supported" >&5
-$as_echo "not supported" >&6; }
-
-    fi
-
-            if test "$fptools_cv_htype_sup_uintmax_t" = yes; then
-        { $as_echo "$as_me:${as_lineno-$LINENO}: result: $fptools_cv_htype_uintmax_t" >&5
-$as_echo "$fptools_cv_htype_uintmax_t" >&6; }
-
-cat >>confdefs.h <<_ACEOF
-#define HTYPE_UINTMAX_T $fptools_cv_htype_uintmax_t
-_ACEOF
-
-    fi
-
-
-
-# test errno values
-for fp_const_name in E2BIG EACCES EADDRINUSE EADDRNOTAVAIL EADV EAFNOSUPPORT EAGAIN EALREADY EBADF EBADMSG EBADRPC EBUSY ECHILD ECOMM ECONNABORTED ECONNREFUSED ECONNRESET EDEADLK EDESTADDRREQ EDIRTY EDOM EDQUOT EEXIST EFAULT EFBIG EFTYPE EHOSTDOWN EHOSTUNREACH EIDRM EILSEQ EINPROGRESS EINTR EINVAL EIO EISCONN EISDIR ELOOP EMFILE EMLINK EMSGSIZE EMULTIHOP ENAMETOOLONG ENETDOWN ENETRESET ENETUNREACH ENFILE ENOBUFS ENODATA ENODEV ENOENT ENOEXEC ENOLCK ENOLINK ENOMEM ENOMSG ENONET ENOPROTOOPT ENOSPC ENOSR ENOSTR ENOSYS ENOTBLK ENOTCONN ENOTDIR ENOTEMPTY ENOTSOCK ENOTTY ENXIO EOPNOTSUPP EPERM EPFNOSUPPORT EPIPE EPROCLIM EPROCUNAVAIL EPROGMISMATCH EPROGUNAVAIL EPROTO EPROTONOSUPPORT EPROTOTYPE ERANGE EREMCHG EREMOTE EROFS ERPCMISMATCH ERREMOTE ESHUTDOWN ESOCKTNOSUPPORT ESPIPE ESRCH ESRMNT ESTALE ETIME ETIMEDOUT ETOOMANYREFS ETXTBSY EUSERS EWOULDBLOCK EXDEV ENOCIGAR ENOTSUP
-do
-as_fp_Cache=`$as_echo "fp_cv_const_$fp_const_name" | $as_tr_sh`
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking value of $fp_const_name" >&5
-$as_echo_n "checking value of $fp_const_name... " >&6; }
-if eval \${$as_fp_Cache+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  if ac_fn_c_compute_int "$LINENO" "$fp_const_name" "fp_check_const_result"        "#include <stdio.h>
-#include <errno.h>
-"; then :
-
-else
-  fp_check_const_result='-1'
-fi
-
-
-eval "$as_fp_Cache=\$fp_check_const_result"
-fi
-eval ac_res=\$$as_fp_Cache
-	       { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
-$as_echo "$ac_res" >&6; }
-cat >>confdefs.h <<_ACEOF
-#define `$as_echo "CONST_$fp_const_name" | $as_tr_cpp` `eval 'as_val=${'$as_fp_Cache'};$as_echo "$as_val"'`
-_ACEOF
-
-done
-
-
-# we need SIGINT in TopHandler.lhs
-for fp_const_name in SIGINT
-do
-as_fp_Cache=`$as_echo "fp_cv_const_$fp_const_name" | $as_tr_sh`
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking value of $fp_const_name" >&5
-$as_echo_n "checking value of $fp_const_name... " >&6; }
-if eval \${$as_fp_Cache+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  if ac_fn_c_compute_int "$LINENO" "$fp_const_name" "fp_check_const_result"        "
-#if HAVE_SIGNAL_H
-#include <signal.h>
-#endif
-"; then :
-
-else
-  fp_check_const_result='-1'
-fi
-
-
-eval "$as_fp_Cache=\$fp_check_const_result"
-fi
-eval ac_res=\$$as_fp_Cache
-	       { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
-$as_echo "$ac_res" >&6; }
-cat >>confdefs.h <<_ACEOF
-#define `$as_echo "CONST_$fp_const_name" | $as_tr_cpp` `eval 'as_val=${'$as_fp_Cache'};$as_echo "$as_val"'`
-_ACEOF
-
-done
-
-
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking value of O_BINARY" >&5
-$as_echo_n "checking value of O_BINARY... " >&6; }
-if ${fp_cv_const_O_BINARY+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  if ac_fn_c_compute_int "$LINENO" "O_BINARY" "fp_check_const_result"        "#include <fcntl.h>
-"; then :
-
-else
-  fp_check_const_result=0
-fi
-
-
-fp_cv_const_O_BINARY=$fp_check_const_result
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $fp_cv_const_O_BINARY" >&5
-$as_echo "$fp_cv_const_O_BINARY" >&6; }
-cat >>confdefs.h <<_ACEOF
-#define CONST_O_BINARY $fp_cv_const_O_BINARY
-_ACEOF
-
-
-# We don't use iconv or libcharset on Windows, but if configure finds
-# them then it can cause problems. So we don't even try looking if
-# we are on Windows.
-# See http://www.haskell.org/pipermail/cvs-ghc/2011-September/065980.html
-if test "$WINDOWS" = "NO"
-then
-
-# We can't just use AC_SEARCH_LIBS for this, as on OpenBSD the iconv.h
-# header needs to be included as iconv_open is #define'd to something
-# else. We therefore use our own FP_SEARCH_LIBS_PROTO, which allows us
-# to give prototype text.
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing iconv" >&5
-$as_echo_n "checking for library containing iconv... " >&6; }
-if ${ac_cv_search_iconv+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  ac_func_search_save_LIBS=$LIBS
-cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-
-#include <stddef.h>
-#include <iconv.h>
-
-int
-main ()
-{
-iconv_t cd;
-                      cd = iconv_open("", "");
-                      iconv(cd,NULL,NULL,NULL,NULL);
-                      iconv_close(cd);
-  ;
-  return 0;
-}
-_ACEOF
-for ac_lib in '' iconv; do
-  if test -z "$ac_lib"; then
-    ac_res="none required"
-  else
-    ac_res=-l$ac_lib
-    LIBS="-l$ac_lib  $ac_func_search_save_LIBS"
-  fi
-  if ac_fn_c_try_link "$LINENO"; then :
-  ac_cv_search_iconv=$ac_res
-fi
-rm -f core conftest.err conftest.$ac_objext \
-    conftest$ac_exeext
-  if ${ac_cv_search_iconv+:} false; then :
-  break
-fi
-done
-if ${ac_cv_search_iconv+:} false; then :
-
-else
-  ac_cv_search_iconv=no
-fi
-rm conftest.$ac_ext
-LIBS=$ac_func_search_save_LIBS
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_iconv" >&5
-$as_echo "$ac_cv_search_iconv" >&6; }
-ac_res=$ac_cv_search_iconv
-if test "$ac_res" != no; then :
-  test "$ac_res" = "none required" || LIBS="$ac_res $LIBS"
-  EXTRA_LIBS="$EXTRA_LIBS $ac_lib"
-else
-  as_fn_error $? "iconv is required on non-Windows platforms" "$LINENO" 5
-fi
-
-# If possible, we use libcharset instead of nl_langinfo(CODESET) to
-# determine the current locale's character encoding.
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing locale_charset" >&5
-$as_echo_n "checking for library containing locale_charset... " >&6; }
-if ${ac_cv_search_locale_charset+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  ac_func_search_save_LIBS=$LIBS
-cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-#include <libcharset.h>
-int
-main ()
-{
-const char* charset = locale_charset();
-  ;
-  return 0;
-}
-_ACEOF
-for ac_lib in '' charset; do
-  if test -z "$ac_lib"; then
-    ac_res="none required"
-  else
-    ac_res=-l$ac_lib
-    LIBS="-l$ac_lib  $ac_func_search_save_LIBS"
-  fi
-  if ac_fn_c_try_link "$LINENO"; then :
-  ac_cv_search_locale_charset=$ac_res
-fi
-rm -f core conftest.err conftest.$ac_objext \
-    conftest$ac_exeext
-  if ${ac_cv_search_locale_charset+:} false; then :
-  break
-fi
-done
-if ${ac_cv_search_locale_charset+:} false; then :
-
-else
-  ac_cv_search_locale_charset=no
-fi
-rm conftest.$ac_ext
-LIBS=$ac_func_search_save_LIBS
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_locale_charset" >&5
-$as_echo "$ac_cv_search_locale_charset" >&6; }
-ac_res=$ac_cv_search_locale_charset
-if test "$ac_res" != no; then :
-  test "$ac_res" = "none required" || LIBS="$ac_res $LIBS"
-
-$as_echo "#define HAVE_LIBCHARSET 1" >>confdefs.h
-
-     EXTRA_LIBS="$EXTRA_LIBS $ac_lib"
+with_libcharset
+'
+      ac_precious_vars='build_alias
+host_alias
+target_alias
+CC
+CFLAGS
+LDFLAGS
+LIBS
+CPPFLAGS
+CPP'
+
+
+# Initialize some variables set by options.
+ac_init_help=
+ac_init_version=false
+ac_unrecognized_opts=
+ac_unrecognized_sep=
+# The variables have the same names as the options, with
+# dashes changed to underlines.
+cache_file=/dev/null
+exec_prefix=NONE
+no_create=
+no_recursion=
+prefix=NONE
+program_prefix=NONE
+program_suffix=NONE
+program_transform_name=s,x,x,
+silent=
+site=
+srcdir=
+verbose=
+x_includes=NONE
+x_libraries=NONE
+
+# Installation directory options.
+# These are left unexpanded so users can "make install exec_prefix=/foo"
+# and all the variables that are supposed to be based on exec_prefix
+# by default will actually change.
+# Use braces instead of parens because sh, perl, etc. also accept them.
+# (The list follows the same order as the GNU Coding Standards.)
+bindir='${exec_prefix}/bin'
+sbindir='${exec_prefix}/sbin'
+libexecdir='${exec_prefix}/libexec'
+datarootdir='${prefix}/share'
+datadir='${datarootdir}'
+sysconfdir='${prefix}/etc'
+sharedstatedir='${prefix}/com'
+localstatedir='${prefix}/var'
+runstatedir='${localstatedir}/run'
+includedir='${prefix}/include'
+oldincludedir='/usr/include'
+docdir='${datarootdir}/doc/${PACKAGE_TARNAME}'
+infodir='${datarootdir}/info'
+htmldir='${docdir}'
+dvidir='${docdir}'
+pdfdir='${docdir}'
+psdir='${docdir}'
+libdir='${exec_prefix}/lib'
+localedir='${datarootdir}/locale'
+mandir='${datarootdir}/man'
+
+ac_prev=
+ac_dashdash=
+for ac_option
+do
+  # If the previous option needs an argument, assign it.
+  if test -n "$ac_prev"; then
+    eval $ac_prev=\$ac_option
+    ac_prev=
+    continue
+  fi
+
+  case $ac_option in
+  *=?*) ac_optarg=`expr "X$ac_option" : '[^=]*=\(.*\)'` ;;
+  *=)   ac_optarg= ;;
+  *)    ac_optarg=yes ;;
+  esac
+
+  # Accept the important Cygnus configure options, so we can diagnose typos.
+
+  case $ac_dashdash$ac_option in
+  --)
+    ac_dashdash=yes ;;
+
+  -bindir | --bindir | --bindi | --bind | --bin | --bi)
+    ac_prev=bindir ;;
+  -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*)
+    bindir=$ac_optarg ;;
+
+  -build | --build | --buil | --bui | --bu)
+    ac_prev=build_alias ;;
+  -build=* | --build=* | --buil=* | --bui=* | --bu=*)
+    build_alias=$ac_optarg ;;
+
+  -cache-file | --cache-file | --cache-fil | --cache-fi \
+  | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c)
+    ac_prev=cache_file ;;
+  -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \
+  | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*)
+    cache_file=$ac_optarg ;;
+
+  --config-cache | -C)
+    cache_file=config.cache ;;
+
+  -datadir | --datadir | --datadi | --datad)
+    ac_prev=datadir ;;
+  -datadir=* | --datadir=* | --datadi=* | --datad=*)
+    datadir=$ac_optarg ;;
+
+  -datarootdir | --datarootdir | --datarootdi | --datarootd | --dataroot \
+  | --dataroo | --dataro | --datar)
+    ac_prev=datarootdir ;;
+  -datarootdir=* | --datarootdir=* | --datarootdi=* | --datarootd=* \
+  | --dataroot=* | --dataroo=* | --dataro=* | --datar=*)
+    datarootdir=$ac_optarg ;;
+
+  -disable-* | --disable-*)
+    ac_useropt=`expr "x$ac_option" : 'x-*disable-\(.*\)'`
+    # Reject names that are not valid shell variable names.
+    expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null &&
+      as_fn_error $? "invalid feature name: $ac_useropt"
+    ac_useropt_orig=$ac_useropt
+    ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'`
+    case $ac_user_opts in
+      *"
+"enable_$ac_useropt"
+"*) ;;
+      *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--disable-$ac_useropt_orig"
+	 ac_unrecognized_sep=', ';;
+    esac
+    eval enable_$ac_useropt=no ;;
+
+  -docdir | --docdir | --docdi | --doc | --do)
+    ac_prev=docdir ;;
+  -docdir=* | --docdir=* | --docdi=* | --doc=* | --do=*)
+    docdir=$ac_optarg ;;
+
+  -dvidir | --dvidir | --dvidi | --dvid | --dvi | --dv)
+    ac_prev=dvidir ;;
+  -dvidir=* | --dvidir=* | --dvidi=* | --dvid=* | --dvi=* | --dv=*)
+    dvidir=$ac_optarg ;;
+
+  -enable-* | --enable-*)
+    ac_useropt=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'`
+    # Reject names that are not valid shell variable names.
+    expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null &&
+      as_fn_error $? "invalid feature name: $ac_useropt"
+    ac_useropt_orig=$ac_useropt
+    ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'`
+    case $ac_user_opts in
+      *"
+"enable_$ac_useropt"
+"*) ;;
+      *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--enable-$ac_useropt_orig"
+	 ac_unrecognized_sep=', ';;
+    esac
+    eval enable_$ac_useropt=\$ac_optarg ;;
+
+  -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \
+  | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \
+  | --exec | --exe | --ex)
+    ac_prev=exec_prefix ;;
+  -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \
+  | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \
+  | --exec=* | --exe=* | --ex=*)
+    exec_prefix=$ac_optarg ;;
+
+  -gas | --gas | --ga | --g)
+    # Obsolete; use --with-gas.
+    with_gas=yes ;;
+
+  -help | --help | --hel | --he | -h)
+    ac_init_help=long ;;
+  -help=r* | --help=r* | --hel=r* | --he=r* | -hr*)
+    ac_init_help=recursive ;;
+  -help=s* | --help=s* | --hel=s* | --he=s* | -hs*)
+    ac_init_help=short ;;
+
+  -host | --host | --hos | --ho)
+    ac_prev=host_alias ;;
+  -host=* | --host=* | --hos=* | --ho=*)
+    host_alias=$ac_optarg ;;
+
+  -htmldir | --htmldir | --htmldi | --htmld | --html | --htm | --ht)
+    ac_prev=htmldir ;;
+  -htmldir=* | --htmldir=* | --htmldi=* | --htmld=* | --html=* | --htm=* \
+  | --ht=*)
+    htmldir=$ac_optarg ;;
+
+  -includedir | --includedir | --includedi | --included | --include \
+  | --includ | --inclu | --incl | --inc)
+    ac_prev=includedir ;;
+  -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \
+  | --includ=* | --inclu=* | --incl=* | --inc=*)
+    includedir=$ac_optarg ;;
+
+  -infodir | --infodir | --infodi | --infod | --info | --inf)
+    ac_prev=infodir ;;
+  -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*)
+    infodir=$ac_optarg ;;
+
+  -libdir | --libdir | --libdi | --libd)
+    ac_prev=libdir ;;
+  -libdir=* | --libdir=* | --libdi=* | --libd=*)
+    libdir=$ac_optarg ;;
+
+  -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \
+  | --libexe | --libex | --libe)
+    ac_prev=libexecdir ;;
+  -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \
+  | --libexe=* | --libex=* | --libe=*)
+    libexecdir=$ac_optarg ;;
+
+  -localedir | --localedir | --localedi | --localed | --locale)
+    ac_prev=localedir ;;
+  -localedir=* | --localedir=* | --localedi=* | --localed=* | --locale=*)
+    localedir=$ac_optarg ;;
+
+  -localstatedir | --localstatedir | --localstatedi | --localstated \
+  | --localstate | --localstat | --localsta | --localst | --locals)
+    ac_prev=localstatedir ;;
+  -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \
+  | --localstate=* | --localstat=* | --localsta=* | --localst=* | --locals=*)
+    localstatedir=$ac_optarg ;;
+
+  -mandir | --mandir | --mandi | --mand | --man | --ma | --m)
+    ac_prev=mandir ;;
+  -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*)
+    mandir=$ac_optarg ;;
+
+  -nfp | --nfp | --nf)
+    # Obsolete; use --without-fp.
+    with_fp=no ;;
+
+  -no-create | --no-create | --no-creat | --no-crea | --no-cre \
+  | --no-cr | --no-c | -n)
+    no_create=yes ;;
+
+  -no-recursion | --no-recursion | --no-recursio | --no-recursi \
+  | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r)
+    no_recursion=yes ;;
+
+  -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \
+  | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \
+  | --oldin | --oldi | --old | --ol | --o)
+    ac_prev=oldincludedir ;;
+  -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \
+  | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \
+  | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*)
+    oldincludedir=$ac_optarg ;;
+
+  -prefix | --prefix | --prefi | --pref | --pre | --pr | --p)
+    ac_prev=prefix ;;
+  -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*)
+    prefix=$ac_optarg ;;
+
+  -program-prefix | --program-prefix | --program-prefi | --program-pref \
+  | --program-pre | --program-pr | --program-p)
+    ac_prev=program_prefix ;;
+  -program-prefix=* | --program-prefix=* | --program-prefi=* \
+  | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*)
+    program_prefix=$ac_optarg ;;
+
+  -program-suffix | --program-suffix | --program-suffi | --program-suff \
+  | --program-suf | --program-su | --program-s)
+    ac_prev=program_suffix ;;
+  -program-suffix=* | --program-suffix=* | --program-suffi=* \
+  | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*)
+    program_suffix=$ac_optarg ;;
+
+  -program-transform-name | --program-transform-name \
+  | --program-transform-nam | --program-transform-na \
+  | --program-transform-n | --program-transform- \
+  | --program-transform | --program-transfor \
+  | --program-transfo | --program-transf \
+  | --program-trans | --program-tran \
+  | --progr-tra | --program-tr | --program-t)
+    ac_prev=program_transform_name ;;
+  -program-transform-name=* | --program-transform-name=* \
+  | --program-transform-nam=* | --program-transform-na=* \
+  | --program-transform-n=* | --program-transform-=* \
+  | --program-transform=* | --program-transfor=* \
+  | --program-transfo=* | --program-transf=* \
+  | --program-trans=* | --program-tran=* \
+  | --progr-tra=* | --program-tr=* | --program-t=*)
+    program_transform_name=$ac_optarg ;;
+
+  -pdfdir | --pdfdir | --pdfdi | --pdfd | --pdf | --pd)
+    ac_prev=pdfdir ;;
+  -pdfdir=* | --pdfdir=* | --pdfdi=* | --pdfd=* | --pdf=* | --pd=*)
+    pdfdir=$ac_optarg ;;
+
+  -psdir | --psdir | --psdi | --psd | --ps)
+    ac_prev=psdir ;;
+  -psdir=* | --psdir=* | --psdi=* | --psd=* | --ps=*)
+    psdir=$ac_optarg ;;
+
+  -q | -quiet | --quiet | --quie | --qui | --qu | --q \
+  | -silent | --silent | --silen | --sile | --sil)
+    silent=yes ;;
+
+  -runstatedir | --runstatedir | --runstatedi | --runstated \
+  | --runstate | --runstat | --runsta | --runst | --runs \
+  | --run | --ru | --r)
+    ac_prev=runstatedir ;;
+  -runstatedir=* | --runstatedir=* | --runstatedi=* | --runstated=* \
+  | --runstate=* | --runstat=* | --runsta=* | --runst=* | --runs=* \
+  | --run=* | --ru=* | --r=*)
+    runstatedir=$ac_optarg ;;
+
+  -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb)
+    ac_prev=sbindir ;;
+  -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \
+  | --sbi=* | --sb=*)
+    sbindir=$ac_optarg ;;
+
+  -sharedstatedir | --sharedstatedir | --sharedstatedi \
+  | --sharedstated | --sharedstate | --sharedstat | --sharedsta \
+  | --sharedst | --shareds | --shared | --share | --shar \
+  | --sha | --sh)
+    ac_prev=sharedstatedir ;;
+  -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \
+  | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \
+  | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \
+  | --sha=* | --sh=*)
+    sharedstatedir=$ac_optarg ;;
+
+  -site | --site | --sit)
+    ac_prev=site ;;
+  -site=* | --site=* | --sit=*)
+    site=$ac_optarg ;;
+
+  -srcdir | --srcdir | --srcdi | --srcd | --src | --sr)
+    ac_prev=srcdir ;;
+  -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*)
+    srcdir=$ac_optarg ;;
+
+  -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \
+  | --syscon | --sysco | --sysc | --sys | --sy)
+    ac_prev=sysconfdir ;;
+  -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \
+  | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*)
+    sysconfdir=$ac_optarg ;;
+
+  -target | --target | --targe | --targ | --tar | --ta | --t)
+    ac_prev=target_alias ;;
+  -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*)
+    target_alias=$ac_optarg ;;
+
+  -v | -verbose | --verbose | --verbos | --verbo | --verb)
+    verbose=yes ;;
+
+  -version | --version | --versio | --versi | --vers | -V)
+    ac_init_version=: ;;
+
+  -with-* | --with-*)
+    ac_useropt=`expr "x$ac_option" : 'x-*with-\([^=]*\)'`
+    # Reject names that are not valid shell variable names.
+    expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null &&
+      as_fn_error $? "invalid package name: $ac_useropt"
+    ac_useropt_orig=$ac_useropt
+    ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'`
+    case $ac_user_opts in
+      *"
+"with_$ac_useropt"
+"*) ;;
+      *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--with-$ac_useropt_orig"
+	 ac_unrecognized_sep=', ';;
+    esac
+    eval with_$ac_useropt=\$ac_optarg ;;
+
+  -without-* | --without-*)
+    ac_useropt=`expr "x$ac_option" : 'x-*without-\(.*\)'`
+    # Reject names that are not valid shell variable names.
+    expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null &&
+      as_fn_error $? "invalid package name: $ac_useropt"
+    ac_useropt_orig=$ac_useropt
+    ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'`
+    case $ac_user_opts in
+      *"
+"with_$ac_useropt"
+"*) ;;
+      *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--without-$ac_useropt_orig"
+	 ac_unrecognized_sep=', ';;
+    esac
+    eval with_$ac_useropt=no ;;
+
+  --x)
+    # Obsolete; use --with-x.
+    with_x=yes ;;
+
+  -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \
+  | --x-incl | --x-inc | --x-in | --x-i)
+    ac_prev=x_includes ;;
+  -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \
+  | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*)
+    x_includes=$ac_optarg ;;
+
+  -x-libraries | --x-libraries | --x-librarie | --x-librari \
+  | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l)
+    ac_prev=x_libraries ;;
+  -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \
+  | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*)
+    x_libraries=$ac_optarg ;;
+
+  -*) as_fn_error $? "unrecognized option: \`$ac_option'
+Try \`$0 --help' for more information"
+    ;;
+
+  *=*)
+    ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='`
+    # Reject names that are not valid shell variable names.
+    case $ac_envvar in #(
+      '' | [0-9]* | *[!_$as_cr_alnum]* )
+      as_fn_error $? "invalid variable name: \`$ac_envvar'" ;;
+    esac
+    eval $ac_envvar=\$ac_optarg
+    export $ac_envvar ;;
+
+  *)
+    # FIXME: should be removed in autoconf 3.0.
+    $as_echo "$as_me: WARNING: you should use --build, --host, --target" >&2
+    expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null &&
+      $as_echo "$as_me: WARNING: invalid host type: $ac_option" >&2
+    : "${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option}"
+    ;;
+
+  esac
+done
+
+if test -n "$ac_prev"; then
+  ac_option=--`echo $ac_prev | sed 's/_/-/g'`
+  as_fn_error $? "missing argument to $ac_option"
+fi
+
+if test -n "$ac_unrecognized_opts"; then
+  case $enable_option_checking in
+    no) ;;
+    fatal) as_fn_error $? "unrecognized options: $ac_unrecognized_opts" ;;
+    *)     $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2 ;;
+  esac
+fi
+
+# Check all directory arguments for consistency.
+for ac_var in	exec_prefix prefix bindir sbindir libexecdir datarootdir \
+		datadir sysconfdir sharedstatedir localstatedir includedir \
+		oldincludedir docdir infodir htmldir dvidir pdfdir psdir \
+		libdir localedir mandir runstatedir
+do
+  eval ac_val=\$$ac_var
+  # Remove trailing slashes.
+  case $ac_val in
+    */ )
+      ac_val=`expr "X$ac_val" : 'X\(.*[^/]\)' \| "X$ac_val" : 'X\(.*\)'`
+      eval $ac_var=\$ac_val;;
+  esac
+  # Be sure to have absolute directory names.
+  case $ac_val in
+    [\\/$]* | ?:[\\/]* )  continue;;
+    NONE | '' ) case $ac_var in *prefix ) continue;; esac;;
+  esac
+  as_fn_error $? "expected an absolute directory name for --$ac_var: $ac_val"
+done
+
+# There might be people who depend on the old broken behavior: `$host'
+# used to hold the argument of --host etc.
+# FIXME: To remove some day.
+build=$build_alias
+host=$host_alias
+target=$target_alias
+
+# FIXME: To remove some day.
+if test "x$host_alias" != x; then
+  if test "x$build_alias" = x; then
+    cross_compiling=maybe
+  elif test "x$build_alias" != "x$host_alias"; then
+    cross_compiling=yes
+  fi
+fi
+
+ac_tool_prefix=
+test -n "$host_alias" && ac_tool_prefix=$host_alias-
+
+test "$silent" = yes && exec 6>/dev/null
+
+
+ac_pwd=`pwd` && test -n "$ac_pwd" &&
+ac_ls_di=`ls -di .` &&
+ac_pwd_ls_di=`cd "$ac_pwd" && ls -di .` ||
+  as_fn_error $? "working directory cannot be determined"
+test "X$ac_ls_di" = "X$ac_pwd_ls_di" ||
+  as_fn_error $? "pwd does not report name of working directory"
+
+
+# Find the source files, if location was not specified.
+if test -z "$srcdir"; then
+  ac_srcdir_defaulted=yes
+  # Try the directory containing this script, then the parent directory.
+  ac_confdir=`$as_dirname -- "$as_myself" ||
+$as_expr X"$as_myself" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+	 X"$as_myself" : 'X\(//\)[^/]' \| \
+	 X"$as_myself" : 'X\(//\)$' \| \
+	 X"$as_myself" : 'X\(/\)' \| . 2>/dev/null ||
+$as_echo X"$as_myself" |
+    sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
+	    s//\1/
+	    q
+	  }
+	  /^X\(\/\/\)[^/].*/{
+	    s//\1/
+	    q
+	  }
+	  /^X\(\/\/\)$/{
+	    s//\1/
+	    q
+	  }
+	  /^X\(\/\).*/{
+	    s//\1/
+	    q
+	  }
+	  s/.*/./; q'`
+  srcdir=$ac_confdir
+  if test ! -r "$srcdir/$ac_unique_file"; then
+    srcdir=..
+  fi
+else
+  ac_srcdir_defaulted=no
+fi
+if test ! -r "$srcdir/$ac_unique_file"; then
+  test "$ac_srcdir_defaulted" = yes && srcdir="$ac_confdir or .."
+  as_fn_error $? "cannot find sources ($ac_unique_file) in $srcdir"
+fi
+ac_msg="sources are in $srcdir, but \`cd $srcdir' does not work"
+ac_abs_confdir=`(
+	cd "$srcdir" && test -r "./$ac_unique_file" || as_fn_error $? "$ac_msg"
+	pwd)`
+# When building in place, set srcdir=.
+if test "$ac_abs_confdir" = "$ac_pwd"; then
+  srcdir=.
+fi
+# Remove unnecessary trailing slashes from srcdir.
+# Double slashes in file names in object file debugging info
+# mess up M-x gdb in Emacs.
+case $srcdir in
+*/) srcdir=`expr "X$srcdir" : 'X\(.*[^/]\)' \| "X$srcdir" : 'X\(.*\)'`;;
+esac
+for ac_var in $ac_precious_vars; do
+  eval ac_env_${ac_var}_set=\${${ac_var}+set}
+  eval ac_env_${ac_var}_value=\$${ac_var}
+  eval ac_cv_env_${ac_var}_set=\${${ac_var}+set}
+  eval ac_cv_env_${ac_var}_value=\$${ac_var}
+done
+
+#
+# Report the --help message.
+#
+if test "$ac_init_help" = "long"; then
+  # Omit some internal or obsolete options to make the list less imposing.
+  # This message is too long to be a string in the A/UX 3.1 sh.
+  cat <<_ACEOF
+\`configure' configures Haskell base package 1.0 to adapt to many kinds of systems.
+
+Usage: $0 [OPTION]... [VAR=VALUE]...
+
+To assign environment variables (e.g., CC, CFLAGS...), specify them as
+VAR=VALUE.  See below for descriptions of some of the useful variables.
+
+Defaults for the options are specified in brackets.
+
+Configuration:
+  -h, --help              display this help and exit
+      --help=short        display options specific to this package
+      --help=recursive    display the short help of all the included packages
+  -V, --version           display version information and exit
+  -q, --quiet, --silent   do not print \`checking ...' messages
+      --cache-file=FILE   cache test results in FILE [disabled]
+  -C, --config-cache      alias for \`--cache-file=config.cache'
+  -n, --no-create         do not create output files
+      --srcdir=DIR        find the sources in DIR [configure dir or \`..']
+
+Installation directories:
+  --prefix=PREFIX         install architecture-independent files in PREFIX
+                          [$ac_default_prefix]
+  --exec-prefix=EPREFIX   install architecture-dependent files in EPREFIX
+                          [PREFIX]
+
+By default, \`make install' will install all the files in
+\`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc.  You can specify
+an installation prefix other than \`$ac_default_prefix' using \`--prefix',
+for instance \`--prefix=\$HOME'.
+
+For better control, use the options below.
+
+Fine tuning of the installation directories:
+  --bindir=DIR            user executables [EPREFIX/bin]
+  --sbindir=DIR           system admin executables [EPREFIX/sbin]
+  --libexecdir=DIR        program executables [EPREFIX/libexec]
+  --sysconfdir=DIR        read-only single-machine data [PREFIX/etc]
+  --sharedstatedir=DIR    modifiable architecture-independent data [PREFIX/com]
+  --localstatedir=DIR     modifiable single-machine data [PREFIX/var]
+  --runstatedir=DIR       modifiable per-process data [LOCALSTATEDIR/run]
+  --libdir=DIR            object code libraries [EPREFIX/lib]
+  --includedir=DIR        C header files [PREFIX/include]
+  --oldincludedir=DIR     C header files for non-gcc [/usr/include]
+  --datarootdir=DIR       read-only arch.-independent data root [PREFIX/share]
+  --datadir=DIR           read-only architecture-independent data [DATAROOTDIR]
+  --infodir=DIR           info documentation [DATAROOTDIR/info]
+  --localedir=DIR         locale-dependent data [DATAROOTDIR/locale]
+  --mandir=DIR            man documentation [DATAROOTDIR/man]
+  --docdir=DIR            documentation root [DATAROOTDIR/doc/base]
+  --htmldir=DIR           html documentation [DOCDIR]
+  --dvidir=DIR            dvi documentation [DOCDIR]
+  --pdfdir=DIR            pdf documentation [DOCDIR]
+  --psdir=DIR             ps documentation [DOCDIR]
+_ACEOF
+
+  cat <<\_ACEOF
+
+System types:
+  --build=BUILD     configure for building on BUILD [guessed]
+  --host=HOST       cross-compile to build programs to run on HOST [BUILD]
+  --target=TARGET   configure for building compilers for TARGET [HOST]
+_ACEOF
+fi
+
+if test -n "$ac_init_help"; then
+  case $ac_init_help in
+     short | recursive ) echo "Configuration of Haskell base package 1.0:";;
+   esac
+  cat <<\_ACEOF
+
+Optional Features:
+  --disable-option-checking  ignore unrecognized --enable/--with options
+  --disable-FEATURE       do not include FEATURE (same as --enable-FEATURE=no)
+  --enable-FEATURE[=ARG]  include FEATURE [ARG=yes]
+  --disable-largefile     omit support for large files
+
+Optional Packages:
+  --with-PACKAGE[=ARG]    use PACKAGE [ARG=yes]
+  --without-PACKAGE       do not use PACKAGE (same as --with-PACKAGE=no)
+  --with-iconv-includes   directory containing iconv.h
+  --with-iconv-libraries  directory containing iconv library
+  --with-libcharset       Use libcharset [default=only if available]
+
+Some influential environment variables:
+  CC          C compiler command
+  CFLAGS      C compiler flags
+  LDFLAGS     linker flags, e.g. -L<lib dir> if you have libraries in a
+              nonstandard directory <lib dir>
+  LIBS        libraries to pass to the linker, e.g. -l<library>
+  CPPFLAGS    (Objective) C/C++ preprocessor flags, e.g. -I<include dir> if
+              you have headers in a nonstandard directory <include dir>
+  CPP         C preprocessor
+
+Use these variables to override the choices made by `configure' or to help
+it to find libraries and programs with nonstandard names/locations.
+
+Report bugs to <libraries@haskell.org>.
+_ACEOF
+ac_status=$?
+fi
+
+if test "$ac_init_help" = "recursive"; then
+  # If there are subdirs, report their specific --help.
+  for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue
+    test -d "$ac_dir" ||
+      { cd "$srcdir" && ac_pwd=`pwd` && srcdir=. && test -d "$ac_dir"; } ||
+      continue
+    ac_builddir=.
+
+case "$ac_dir" in
+.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;;
+*)
+  ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'`
+  # A ".." for each directory in $ac_dir_suffix.
+  ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'`
+  case $ac_top_builddir_sub in
+  "") ac_top_builddir_sub=. ac_top_build_prefix= ;;
+  *)  ac_top_build_prefix=$ac_top_builddir_sub/ ;;
+  esac ;;
+esac
+ac_abs_top_builddir=$ac_pwd
+ac_abs_builddir=$ac_pwd$ac_dir_suffix
+# for backward compatibility:
+ac_top_builddir=$ac_top_build_prefix
+
+case $srcdir in
+  .)  # We are building in place.
+    ac_srcdir=.
+    ac_top_srcdir=$ac_top_builddir_sub
+    ac_abs_top_srcdir=$ac_pwd ;;
+  [\\/]* | ?:[\\/]* )  # Absolute name.
+    ac_srcdir=$srcdir$ac_dir_suffix;
+    ac_top_srcdir=$srcdir
+    ac_abs_top_srcdir=$srcdir ;;
+  *) # Relative name.
+    ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix
+    ac_top_srcdir=$ac_top_build_prefix$srcdir
+    ac_abs_top_srcdir=$ac_pwd/$srcdir ;;
+esac
+ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix
+
+    cd "$ac_dir" || { ac_status=$?; continue; }
+    # Check for guested configure.
+    if test -f "$ac_srcdir/configure.gnu"; then
+      echo &&
+      $SHELL "$ac_srcdir/configure.gnu" --help=recursive
+    elif test -f "$ac_srcdir/configure"; then
+      echo &&
+      $SHELL "$ac_srcdir/configure" --help=recursive
+    else
+      $as_echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2
+    fi || ac_status=$?
+    cd "$ac_pwd" || { ac_status=$?; break; }
+  done
+fi
+
+test -n "$ac_init_help" && exit $ac_status
+if $ac_init_version; then
+  cat <<\_ACEOF
+Haskell base package configure 1.0
+generated by GNU Autoconf 2.69
+
+Copyright (C) 2012 Free Software Foundation, Inc.
+This configure script is free software; the Free Software Foundation
+gives unlimited permission to copy, distribute and modify it.
+_ACEOF
+  exit
+fi
+
+## ------------------------ ##
+## Autoconf initialization. ##
+## ------------------------ ##
+
+# ac_fn_c_try_compile LINENO
+# --------------------------
+# Try to compile conftest.$ac_ext, and return whether this succeeded.
+ac_fn_c_try_compile ()
+{
+  as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+  rm -f conftest.$ac_objext
+  if { { ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+  (eval "$ac_compile") 2>conftest.err
+  ac_status=$?
+  if test -s conftest.err; then
+    grep -v '^ *+' conftest.err >conftest.er1
+    cat conftest.er1 >&5
+    mv -f conftest.er1 conftest.err
+  fi
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then :
+  ac_retval=0
+else
+  $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	ac_retval=1
+fi
+  eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
+  as_fn_set_status $ac_retval
+
+} # ac_fn_c_try_compile
+
+# ac_fn_c_try_cpp LINENO
+# ----------------------
+# Try to preprocess conftest.$ac_ext, and return whether this succeeded.
+ac_fn_c_try_cpp ()
+{
+  as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+  if { { ac_try="$ac_cpp conftest.$ac_ext"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+  (eval "$ac_cpp conftest.$ac_ext") 2>conftest.err
+  ac_status=$?
+  if test -s conftest.err; then
+    grep -v '^ *+' conftest.err >conftest.er1
+    cat conftest.er1 >&5
+    mv -f conftest.er1 conftest.err
+  fi
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; } > conftest.i && {
+	 test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       }; then :
+  ac_retval=0
+else
+  $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+    ac_retval=1
+fi
+  eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
+  as_fn_set_status $ac_retval
+
+} # ac_fn_c_try_cpp
+
+# ac_fn_c_check_header_mongrel LINENO HEADER VAR INCLUDES
+# -------------------------------------------------------
+# Tests whether HEADER exists, giving a warning if it cannot be compiled using
+# the include files in INCLUDES and setting the cache variable VAR
+# accordingly.
+ac_fn_c_check_header_mongrel ()
+{
+  as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+  if eval \${$3+:} false; then :
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
+$as_echo_n "checking for $2... " >&6; }
+if eval \${$3+:} false; then :
+  $as_echo_n "(cached) " >&6
+fi
+eval ac_res=\$$3
+	       { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+else
+  # Is the header compilable?
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 usability" >&5
+$as_echo_n "checking $2 usability... " >&6; }
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+$4
+#include <$2>
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  ac_header_compiler=yes
+else
+  ac_header_compiler=no
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_compiler" >&5
+$as_echo "$ac_header_compiler" >&6; }
+
+# Is the header present?
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 presence" >&5
+$as_echo_n "checking $2 presence... " >&6; }
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#include <$2>
+_ACEOF
+if ac_fn_c_try_cpp "$LINENO"; then :
+  ac_header_preproc=yes
+else
+  ac_header_preproc=no
+fi
+rm -f conftest.err conftest.i conftest.$ac_ext
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_preproc" >&5
+$as_echo "$ac_header_preproc" >&6; }
+
+# So?  What about this header?
+case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in #((
+  yes:no: )
+    { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&5
+$as_echo "$as_me: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&2;}
+    { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5
+$as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;}
+    ;;
+  no:yes:* )
+    { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: present but cannot be compiled" >&5
+$as_echo "$as_me: WARNING: $2: present but cannot be compiled" >&2;}
+    { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2:     check for missing prerequisite headers?" >&5
+$as_echo "$as_me: WARNING: $2:     check for missing prerequisite headers?" >&2;}
+    { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: see the Autoconf documentation" >&5
+$as_echo "$as_me: WARNING: $2: see the Autoconf documentation" >&2;}
+    { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2:     section \"Present But Cannot Be Compiled\"" >&5
+$as_echo "$as_me: WARNING: $2:     section \"Present But Cannot Be Compiled\"" >&2;}
+    { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5
+$as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;}
+( $as_echo "## ------------------------------------ ##
+## Report this to libraries@haskell.org ##
+## ------------------------------------ ##"
+     ) | sed "s/^/$as_me: WARNING:     /" >&2
+    ;;
+esac
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
+$as_echo_n "checking for $2... " >&6; }
+if eval \${$3+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  eval "$3=\$ac_header_compiler"
+fi
+eval ac_res=\$$3
+	       { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+fi
+  eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
+
+} # ac_fn_c_check_header_mongrel
+
+# ac_fn_c_try_run LINENO
+# ----------------------
+# Try to link conftest.$ac_ext, and return whether this succeeded. Assumes
+# that executables *can* be run.
+ac_fn_c_try_run ()
+{
+  as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+  if { { ac_try="$ac_link"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+  (eval "$ac_link") 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; } && { ac_try='./conftest$ac_exeext'
+  { { case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+  (eval "$ac_try") 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }; }; then :
+  ac_retval=0
+else
+  $as_echo "$as_me: program exited with status $ac_status" >&5
+       $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+       ac_retval=$ac_status
+fi
+  rm -rf conftest.dSYM conftest_ipa8_conftest.oo
+  eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
+  as_fn_set_status $ac_retval
+
+} # ac_fn_c_try_run
+
+# ac_fn_c_check_header_compile LINENO HEADER VAR INCLUDES
+# -------------------------------------------------------
+# Tests whether HEADER exists and can be compiled using the include files in
+# INCLUDES, setting the cache variable VAR accordingly.
+ac_fn_c_check_header_compile ()
+{
+  as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
+$as_echo_n "checking for $2... " >&6; }
+if eval \${$3+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+$4
+#include <$2>
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  eval "$3=yes"
+else
+  eval "$3=no"
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+eval ac_res=\$$3
+	       { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+  eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
+
+} # ac_fn_c_check_header_compile
+
+# ac_fn_c_check_type LINENO TYPE VAR INCLUDES
+# -------------------------------------------
+# Tests whether TYPE exists after having included INCLUDES, setting cache
+# variable VAR accordingly.
+ac_fn_c_check_type ()
+{
+  as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
+$as_echo_n "checking for $2... " >&6; }
+if eval \${$3+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  eval "$3=no"
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+$4
+int
+main ()
+{
+if (sizeof ($2))
+	 return 0;
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+$4
+int
+main ()
+{
+if (sizeof (($2)))
+	    return 0;
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+
+else
+  eval "$3=yes"
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+eval ac_res=\$$3
+	       { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+  eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
+
+} # ac_fn_c_check_type
+
+# ac_fn_c_try_link LINENO
+# -----------------------
+# Try to link conftest.$ac_ext, and return whether this succeeded.
+ac_fn_c_try_link ()
+{
+  as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+  rm -f conftest.$ac_objext conftest$ac_exeext
+  if { { ac_try="$ac_link"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+  (eval "$ac_link") 2>conftest.err
+  ac_status=$?
+  if test -s conftest.err; then
+    grep -v '^ *+' conftest.err >conftest.er1
+    cat conftest.er1 >&5
+    mv -f conftest.er1 conftest.err
+  fi
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest$ac_exeext && {
+	 test "$cross_compiling" = yes ||
+	 test -x conftest$ac_exeext
+       }; then :
+  ac_retval=0
+else
+  $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	ac_retval=1
+fi
+  # Delete the IPA/IPO (Inter Procedural Analysis/Optimization) information
+  # created by the PGI compiler (conftest_ipa8_conftest.oo), as it would
+  # interfere with the next link command; also delete a directory that is
+  # left behind by Apple's compiler.  We do this before executing the actions.
+  rm -rf conftest.dSYM conftest_ipa8_conftest.oo
+  eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
+  as_fn_set_status $ac_retval
+
+} # ac_fn_c_try_link
+
+# ac_fn_c_check_func LINENO FUNC VAR
+# ----------------------------------
+# Tests whether FUNC exists, setting the cache variable VAR accordingly
+ac_fn_c_check_func ()
+{
+  as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
+$as_echo_n "checking for $2... " >&6; }
+if eval \${$3+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+/* Define $2 to an innocuous variant, in case <limits.h> declares $2.
+   For example, HP-UX 11i <limits.h> declares gettimeofday.  */
+#define $2 innocuous_$2
+
+/* System header to define __stub macros and hopefully few prototypes,
+    which can conflict with char $2 (); below.
+    Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
+    <limits.h> exists even on freestanding compilers.  */
+
+#ifdef __STDC__
+# include <limits.h>
+#else
+# include <assert.h>
+#endif
+
+#undef $2
+
+/* Override any GCC internal prototype to avoid an error.
+   Use char because int might match the return type of a GCC
+   builtin and then its argument prototype would still apply.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+char $2 ();
+/* The GNU C library defines this for functions which it implements
+    to always fail with ENOSYS.  Some functions are actually named
+    something starting with __ and the normal name is an alias.  */
+#if defined __stub_$2 || defined __stub___$2
+choke me
+#endif
+
+int
+main ()
+{
+return $2 ();
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+  eval "$3=yes"
+else
+  eval "$3=no"
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+fi
+eval ac_res=\$$3
+	       { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+  eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
+
+} # ac_fn_c_check_func
+
+# ac_fn_c_compute_int LINENO EXPR VAR INCLUDES
+# --------------------------------------------
+# Tries to find the compile-time value of EXPR in a program that includes
+# INCLUDES, setting VAR accordingly. Returns whether the value could be
+# computed
+ac_fn_c_compute_int ()
+{
+  as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+  if test "$cross_compiling" = yes; then
+    # Depending upon the size, compute the lo and hi bounds.
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+$4
+int
+main ()
+{
+static int test_array [1 - 2 * !(($2) >= 0)];
+test_array [0] = 0;
+return test_array [0];
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  ac_lo=0 ac_mid=0
+  while :; do
+    cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+$4
+int
+main ()
+{
+static int test_array [1 - 2 * !(($2) <= $ac_mid)];
+test_array [0] = 0;
+return test_array [0];
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  ac_hi=$ac_mid; break
+else
+  as_fn_arith $ac_mid + 1 && ac_lo=$as_val
+			if test $ac_lo -le $ac_mid; then
+			  ac_lo= ac_hi=
+			  break
+			fi
+			as_fn_arith 2 '*' $ac_mid + 1 && ac_mid=$as_val
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+  done
+else
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+$4
+int
+main ()
+{
+static int test_array [1 - 2 * !(($2) < 0)];
+test_array [0] = 0;
+return test_array [0];
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  ac_hi=-1 ac_mid=-1
+  while :; do
+    cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+$4
+int
+main ()
+{
+static int test_array [1 - 2 * !(($2) >= $ac_mid)];
+test_array [0] = 0;
+return test_array [0];
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  ac_lo=$ac_mid; break
+else
+  as_fn_arith '(' $ac_mid ')' - 1 && ac_hi=$as_val
+			if test $ac_mid -le $ac_hi; then
+			  ac_lo= ac_hi=
+			  break
+			fi
+			as_fn_arith 2 '*' $ac_mid && ac_mid=$as_val
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+  done
+else
+  ac_lo= ac_hi=
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+# Binary search between lo and hi bounds.
+while test "x$ac_lo" != "x$ac_hi"; do
+  as_fn_arith '(' $ac_hi - $ac_lo ')' / 2 + $ac_lo && ac_mid=$as_val
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+$4
+int
+main ()
+{
+static int test_array [1 - 2 * !(($2) <= $ac_mid)];
+test_array [0] = 0;
+return test_array [0];
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  ac_hi=$ac_mid
+else
+  as_fn_arith '(' $ac_mid ')' + 1 && ac_lo=$as_val
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+done
+case $ac_lo in #((
+?*) eval "$3=\$ac_lo"; ac_retval=0 ;;
+'') ac_retval=1 ;;
+esac
+  else
+    cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+$4
+static long int longval () { return $2; }
+static unsigned long int ulongval () { return $2; }
+#include <stdio.h>
+#include <stdlib.h>
+int
+main ()
+{
+
+  FILE *f = fopen ("conftest.val", "w");
+  if (! f)
+    return 1;
+  if (($2) < 0)
+    {
+      long int i = longval ();
+      if (i != ($2))
+	return 1;
+      fprintf (f, "%ld", i);
+    }
+  else
+    {
+      unsigned long int i = ulongval ();
+      if (i != ($2))
+	return 1;
+      fprintf (f, "%lu", i);
+    }
+  /* Do not output a trailing newline, as this causes \r\n confusion
+     on some platforms.  */
+  return ferror (f) || fclose (f) != 0;
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_run "$LINENO"; then :
+  echo >>conftest.val; read $3 <conftest.val; ac_retval=0
+else
+  ac_retval=1
+fi
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
+  conftest.$ac_objext conftest.beam conftest.$ac_ext
+rm -f conftest.val
+
+  fi
+  eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
+  as_fn_set_status $ac_retval
+
+} # ac_fn_c_compute_int
+cat >config.log <<_ACEOF
+This file contains any messages produced by compilers while
+running configure, to aid debugging if configure makes a mistake.
+
+It was created by Haskell base package $as_me 1.0, which was
+generated by GNU Autoconf 2.69.  Invocation command line was
+
+  $ $0 $@
+
+_ACEOF
+exec 5>>config.log
+{
+cat <<_ASUNAME
+## --------- ##
+## Platform. ##
+## --------- ##
+
+hostname = `(hostname || uname -n) 2>/dev/null | sed 1q`
+uname -m = `(uname -m) 2>/dev/null || echo unknown`
+uname -r = `(uname -r) 2>/dev/null || echo unknown`
+uname -s = `(uname -s) 2>/dev/null || echo unknown`
+uname -v = `(uname -v) 2>/dev/null || echo unknown`
+
+/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown`
+/bin/uname -X     = `(/bin/uname -X) 2>/dev/null     || echo unknown`
+
+/bin/arch              = `(/bin/arch) 2>/dev/null              || echo unknown`
+/usr/bin/arch -k       = `(/usr/bin/arch -k) 2>/dev/null       || echo unknown`
+/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown`
+/usr/bin/hostinfo      = `(/usr/bin/hostinfo) 2>/dev/null      || echo unknown`
+/bin/machine           = `(/bin/machine) 2>/dev/null           || echo unknown`
+/usr/bin/oslevel       = `(/usr/bin/oslevel) 2>/dev/null       || echo unknown`
+/bin/universe          = `(/bin/universe) 2>/dev/null          || echo unknown`
+
+_ASUNAME
+
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    $as_echo "PATH: $as_dir"
+  done
+IFS=$as_save_IFS
+
+} >&5
+
+cat >&5 <<_ACEOF
+
+
+## ----------- ##
+## Core tests. ##
+## ----------- ##
+
+_ACEOF
+
+
+# Keep a trace of the command line.
+# Strip out --no-create and --no-recursion so they do not pile up.
+# Strip out --silent because we don't want to record it for future runs.
+# Also quote any args containing shell meta-characters.
+# Make two passes to allow for proper duplicate-argument suppression.
+ac_configure_args=
+ac_configure_args0=
+ac_configure_args1=
+ac_must_keep_next=false
+for ac_pass in 1 2
+do
+  for ac_arg
+  do
+    case $ac_arg in
+    -no-create | --no-c* | -n | -no-recursion | --no-r*) continue ;;
+    -q | -quiet | --quiet | --quie | --qui | --qu | --q \
+    | -silent | --silent | --silen | --sile | --sil)
+      continue ;;
+    *\'*)
+      ac_arg=`$as_echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;;
+    esac
+    case $ac_pass in
+    1) as_fn_append ac_configure_args0 " '$ac_arg'" ;;
+    2)
+      as_fn_append ac_configure_args1 " '$ac_arg'"
+      if test $ac_must_keep_next = true; then
+	ac_must_keep_next=false # Got value, back to normal.
+      else
+	case $ac_arg in
+	  *=* | --config-cache | -C | -disable-* | --disable-* \
+	  | -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \
+	  | -q | -quiet | --q* | -silent | --sil* | -v | -verb* \
+	  | -with-* | --with-* | -without-* | --without-* | --x)
+	    case "$ac_configure_args0 " in
+	      "$ac_configure_args1"*" '$ac_arg' "* ) continue ;;
+	    esac
+	    ;;
+	  -* ) ac_must_keep_next=true ;;
+	esac
+      fi
+      as_fn_append ac_configure_args " '$ac_arg'"
+      ;;
+    esac
+  done
+done
+{ ac_configure_args0=; unset ac_configure_args0;}
+{ ac_configure_args1=; unset ac_configure_args1;}
+
+# When interrupted or exit'd, cleanup temporary files, and complete
+# config.log.  We remove comments because anyway the quotes in there
+# would cause problems or look ugly.
+# WARNING: Use '\'' to represent an apostrophe within the trap.
+# WARNING: Do not start the trap code with a newline, due to a FreeBSD 4.0 bug.
+trap 'exit_status=$?
+  # Save into config.log some information that might help in debugging.
+  {
+    echo
+
+    $as_echo "## ---------------- ##
+## Cache variables. ##
+## ---------------- ##"
+    echo
+    # The following way of writing the cache mishandles newlines in values,
+(
+  for ac_var in `(set) 2>&1 | sed -n '\''s/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'\''`; do
+    eval ac_val=\$$ac_var
+    case $ac_val in #(
+    *${as_nl}*)
+      case $ac_var in #(
+      *_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5
+$as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;;
+      esac
+      case $ac_var in #(
+      _ | IFS | as_nl) ;; #(
+      BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #(
+      *) { eval $ac_var=; unset $ac_var;} ;;
+      esac ;;
+    esac
+  done
+  (set) 2>&1 |
+    case $as_nl`(ac_space='\'' '\''; set) 2>&1` in #(
+    *${as_nl}ac_space=\ *)
+      sed -n \
+	"s/'\''/'\''\\\\'\'''\''/g;
+	  s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\''\\2'\''/p"
+      ;; #(
+    *)
+      sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p"
+      ;;
+    esac |
+    sort
+)
+    echo
+
+    $as_echo "## ----------------- ##
+## Output variables. ##
+## ----------------- ##"
+    echo
+    for ac_var in $ac_subst_vars
+    do
+      eval ac_val=\$$ac_var
+      case $ac_val in
+      *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;;
+      esac
+      $as_echo "$ac_var='\''$ac_val'\''"
+    done | sort
+    echo
+
+    if test -n "$ac_subst_files"; then
+      $as_echo "## ------------------- ##
+## File substitutions. ##
+## ------------------- ##"
+      echo
+      for ac_var in $ac_subst_files
+      do
+	eval ac_val=\$$ac_var
+	case $ac_val in
+	*\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;;
+	esac
+	$as_echo "$ac_var='\''$ac_val'\''"
+      done | sort
+      echo
+    fi
+
+    if test -s confdefs.h; then
+      $as_echo "## ----------- ##
+## confdefs.h. ##
+## ----------- ##"
+      echo
+      cat confdefs.h
+      echo
+    fi
+    test "$ac_signal" != 0 &&
+      $as_echo "$as_me: caught signal $ac_signal"
+    $as_echo "$as_me: exit $exit_status"
+  } >&5
+  rm -f core *.core core.conftest.* &&
+    rm -f -r conftest* confdefs* conf$$* $ac_clean_files &&
+    exit $exit_status
+' 0
+for ac_signal in 1 2 13 15; do
+  trap 'ac_signal='$ac_signal'; as_fn_exit 1' $ac_signal
+done
+ac_signal=0
+
+# confdefs.h avoids OS command line length limits that DEFS can exceed.
+rm -f -r conftest* confdefs.h
+
+$as_echo "/* confdefs.h */" > confdefs.h
+
+# Predefined preprocessor variables.
+
+cat >>confdefs.h <<_ACEOF
+#define PACKAGE_NAME "$PACKAGE_NAME"
+_ACEOF
+
+cat >>confdefs.h <<_ACEOF
+#define PACKAGE_TARNAME "$PACKAGE_TARNAME"
+_ACEOF
+
+cat >>confdefs.h <<_ACEOF
+#define PACKAGE_VERSION "$PACKAGE_VERSION"
+_ACEOF
+
+cat >>confdefs.h <<_ACEOF
+#define PACKAGE_STRING "$PACKAGE_STRING"
+_ACEOF
+
+cat >>confdefs.h <<_ACEOF
+#define PACKAGE_BUGREPORT "$PACKAGE_BUGREPORT"
+_ACEOF
+
+cat >>confdefs.h <<_ACEOF
+#define PACKAGE_URL "$PACKAGE_URL"
+_ACEOF
+
+
+# Let the site file select an alternate cache file if it wants to.
+# Prefer an explicitly selected file to automatically selected ones.
+ac_site_file1=NONE
+ac_site_file2=NONE
+if test -n "$CONFIG_SITE"; then
+  # We do not want a PATH search for config.site.
+  case $CONFIG_SITE in #((
+    -*)  ac_site_file1=./$CONFIG_SITE;;
+    */*) ac_site_file1=$CONFIG_SITE;;
+    *)   ac_site_file1=./$CONFIG_SITE;;
+  esac
+elif test "x$prefix" != xNONE; then
+  ac_site_file1=$prefix/share/config.site
+  ac_site_file2=$prefix/etc/config.site
+else
+  ac_site_file1=$ac_default_prefix/share/config.site
+  ac_site_file2=$ac_default_prefix/etc/config.site
+fi
+for ac_site_file in "$ac_site_file1" "$ac_site_file2"
+do
+  test "x$ac_site_file" = xNONE && continue
+  if test /dev/null != "$ac_site_file" && test -r "$ac_site_file"; then
+    { $as_echo "$as_me:${as_lineno-$LINENO}: loading site script $ac_site_file" >&5
+$as_echo "$as_me: loading site script $ac_site_file" >&6;}
+    sed 's/^/| /' "$ac_site_file" >&5
+    . "$ac_site_file" \
+      || { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error $? "failed to load site script $ac_site_file
+See \`config.log' for more details" "$LINENO" 5; }
+  fi
+done
+
+if test -r "$cache_file"; then
+  # Some versions of bash will fail to source /dev/null (special files
+  # actually), so we avoid doing that.  DJGPP emulates it as a regular file.
+  if test /dev/null != "$cache_file" && test -f "$cache_file"; then
+    { $as_echo "$as_me:${as_lineno-$LINENO}: loading cache $cache_file" >&5
+$as_echo "$as_me: loading cache $cache_file" >&6;}
+    case $cache_file in
+      [\\/]* | ?:[\\/]* ) . "$cache_file";;
+      *)                      . "./$cache_file";;
+    esac
+  fi
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: creating cache $cache_file" >&5
+$as_echo "$as_me: creating cache $cache_file" >&6;}
+  >$cache_file
+fi
+
+# Check that the precious variables saved in the cache have kept the same
+# value.
+ac_cache_corrupted=false
+for ac_var in $ac_precious_vars; do
+  eval ac_old_set=\$ac_cv_env_${ac_var}_set
+  eval ac_new_set=\$ac_env_${ac_var}_set
+  eval ac_old_val=\$ac_cv_env_${ac_var}_value
+  eval ac_new_val=\$ac_env_${ac_var}_value
+  case $ac_old_set,$ac_new_set in
+    set,)
+      { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5
+$as_echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;}
+      ac_cache_corrupted=: ;;
+    ,set)
+      { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was not set in the previous run" >&5
+$as_echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;}
+      ac_cache_corrupted=: ;;
+    ,);;
+    *)
+      if test "x$ac_old_val" != "x$ac_new_val"; then
+	# differences in whitespace do not lead to failure.
+	ac_old_val_w=`echo x $ac_old_val`
+	ac_new_val_w=`echo x $ac_new_val`
+	if test "$ac_old_val_w" != "$ac_new_val_w"; then
+	  { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' has changed since the previous run:" >&5
+$as_echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;}
+	  ac_cache_corrupted=:
+	else
+	  { $as_echo "$as_me:${as_lineno-$LINENO}: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&5
+$as_echo "$as_me: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&2;}
+	  eval $ac_var=\$ac_old_val
+	fi
+	{ $as_echo "$as_me:${as_lineno-$LINENO}:   former value:  \`$ac_old_val'" >&5
+$as_echo "$as_me:   former value:  \`$ac_old_val'" >&2;}
+	{ $as_echo "$as_me:${as_lineno-$LINENO}:   current value: \`$ac_new_val'" >&5
+$as_echo "$as_me:   current value: \`$ac_new_val'" >&2;}
+      fi;;
+  esac
+  # Pass precious variables to config.status.
+  if test "$ac_new_set" = set; then
+    case $ac_new_val in
+    *\'*) ac_arg=$ac_var=`$as_echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;;
+    *) ac_arg=$ac_var=$ac_new_val ;;
+    esac
+    case " $ac_configure_args " in
+      *" '$ac_arg' "*) ;; # Avoid dups.  Use of quotes ensures accuracy.
+      *) as_fn_append ac_configure_args " '$ac_arg'" ;;
+    esac
+  fi
+done
+if $ac_cache_corrupted; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+  { $as_echo "$as_me:${as_lineno-$LINENO}: error: changes in the environment can compromise the build" >&5
+$as_echo "$as_me: error: changes in the environment can compromise the build" >&2;}
+  as_fn_error $? "run \`make distclean' and/or \`rm $cache_file' and start over" "$LINENO" 5
+fi
+## -------------------- ##
+## Main body of script. ##
+## -------------------- ##
+
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+
+
+# Safety check: Ensure that we are in the correct source directory.
+
+
+ac_config_headers="$ac_config_headers include/HsBaseConfig.h include/EventConfig.h"
+
+
+ac_aux_dir=
+for ac_dir in "$srcdir" "$srcdir/.." "$srcdir/../.."; do
+  if test -f "$ac_dir/install-sh"; then
+    ac_aux_dir=$ac_dir
+    ac_install_sh="$ac_aux_dir/install-sh -c"
+    break
+  elif test -f "$ac_dir/install.sh"; then
+    ac_aux_dir=$ac_dir
+    ac_install_sh="$ac_aux_dir/install.sh -c"
+    break
+  elif test -f "$ac_dir/shtool"; then
+    ac_aux_dir=$ac_dir
+    ac_install_sh="$ac_aux_dir/shtool install -c"
+    break
+  fi
+done
+if test -z "$ac_aux_dir"; then
+  as_fn_error $? "cannot find install-sh, install.sh, or shtool in \"$srcdir\" \"$srcdir/..\" \"$srcdir/../..\"" "$LINENO" 5
+fi
+
+# These three variables are undocumented and unsupported,
+# and are intended to be withdrawn in a future Autoconf release.
+# They can cause serious problems if a builder's source tree is in a directory
+# whose full name contains unusual characters.
+ac_config_guess="$SHELL $ac_aux_dir/config.guess"  # Please don't use this var.
+ac_config_sub="$SHELL $ac_aux_dir/config.sub"  # Please don't use this var.
+ac_configure="$SHELL $ac_aux_dir/configure"  # Please don't use this var.
+
+
+# Make sure we can run config.sub.
+$SHELL "$ac_aux_dir/config.sub" sun4 >/dev/null 2>&1 ||
+  as_fn_error $? "cannot run $SHELL $ac_aux_dir/config.sub" "$LINENO" 5
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking build system type" >&5
+$as_echo_n "checking build system type... " >&6; }
+if ${ac_cv_build+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  ac_build_alias=$build_alias
+test "x$ac_build_alias" = x &&
+  ac_build_alias=`$SHELL "$ac_aux_dir/config.guess"`
+test "x$ac_build_alias" = x &&
+  as_fn_error $? "cannot guess build type; you must specify one" "$LINENO" 5
+ac_cv_build=`$SHELL "$ac_aux_dir/config.sub" $ac_build_alias` ||
+  as_fn_error $? "$SHELL $ac_aux_dir/config.sub $ac_build_alias failed" "$LINENO" 5
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_build" >&5
+$as_echo "$ac_cv_build" >&6; }
+case $ac_cv_build in
+*-*-*) ;;
+*) as_fn_error $? "invalid value of canonical build" "$LINENO" 5;;
+esac
+build=$ac_cv_build
+ac_save_IFS=$IFS; IFS='-'
+set x $ac_cv_build
+shift
+build_cpu=$1
+build_vendor=$2
+shift; shift
+# Remember, the first character of IFS is used to create $*,
+# except with old shells:
+build_os=$*
+IFS=$ac_save_IFS
+case $build_os in *\ *) build_os=`echo "$build_os" | sed 's/ /-/g'`;; esac
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking host system type" >&5
+$as_echo_n "checking host system type... " >&6; }
+if ${ac_cv_host+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test "x$host_alias" = x; then
+  ac_cv_host=$ac_cv_build
+else
+  ac_cv_host=`$SHELL "$ac_aux_dir/config.sub" $host_alias` ||
+    as_fn_error $? "$SHELL $ac_aux_dir/config.sub $host_alias failed" "$LINENO" 5
+fi
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_host" >&5
+$as_echo "$ac_cv_host" >&6; }
+case $ac_cv_host in
+*-*-*) ;;
+*) as_fn_error $? "invalid value of canonical host" "$LINENO" 5;;
+esac
+host=$ac_cv_host
+ac_save_IFS=$IFS; IFS='-'
+set x $ac_cv_host
+shift
+host_cpu=$1
+host_vendor=$2
+shift; shift
+# Remember, the first character of IFS is used to create $*,
+# except with old shells:
+host_os=$*
+IFS=$ac_save_IFS
+case $host_os in *\ *) host_os=`echo "$host_os" | sed 's/ /-/g'`;; esac
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking target system type" >&5
+$as_echo_n "checking target system type... " >&6; }
+if ${ac_cv_target+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test "x$target_alias" = x; then
+  ac_cv_target=$ac_cv_host
+else
+  ac_cv_target=`$SHELL "$ac_aux_dir/config.sub" $target_alias` ||
+    as_fn_error $? "$SHELL $ac_aux_dir/config.sub $target_alias failed" "$LINENO" 5
+fi
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_target" >&5
+$as_echo "$ac_cv_target" >&6; }
+case $ac_cv_target in
+*-*-*) ;;
+*) as_fn_error $? "invalid value of canonical target" "$LINENO" 5;;
+esac
+target=$ac_cv_target
+ac_save_IFS=$IFS; IFS='-'
+set x $ac_cv_target
+shift
+target_cpu=$1
+target_vendor=$2
+shift; shift
+# Remember, the first character of IFS is used to create $*,
+# except with old shells:
+target_os=$*
+IFS=$ac_save_IFS
+case $target_os in *\ *) target_os=`echo "$target_os" | sed 's/ /-/g'`;; esac
+
+
+# The aliases save the names the user supplied, while $host etc.
+# will get canonicalized.
+test -n "$target_alias" &&
+  test "$program_prefix$program_suffix$program_transform_name" = \
+    NONENONEs,x,x, &&
+  program_prefix=${target_alias}-
+
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+if test -n "$ac_tool_prefix"; then
+  # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args.
+set dummy ${ac_tool_prefix}gcc; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_CC+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$CC"; then
+  ac_cv_prog_CC="$CC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_prog_CC="${ac_tool_prefix}gcc"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+fi
+fi
+CC=$ac_cv_prog_CC
+if test -n "$CC"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5
+$as_echo "$CC" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+fi
+if test -z "$ac_cv_prog_CC"; then
+  ac_ct_CC=$CC
+  # Extract the first word of "gcc", so it can be a program name with args.
+set dummy gcc; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_ac_ct_CC+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$ac_ct_CC"; then
+  ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_prog_ac_ct_CC="gcc"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_CC=$ac_cv_prog_ac_ct_CC
+if test -n "$ac_ct_CC"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5
+$as_echo "$ac_ct_CC" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+  if test "x$ac_ct_CC" = x; then
+    CC=""
+  else
+    case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+    CC=$ac_ct_CC
+  fi
+else
+  CC="$ac_cv_prog_CC"
+fi
+
+if test -z "$CC"; then
+          if test -n "$ac_tool_prefix"; then
+    # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args.
+set dummy ${ac_tool_prefix}cc; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_CC+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$CC"; then
+  ac_cv_prog_CC="$CC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_prog_CC="${ac_tool_prefix}cc"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+fi
+fi
+CC=$ac_cv_prog_CC
+if test -n "$CC"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5
+$as_echo "$CC" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+  fi
+fi
+if test -z "$CC"; then
+  # Extract the first word of "cc", so it can be a program name with args.
+set dummy cc; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_CC+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$CC"; then
+  ac_cv_prog_CC="$CC" # Let the user override the test.
+else
+  ac_prog_rejected=no
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then
+       ac_prog_rejected=yes
+       continue
+     fi
+    ac_cv_prog_CC="cc"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+if test $ac_prog_rejected = yes; then
+  # We found a bogon in the path, so make sure we never use it.
+  set dummy $ac_cv_prog_CC
+  shift
+  if test $# != 0; then
+    # We chose a different compiler from the bogus one.
+    # However, it has the same basename, so the bogon will be chosen
+    # first if we set CC to just the basename; use the full file name.
+    shift
+    ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@"
+  fi
+fi
+fi
+fi
+CC=$ac_cv_prog_CC
+if test -n "$CC"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5
+$as_echo "$CC" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+fi
+if test -z "$CC"; then
+  if test -n "$ac_tool_prefix"; then
+  for ac_prog in cl.exe
+  do
+    # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args.
+set dummy $ac_tool_prefix$ac_prog; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_CC+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$CC"; then
+  ac_cv_prog_CC="$CC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_prog_CC="$ac_tool_prefix$ac_prog"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+fi
+fi
+CC=$ac_cv_prog_CC
+if test -n "$CC"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5
+$as_echo "$CC" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+    test -n "$CC" && break
+  done
+fi
+if test -z "$CC"; then
+  ac_ct_CC=$CC
+  for ac_prog in cl.exe
+do
+  # Extract the first word of "$ac_prog", so it can be a program name with args.
+set dummy $ac_prog; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_ac_ct_CC+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$ac_ct_CC"; then
+  ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_prog_ac_ct_CC="$ac_prog"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_CC=$ac_cv_prog_ac_ct_CC
+if test -n "$ac_ct_CC"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5
+$as_echo "$ac_ct_CC" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+  test -n "$ac_ct_CC" && break
+done
+
+  if test "x$ac_ct_CC" = x; then
+    CC=""
+  else
+    case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+    CC=$ac_ct_CC
+  fi
+fi
+
+fi
+
+
+test -z "$CC" && { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error $? "no acceptable C compiler found in \$PATH
+See \`config.log' for more details" "$LINENO" 5; }
+
+# Provide some information about the compiler.
+$as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler version" >&5
+set X $ac_compile
+ac_compiler=$2
+for ac_option in --version -v -V -qversion; do
+  { { ac_try="$ac_compiler $ac_option >&5"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+  (eval "$ac_compiler $ac_option >&5") 2>conftest.err
+  ac_status=$?
+  if test -s conftest.err; then
+    sed '10a\
+... rest of stderr output deleted ...
+         10q' conftest.err >conftest.er1
+    cat conftest.er1 >&5
+  fi
+  rm -f conftest.er1 conftest.err
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }
+done
+
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+ac_clean_files_save=$ac_clean_files
+ac_clean_files="$ac_clean_files a.out a.out.dSYM a.exe b.out"
+# Try to create an executable without -o first, disregard a.out.
+# It will help us diagnose broken compilers, and finding out an intuition
+# of exeext.
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the C compiler works" >&5
+$as_echo_n "checking whether the C compiler works... " >&6; }
+ac_link_default=`$as_echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'`
+
+# The possible output files:
+ac_files="a.out conftest.exe conftest a.exe a_out.exe b.out conftest.*"
+
+ac_rmfiles=
+for ac_file in $ac_files
+do
+  case $ac_file in
+    *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;;
+    * ) ac_rmfiles="$ac_rmfiles $ac_file";;
+  esac
+done
+rm -f $ac_rmfiles
+
+if { { ac_try="$ac_link_default"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+  (eval "$ac_link_default") 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }; then :
+  # Autoconf-2.13 could set the ac_cv_exeext variable to `no'.
+# So ignore a value of `no', otherwise this would lead to `EXEEXT = no'
+# in a Makefile.  We should not override ac_cv_exeext if it was cached,
+# so that the user can short-circuit this test for compilers unknown to
+# Autoconf.
+for ac_file in $ac_files ''
+do
+  test -f "$ac_file" || continue
+  case $ac_file in
+    *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj )
+	;;
+    [ab].out )
+	# We found the default executable, but exeext='' is most
+	# certainly right.
+	break;;
+    *.* )
+	if test "${ac_cv_exeext+set}" = set && test "$ac_cv_exeext" != no;
+	then :; else
+	   ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'`
+	fi
+	# We set ac_cv_exeext here because the later test for it is not
+	# safe: cross compilers may not add the suffix if given an `-o'
+	# argument, so we may need to know it at that point already.
+	# Even if this section looks crufty: it has the advantage of
+	# actually working.
+	break;;
+    * )
+	break;;
+  esac
+done
+test "$ac_cv_exeext" = no && ac_cv_exeext=
+
+else
+  ac_file=''
+fi
+if test -z "$ac_file"; then :
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+$as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error 77 "C compiler cannot create executables
+See \`config.log' for more details" "$LINENO" 5; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler default output file name" >&5
+$as_echo_n "checking for C compiler default output file name... " >&6; }
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_file" >&5
+$as_echo "$ac_file" >&6; }
+ac_exeext=$ac_cv_exeext
+
+rm -f -r a.out a.out.dSYM a.exe conftest$ac_cv_exeext b.out
+ac_clean_files=$ac_clean_files_save
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of executables" >&5
+$as_echo_n "checking for suffix of executables... " >&6; }
+if { { ac_try="$ac_link"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+  (eval "$ac_link") 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }; then :
+  # If both `conftest.exe' and `conftest' are `present' (well, observable)
+# catch `conftest.exe'.  For instance with Cygwin, `ls conftest' will
+# work properly (i.e., refer to `conftest.exe'), while it won't with
+# `rm'.
+for ac_file in conftest.exe conftest conftest.*; do
+  test -f "$ac_file" || continue
+  case $ac_file in
+    *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;;
+    *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'`
+	  break;;
+    * ) break;;
+  esac
+done
+else
+  { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error $? "cannot compute suffix of executables: cannot compile and link
+See \`config.log' for more details" "$LINENO" 5; }
+fi
+rm -f conftest conftest$ac_cv_exeext
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_exeext" >&5
+$as_echo "$ac_cv_exeext" >&6; }
+
+rm -f conftest.$ac_ext
+EXEEXT=$ac_cv_exeext
+ac_exeext=$EXEEXT
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#include <stdio.h>
+int
+main ()
+{
+FILE *f = fopen ("conftest.out", "w");
+ return ferror (f) || fclose (f) != 0;
+
+  ;
+  return 0;
+}
+_ACEOF
+ac_clean_files="$ac_clean_files conftest.out"
+# Check that the compiler produces executables we can run.  If not, either
+# the compiler is broken, or we cross compile.
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are cross compiling" >&5
+$as_echo_n "checking whether we are cross compiling... " >&6; }
+if test "$cross_compiling" != yes; then
+  { { ac_try="$ac_link"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+  (eval "$ac_link") 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }
+  if { ac_try='./conftest$ac_cv_exeext'
+  { { case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+  (eval "$ac_try") 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }; }; then
+    cross_compiling=no
+  else
+    if test "$cross_compiling" = maybe; then
+	cross_compiling=yes
+    else
+	{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error $? "cannot run C compiled programs.
+If you meant to cross compile, use \`--host'.
+See \`config.log' for more details" "$LINENO" 5; }
+    fi
+  fi
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $cross_compiling" >&5
+$as_echo "$cross_compiling" >&6; }
+
+rm -f conftest.$ac_ext conftest$ac_cv_exeext conftest.out
+ac_clean_files=$ac_clean_files_save
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of object files" >&5
+$as_echo_n "checking for suffix of object files... " >&6; }
+if ${ac_cv_objext+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.o conftest.obj
+if { { ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+  (eval "$ac_compile") 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }; then :
+  for ac_file in conftest.o conftest.obj conftest.*; do
+  test -f "$ac_file" || continue;
+  case $ac_file in
+    *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM ) ;;
+    *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'`
+       break;;
+  esac
+done
+else
+  $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error $? "cannot compute suffix of object files: cannot compile
+See \`config.log' for more details" "$LINENO" 5; }
+fi
+rm -f conftest.$ac_cv_objext conftest.$ac_ext
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_objext" >&5
+$as_echo "$ac_cv_objext" >&6; }
+OBJEXT=$ac_cv_objext
+ac_objext=$OBJEXT
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU C compiler" >&5
+$as_echo_n "checking whether we are using the GNU C compiler... " >&6; }
+if ${ac_cv_c_compiler_gnu+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+int
+main ()
+{
+#ifndef __GNUC__
+       choke me
+#endif
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  ac_compiler_gnu=yes
+else
+  ac_compiler_gnu=no
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+ac_cv_c_compiler_gnu=$ac_compiler_gnu
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_compiler_gnu" >&5
+$as_echo "$ac_cv_c_compiler_gnu" >&6; }
+if test $ac_compiler_gnu = yes; then
+  GCC=yes
+else
+  GCC=
+fi
+ac_test_CFLAGS=${CFLAGS+set}
+ac_save_CFLAGS=$CFLAGS
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC accepts -g" >&5
+$as_echo_n "checking whether $CC accepts -g... " >&6; }
+if ${ac_cv_prog_cc_g+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  ac_save_c_werror_flag=$ac_c_werror_flag
+   ac_c_werror_flag=yes
+   ac_cv_prog_cc_g=no
+   CFLAGS="-g"
+   cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  ac_cv_prog_cc_g=yes
+else
+  CFLAGS=""
+      cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+
+else
+  ac_c_werror_flag=$ac_save_c_werror_flag
+	 CFLAGS="-g"
+	 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  ac_cv_prog_cc_g=yes
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+   ac_c_werror_flag=$ac_save_c_werror_flag
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_g" >&5
+$as_echo "$ac_cv_prog_cc_g" >&6; }
+if test "$ac_test_CFLAGS" = set; then
+  CFLAGS=$ac_save_CFLAGS
+elif test $ac_cv_prog_cc_g = yes; then
+  if test "$GCC" = yes; then
+    CFLAGS="-g -O2"
+  else
+    CFLAGS="-g"
+  fi
+else
+  if test "$GCC" = yes; then
+    CFLAGS="-O2"
+  else
+    CFLAGS=
+  fi
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CC option to accept ISO C89" >&5
+$as_echo_n "checking for $CC option to accept ISO C89... " >&6; }
+if ${ac_cv_prog_cc_c89+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  ac_cv_prog_cc_c89=no
+ac_save_CC=$CC
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#include <stdarg.h>
+#include <stdio.h>
+struct stat;
+/* Most of the following tests are stolen from RCS 5.7's src/conf.sh.  */
+struct buf { int x; };
+FILE * (*rcsopen) (struct buf *, struct stat *, int);
+static char *e (p, i)
+     char **p;
+     int i;
+{
+  return p[i];
+}
+static char *f (char * (*g) (char **, int), char **p, ...)
+{
+  char *s;
+  va_list v;
+  va_start (v,p);
+  s = g (p, va_arg (v,int));
+  va_end (v);
+  return s;
+}
+
+/* OSF 4.0 Compaq cc is some sort of almost-ANSI by default.  It has
+   function prototypes and stuff, but not '\xHH' hex character constants.
+   These don't provoke an error unfortunately, instead are silently treated
+   as 'x'.  The following induces an error, until -std is added to get
+   proper ANSI mode.  Curiously '\x00'!='x' always comes out true, for an
+   array size at least.  It's necessary to write '\x00'==0 to get something
+   that's true only with -std.  */
+int osf4_cc_array ['\x00' == 0 ? 1 : -1];
+
+/* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters
+   inside strings and character constants.  */
+#define FOO(x) 'x'
+int xlc6_cc_array[FOO(a) == 'x' ? 1 : -1];
+
+int test (int i, double x);
+struct s1 {int (*f) (int a);};
+struct s2 {int (*f) (double a);};
+int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int);
+int argc;
+char **argv;
+int
+main ()
+{
+return f (e, argv, 0) != argv[0]  ||  f (e, argv, 1) != argv[1];
+  ;
+  return 0;
+}
+_ACEOF
+for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std \
+	-Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__"
+do
+  CC="$ac_save_CC $ac_arg"
+  if ac_fn_c_try_compile "$LINENO"; then :
+  ac_cv_prog_cc_c89=$ac_arg
+fi
+rm -f core conftest.err conftest.$ac_objext
+  test "x$ac_cv_prog_cc_c89" != "xno" && break
+done
+rm -f conftest.$ac_ext
+CC=$ac_save_CC
+
+fi
+# AC_CACHE_VAL
+case "x$ac_cv_prog_cc_c89" in
+  x)
+    { $as_echo "$as_me:${as_lineno-$LINENO}: result: none needed" >&5
+$as_echo "none needed" >&6; } ;;
+  xno)
+    { $as_echo "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5
+$as_echo "unsupported" >&6; } ;;
+  *)
+    CC="$CC $ac_cv_prog_cc_c89"
+    { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c89" >&5
+$as_echo "$ac_cv_prog_cc_c89" >&6; } ;;
+esac
+if test "x$ac_cv_prog_cc_c89" != xno; then :
+
+fi
+
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to run the C preprocessor" >&5
+$as_echo_n "checking how to run the C preprocessor... " >&6; }
+# On Suns, sometimes $CPP names a directory.
+if test -n "$CPP" && test -d "$CPP"; then
+  CPP=
+fi
+if test -z "$CPP"; then
+  if ${ac_cv_prog_CPP+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+      # Double quotes because CPP needs to be expanded
+    for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp"
+    do
+      ac_preproc_ok=false
+for ac_c_preproc_warn_flag in '' yes
+do
+  # Use a header file that comes with gcc, so configuring glibc
+  # with a fresh cross-compiler works.
+  # Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
+  # <limits.h> exists even on freestanding compilers.
+  # On the NeXT, cc -E runs the code through the compiler's parser,
+  # not just through cpp. "Syntax error" is here to catch this case.
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#ifdef __STDC__
+# include <limits.h>
+#else
+# include <assert.h>
+#endif
+		     Syntax error
+_ACEOF
+if ac_fn_c_try_cpp "$LINENO"; then :
+
+else
+  # Broken: fails on valid input.
+continue
+fi
+rm -f conftest.err conftest.i conftest.$ac_ext
+
+  # OK, works on sane cases.  Now check whether nonexistent headers
+  # can be detected and how.
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#include <ac_nonexistent.h>
+_ACEOF
+if ac_fn_c_try_cpp "$LINENO"; then :
+  # Broken: success on invalid input.
+continue
+else
+  # Passes both tests.
+ac_preproc_ok=:
+break
+fi
+rm -f conftest.err conftest.i conftest.$ac_ext
+
+done
+# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped.
+rm -f conftest.i conftest.err conftest.$ac_ext
+if $ac_preproc_ok; then :
+  break
+fi
+
+    done
+    ac_cv_prog_CPP=$CPP
+
+fi
+  CPP=$ac_cv_prog_CPP
+else
+  ac_cv_prog_CPP=$CPP
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $CPP" >&5
+$as_echo "$CPP" >&6; }
+ac_preproc_ok=false
+for ac_c_preproc_warn_flag in '' yes
+do
+  # Use a header file that comes with gcc, so configuring glibc
+  # with a fresh cross-compiler works.
+  # Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
+  # <limits.h> exists even on freestanding compilers.
+  # On the NeXT, cc -E runs the code through the compiler's parser,
+  # not just through cpp. "Syntax error" is here to catch this case.
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#ifdef __STDC__
+# include <limits.h>
+#else
+# include <assert.h>
+#endif
+		     Syntax error
+_ACEOF
+if ac_fn_c_try_cpp "$LINENO"; then :
+
+else
+  # Broken: fails on valid input.
+continue
+fi
+rm -f conftest.err conftest.i conftest.$ac_ext
+
+  # OK, works on sane cases.  Now check whether nonexistent headers
+  # can be detected and how.
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#include <ac_nonexistent.h>
+_ACEOF
+if ac_fn_c_try_cpp "$LINENO"; then :
+  # Broken: success on invalid input.
+continue
+else
+  # Passes both tests.
+ac_preproc_ok=:
+break
+fi
+rm -f conftest.err conftest.i conftest.$ac_ext
+
+done
+# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped.
+rm -f conftest.i conftest.err conftest.$ac_ext
+if $ac_preproc_ok; then :
+
+else
+  { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error $? "C preprocessor \"$CPP\" fails sanity check
+See \`config.log' for more details" "$LINENO" 5; }
+fi
+
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for grep that handles long lines and -e" >&5
+$as_echo_n "checking for grep that handles long lines and -e... " >&6; }
+if ${ac_cv_path_GREP+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -z "$GREP"; then
+  ac_path_GREP_found=false
+  # Loop through the user's path and test for each of PROGNAME-LIST
+  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_prog in grep ggrep; do
+    for ac_exec_ext in '' $ac_executable_extensions; do
+      ac_path_GREP="$as_dir/$ac_prog$ac_exec_ext"
+      as_fn_executable_p "$ac_path_GREP" || continue
+# Check for GNU ac_path_GREP and select it if it is found.
+  # Check for GNU $ac_path_GREP
+case `"$ac_path_GREP" --version 2>&1` in
+*GNU*)
+  ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_found=:;;
+*)
+  ac_count=0
+  $as_echo_n 0123456789 >"conftest.in"
+  while :
+  do
+    cat "conftest.in" "conftest.in" >"conftest.tmp"
+    mv "conftest.tmp" "conftest.in"
+    cp "conftest.in" "conftest.nl"
+    $as_echo 'GREP' >> "conftest.nl"
+    "$ac_path_GREP" -e 'GREP$' -e '-(cannot match)-' < "conftest.nl" >"conftest.out" 2>/dev/null || break
+    diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break
+    as_fn_arith $ac_count + 1 && ac_count=$as_val
+    if test $ac_count -gt ${ac_path_GREP_max-0}; then
+      # Best one so far, save it but keep looking for a better one
+      ac_cv_path_GREP="$ac_path_GREP"
+      ac_path_GREP_max=$ac_count
+    fi
+    # 10*(2^10) chars as input seems more than enough
+    test $ac_count -gt 10 && break
+  done
+  rm -f conftest.in conftest.tmp conftest.nl conftest.out;;
+esac
+
+      $ac_path_GREP_found && break 3
+    done
+  done
+  done
+IFS=$as_save_IFS
+  if test -z "$ac_cv_path_GREP"; then
+    as_fn_error $? "no acceptable grep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5
+  fi
+else
+  ac_cv_path_GREP=$GREP
+fi
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_GREP" >&5
+$as_echo "$ac_cv_path_GREP" >&6; }
+ GREP="$ac_cv_path_GREP"
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for egrep" >&5
+$as_echo_n "checking for egrep... " >&6; }
+if ${ac_cv_path_EGREP+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if echo a | $GREP -E '(a|b)' >/dev/null 2>&1
+   then ac_cv_path_EGREP="$GREP -E"
+   else
+     if test -z "$EGREP"; then
+  ac_path_EGREP_found=false
+  # Loop through the user's path and test for each of PROGNAME-LIST
+  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_prog in egrep; do
+    for ac_exec_ext in '' $ac_executable_extensions; do
+      ac_path_EGREP="$as_dir/$ac_prog$ac_exec_ext"
+      as_fn_executable_p "$ac_path_EGREP" || continue
+# Check for GNU ac_path_EGREP and select it if it is found.
+  # Check for GNU $ac_path_EGREP
+case `"$ac_path_EGREP" --version 2>&1` in
+*GNU*)
+  ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_found=:;;
+*)
+  ac_count=0
+  $as_echo_n 0123456789 >"conftest.in"
+  while :
+  do
+    cat "conftest.in" "conftest.in" >"conftest.tmp"
+    mv "conftest.tmp" "conftest.in"
+    cp "conftest.in" "conftest.nl"
+    $as_echo 'EGREP' >> "conftest.nl"
+    "$ac_path_EGREP" 'EGREP$' < "conftest.nl" >"conftest.out" 2>/dev/null || break
+    diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break
+    as_fn_arith $ac_count + 1 && ac_count=$as_val
+    if test $ac_count -gt ${ac_path_EGREP_max-0}; then
+      # Best one so far, save it but keep looking for a better one
+      ac_cv_path_EGREP="$ac_path_EGREP"
+      ac_path_EGREP_max=$ac_count
+    fi
+    # 10*(2^10) chars as input seems more than enough
+    test $ac_count -gt 10 && break
+  done
+  rm -f conftest.in conftest.tmp conftest.nl conftest.out;;
+esac
+
+      $ac_path_EGREP_found && break 3
+    done
+  done
+  done
+IFS=$as_save_IFS
+  if test -z "$ac_cv_path_EGREP"; then
+    as_fn_error $? "no acceptable egrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5
+  fi
+else
+  ac_cv_path_EGREP=$EGREP
+fi
+
+   fi
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_EGREP" >&5
+$as_echo "$ac_cv_path_EGREP" >&6; }
+ EGREP="$ac_cv_path_EGREP"
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ANSI C header files" >&5
+$as_echo_n "checking for ANSI C header files... " >&6; }
+if ${ac_cv_header_stdc+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#include <stdlib.h>
+#include <stdarg.h>
+#include <string.h>
+#include <float.h>
+
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  ac_cv_header_stdc=yes
+else
+  ac_cv_header_stdc=no
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+
+if test $ac_cv_header_stdc = yes; then
+  # SunOS 4.x string.h does not declare mem*, contrary to ANSI.
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#include <string.h>
+
+_ACEOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+  $EGREP "memchr" >/dev/null 2>&1; then :
+
+else
+  ac_cv_header_stdc=no
+fi
+rm -f conftest*
+
+fi
+
+if test $ac_cv_header_stdc = yes; then
+  # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI.
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#include <stdlib.h>
+
+_ACEOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+  $EGREP "free" >/dev/null 2>&1; then :
+
+else
+  ac_cv_header_stdc=no
+fi
+rm -f conftest*
+
+fi
+
+if test $ac_cv_header_stdc = yes; then
+  # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi.
+  if test "$cross_compiling" = yes; then :
+  :
+else
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#include <ctype.h>
+#include <stdlib.h>
+#if ((' ' & 0x0FF) == 0x020)
+# define ISLOWER(c) ('a' <= (c) && (c) <= 'z')
+# define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c))
+#else
+# define ISLOWER(c) \
+		   (('a' <= (c) && (c) <= 'i') \
+		     || ('j' <= (c) && (c) <= 'r') \
+		     || ('s' <= (c) && (c) <= 'z'))
+# define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c))
+#endif
+
+#define XOR(e, f) (((e) && !(f)) || (!(e) && (f)))
+int
+main ()
+{
+  int i;
+  for (i = 0; i < 256; i++)
+    if (XOR (islower (i), ISLOWER (i))
+	|| toupper (i) != TOUPPER (i))
+      return 2;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_run "$LINENO"; then :
+
+else
+  ac_cv_header_stdc=no
+fi
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
+  conftest.$ac_objext conftest.beam conftest.$ac_ext
+fi
+
+fi
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_stdc" >&5
+$as_echo "$ac_cv_header_stdc" >&6; }
+if test $ac_cv_header_stdc = yes; then
+
+$as_echo "#define STDC_HEADERS 1" >>confdefs.h
+
+fi
+
+# On IRIX 5.3, sys/types and inttypes.h are conflicting.
+for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \
+		  inttypes.h stdint.h unistd.h
+do :
+  as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
+ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default
+"
+if eval test \"x\$"$as_ac_Header"\" = x"yes"; then :
+  cat >>confdefs.h <<_ACEOF
+#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1
+_ACEOF
+
+fi
+
+done
+
+
+
+  ac_fn_c_check_header_mongrel "$LINENO" "minix/config.h" "ac_cv_header_minix_config_h" "$ac_includes_default"
+if test "x$ac_cv_header_minix_config_h" = xyes; then :
+  MINIX=yes
+else
+  MINIX=
+fi
+
+
+  if test "$MINIX" = yes; then
+
+$as_echo "#define _POSIX_SOURCE 1" >>confdefs.h
+
+
+$as_echo "#define _POSIX_1_SOURCE 2" >>confdefs.h
+
+
+$as_echo "#define _MINIX 1" >>confdefs.h
+
+  fi
+
+
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether it is safe to define __EXTENSIONS__" >&5
+$as_echo_n "checking whether it is safe to define __EXTENSIONS__... " >&6; }
+if ${ac_cv_safe_to_define___extensions__+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+#         define __EXTENSIONS__ 1
+          $ac_includes_default
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  ac_cv_safe_to_define___extensions__=yes
+else
+  ac_cv_safe_to_define___extensions__=no
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_safe_to_define___extensions__" >&5
+$as_echo "$ac_cv_safe_to_define___extensions__" >&6; }
+  test $ac_cv_safe_to_define___extensions__ = yes &&
+    $as_echo "#define __EXTENSIONS__ 1" >>confdefs.h
+
+  $as_echo "#define _ALL_SOURCE 1" >>confdefs.h
+
+  $as_echo "#define _GNU_SOURCE 1" >>confdefs.h
+
+  $as_echo "#define _POSIX_PTHREAD_SEMANTICS 1" >>confdefs.h
+
+  $as_echo "#define _TANDEM_SOURCE 1" >>confdefs.h
+
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for WINDOWS platform" >&5
+$as_echo_n "checking for WINDOWS platform... " >&6; }
+case $host in
+    *mingw32*|*mingw64*|*cygwin*|*msys*)
+        WINDOWS=YES;;
+    *)
+        WINDOWS=NO;;
+esac
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $WINDOWS" >&5
+$as_echo "$WINDOWS" >&6; }
+
+# do we have long longs?
+ac_fn_c_check_type "$LINENO" "long long" "ac_cv_type_long_long" "$ac_includes_default"
+if test "x$ac_cv_type_long_long" = xyes; then :
+
+cat >>confdefs.h <<_ACEOF
+#define HAVE_LONG_LONG 1
+_ACEOF
+
+
+fi
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ANSI C header files" >&5
+$as_echo_n "checking for ANSI C header files... " >&6; }
+if ${ac_cv_header_stdc+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#include <stdlib.h>
+#include <stdarg.h>
+#include <string.h>
+#include <float.h>
+
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  ac_cv_header_stdc=yes
+else
+  ac_cv_header_stdc=no
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+
+if test $ac_cv_header_stdc = yes; then
+  # SunOS 4.x string.h does not declare mem*, contrary to ANSI.
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#include <string.h>
+
+_ACEOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+  $EGREP "memchr" >/dev/null 2>&1; then :
+
+else
+  ac_cv_header_stdc=no
+fi
+rm -f conftest*
+
+fi
+
+if test $ac_cv_header_stdc = yes; then
+  # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI.
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#include <stdlib.h>
+
+_ACEOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+  $EGREP "free" >/dev/null 2>&1; then :
+
+else
+  ac_cv_header_stdc=no
+fi
+rm -f conftest*
+
+fi
+
+if test $ac_cv_header_stdc = yes; then
+  # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi.
+  if test "$cross_compiling" = yes; then :
+  :
+else
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#include <ctype.h>
+#include <stdlib.h>
+#if ((' ' & 0x0FF) == 0x020)
+# define ISLOWER(c) ('a' <= (c) && (c) <= 'z')
+# define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c))
+#else
+# define ISLOWER(c) \
+		   (('a' <= (c) && (c) <= 'i') \
+		     || ('j' <= (c) && (c) <= 'r') \
+		     || ('s' <= (c) && (c) <= 'z'))
+# define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c))
+#endif
+
+#define XOR(e, f) (((e) && !(f)) || (!(e) && (f)))
+int
+main ()
+{
+  int i;
+  for (i = 0; i < 256; i++)
+    if (XOR (islower (i), ISLOWER (i))
+	|| toupper (i) != TOUPPER (i))
+      return 2;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_run "$LINENO"; then :
+
+else
+  ac_cv_header_stdc=no
+fi
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
+  conftest.$ac_objext conftest.beam conftest.$ac_ext
+fi
+
+fi
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_stdc" >&5
+$as_echo "$ac_cv_header_stdc" >&6; }
+if test $ac_cv_header_stdc = yes; then
+
+$as_echo "#define STDC_HEADERS 1" >>confdefs.h
+
+fi
+
+
+# check for specific header (.h) files that we are interested in
+for ac_header in ctype.h errno.h fcntl.h inttypes.h limits.h signal.h sys/file.h sys/resource.h sys/select.h sys/stat.h sys/syscall.h sys/time.h sys/timeb.h sys/timers.h sys/times.h sys/types.h sys/utsname.h sys/wait.h termios.h time.h unistd.h utime.h windows.h winsock.h langinfo.h poll.h sys/epoll.h sys/event.h sys/eventfd.h
+do :
+  as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
+ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default"
+if eval test \"x\$"$as_ac_Header"\" = x"yes"; then :
+  cat >>confdefs.h <<_ACEOF
+#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1
+_ACEOF
+
+fi
+
+done
+
+
+# Enable large file support. Do this before testing the types ino_t, off_t, and
+# rlim_t, because it will affect the result of that test.
+# Check whether --enable-largefile was given.
+if test "${enable_largefile+set}" = set; then :
+  enableval=$enable_largefile;
+fi
+
+if test "$enable_largefile" != no; then
+
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for special C compiler options needed for large files" >&5
+$as_echo_n "checking for special C compiler options needed for large files... " >&6; }
+if ${ac_cv_sys_largefile_CC+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  ac_cv_sys_largefile_CC=no
+     if test "$GCC" != yes; then
+       ac_save_CC=$CC
+       while :; do
+	 # IRIX 6.2 and later do not support large files by default,
+	 # so use the C compiler's -n32 option if that helps.
+	 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#include <sys/types.h>
+ /* Check that off_t can represent 2**63 - 1 correctly.
+    We can't simply define LARGE_OFF_T to be 9223372036854775807,
+    since some C++ compilers masquerading as C compilers
+    incorrectly reject 9223372036854775807.  */
+#define LARGE_OFF_T ((((off_t) 1 << 31) << 31) - 1 + (((off_t) 1 << 31) << 31))
+  int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721
+		       && LARGE_OFF_T % 2147483647 == 1)
+		      ? 1 : -1];
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+	 if ac_fn_c_try_compile "$LINENO"; then :
+  break
+fi
+rm -f core conftest.err conftest.$ac_objext
+	 CC="$CC -n32"
+	 if ac_fn_c_try_compile "$LINENO"; then :
+  ac_cv_sys_largefile_CC=' -n32'; break
+fi
+rm -f core conftest.err conftest.$ac_objext
+	 break
+       done
+       CC=$ac_save_CC
+       rm -f conftest.$ac_ext
+    fi
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sys_largefile_CC" >&5
+$as_echo "$ac_cv_sys_largefile_CC" >&6; }
+  if test "$ac_cv_sys_largefile_CC" != no; then
+    CC=$CC$ac_cv_sys_largefile_CC
+  fi
+
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for _FILE_OFFSET_BITS value needed for large files" >&5
+$as_echo_n "checking for _FILE_OFFSET_BITS value needed for large files... " >&6; }
+if ${ac_cv_sys_file_offset_bits+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  while :; do
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#include <sys/types.h>
+ /* Check that off_t can represent 2**63 - 1 correctly.
+    We can't simply define LARGE_OFF_T to be 9223372036854775807,
+    since some C++ compilers masquerading as C compilers
+    incorrectly reject 9223372036854775807.  */
+#define LARGE_OFF_T ((((off_t) 1 << 31) << 31) - 1 + (((off_t) 1 << 31) << 31))
+  int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721
+		       && LARGE_OFF_T % 2147483647 == 1)
+		      ? 1 : -1];
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  ac_cv_sys_file_offset_bits=no; break
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#define _FILE_OFFSET_BITS 64
+#include <sys/types.h>
+ /* Check that off_t can represent 2**63 - 1 correctly.
+    We can't simply define LARGE_OFF_T to be 9223372036854775807,
+    since some C++ compilers masquerading as C compilers
+    incorrectly reject 9223372036854775807.  */
+#define LARGE_OFF_T ((((off_t) 1 << 31) << 31) - 1 + (((off_t) 1 << 31) << 31))
+  int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721
+		       && LARGE_OFF_T % 2147483647 == 1)
+		      ? 1 : -1];
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  ac_cv_sys_file_offset_bits=64; break
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+  ac_cv_sys_file_offset_bits=unknown
+  break
+done
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sys_file_offset_bits" >&5
+$as_echo "$ac_cv_sys_file_offset_bits" >&6; }
+case $ac_cv_sys_file_offset_bits in #(
+  no | unknown) ;;
+  *)
+cat >>confdefs.h <<_ACEOF
+#define _FILE_OFFSET_BITS $ac_cv_sys_file_offset_bits
+_ACEOF
+;;
+esac
+rm -rf conftest*
+  if test $ac_cv_sys_file_offset_bits = unknown; then
+    { $as_echo "$as_me:${as_lineno-$LINENO}: checking for _LARGE_FILES value needed for large files" >&5
+$as_echo_n "checking for _LARGE_FILES value needed for large files... " >&6; }
+if ${ac_cv_sys_large_files+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  while :; do
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#include <sys/types.h>
+ /* Check that off_t can represent 2**63 - 1 correctly.
+    We can't simply define LARGE_OFF_T to be 9223372036854775807,
+    since some C++ compilers masquerading as C compilers
+    incorrectly reject 9223372036854775807.  */
+#define LARGE_OFF_T ((((off_t) 1 << 31) << 31) - 1 + (((off_t) 1 << 31) << 31))
+  int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721
+		       && LARGE_OFF_T % 2147483647 == 1)
+		      ? 1 : -1];
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  ac_cv_sys_large_files=no; break
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#define _LARGE_FILES 1
+#include <sys/types.h>
+ /* Check that off_t can represent 2**63 - 1 correctly.
+    We can't simply define LARGE_OFF_T to be 9223372036854775807,
+    since some C++ compilers masquerading as C compilers
+    incorrectly reject 9223372036854775807.  */
+#define LARGE_OFF_T ((((off_t) 1 << 31) << 31) - 1 + (((off_t) 1 << 31) << 31))
+  int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721
+		       && LARGE_OFF_T % 2147483647 == 1)
+		      ? 1 : -1];
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  ac_cv_sys_large_files=1; break
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+  ac_cv_sys_large_files=unknown
+  break
+done
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sys_large_files" >&5
+$as_echo "$ac_cv_sys_large_files" >&6; }
+case $ac_cv_sys_large_files in #(
+  no | unknown) ;;
+  *)
+cat >>confdefs.h <<_ACEOF
+#define _LARGE_FILES $ac_cv_sys_large_files
+_ACEOF
+;;
+esac
+rm -rf conftest*
+  fi
+
+
+fi
+
+
+for ac_header in wctype.h
+do :
+  ac_fn_c_check_header_mongrel "$LINENO" "wctype.h" "ac_cv_header_wctype_h" "$ac_includes_default"
+if test "x$ac_cv_header_wctype_h" = xyes; then :
+  cat >>confdefs.h <<_ACEOF
+#define HAVE_WCTYPE_H 1
+_ACEOF
+ for ac_func in iswspace
+do :
+  ac_fn_c_check_func "$LINENO" "iswspace" "ac_cv_func_iswspace"
+if test "x$ac_cv_func_iswspace" = xyes; then :
+  cat >>confdefs.h <<_ACEOF
+#define HAVE_ISWSPACE 1
+_ACEOF
+
+fi
+done
+
+fi
+
+done
+
+
+for ac_func in lstat
+do :
+  ac_fn_c_check_func "$LINENO" "lstat" "ac_cv_func_lstat"
+if test "x$ac_cv_func_lstat" = xyes; then :
+  cat >>confdefs.h <<_ACEOF
+#define HAVE_LSTAT 1
+_ACEOF
+
+fi
+done
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for clock_gettime in -lrt" >&5
+$as_echo_n "checking for clock_gettime in -lrt... " >&6; }
+if ${ac_cv_lib_rt_clock_gettime+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-lrt  $LIBS"
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+/* Override any GCC internal prototype to avoid an error.
+   Use char because int might match the return type of a GCC
+   builtin and then its argument prototype would still apply.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+char clock_gettime ();
+int
+main ()
+{
+return clock_gettime ();
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+  ac_cv_lib_rt_clock_gettime=yes
+else
+  ac_cv_lib_rt_clock_gettime=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_rt_clock_gettime" >&5
+$as_echo "$ac_cv_lib_rt_clock_gettime" >&6; }
+if test "x$ac_cv_lib_rt_clock_gettime" = xyes; then :
+  cat >>confdefs.h <<_ACEOF
+#define HAVE_LIBRT 1
+_ACEOF
+
+  LIBS="-lrt $LIBS"
+
+fi
+
+for ac_func in clock_gettime
+do :
+  ac_fn_c_check_func "$LINENO" "clock_gettime" "ac_cv_func_clock_gettime"
+if test "x$ac_cv_func_clock_gettime" = xyes; then :
+  cat >>confdefs.h <<_ACEOF
+#define HAVE_CLOCK_GETTIME 1
+_ACEOF
+
+fi
+done
+
+for ac_func in getclock getrusage times
+do :
+  as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
+ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var"
+if eval test \"x\$"$as_ac_var"\" = x"yes"; then :
+  cat >>confdefs.h <<_ACEOF
+#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
+_ACEOF
+
+fi
+done
+
+for ac_func in _chsize ftruncate
+do :
+  as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
+ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var"
+if eval test \"x\$"$as_ac_var"\" = x"yes"; then :
+  cat >>confdefs.h <<_ACEOF
+#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
+_ACEOF
+
+fi
+done
+
+
+for ac_func in epoll_ctl eventfd kevent kevent64 kqueue poll
+do :
+  as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
+ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var"
+if eval test \"x\$"$as_ac_var"\" = x"yes"; then :
+  cat >>confdefs.h <<_ACEOF
+#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
+_ACEOF
+
+fi
+done
+
+
+# event-related fun
+
+if test "$ac_cv_header_sys_epoll_h" = yes && test "$ac_cv_func_epoll_ctl" = yes; then
+
+$as_echo "#define HAVE_EPOLL 1" >>confdefs.h
+
+fi
+
+if test "$ac_cv_header_sys_event_h" = yes && test "$ac_cv_func_kqueue" = yes; then
+
+$as_echo "#define HAVE_KQUEUE 1" >>confdefs.h
+
+
+  # The cast to long int works around a bug in the HP C Compiler
+# version HP92453-01 B.11.11.23709.GP, which incorrectly rejects
+# declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'.
+# This bug is HP SR number 8606223364.
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking size of kev.filter" >&5
+$as_echo_n "checking size of kev.filter... " >&6; }
+if ${ac_cv_sizeof_kev_filter+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (kev.filter))" "ac_cv_sizeof_kev_filter"        "#include <sys/event.h>
+struct kevent kev;
+"; then :
+
+else
+  if test "$ac_cv_type_kev_filter" = yes; then
+     { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error 77 "cannot compute sizeof (kev.filter)
+See \`config.log' for more details" "$LINENO" 5; }
+   else
+     ac_cv_sizeof_kev_filter=0
+   fi
+fi
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sizeof_kev_filter" >&5
+$as_echo "$ac_cv_sizeof_kev_filter" >&6; }
+
+
+
+cat >>confdefs.h <<_ACEOF
+#define SIZEOF_KEV_FILTER $ac_cv_sizeof_kev_filter
+_ACEOF
+
+
+
+  # The cast to long int works around a bug in the HP C Compiler
+# version HP92453-01 B.11.11.23709.GP, which incorrectly rejects
+# declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'.
+# This bug is HP SR number 8606223364.
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking size of kev.flags" >&5
+$as_echo_n "checking size of kev.flags... " >&6; }
+if ${ac_cv_sizeof_kev_flags+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (kev.flags))" "ac_cv_sizeof_kev_flags"        "#include <sys/event.h>
+struct kevent kev;
+"; then :
+
+else
+  if test "$ac_cv_type_kev_flags" = yes; then
+     { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error 77 "cannot compute sizeof (kev.flags)
+See \`config.log' for more details" "$LINENO" 5; }
+   else
+     ac_cv_sizeof_kev_flags=0
+   fi
+fi
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sizeof_kev_flags" >&5
+$as_echo "$ac_cv_sizeof_kev_flags" >&6; }
+
+
+
+cat >>confdefs.h <<_ACEOF
+#define SIZEOF_KEV_FLAGS $ac_cv_sizeof_kev_flags
+_ACEOF
+
+
+fi
+
+if test "$ac_cv_header_poll_h" = yes && test "$ac_cv_func_poll" = yes; then
+
+$as_echo "#define HAVE_POLL 1" >>confdefs.h
+
+fi
+
+#flock
+for ac_func in flock
+do :
+  ac_fn_c_check_func "$LINENO" "flock" "ac_cv_func_flock"
+if test "x$ac_cv_func_flock" = xyes; then :
+  cat >>confdefs.h <<_ACEOF
+#define HAVE_FLOCK 1
+_ACEOF
+
+fi
+done
+
+if test "$ac_cv_header_sys_file_h" = yes && test "$ac_cv_func_flock" = yes; then
+
+$as_echo "#define HAVE_FLOCK 1" >>confdefs.h
+
+fi
+
+# unsetenv
+for ac_func in unsetenv
+do :
+  ac_fn_c_check_func "$LINENO" "unsetenv" "ac_cv_func_unsetenv"
+if test "x$ac_cv_func_unsetenv" = xyes; then :
+  cat >>confdefs.h <<_ACEOF
+#define HAVE_UNSETENV 1
+_ACEOF
+
+fi
+done
+
+
+###  POSIX.1003.1 unsetenv returns 0 or -1 (EINVAL), but older implementations
+###  in common use return void.
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking return type of unsetenv" >&5
+$as_echo_n "checking return type of unsetenv... " >&6; }
+if ${fptools_cv_func_unsetenv_return_type+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#include <stdlib.h>
+
+_ACEOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+  $EGREP "void[      ]+unsetenv" >/dev/null 2>&1; then :
+  fptools_cv_func_unsetenv_return_type=void
+else
+  fptools_cv_func_unsetenv_return_type=int
+fi
+rm -f conftest*
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $fptools_cv_func_unsetenv_return_type" >&5
+$as_echo "$fptools_cv_func_unsetenv_return_type" >&6; }
+case "$fptools_cv_func_unsetenv_return_type" in
+  "void" )
+
+$as_echo "#define UNSETENV_RETURNS_VOID 1" >>confdefs.h
+
+  ;;
+esac
+
+
+
+# Check whether --with-iconv-includes was given.
+if test "${with_iconv_includes+set}" = set; then :
+  withval=$with_iconv_includes; ICONV_INCLUDE_DIRS=$withval; CPPFLAGS="-I$withval $CPPFLAGS"
+else
+  ICONV_INCLUDE_DIRS=
+fi
+
+
+
+# Check whether --with-iconv-libraries was given.
+if test "${with_iconv_libraries+set}" = set; then :
+  withval=$with_iconv_libraries; ICONV_LIB_DIRS=$withval; LDFLAGS="-L$withval $LDFLAGS"
+else
+  ICONV_LIB_DIRS=
+fi
+
+
+
+
+
+# map standard C types and ISO types to Haskell types
+
+
+
+
+
+
+
+
+    { $as_echo "$as_me:${as_lineno-$LINENO}: checking Haskell type for char" >&5
+$as_echo_n "checking Haskell type for char... " >&6; }
+    if ${fptools_cv_htype_char+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+
+        fptools_cv_htype_sup_char=yes
+        if ac_fn_c_compute_int "$LINENO" "(char)0.2 - (char)0.4 < 0 ? 0 : 1" "HTYPE_IS_INTEGRAL"        "
+#include <stdbool.h>
+#include <stdio.h>
+#include <stddef.h>
+
+#if HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+
+#if HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+
+#if HAVE_SYS_STAT_H
+# include <sys/stat.h>
+#endif
+
+#if HAVE_FCNTL_H
+# include <fcntl.h>
+#endif
+
+#if HAVE_SIGNAL_H
+# include <signal.h>
+#endif
+
+#if HAVE_TIME_H
+# include <time.h>
+#endif
+
+#if HAVE_TERMIOS_H
+# include <termios.h>
+#endif
+
+#if HAVE_STRING_H
+# include <string.h>
+#endif
+
+#if HAVE_CTYPE_H
+# include <ctype.h>
+#endif
+
+#if HAVE_INTTYPES_H
+# include <inttypes.h>
+#else
+# if HAVE_STDINT_H
+#  include <stdint.h>
+# endif
+#endif
+
+#if HAVE_SYS_RESOURCE_H
+# include <sys/resource.h>
+#endif
+
+#include <stdlib.h>
+"; then :
+
+else
+  HTYPE_IS_INTEGRAL=0
+fi
+
+
+
+        if test "$HTYPE_IS_INTEGRAL" -eq 0
+        then
+                                                            cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+#include <stdbool.h>
+#include <stdio.h>
+#include <stddef.h>
+
+#if HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+
+#if HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+
+#if HAVE_SYS_STAT_H
+# include <sys/stat.h>
+#endif
+
+#if HAVE_FCNTL_H
+# include <fcntl.h>
+#endif
+
+#if HAVE_SIGNAL_H
+# include <signal.h>
+#endif
+
+#if HAVE_TIME_H
+# include <time.h>
+#endif
+
+#if HAVE_TERMIOS_H
+# include <termios.h>
+#endif
+
+#if HAVE_STRING_H
+# include <string.h>
+#endif
+
+#if HAVE_CTYPE_H
+# include <ctype.h>
+#endif
+
+#if HAVE_INTTYPES_H
+# include <inttypes.h>
+#else
+# if HAVE_STDINT_H
+#  include <stdint.h>
+# endif
+#endif
+
+#if HAVE_SYS_RESOURCE_H
+# include <sys/resource.h>
+#endif
+
+#include <stdlib.h>
+
+int
+main ()
+{
+char val; *val;
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  HTYPE_IS_POINTER=yes
+else
+  HTYPE_IS_POINTER=no
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+
+            if test "$HTYPE_IS_POINTER" = yes
+            then
+                fptools_cv_htype_char="Ptr ()"
+            else
+                if ac_fn_c_compute_int "$LINENO" "sizeof(char) == sizeof(float)" "HTYPE_IS_FLOAT"        "
+#include <stdbool.h>
+#include <stdio.h>
+#include <stddef.h>
+
+#if HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+
+#if HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+
+#if HAVE_SYS_STAT_H
+# include <sys/stat.h>
+#endif
+
+#if HAVE_FCNTL_H
+# include <fcntl.h>
+#endif
+
+#if HAVE_SIGNAL_H
+# include <signal.h>
+#endif
+
+#if HAVE_TIME_H
+# include <time.h>
+#endif
+
+#if HAVE_TERMIOS_H
+# include <termios.h>
+#endif
+
+#if HAVE_STRING_H
+# include <string.h>
+#endif
+
+#if HAVE_CTYPE_H
+# include <ctype.h>
+#endif
+
+#if HAVE_INTTYPES_H
+# include <inttypes.h>
+#else
+# if HAVE_STDINT_H
+#  include <stdint.h>
+# endif
+#endif
+
+#if HAVE_SYS_RESOURCE_H
+# include <sys/resource.h>
+#endif
+
+#include <stdlib.h>
+"; then :
+
+else
+  fptools_cv_htype_sup_char=no
+fi
+
+
+                if ac_fn_c_compute_int "$LINENO" "sizeof(char) == sizeof(double)" "HTYPE_IS_DOUBLE"        "
+#include <stdbool.h>
+#include <stdio.h>
+#include <stddef.h>
+
+#if HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+
+#if HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+
+#if HAVE_SYS_STAT_H
+# include <sys/stat.h>
+#endif
+
+#if HAVE_FCNTL_H
+# include <fcntl.h>
+#endif
+
+#if HAVE_SIGNAL_H
+# include <signal.h>
+#endif
+
+#if HAVE_TIME_H
+# include <time.h>
+#endif
+
+#if HAVE_TERMIOS_H
+# include <termios.h>
+#endif
+
+#if HAVE_STRING_H
+# include <string.h>
+#endif
+
+#if HAVE_CTYPE_H
+# include <ctype.h>
+#endif
+
+#if HAVE_INTTYPES_H
+# include <inttypes.h>
+#else
+# if HAVE_STDINT_H
+#  include <stdint.h>
+# endif
+#endif
+
+#if HAVE_SYS_RESOURCE_H
+# include <sys/resource.h>
+#endif
+
+#include <stdlib.h>
+"; then :
+
+else
+  fptools_cv_htype_sup_char=no
+fi
+
+
+                if ac_fn_c_compute_int "$LINENO" "sizeof(char) == sizeof(long double)" "HTYPE_IS_LDOUBLE"        "
+#include <stdbool.h>
+#include <stdio.h>
+#include <stddef.h>
+
+#if HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+
+#if HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+
+#if HAVE_SYS_STAT_H
+# include <sys/stat.h>
+#endif
+
+#if HAVE_FCNTL_H
+# include <fcntl.h>
+#endif
+
+#if HAVE_SIGNAL_H
+# include <signal.h>
+#endif
+
+#if HAVE_TIME_H
+# include <time.h>
+#endif
+
+#if HAVE_TERMIOS_H
+# include <termios.h>
+#endif
+
+#if HAVE_STRING_H
+# include <string.h>
+#endif
+
+#if HAVE_CTYPE_H
+# include <ctype.h>
+#endif
+
+#if HAVE_INTTYPES_H
+# include <inttypes.h>
+#else
+# if HAVE_STDINT_H
+#  include <stdint.h>
+# endif
+#endif
+
+#if HAVE_SYS_RESOURCE_H
+# include <sys/resource.h>
+#endif
+
+#include <stdlib.h>
+"; then :
+
+else
+  fptools_cv_htype_sup_char=no
+fi
+
+
+                if test "$HTYPE_IS_FLOAT" -eq 1
+                then
+                    fptools_cv_htype_char=Float
+                elif test "$HTYPE_IS_DOUBLE" -eq 1
+                then
+                    fptools_cv_htype_char=Double
+                elif test "$HTYPE_IS_LDOUBLE" -eq 1
+                then
+                    fptools_cv_htype_char=LDouble
+                else
+                    fptools_cv_htype_sup_char=no
+                fi
+            fi
+        else
+            if ac_fn_c_compute_int "$LINENO" "((char)(-1)) < ((char)0)" "HTYPE_IS_SIGNED"        "
+#include <stdbool.h>
+#include <stdio.h>
+#include <stddef.h>
+
+#if HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+
+#if HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+
+#if HAVE_SYS_STAT_H
+# include <sys/stat.h>
+#endif
+
+#if HAVE_FCNTL_H
+# include <fcntl.h>
+#endif
+
+#if HAVE_SIGNAL_H
+# include <signal.h>
+#endif
+
+#if HAVE_TIME_H
+# include <time.h>
+#endif
+
+#if HAVE_TERMIOS_H
+# include <termios.h>
+#endif
+
+#if HAVE_STRING_H
+# include <string.h>
+#endif
+
+#if HAVE_CTYPE_H
+# include <ctype.h>
+#endif
+
+#if HAVE_INTTYPES_H
+# include <inttypes.h>
+#else
+# if HAVE_STDINT_H
+#  include <stdint.h>
+# endif
+#endif
+
+#if HAVE_SYS_RESOURCE_H
+# include <sys/resource.h>
+#endif
+
+#include <stdlib.h>
+"; then :
+
+else
+  fptools_cv_htype_sup_char=no
+fi
+
+
+            if ac_fn_c_compute_int "$LINENO" "sizeof(char) * 8" "HTYPE_SIZE"        "
+#include <stdbool.h>
+#include <stdio.h>
+#include <stddef.h>
+
+#if HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+
+#if HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+
+#if HAVE_SYS_STAT_H
+# include <sys/stat.h>
+#endif
+
+#if HAVE_FCNTL_H
+# include <fcntl.h>
+#endif
+
+#if HAVE_SIGNAL_H
+# include <signal.h>
+#endif
+
+#if HAVE_TIME_H
+# include <time.h>
+#endif
+
+#if HAVE_TERMIOS_H
+# include <termios.h>
+#endif
+
+#if HAVE_STRING_H
+# include <string.h>
+#endif
+
+#if HAVE_CTYPE_H
+# include <ctype.h>
+#endif
+
+#if HAVE_INTTYPES_H
+# include <inttypes.h>
+#else
+# if HAVE_STDINT_H
+#  include <stdint.h>
+# endif
+#endif
+
+#if HAVE_SYS_RESOURCE_H
+# include <sys/resource.h>
+#endif
+
+#include <stdlib.h>
+"; then :
+
+else
+  fptools_cv_htype_sup_char=no
+fi
+
+
+            if test "$HTYPE_IS_SIGNED" -eq 0
+            then
+                fptools_cv_htype_char="Word$HTYPE_SIZE"
+            else
+                fptools_cv_htype_char="Int$HTYPE_SIZE"
+            fi
+        fi
+
+fi
+
+    if test "$fptools_cv_htype_sup_char" = no
+    then
+
+        fptools_cv_htype_char=NotReallyAType
+        { $as_echo "$as_me:${as_lineno-$LINENO}: result: not supported" >&5
+$as_echo "not supported" >&6; }
+
+    fi
+
+            if test "$fptools_cv_htype_sup_char" = yes; then
+        { $as_echo "$as_me:${as_lineno-$LINENO}: result: $fptools_cv_htype_char" >&5
+$as_echo "$fptools_cv_htype_char" >&6; }
+
+cat >>confdefs.h <<_ACEOF
+#define HTYPE_CHAR $fptools_cv_htype_char
+_ACEOF
+
+    fi
+
+
+
+
+
+
+
+
+
+
+    { $as_echo "$as_me:${as_lineno-$LINENO}: checking Haskell type for signed char" >&5
+$as_echo_n "checking Haskell type for signed char... " >&6; }
+    if ${fptools_cv_htype_signed_char+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+
+        fptools_cv_htype_sup_signed_char=yes
+        if ac_fn_c_compute_int "$LINENO" "(signed char)0.2 - (signed char)0.4 < 0 ? 0 : 1" "HTYPE_IS_INTEGRAL"        "
+#include <stdbool.h>
+#include <stdio.h>
+#include <stddef.h>
+
+#if HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+
+#if HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+
+#if HAVE_SYS_STAT_H
+# include <sys/stat.h>
+#endif
+
+#if HAVE_FCNTL_H
+# include <fcntl.h>
+#endif
+
+#if HAVE_SIGNAL_H
+# include <signal.h>
+#endif
+
+#if HAVE_TIME_H
+# include <time.h>
+#endif
+
+#if HAVE_TERMIOS_H
+# include <termios.h>
+#endif
+
+#if HAVE_STRING_H
+# include <string.h>
+#endif
+
+#if HAVE_CTYPE_H
+# include <ctype.h>
+#endif
+
+#if HAVE_INTTYPES_H
+# include <inttypes.h>
+#else
+# if HAVE_STDINT_H
+#  include <stdint.h>
+# endif
+#endif
+
+#if HAVE_SYS_RESOURCE_H
+# include <sys/resource.h>
+#endif
+
+#include <stdlib.h>
+"; then :
+
+else
+  HTYPE_IS_INTEGRAL=0
+fi
+
+
+
+        if test "$HTYPE_IS_INTEGRAL" -eq 0
+        then
+                                                            cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+#include <stdbool.h>
+#include <stdio.h>
+#include <stddef.h>
+
+#if HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+
+#if HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+
+#if HAVE_SYS_STAT_H
+# include <sys/stat.h>
+#endif
+
+#if HAVE_FCNTL_H
+# include <fcntl.h>
+#endif
+
+#if HAVE_SIGNAL_H
+# include <signal.h>
+#endif
+
+#if HAVE_TIME_H
+# include <time.h>
+#endif
+
+#if HAVE_TERMIOS_H
+# include <termios.h>
+#endif
+
+#if HAVE_STRING_H
+# include <string.h>
+#endif
+
+#if HAVE_CTYPE_H
+# include <ctype.h>
+#endif
+
+#if HAVE_INTTYPES_H
+# include <inttypes.h>
+#else
+# if HAVE_STDINT_H
+#  include <stdint.h>
+# endif
+#endif
+
+#if HAVE_SYS_RESOURCE_H
+# include <sys/resource.h>
+#endif
+
+#include <stdlib.h>
+
+int
+main ()
+{
+signed char val; *val;
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  HTYPE_IS_POINTER=yes
+else
+  HTYPE_IS_POINTER=no
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+
+            if test "$HTYPE_IS_POINTER" = yes
+            then
+                fptools_cv_htype_signed_char="Ptr ()"
+            else
+                if ac_fn_c_compute_int "$LINENO" "sizeof(signed char) == sizeof(float)" "HTYPE_IS_FLOAT"        "
+#include <stdbool.h>
+#include <stdio.h>
+#include <stddef.h>
+
+#if HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+
+#if HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+
+#if HAVE_SYS_STAT_H
+# include <sys/stat.h>
+#endif
+
+#if HAVE_FCNTL_H
+# include <fcntl.h>
+#endif
+
+#if HAVE_SIGNAL_H
+# include <signal.h>
+#endif
+
+#if HAVE_TIME_H
+# include <time.h>
+#endif
+
+#if HAVE_TERMIOS_H
+# include <termios.h>
+#endif
+
+#if HAVE_STRING_H
+# include <string.h>
+#endif
+
+#if HAVE_CTYPE_H
+# include <ctype.h>
+#endif
+
+#if HAVE_INTTYPES_H
+# include <inttypes.h>
+#else
+# if HAVE_STDINT_H
+#  include <stdint.h>
+# endif
+#endif
+
+#if HAVE_SYS_RESOURCE_H
+# include <sys/resource.h>
+#endif
+
+#include <stdlib.h>
+"; then :
+
+else
+  fptools_cv_htype_sup_signed_char=no
+fi
+
+
+                if ac_fn_c_compute_int "$LINENO" "sizeof(signed char) == sizeof(double)" "HTYPE_IS_DOUBLE"        "
+#include <stdbool.h>
+#include <stdio.h>
+#include <stddef.h>
+
+#if HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+
+#if HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+
+#if HAVE_SYS_STAT_H
+# include <sys/stat.h>
+#endif
+
+#if HAVE_FCNTL_H
+# include <fcntl.h>
+#endif
+
+#if HAVE_SIGNAL_H
+# include <signal.h>
+#endif
+
+#if HAVE_TIME_H
+# include <time.h>
+#endif
+
+#if HAVE_TERMIOS_H
+# include <termios.h>
+#endif
+
+#if HAVE_STRING_H
+# include <string.h>
+#endif
+
+#if HAVE_CTYPE_H
+# include <ctype.h>
+#endif
+
+#if HAVE_INTTYPES_H
+# include <inttypes.h>
+#else
+# if HAVE_STDINT_H
+#  include <stdint.h>
+# endif
+#endif
+
+#if HAVE_SYS_RESOURCE_H
+# include <sys/resource.h>
+#endif
+
+#include <stdlib.h>
+"; then :
+
+else
+  fptools_cv_htype_sup_signed_char=no
+fi
+
+
+                if ac_fn_c_compute_int "$LINENO" "sizeof(signed char) == sizeof(long double)" "HTYPE_IS_LDOUBLE"        "
+#include <stdbool.h>
+#include <stdio.h>
+#include <stddef.h>
+
+#if HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+
+#if HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+
+#if HAVE_SYS_STAT_H
+# include <sys/stat.h>
+#endif
+
+#if HAVE_FCNTL_H
+# include <fcntl.h>
+#endif
+
+#if HAVE_SIGNAL_H
+# include <signal.h>
+#endif
+
+#if HAVE_TIME_H
+# include <time.h>
+#endif
+
+#if HAVE_TERMIOS_H
+# include <termios.h>
+#endif
+
+#if HAVE_STRING_H
+# include <string.h>
+#endif
+
+#if HAVE_CTYPE_H
+# include <ctype.h>
+#endif
+
+#if HAVE_INTTYPES_H
+# include <inttypes.h>
+#else
+# if HAVE_STDINT_H
+#  include <stdint.h>
+# endif
+#endif
+
+#if HAVE_SYS_RESOURCE_H
+# include <sys/resource.h>
+#endif
+
+#include <stdlib.h>
+"; then :
+
+else
+  fptools_cv_htype_sup_signed_char=no
+fi
+
+
+                if test "$HTYPE_IS_FLOAT" -eq 1
+                then
+                    fptools_cv_htype_signed_char=Float
+                elif test "$HTYPE_IS_DOUBLE" -eq 1
+                then
+                    fptools_cv_htype_signed_char=Double
+                elif test "$HTYPE_IS_LDOUBLE" -eq 1
+                then
+                    fptools_cv_htype_signed_char=LDouble
+                else
+                    fptools_cv_htype_sup_signed_char=no
+                fi
+            fi
+        else
+            if ac_fn_c_compute_int "$LINENO" "((signed char)(-1)) < ((signed char)0)" "HTYPE_IS_SIGNED"        "
+#include <stdbool.h>
+#include <stdio.h>
+#include <stddef.h>
+
+#if HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+
+#if HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+
+#if HAVE_SYS_STAT_H
+# include <sys/stat.h>
+#endif
+
+#if HAVE_FCNTL_H
+# include <fcntl.h>
+#endif
+
+#if HAVE_SIGNAL_H
+# include <signal.h>
+#endif
+
+#if HAVE_TIME_H
+# include <time.h>
+#endif
+
+#if HAVE_TERMIOS_H
+# include <termios.h>
+#endif
+
+#if HAVE_STRING_H
+# include <string.h>
+#endif
+
+#if HAVE_CTYPE_H
+# include <ctype.h>
+#endif
+
+#if HAVE_INTTYPES_H
+# include <inttypes.h>
+#else
+# if HAVE_STDINT_H
+#  include <stdint.h>
+# endif
+#endif
+
+#if HAVE_SYS_RESOURCE_H
+# include <sys/resource.h>
+#endif
+
+#include <stdlib.h>
+"; then :
+
+else
+  fptools_cv_htype_sup_signed_char=no
+fi
+
+
+            if ac_fn_c_compute_int "$LINENO" "sizeof(signed char) * 8" "HTYPE_SIZE"        "
+#include <stdbool.h>
+#include <stdio.h>
+#include <stddef.h>
+
+#if HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+
+#if HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+
+#if HAVE_SYS_STAT_H
+# include <sys/stat.h>
+#endif
+
+#if HAVE_FCNTL_H
+# include <fcntl.h>
+#endif
+
+#if HAVE_SIGNAL_H
+# include <signal.h>
+#endif
+
+#if HAVE_TIME_H
+# include <time.h>
+#endif
+
+#if HAVE_TERMIOS_H
+# include <termios.h>
+#endif
+
+#if HAVE_STRING_H
+# include <string.h>
+#endif
+
+#if HAVE_CTYPE_H
+# include <ctype.h>
+#endif
+
+#if HAVE_INTTYPES_H
+# include <inttypes.h>
+#else
+# if HAVE_STDINT_H
+#  include <stdint.h>
+# endif
+#endif
+
+#if HAVE_SYS_RESOURCE_H
+# include <sys/resource.h>
+#endif
+
+#include <stdlib.h>
+"; then :
+
+else
+  fptools_cv_htype_sup_signed_char=no
+fi
+
+
+            if test "$HTYPE_IS_SIGNED" -eq 0
+            then
+                fptools_cv_htype_signed_char="Word$HTYPE_SIZE"
+            else
+                fptools_cv_htype_signed_char="Int$HTYPE_SIZE"
+            fi
+        fi
+
+fi
+
+    if test "$fptools_cv_htype_sup_signed_char" = no
+    then
+
+        fptools_cv_htype_signed_char=NotReallyAType
+        { $as_echo "$as_me:${as_lineno-$LINENO}: result: not supported" >&5
+$as_echo "not supported" >&6; }
+
+    fi
+
+            if test "$fptools_cv_htype_sup_signed_char" = yes; then
+        { $as_echo "$as_me:${as_lineno-$LINENO}: result: $fptools_cv_htype_signed_char" >&5
+$as_echo "$fptools_cv_htype_signed_char" >&6; }
+
+cat >>confdefs.h <<_ACEOF
+#define HTYPE_SIGNED_CHAR $fptools_cv_htype_signed_char
+_ACEOF
+
+    fi
+
+
+
+
+
+
+
+
+
+
+    { $as_echo "$as_me:${as_lineno-$LINENO}: checking Haskell type for unsigned char" >&5
+$as_echo_n "checking Haskell type for unsigned char... " >&6; }
+    if ${fptools_cv_htype_unsigned_char+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+
+        fptools_cv_htype_sup_unsigned_char=yes
+        if ac_fn_c_compute_int "$LINENO" "(unsigned char)0.2 - (unsigned char)0.4 < 0 ? 0 : 1" "HTYPE_IS_INTEGRAL"        "
+#include <stdbool.h>
+#include <stdio.h>
+#include <stddef.h>
+
+#if HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+
+#if HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+
+#if HAVE_SYS_STAT_H
+# include <sys/stat.h>
+#endif
+
+#if HAVE_FCNTL_H
+# include <fcntl.h>
+#endif
+
+#if HAVE_SIGNAL_H
+# include <signal.h>
+#endif
+
+#if HAVE_TIME_H
+# include <time.h>
+#endif
+
+#if HAVE_TERMIOS_H
+# include <termios.h>
+#endif
+
+#if HAVE_STRING_H
+# include <string.h>
+#endif
+
+#if HAVE_CTYPE_H
+# include <ctype.h>
+#endif
+
+#if HAVE_INTTYPES_H
+# include <inttypes.h>
+#else
+# if HAVE_STDINT_H
+#  include <stdint.h>
+# endif
+#endif
+
+#if HAVE_SYS_RESOURCE_H
+# include <sys/resource.h>
+#endif
+
+#include <stdlib.h>
+"; then :
+
+else
+  HTYPE_IS_INTEGRAL=0
+fi
+
+
+
+        if test "$HTYPE_IS_INTEGRAL" -eq 0
+        then
+                                                            cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+#include <stdbool.h>
+#include <stdio.h>
+#include <stddef.h>
+
+#if HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+
+#if HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+
+#if HAVE_SYS_STAT_H
+# include <sys/stat.h>
+#endif
+
+#if HAVE_FCNTL_H
+# include <fcntl.h>
+#endif
+
+#if HAVE_SIGNAL_H
+# include <signal.h>
+#endif
+
+#if HAVE_TIME_H
+# include <time.h>
+#endif
+
+#if HAVE_TERMIOS_H
+# include <termios.h>
+#endif
+
+#if HAVE_STRING_H
+# include <string.h>
+#endif
+
+#if HAVE_CTYPE_H
+# include <ctype.h>
+#endif
+
+#if HAVE_INTTYPES_H
+# include <inttypes.h>
+#else
+# if HAVE_STDINT_H
+#  include <stdint.h>
+# endif
+#endif
+
+#if HAVE_SYS_RESOURCE_H
+# include <sys/resource.h>
+#endif
+
+#include <stdlib.h>
+
+int
+main ()
+{
+unsigned char val; *val;
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  HTYPE_IS_POINTER=yes
+else
+  HTYPE_IS_POINTER=no
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+
+            if test "$HTYPE_IS_POINTER" = yes
+            then
+                fptools_cv_htype_unsigned_char="Ptr ()"
+            else
+                if ac_fn_c_compute_int "$LINENO" "sizeof(unsigned char) == sizeof(float)" "HTYPE_IS_FLOAT"        "
+#include <stdbool.h>
+#include <stdio.h>
+#include <stddef.h>
+
+#if HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+
+#if HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+
+#if HAVE_SYS_STAT_H
+# include <sys/stat.h>
+#endif
+
+#if HAVE_FCNTL_H
+# include <fcntl.h>
+#endif
+
+#if HAVE_SIGNAL_H
+# include <signal.h>
+#endif
+
+#if HAVE_TIME_H
+# include <time.h>
+#endif
+
+#if HAVE_TERMIOS_H
+# include <termios.h>
+#endif
+
+#if HAVE_STRING_H
+# include <string.h>
+#endif
+
+#if HAVE_CTYPE_H
+# include <ctype.h>
+#endif
+
+#if HAVE_INTTYPES_H
+# include <inttypes.h>
+#else
+# if HAVE_STDINT_H
+#  include <stdint.h>
+# endif
+#endif
+
+#if HAVE_SYS_RESOURCE_H
+# include <sys/resource.h>
+#endif
+
+#include <stdlib.h>
+"; then :
+
+else
+  fptools_cv_htype_sup_unsigned_char=no
+fi
+
+
+                if ac_fn_c_compute_int "$LINENO" "sizeof(unsigned char) == sizeof(double)" "HTYPE_IS_DOUBLE"        "
+#include <stdbool.h>
+#include <stdio.h>
+#include <stddef.h>
+
+#if HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+
+#if HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+
+#if HAVE_SYS_STAT_H
+# include <sys/stat.h>
+#endif
+
+#if HAVE_FCNTL_H
+# include <fcntl.h>
+#endif
+
+#if HAVE_SIGNAL_H
+# include <signal.h>
+#endif
+
+#if HAVE_TIME_H
+# include <time.h>
+#endif
+
+#if HAVE_TERMIOS_H
+# include <termios.h>
+#endif
+
+#if HAVE_STRING_H
+# include <string.h>
+#endif
+
+#if HAVE_CTYPE_H
+# include <ctype.h>
+#endif
+
+#if HAVE_INTTYPES_H
+# include <inttypes.h>
+#else
+# if HAVE_STDINT_H
+#  include <stdint.h>
+# endif
+#endif
+
+#if HAVE_SYS_RESOURCE_H
+# include <sys/resource.h>
+#endif
+
+#include <stdlib.h>
+"; then :
+
+else
+  fptools_cv_htype_sup_unsigned_char=no
+fi
+
+
+                if ac_fn_c_compute_int "$LINENO" "sizeof(unsigned char) == sizeof(long double)" "HTYPE_IS_LDOUBLE"        "
+#include <stdbool.h>
+#include <stdio.h>
+#include <stddef.h>
+
+#if HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+
+#if HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+
+#if HAVE_SYS_STAT_H
+# include <sys/stat.h>
+#endif
+
+#if HAVE_FCNTL_H
+# include <fcntl.h>
+#endif
+
+#if HAVE_SIGNAL_H
+# include <signal.h>
+#endif
+
+#if HAVE_TIME_H
+# include <time.h>
+#endif
+
+#if HAVE_TERMIOS_H
+# include <termios.h>
+#endif
+
+#if HAVE_STRING_H
+# include <string.h>
+#endif
+
+#if HAVE_CTYPE_H
+# include <ctype.h>
+#endif
+
+#if HAVE_INTTYPES_H
+# include <inttypes.h>
+#else
+# if HAVE_STDINT_H
+#  include <stdint.h>
+# endif
+#endif
+
+#if HAVE_SYS_RESOURCE_H
+# include <sys/resource.h>
+#endif
+
+#include <stdlib.h>
+"; then :
+
+else
+  fptools_cv_htype_sup_unsigned_char=no
+fi
+
+
+                if test "$HTYPE_IS_FLOAT" -eq 1
+                then
+                    fptools_cv_htype_unsigned_char=Float
+                elif test "$HTYPE_IS_DOUBLE" -eq 1
+                then
+                    fptools_cv_htype_unsigned_char=Double
+                elif test "$HTYPE_IS_LDOUBLE" -eq 1
+                then
+                    fptools_cv_htype_unsigned_char=LDouble
+                else
+                    fptools_cv_htype_sup_unsigned_char=no
+                fi
+            fi
+        else
+            if ac_fn_c_compute_int "$LINENO" "((unsigned char)(-1)) < ((unsigned char)0)" "HTYPE_IS_SIGNED"        "
+#include <stdbool.h>
+#include <stdio.h>
+#include <stddef.h>
+
+#if HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+
+#if HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+
+#if HAVE_SYS_STAT_H
+# include <sys/stat.h>
+#endif
+
+#if HAVE_FCNTL_H
+# include <fcntl.h>
+#endif
+
+#if HAVE_SIGNAL_H
+# include <signal.h>
+#endif
+
+#if HAVE_TIME_H
+# include <time.h>
+#endif
+
+#if HAVE_TERMIOS_H
+# include <termios.h>
+#endif
+
+#if HAVE_STRING_H
+# include <string.h>
+#endif
+
+#if HAVE_CTYPE_H
+# include <ctype.h>
+#endif
+
+#if HAVE_INTTYPES_H
+# include <inttypes.h>
+#else
+# if HAVE_STDINT_H
+#  include <stdint.h>
+# endif
+#endif
+
+#if HAVE_SYS_RESOURCE_H
+# include <sys/resource.h>
+#endif
+
+#include <stdlib.h>
+"; then :
+
+else
+  fptools_cv_htype_sup_unsigned_char=no
+fi
+
+
+            if ac_fn_c_compute_int "$LINENO" "sizeof(unsigned char) * 8" "HTYPE_SIZE"        "
+#include <stdbool.h>
+#include <stdio.h>
+#include <stddef.h>
+
+#if HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+
+#if HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+
+#if HAVE_SYS_STAT_H
+# include <sys/stat.h>
+#endif
+
+#if HAVE_FCNTL_H
+# include <fcntl.h>
+#endif
+
+#if HAVE_SIGNAL_H
+# include <signal.h>
+#endif
+
+#if HAVE_TIME_H
+# include <time.h>
+#endif
+
+#if HAVE_TERMIOS_H
+# include <termios.h>
+#endif
+
+#if HAVE_STRING_H
+# include <string.h>
+#endif
+
+#if HAVE_CTYPE_H
+# include <ctype.h>
+#endif
+
+#if HAVE_INTTYPES_H
+# include <inttypes.h>
+#else
+# if HAVE_STDINT_H
+#  include <stdint.h>
+# endif
+#endif
+
+#if HAVE_SYS_RESOURCE_H
+# include <sys/resource.h>
+#endif
+
+#include <stdlib.h>
+"; then :
+
+else
+  fptools_cv_htype_sup_unsigned_char=no
+fi
+
+
+            if test "$HTYPE_IS_SIGNED" -eq 0
+            then
+                fptools_cv_htype_unsigned_char="Word$HTYPE_SIZE"
+            else
+                fptools_cv_htype_unsigned_char="Int$HTYPE_SIZE"
+            fi
+        fi
+
+fi
+
+    if test "$fptools_cv_htype_sup_unsigned_char" = no
+    then
+
+        fptools_cv_htype_unsigned_char=NotReallyAType
+        { $as_echo "$as_me:${as_lineno-$LINENO}: result: not supported" >&5
+$as_echo "not supported" >&6; }
+
+    fi
+
+            if test "$fptools_cv_htype_sup_unsigned_char" = yes; then
+        { $as_echo "$as_me:${as_lineno-$LINENO}: result: $fptools_cv_htype_unsigned_char" >&5
+$as_echo "$fptools_cv_htype_unsigned_char" >&6; }
+
+cat >>confdefs.h <<_ACEOF
+#define HTYPE_UNSIGNED_CHAR $fptools_cv_htype_unsigned_char
+_ACEOF
+
+    fi
+
+
+
+
+
+
+
+
+
+
+    { $as_echo "$as_me:${as_lineno-$LINENO}: checking Haskell type for short" >&5
+$as_echo_n "checking Haskell type for short... " >&6; }
+    if ${fptools_cv_htype_short+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+
+        fptools_cv_htype_sup_short=yes
+        if ac_fn_c_compute_int "$LINENO" "(short)0.2 - (short)0.4 < 0 ? 0 : 1" "HTYPE_IS_INTEGRAL"        "
+#include <stdbool.h>
+#include <stdio.h>
+#include <stddef.h>
+
+#if HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+
+#if HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+
+#if HAVE_SYS_STAT_H
+# include <sys/stat.h>
+#endif
+
+#if HAVE_FCNTL_H
+# include <fcntl.h>
+#endif
+
+#if HAVE_SIGNAL_H
+# include <signal.h>
+#endif
+
+#if HAVE_TIME_H
+# include <time.h>
+#endif
+
+#if HAVE_TERMIOS_H
+# include <termios.h>
+#endif
+
+#if HAVE_STRING_H
+# include <string.h>
+#endif
+
+#if HAVE_CTYPE_H
+# include <ctype.h>
+#endif
+
+#if HAVE_INTTYPES_H
+# include <inttypes.h>
+#else
+# if HAVE_STDINT_H
+#  include <stdint.h>
+# endif
+#endif
+
+#if HAVE_SYS_RESOURCE_H
+# include <sys/resource.h>
+#endif
+
+#include <stdlib.h>
+"; then :
+
+else
+  HTYPE_IS_INTEGRAL=0
+fi
+
+
+
+        if test "$HTYPE_IS_INTEGRAL" -eq 0
+        then
+                                                            cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+#include <stdbool.h>
+#include <stdio.h>
+#include <stddef.h>
+
+#if HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+
+#if HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+
+#if HAVE_SYS_STAT_H
+# include <sys/stat.h>
+#endif
+
+#if HAVE_FCNTL_H
+# include <fcntl.h>
+#endif
+
+#if HAVE_SIGNAL_H
+# include <signal.h>
+#endif
+
+#if HAVE_TIME_H
+# include <time.h>
+#endif
+
+#if HAVE_TERMIOS_H
+# include <termios.h>
+#endif
+
+#if HAVE_STRING_H
+# include <string.h>
+#endif
+
+#if HAVE_CTYPE_H
+# include <ctype.h>
+#endif
+
+#if HAVE_INTTYPES_H
+# include <inttypes.h>
+#else
+# if HAVE_STDINT_H
+#  include <stdint.h>
+# endif
+#endif
+
+#if HAVE_SYS_RESOURCE_H
+# include <sys/resource.h>
+#endif
+
+#include <stdlib.h>
+
+int
+main ()
+{
+short val; *val;
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  HTYPE_IS_POINTER=yes
+else
+  HTYPE_IS_POINTER=no
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+
+            if test "$HTYPE_IS_POINTER" = yes
+            then
+                fptools_cv_htype_short="Ptr ()"
+            else
+                if ac_fn_c_compute_int "$LINENO" "sizeof(short) == sizeof(float)" "HTYPE_IS_FLOAT"        "
+#include <stdbool.h>
+#include <stdio.h>
+#include <stddef.h>
+
+#if HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+
+#if HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+
+#if HAVE_SYS_STAT_H
+# include <sys/stat.h>
+#endif
+
+#if HAVE_FCNTL_H
+# include <fcntl.h>
+#endif
+
+#if HAVE_SIGNAL_H
+# include <signal.h>
+#endif
+
+#if HAVE_TIME_H
+# include <time.h>
+#endif
+
+#if HAVE_TERMIOS_H
+# include <termios.h>
+#endif
+
+#if HAVE_STRING_H
+# include <string.h>
+#endif
+
+#if HAVE_CTYPE_H
+# include <ctype.h>
+#endif
+
+#if HAVE_INTTYPES_H
+# include <inttypes.h>
+#else
+# if HAVE_STDINT_H
+#  include <stdint.h>
+# endif
+#endif
+
+#if HAVE_SYS_RESOURCE_H
+# include <sys/resource.h>
+#endif
+
+#include <stdlib.h>
+"; then :
+
+else
+  fptools_cv_htype_sup_short=no
+fi
+
+
+                if ac_fn_c_compute_int "$LINENO" "sizeof(short) == sizeof(double)" "HTYPE_IS_DOUBLE"        "
+#include <stdbool.h>
+#include <stdio.h>
+#include <stddef.h>
+
+#if HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+
+#if HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+
+#if HAVE_SYS_STAT_H
+# include <sys/stat.h>
+#endif
+
+#if HAVE_FCNTL_H
+# include <fcntl.h>
+#endif
+
+#if HAVE_SIGNAL_H
+# include <signal.h>
+#endif
+
+#if HAVE_TIME_H
+# include <time.h>
+#endif
+
+#if HAVE_TERMIOS_H
+# include <termios.h>
+#endif
+
+#if HAVE_STRING_H
+# include <string.h>
+#endif
+
+#if HAVE_CTYPE_H
+# include <ctype.h>
+#endif
+
+#if HAVE_INTTYPES_H
+# include <inttypes.h>
+#else
+# if HAVE_STDINT_H
+#  include <stdint.h>
+# endif
+#endif
+
+#if HAVE_SYS_RESOURCE_H
+# include <sys/resource.h>
+#endif
+
+#include <stdlib.h>
+"; then :
+
+else
+  fptools_cv_htype_sup_short=no
+fi
+
+
+                if ac_fn_c_compute_int "$LINENO" "sizeof(short) == sizeof(long double)" "HTYPE_IS_LDOUBLE"        "
+#include <stdbool.h>
+#include <stdio.h>
+#include <stddef.h>
+
+#if HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+
+#if HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+
+#if HAVE_SYS_STAT_H
+# include <sys/stat.h>
+#endif
+
+#if HAVE_FCNTL_H
+# include <fcntl.h>
+#endif
+
+#if HAVE_SIGNAL_H
+# include <signal.h>
+#endif
+
+#if HAVE_TIME_H
+# include <time.h>
+#endif
+
+#if HAVE_TERMIOS_H
+# include <termios.h>
+#endif
+
+#if HAVE_STRING_H
+# include <string.h>
+#endif
+
+#if HAVE_CTYPE_H
+# include <ctype.h>
+#endif
+
+#if HAVE_INTTYPES_H
+# include <inttypes.h>
+#else
+# if HAVE_STDINT_H
+#  include <stdint.h>
+# endif
+#endif
+
+#if HAVE_SYS_RESOURCE_H
+# include <sys/resource.h>
+#endif
+
+#include <stdlib.h>
+"; then :
+
+else
+  fptools_cv_htype_sup_short=no
+fi
+
+
+                if test "$HTYPE_IS_FLOAT" -eq 1
+                then
+                    fptools_cv_htype_short=Float
+                elif test "$HTYPE_IS_DOUBLE" -eq 1
+                then
+                    fptools_cv_htype_short=Double
+                elif test "$HTYPE_IS_LDOUBLE" -eq 1
+                then
+                    fptools_cv_htype_short=LDouble
+                else
+                    fptools_cv_htype_sup_short=no
+                fi
+            fi
+        else
+            if ac_fn_c_compute_int "$LINENO" "((short)(-1)) < ((short)0)" "HTYPE_IS_SIGNED"        "
+#include <stdbool.h>
+#include <stdio.h>
+#include <stddef.h>
+
+#if HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+
+#if HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+
+#if HAVE_SYS_STAT_H
+# include <sys/stat.h>
+#endif
+
+#if HAVE_FCNTL_H
+# include <fcntl.h>
+#endif
+
+#if HAVE_SIGNAL_H
+# include <signal.h>
+#endif
+
+#if HAVE_TIME_H
+# include <time.h>
+#endif
+
+#if HAVE_TERMIOS_H
+# include <termios.h>
+#endif
+
+#if HAVE_STRING_H
+# include <string.h>
+#endif
+
+#if HAVE_CTYPE_H
+# include <ctype.h>
+#endif
+
+#if HAVE_INTTYPES_H
+# include <inttypes.h>
+#else
+# if HAVE_STDINT_H
+#  include <stdint.h>
+# endif
+#endif
+
+#if HAVE_SYS_RESOURCE_H
+# include <sys/resource.h>
+#endif
+
+#include <stdlib.h>
+"; then :
+
+else
+  fptools_cv_htype_sup_short=no
+fi
+
+
+            if ac_fn_c_compute_int "$LINENO" "sizeof(short) * 8" "HTYPE_SIZE"        "
+#include <stdbool.h>
+#include <stdio.h>
+#include <stddef.h>
+
+#if HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+
+#if HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+
+#if HAVE_SYS_STAT_H
+# include <sys/stat.h>
+#endif
+
+#if HAVE_FCNTL_H
+# include <fcntl.h>
+#endif
+
+#if HAVE_SIGNAL_H
+# include <signal.h>
+#endif
+
+#if HAVE_TIME_H
+# include <time.h>
+#endif
+
+#if HAVE_TERMIOS_H
+# include <termios.h>
+#endif
+
+#if HAVE_STRING_H
+# include <string.h>
+#endif
+
+#if HAVE_CTYPE_H
+# include <ctype.h>
+#endif
+
+#if HAVE_INTTYPES_H
+# include <inttypes.h>
+#else
+# if HAVE_STDINT_H
+#  include <stdint.h>
+# endif
+#endif
+
+#if HAVE_SYS_RESOURCE_H
+# include <sys/resource.h>
+#endif
+
+#include <stdlib.h>
+"; then :
+
+else
+  fptools_cv_htype_sup_short=no
+fi
+
+
+            if test "$HTYPE_IS_SIGNED" -eq 0
+            then
+                fptools_cv_htype_short="Word$HTYPE_SIZE"
+            else
+                fptools_cv_htype_short="Int$HTYPE_SIZE"
+            fi
+        fi
+
+fi
+
+    if test "$fptools_cv_htype_sup_short" = no
+    then
+
+        fptools_cv_htype_short=NotReallyAType
+        { $as_echo "$as_me:${as_lineno-$LINENO}: result: not supported" >&5
+$as_echo "not supported" >&6; }
+
+    fi
+
+            if test "$fptools_cv_htype_sup_short" = yes; then
+        { $as_echo "$as_me:${as_lineno-$LINENO}: result: $fptools_cv_htype_short" >&5
+$as_echo "$fptools_cv_htype_short" >&6; }
+
+cat >>confdefs.h <<_ACEOF
+#define HTYPE_SHORT $fptools_cv_htype_short
+_ACEOF
+
+    fi
+
+
+
+
+
+
+
+
+
+
+    { $as_echo "$as_me:${as_lineno-$LINENO}: checking Haskell type for unsigned short" >&5
+$as_echo_n "checking Haskell type for unsigned short... " >&6; }
+    if ${fptools_cv_htype_unsigned_short+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+
+        fptools_cv_htype_sup_unsigned_short=yes
+        if ac_fn_c_compute_int "$LINENO" "(unsigned short)0.2 - (unsigned short)0.4 < 0 ? 0 : 1" "HTYPE_IS_INTEGRAL"        "
+#include <stdbool.h>
+#include <stdio.h>
+#include <stddef.h>
+
+#if HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+
+#if HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+
+#if HAVE_SYS_STAT_H
+# include <sys/stat.h>
+#endif
+
+#if HAVE_FCNTL_H
+# include <fcntl.h>
+#endif
+
+#if HAVE_SIGNAL_H
+# include <signal.h>
+#endif
+
+#if HAVE_TIME_H
+# include <time.h>
+#endif
+
+#if HAVE_TERMIOS_H
+# include <termios.h>
+#endif
+
+#if HAVE_STRING_H
+# include <string.h>
+#endif
+
+#if HAVE_CTYPE_H
+# include <ctype.h>
+#endif
+
+#if HAVE_INTTYPES_H
+# include <inttypes.h>
+#else
+# if HAVE_STDINT_H
+#  include <stdint.h>
+# endif
+#endif
+
+#if HAVE_SYS_RESOURCE_H
+# include <sys/resource.h>
+#endif
+
+#include <stdlib.h>
+"; then :
+
+else
+  HTYPE_IS_INTEGRAL=0
+fi
+
+
+
+        if test "$HTYPE_IS_INTEGRAL" -eq 0
+        then
+                                                            cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+#include <stdbool.h>
+#include <stdio.h>
+#include <stddef.h>
+
+#if HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+
+#if HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+
+#if HAVE_SYS_STAT_H
+# include <sys/stat.h>
+#endif
+
+#if HAVE_FCNTL_H
+# include <fcntl.h>
+#endif
+
+#if HAVE_SIGNAL_H
+# include <signal.h>
+#endif
+
+#if HAVE_TIME_H
+# include <time.h>
+#endif
+
+#if HAVE_TERMIOS_H
+# include <termios.h>
+#endif
+
+#if HAVE_STRING_H
+# include <string.h>
+#endif
+
+#if HAVE_CTYPE_H
+# include <ctype.h>
+#endif
+
+#if HAVE_INTTYPES_H
+# include <inttypes.h>
+#else
+# if HAVE_STDINT_H
+#  include <stdint.h>
+# endif
+#endif
+
+#if HAVE_SYS_RESOURCE_H
+# include <sys/resource.h>
+#endif
+
+#include <stdlib.h>
+
+int
+main ()
+{
+unsigned short val; *val;
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  HTYPE_IS_POINTER=yes
+else
+  HTYPE_IS_POINTER=no
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+
+            if test "$HTYPE_IS_POINTER" = yes
+            then
+                fptools_cv_htype_unsigned_short="Ptr ()"
+            else
+                if ac_fn_c_compute_int "$LINENO" "sizeof(unsigned short) == sizeof(float)" "HTYPE_IS_FLOAT"        "
+#include <stdbool.h>
+#include <stdio.h>
+#include <stddef.h>
+
+#if HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+
+#if HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+
+#if HAVE_SYS_STAT_H
+# include <sys/stat.h>
+#endif
+
+#if HAVE_FCNTL_H
+# include <fcntl.h>
+#endif
+
+#if HAVE_SIGNAL_H
+# include <signal.h>
+#endif
+
+#if HAVE_TIME_H
+# include <time.h>
+#endif
+
+#if HAVE_TERMIOS_H
+# include <termios.h>
+#endif
+
+#if HAVE_STRING_H
+# include <string.h>
+#endif
+
+#if HAVE_CTYPE_H
+# include <ctype.h>
+#endif
+
+#if HAVE_INTTYPES_H
+# include <inttypes.h>
+#else
+# if HAVE_STDINT_H
+#  include <stdint.h>
+# endif
+#endif
+
+#if HAVE_SYS_RESOURCE_H
+# include <sys/resource.h>
+#endif
+
+#include <stdlib.h>
+"; then :
+
+else
+  fptools_cv_htype_sup_unsigned_short=no
+fi
+
+
+                if ac_fn_c_compute_int "$LINENO" "sizeof(unsigned short) == sizeof(double)" "HTYPE_IS_DOUBLE"        "
+#include <stdbool.h>
+#include <stdio.h>
+#include <stddef.h>
+
+#if HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+
+#if HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+
+#if HAVE_SYS_STAT_H
+# include <sys/stat.h>
+#endif
+
+#if HAVE_FCNTL_H
+# include <fcntl.h>
+#endif
+
+#if HAVE_SIGNAL_H
+# include <signal.h>
+#endif
+
+#if HAVE_TIME_H
+# include <time.h>
+#endif
+
+#if HAVE_TERMIOS_H
+# include <termios.h>
+#endif
+
+#if HAVE_STRING_H
+# include <string.h>
+#endif
+
+#if HAVE_CTYPE_H
+# include <ctype.h>
+#endif
+
+#if HAVE_INTTYPES_H
+# include <inttypes.h>
+#else
+# if HAVE_STDINT_H
+#  include <stdint.h>
+# endif
+#endif
+
+#if HAVE_SYS_RESOURCE_H
+# include <sys/resource.h>
+#endif
+
+#include <stdlib.h>
+"; then :
+
+else
+  fptools_cv_htype_sup_unsigned_short=no
+fi
+
+
+                if ac_fn_c_compute_int "$LINENO" "sizeof(unsigned short) == sizeof(long double)" "HTYPE_IS_LDOUBLE"        "
+#include <stdbool.h>
+#include <stdio.h>
+#include <stddef.h>
+
+#if HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+
+#if HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+
+#if HAVE_SYS_STAT_H
+# include <sys/stat.h>
+#endif
+
+#if HAVE_FCNTL_H
+# include <fcntl.h>
+#endif
+
+#if HAVE_SIGNAL_H
+# include <signal.h>
+#endif
+
+#if HAVE_TIME_H
+# include <time.h>
+#endif
+
+#if HAVE_TERMIOS_H
+# include <termios.h>
+#endif
+
+#if HAVE_STRING_H
+# include <string.h>
+#endif
+
+#if HAVE_CTYPE_H
+# include <ctype.h>
+#endif
+
+#if HAVE_INTTYPES_H
+# include <inttypes.h>
+#else
+# if HAVE_STDINT_H
+#  include <stdint.h>
+# endif
+#endif
+
+#if HAVE_SYS_RESOURCE_H
+# include <sys/resource.h>
+#endif
+
+#include <stdlib.h>
+"; then :
+
+else
+  fptools_cv_htype_sup_unsigned_short=no
+fi
+
+
+                if test "$HTYPE_IS_FLOAT" -eq 1
+                then
+                    fptools_cv_htype_unsigned_short=Float
+                elif test "$HTYPE_IS_DOUBLE" -eq 1
+                then
+                    fptools_cv_htype_unsigned_short=Double
+                elif test "$HTYPE_IS_LDOUBLE" -eq 1
+                then
+                    fptools_cv_htype_unsigned_short=LDouble
+                else
+                    fptools_cv_htype_sup_unsigned_short=no
+                fi
+            fi
+        else
+            if ac_fn_c_compute_int "$LINENO" "((unsigned short)(-1)) < ((unsigned short)0)" "HTYPE_IS_SIGNED"        "
+#include <stdbool.h>
+#include <stdio.h>
+#include <stddef.h>
+
+#if HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+
+#if HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+
+#if HAVE_SYS_STAT_H
+# include <sys/stat.h>
+#endif
+
+#if HAVE_FCNTL_H
+# include <fcntl.h>
+#endif
+
+#if HAVE_SIGNAL_H
+# include <signal.h>
+#endif
+
+#if HAVE_TIME_H
+# include <time.h>
+#endif
+
+#if HAVE_TERMIOS_H
+# include <termios.h>
+#endif
+
+#if HAVE_STRING_H
+# include <string.h>
+#endif
+
+#if HAVE_CTYPE_H
+# include <ctype.h>
+#endif
+
+#if HAVE_INTTYPES_H
+# include <inttypes.h>
+#else
+# if HAVE_STDINT_H
+#  include <stdint.h>
+# endif
+#endif
+
+#if HAVE_SYS_RESOURCE_H
+# include <sys/resource.h>
+#endif
+
+#include <stdlib.h>
+"; then :
+
+else
+  fptools_cv_htype_sup_unsigned_short=no
+fi
+
+
+            if ac_fn_c_compute_int "$LINENO" "sizeof(unsigned short) * 8" "HTYPE_SIZE"        "
+#include <stdbool.h>
+#include <stdio.h>
+#include <stddef.h>
+
+#if HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+
+#if HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+
+#if HAVE_SYS_STAT_H
+# include <sys/stat.h>
+#endif
+
+#if HAVE_FCNTL_H
+# include <fcntl.h>
+#endif
+
+#if HAVE_SIGNAL_H
+# include <signal.h>
+#endif
+
+#if HAVE_TIME_H
+# include <time.h>
+#endif
+
+#if HAVE_TERMIOS_H
+# include <termios.h>
+#endif
+
+#if HAVE_STRING_H
+# include <string.h>
+#endif
+
+#if HAVE_CTYPE_H
+# include <ctype.h>
+#endif
+
+#if HAVE_INTTYPES_H
+# include <inttypes.h>
+#else
+# if HAVE_STDINT_H
+#  include <stdint.h>
+# endif
+#endif
+
+#if HAVE_SYS_RESOURCE_H
+# include <sys/resource.h>
+#endif
+
+#include <stdlib.h>
+"; then :
+
+else
+  fptools_cv_htype_sup_unsigned_short=no
+fi
+
+
+            if test "$HTYPE_IS_SIGNED" -eq 0
+            then
+                fptools_cv_htype_unsigned_short="Word$HTYPE_SIZE"
+            else
+                fptools_cv_htype_unsigned_short="Int$HTYPE_SIZE"
+            fi
+        fi
+
+fi
+
+    if test "$fptools_cv_htype_sup_unsigned_short" = no
+    then
+
+        fptools_cv_htype_unsigned_short=NotReallyAType
+        { $as_echo "$as_me:${as_lineno-$LINENO}: result: not supported" >&5
+$as_echo "not supported" >&6; }
+
+    fi
+
+            if test "$fptools_cv_htype_sup_unsigned_short" = yes; then
+        { $as_echo "$as_me:${as_lineno-$LINENO}: result: $fptools_cv_htype_unsigned_short" >&5
+$as_echo "$fptools_cv_htype_unsigned_short" >&6; }
+
+cat >>confdefs.h <<_ACEOF
+#define HTYPE_UNSIGNED_SHORT $fptools_cv_htype_unsigned_short
+_ACEOF
+
+    fi
+
+
+
+
+
+
+
+
+
+
+    { $as_echo "$as_me:${as_lineno-$LINENO}: checking Haskell type for int" >&5
+$as_echo_n "checking Haskell type for int... " >&6; }
+    if ${fptools_cv_htype_int+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+
+        fptools_cv_htype_sup_int=yes
+        if ac_fn_c_compute_int "$LINENO" "(int)0.2 - (int)0.4 < 0 ? 0 : 1" "HTYPE_IS_INTEGRAL"        "
+#include <stdbool.h>
+#include <stdio.h>
+#include <stddef.h>
+
+#if HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+
+#if HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+
+#if HAVE_SYS_STAT_H
+# include <sys/stat.h>
+#endif
+
+#if HAVE_FCNTL_H
+# include <fcntl.h>
+#endif
+
+#if HAVE_SIGNAL_H
+# include <signal.h>
+#endif
+
+#if HAVE_TIME_H
+# include <time.h>
+#endif
+
+#if HAVE_TERMIOS_H
+# include <termios.h>
+#endif
+
+#if HAVE_STRING_H
+# include <string.h>
+#endif
+
+#if HAVE_CTYPE_H
+# include <ctype.h>
+#endif
+
+#if HAVE_INTTYPES_H
+# include <inttypes.h>
+#else
+# if HAVE_STDINT_H
+#  include <stdint.h>
+# endif
+#endif
+
+#if HAVE_SYS_RESOURCE_H
+# include <sys/resource.h>
+#endif
+
+#include <stdlib.h>
+"; then :
+
+else
+  HTYPE_IS_INTEGRAL=0
+fi
+
+
+
+        if test "$HTYPE_IS_INTEGRAL" -eq 0
+        then
+                                                            cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+#include <stdbool.h>
+#include <stdio.h>
+#include <stddef.h>
+
+#if HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+
+#if HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+
+#if HAVE_SYS_STAT_H
+# include <sys/stat.h>
+#endif
+
+#if HAVE_FCNTL_H
+# include <fcntl.h>
+#endif
+
+#if HAVE_SIGNAL_H
+# include <signal.h>
+#endif
+
+#if HAVE_TIME_H
+# include <time.h>
+#endif
+
+#if HAVE_TERMIOS_H
+# include <termios.h>
+#endif
+
+#if HAVE_STRING_H
+# include <string.h>
+#endif
+
+#if HAVE_CTYPE_H
+# include <ctype.h>
+#endif
+
+#if HAVE_INTTYPES_H
+# include <inttypes.h>
+#else
+# if HAVE_STDINT_H
+#  include <stdint.h>
+# endif
+#endif
+
+#if HAVE_SYS_RESOURCE_H
+# include <sys/resource.h>
+#endif
+
+#include <stdlib.h>
+
+int
+main ()
+{
+int val; *val;
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  HTYPE_IS_POINTER=yes
+else
+  HTYPE_IS_POINTER=no
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+
+            if test "$HTYPE_IS_POINTER" = yes
+            then
+                fptools_cv_htype_int="Ptr ()"
+            else
+                if ac_fn_c_compute_int "$LINENO" "sizeof(int) == sizeof(float)" "HTYPE_IS_FLOAT"        "
+#include <stdbool.h>
+#include <stdio.h>
+#include <stddef.h>
+
+#if HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+
+#if HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+
+#if HAVE_SYS_STAT_H
+# include <sys/stat.h>
+#endif
+
+#if HAVE_FCNTL_H
+# include <fcntl.h>
+#endif
+
+#if HAVE_SIGNAL_H
+# include <signal.h>
+#endif
+
+#if HAVE_TIME_H
+# include <time.h>
+#endif
+
+#if HAVE_TERMIOS_H
+# include <termios.h>
+#endif
+
+#if HAVE_STRING_H
+# include <string.h>
+#endif
+
+#if HAVE_CTYPE_H
+# include <ctype.h>
+#endif
+
+#if HAVE_INTTYPES_H
+# include <inttypes.h>
+#else
+# if HAVE_STDINT_H
+#  include <stdint.h>
+# endif
+#endif
+
+#if HAVE_SYS_RESOURCE_H
+# include <sys/resource.h>
+#endif
+
+#include <stdlib.h>
+"; then :
+
+else
+  fptools_cv_htype_sup_int=no
+fi
+
+
+                if ac_fn_c_compute_int "$LINENO" "sizeof(int) == sizeof(double)" "HTYPE_IS_DOUBLE"        "
+#include <stdbool.h>
+#include <stdio.h>
+#include <stddef.h>
+
+#if HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+
+#if HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+
+#if HAVE_SYS_STAT_H
+# include <sys/stat.h>
+#endif
+
+#if HAVE_FCNTL_H
+# include <fcntl.h>
+#endif
+
+#if HAVE_SIGNAL_H
+# include <signal.h>
+#endif
+
+#if HAVE_TIME_H
+# include <time.h>
+#endif
+
+#if HAVE_TERMIOS_H
+# include <termios.h>
+#endif
+
+#if HAVE_STRING_H
+# include <string.h>
+#endif
+
+#if HAVE_CTYPE_H
+# include <ctype.h>
+#endif
+
+#if HAVE_INTTYPES_H
+# include <inttypes.h>
+#else
+# if HAVE_STDINT_H
+#  include <stdint.h>
+# endif
+#endif
+
+#if HAVE_SYS_RESOURCE_H
+# include <sys/resource.h>
+#endif
+
+#include <stdlib.h>
+"; then :
+
+else
+  fptools_cv_htype_sup_int=no
+fi
+
+
+                if ac_fn_c_compute_int "$LINENO" "sizeof(int) == sizeof(long double)" "HTYPE_IS_LDOUBLE"        "
+#include <stdbool.h>
+#include <stdio.h>
+#include <stddef.h>
+
+#if HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+
+#if HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+
+#if HAVE_SYS_STAT_H
+# include <sys/stat.h>
+#endif
+
+#if HAVE_FCNTL_H
+# include <fcntl.h>
+#endif
+
+#if HAVE_SIGNAL_H
+# include <signal.h>
+#endif
+
+#if HAVE_TIME_H
+# include <time.h>
+#endif
+
+#if HAVE_TERMIOS_H
+# include <termios.h>
+#endif
+
+#if HAVE_STRING_H
+# include <string.h>
+#endif
+
+#if HAVE_CTYPE_H
+# include <ctype.h>
+#endif
+
+#if HAVE_INTTYPES_H
+# include <inttypes.h>
+#else
+# if HAVE_STDINT_H
+#  include <stdint.h>
+# endif
+#endif
+
+#if HAVE_SYS_RESOURCE_H
+# include <sys/resource.h>
+#endif
+
+#include <stdlib.h>
+"; then :
+
+else
+  fptools_cv_htype_sup_int=no
+fi
+
+
+                if test "$HTYPE_IS_FLOAT" -eq 1
+                then
+                    fptools_cv_htype_int=Float
+                elif test "$HTYPE_IS_DOUBLE" -eq 1
+                then
+                    fptools_cv_htype_int=Double
+                elif test "$HTYPE_IS_LDOUBLE" -eq 1
+                then
+                    fptools_cv_htype_int=LDouble
+                else
+                    fptools_cv_htype_sup_int=no
+                fi
+            fi
+        else
+            if ac_fn_c_compute_int "$LINENO" "((int)(-1)) < ((int)0)" "HTYPE_IS_SIGNED"        "
+#include <stdbool.h>
+#include <stdio.h>
+#include <stddef.h>
+
+#if HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+
+#if HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+
+#if HAVE_SYS_STAT_H
+# include <sys/stat.h>
+#endif
+
+#if HAVE_FCNTL_H
+# include <fcntl.h>
+#endif
+
+#if HAVE_SIGNAL_H
+# include <signal.h>
+#endif
+
+#if HAVE_TIME_H
+# include <time.h>
+#endif
+
+#if HAVE_TERMIOS_H
+# include <termios.h>
+#endif
+
+#if HAVE_STRING_H
+# include <string.h>
+#endif
+
+#if HAVE_CTYPE_H
+# include <ctype.h>
+#endif
+
+#if HAVE_INTTYPES_H
+# include <inttypes.h>
+#else
+# if HAVE_STDINT_H
+#  include <stdint.h>
+# endif
+#endif
+
+#if HAVE_SYS_RESOURCE_H
+# include <sys/resource.h>
+#endif
+
+#include <stdlib.h>
+"; then :
+
+else
+  fptools_cv_htype_sup_int=no
+fi
+
+
+            if ac_fn_c_compute_int "$LINENO" "sizeof(int) * 8" "HTYPE_SIZE"        "
+#include <stdbool.h>
+#include <stdio.h>
+#include <stddef.h>
+
+#if HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+
+#if HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+
+#if HAVE_SYS_STAT_H
+# include <sys/stat.h>
+#endif
+
+#if HAVE_FCNTL_H
+# include <fcntl.h>
+#endif
+
+#if HAVE_SIGNAL_H
+# include <signal.h>
+#endif
+
+#if HAVE_TIME_H
+# include <time.h>
+#endif
+
+#if HAVE_TERMIOS_H
+# include <termios.h>
+#endif
+
+#if HAVE_STRING_H
+# include <string.h>
+#endif
+
+#if HAVE_CTYPE_H
+# include <ctype.h>
+#endif
+
+#if HAVE_INTTYPES_H
+# include <inttypes.h>
+#else
+# if HAVE_STDINT_H
+#  include <stdint.h>
+# endif
+#endif
+
+#if HAVE_SYS_RESOURCE_H
+# include <sys/resource.h>
+#endif
+
+#include <stdlib.h>
+"; then :
+
+else
+  fptools_cv_htype_sup_int=no
+fi
+
+
+            if test "$HTYPE_IS_SIGNED" -eq 0
+            then
+                fptools_cv_htype_int="Word$HTYPE_SIZE"
+            else
+                fptools_cv_htype_int="Int$HTYPE_SIZE"
+            fi
+        fi
+
+fi
+
+    if test "$fptools_cv_htype_sup_int" = no
+    then
+
+        fptools_cv_htype_int=NotReallyAType
+        { $as_echo "$as_me:${as_lineno-$LINENO}: result: not supported" >&5
+$as_echo "not supported" >&6; }
+
+    fi
+
+            if test "$fptools_cv_htype_sup_int" = yes; then
+        { $as_echo "$as_me:${as_lineno-$LINENO}: result: $fptools_cv_htype_int" >&5
+$as_echo "$fptools_cv_htype_int" >&6; }
+
+cat >>confdefs.h <<_ACEOF
+#define HTYPE_INT $fptools_cv_htype_int
+_ACEOF
+
+    fi
+
+
+
+
+
+
+
+
+
+
+    { $as_echo "$as_me:${as_lineno-$LINENO}: checking Haskell type for unsigned int" >&5
+$as_echo_n "checking Haskell type for unsigned int... " >&6; }
+    if ${fptools_cv_htype_unsigned_int+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+
+        fptools_cv_htype_sup_unsigned_int=yes
+        if ac_fn_c_compute_int "$LINENO" "(unsigned int)0.2 - (unsigned int)0.4 < 0 ? 0 : 1" "HTYPE_IS_INTEGRAL"        "
+#include <stdbool.h>
+#include <stdio.h>
+#include <stddef.h>
+
+#if HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+
+#if HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+
+#if HAVE_SYS_STAT_H
+# include <sys/stat.h>
+#endif
+
+#if HAVE_FCNTL_H
+# include <fcntl.h>
+#endif
+
+#if HAVE_SIGNAL_H
+# include <signal.h>
+#endif
+
+#if HAVE_TIME_H
+# include <time.h>
+#endif
+
+#if HAVE_TERMIOS_H
+# include <termios.h>
+#endif
+
+#if HAVE_STRING_H
+# include <string.h>
+#endif
+
+#if HAVE_CTYPE_H
+# include <ctype.h>
+#endif
+
+#if HAVE_INTTYPES_H
+# include <inttypes.h>
+#else
+# if HAVE_STDINT_H
+#  include <stdint.h>
+# endif
+#endif
+
+#if HAVE_SYS_RESOURCE_H
+# include <sys/resource.h>
+#endif
+
+#include <stdlib.h>
+"; then :
+
+else
+  HTYPE_IS_INTEGRAL=0
+fi
+
+
+
+        if test "$HTYPE_IS_INTEGRAL" -eq 0
+        then
+                                                            cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+#include <stdbool.h>
+#include <stdio.h>
+#include <stddef.h>
+
+#if HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+
+#if HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+
+#if HAVE_SYS_STAT_H
+# include <sys/stat.h>
+#endif
+
+#if HAVE_FCNTL_H
+# include <fcntl.h>
+#endif
+
+#if HAVE_SIGNAL_H
+# include <signal.h>
+#endif
+
+#if HAVE_TIME_H
+# include <time.h>
+#endif
+
+#if HAVE_TERMIOS_H
+# include <termios.h>
+#endif
+
+#if HAVE_STRING_H
+# include <string.h>
+#endif
+
+#if HAVE_CTYPE_H
+# include <ctype.h>
+#endif
+
+#if HAVE_INTTYPES_H
+# include <inttypes.h>
+#else
+# if HAVE_STDINT_H
+#  include <stdint.h>
+# endif
+#endif
+
+#if HAVE_SYS_RESOURCE_H
+# include <sys/resource.h>
+#endif
+
+#include <stdlib.h>
+
+int
+main ()
+{
+unsigned int val; *val;
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  HTYPE_IS_POINTER=yes
+else
+  HTYPE_IS_POINTER=no
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+
+            if test "$HTYPE_IS_POINTER" = yes
+            then
+                fptools_cv_htype_unsigned_int="Ptr ()"
+            else
+                if ac_fn_c_compute_int "$LINENO" "sizeof(unsigned int) == sizeof(float)" "HTYPE_IS_FLOAT"        "
+#include <stdbool.h>
+#include <stdio.h>
+#include <stddef.h>
+
+#if HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+
+#if HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+
+#if HAVE_SYS_STAT_H
+# include <sys/stat.h>
+#endif
+
+#if HAVE_FCNTL_H
+# include <fcntl.h>
+#endif
+
+#if HAVE_SIGNAL_H
+# include <signal.h>
+#endif
+
+#if HAVE_TIME_H
+# include <time.h>
+#endif
+
+#if HAVE_TERMIOS_H
+# include <termios.h>
+#endif
+
+#if HAVE_STRING_H
+# include <string.h>
+#endif
+
+#if HAVE_CTYPE_H
+# include <ctype.h>
+#endif
+
+#if HAVE_INTTYPES_H
+# include <inttypes.h>
+#else
+# if HAVE_STDINT_H
+#  include <stdint.h>
+# endif
+#endif
+
+#if HAVE_SYS_RESOURCE_H
+# include <sys/resource.h>
+#endif
+
+#include <stdlib.h>
+"; then :
+
+else
+  fptools_cv_htype_sup_unsigned_int=no
+fi
+
+
+                if ac_fn_c_compute_int "$LINENO" "sizeof(unsigned int) == sizeof(double)" "HTYPE_IS_DOUBLE"        "
+#include <stdbool.h>
+#include <stdio.h>
+#include <stddef.h>
+
+#if HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+
+#if HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+
+#if HAVE_SYS_STAT_H
+# include <sys/stat.h>
+#endif
+
+#if HAVE_FCNTL_H
+# include <fcntl.h>
+#endif
+
+#if HAVE_SIGNAL_H
+# include <signal.h>
+#endif
+
+#if HAVE_TIME_H
+# include <time.h>
+#endif
+
+#if HAVE_TERMIOS_H
+# include <termios.h>
+#endif
+
+#if HAVE_STRING_H
+# include <string.h>
+#endif
+
+#if HAVE_CTYPE_H
+# include <ctype.h>
+#endif
+
+#if HAVE_INTTYPES_H
+# include <inttypes.h>
+#else
+# if HAVE_STDINT_H
+#  include <stdint.h>
+# endif
+#endif
+
+#if HAVE_SYS_RESOURCE_H
+# include <sys/resource.h>
+#endif
+
+#include <stdlib.h>
+"; then :
+
+else
+  fptools_cv_htype_sup_unsigned_int=no
+fi
+
+
+                if ac_fn_c_compute_int "$LINENO" "sizeof(unsigned int) == sizeof(long double)" "HTYPE_IS_LDOUBLE"        "
+#include <stdbool.h>
+#include <stdio.h>
+#include <stddef.h>
+
+#if HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+
+#if HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+
+#if HAVE_SYS_STAT_H
+# include <sys/stat.h>
+#endif
+
+#if HAVE_FCNTL_H
+# include <fcntl.h>
+#endif
+
+#if HAVE_SIGNAL_H
+# include <signal.h>
+#endif
+
+#if HAVE_TIME_H
+# include <time.h>
+#endif
+
+#if HAVE_TERMIOS_H
+# include <termios.h>
+#endif
+
+#if HAVE_STRING_H
+# include <string.h>
+#endif
+
+#if HAVE_CTYPE_H
+# include <ctype.h>
+#endif
+
+#if HAVE_INTTYPES_H
+# include <inttypes.h>
+#else
+# if HAVE_STDINT_H
+#  include <stdint.h>
+# endif
+#endif
+
+#if HAVE_SYS_RESOURCE_H
+# include <sys/resource.h>
+#endif
+
+#include <stdlib.h>
+"; then :
+
+else
+  fptools_cv_htype_sup_unsigned_int=no
+fi
+
+
+                if test "$HTYPE_IS_FLOAT" -eq 1
+                then
+                    fptools_cv_htype_unsigned_int=Float
+                elif test "$HTYPE_IS_DOUBLE" -eq 1
+                then
+                    fptools_cv_htype_unsigned_int=Double
+                elif test "$HTYPE_IS_LDOUBLE" -eq 1
+                then
+                    fptools_cv_htype_unsigned_int=LDouble
+                else
+                    fptools_cv_htype_sup_unsigned_int=no
+                fi
+            fi
+        else
+            if ac_fn_c_compute_int "$LINENO" "((unsigned int)(-1)) < ((unsigned int)0)" "HTYPE_IS_SIGNED"        "
+#include <stdbool.h>
+#include <stdio.h>
+#include <stddef.h>
+
+#if HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+
+#if HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+
+#if HAVE_SYS_STAT_H
+# include <sys/stat.h>
+#endif
+
+#if HAVE_FCNTL_H
+# include <fcntl.h>
+#endif
+
+#if HAVE_SIGNAL_H
+# include <signal.h>
+#endif
+
+#if HAVE_TIME_H
+# include <time.h>
+#endif
+
+#if HAVE_TERMIOS_H
+# include <termios.h>
+#endif
+
+#if HAVE_STRING_H
+# include <string.h>
+#endif
+
+#if HAVE_CTYPE_H
+# include <ctype.h>
+#endif
+
+#if HAVE_INTTYPES_H
+# include <inttypes.h>
+#else
+# if HAVE_STDINT_H
+#  include <stdint.h>
+# endif
+#endif
+
+#if HAVE_SYS_RESOURCE_H
+# include <sys/resource.h>
+#endif
+
+#include <stdlib.h>
+"; then :
+
+else
+  fptools_cv_htype_sup_unsigned_int=no
+fi
+
+
+            if ac_fn_c_compute_int "$LINENO" "sizeof(unsigned int) * 8" "HTYPE_SIZE"        "
+#include <stdbool.h>
+#include <stdio.h>
+#include <stddef.h>
+
+#if HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+
+#if HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+
+#if HAVE_SYS_STAT_H
+# include <sys/stat.h>
+#endif
+
+#if HAVE_FCNTL_H
+# include <fcntl.h>
+#endif
+
+#if HAVE_SIGNAL_H
+# include <signal.h>
+#endif
+
+#if HAVE_TIME_H
+# include <time.h>
+#endif
+
+#if HAVE_TERMIOS_H
+# include <termios.h>
+#endif
+
+#if HAVE_STRING_H
+# include <string.h>
+#endif
+
+#if HAVE_CTYPE_H
+# include <ctype.h>
+#endif
+
+#if HAVE_INTTYPES_H
+# include <inttypes.h>
+#else
+# if HAVE_STDINT_H
+#  include <stdint.h>
+# endif
+#endif
+
+#if HAVE_SYS_RESOURCE_H
+# include <sys/resource.h>
+#endif
+
+#include <stdlib.h>
+"; then :
+
+else
+  fptools_cv_htype_sup_unsigned_int=no
+fi
+
+
+            if test "$HTYPE_IS_SIGNED" -eq 0
+            then
+                fptools_cv_htype_unsigned_int="Word$HTYPE_SIZE"
+            else
+                fptools_cv_htype_unsigned_int="Int$HTYPE_SIZE"
+            fi
+        fi
+
+fi
+
+    if test "$fptools_cv_htype_sup_unsigned_int" = no
+    then
+
+        fptools_cv_htype_unsigned_int=NotReallyAType
+        { $as_echo "$as_me:${as_lineno-$LINENO}: result: not supported" >&5
+$as_echo "not supported" >&6; }
+
+    fi
+
+            if test "$fptools_cv_htype_sup_unsigned_int" = yes; then
+        { $as_echo "$as_me:${as_lineno-$LINENO}: result: $fptools_cv_htype_unsigned_int" >&5
+$as_echo "$fptools_cv_htype_unsigned_int" >&6; }
+
+cat >>confdefs.h <<_ACEOF
+#define HTYPE_UNSIGNED_INT $fptools_cv_htype_unsigned_int
+_ACEOF
+
+    fi
+
+
+
+
+
+
+
+
+
+
+    { $as_echo "$as_me:${as_lineno-$LINENO}: checking Haskell type for long" >&5
+$as_echo_n "checking Haskell type for long... " >&6; }
+    if ${fptools_cv_htype_long+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+
+        fptools_cv_htype_sup_long=yes
+        if ac_fn_c_compute_int "$LINENO" "(long)0.2 - (long)0.4 < 0 ? 0 : 1" "HTYPE_IS_INTEGRAL"        "
+#include <stdbool.h>
+#include <stdio.h>
+#include <stddef.h>
+
+#if HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+
+#if HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+
+#if HAVE_SYS_STAT_H
+# include <sys/stat.h>
+#endif
+
+#if HAVE_FCNTL_H
+# include <fcntl.h>
+#endif
+
+#if HAVE_SIGNAL_H
+# include <signal.h>
+#endif
+
+#if HAVE_TIME_H
+# include <time.h>
+#endif
+
+#if HAVE_TERMIOS_H
+# include <termios.h>
+#endif
+
+#if HAVE_STRING_H
+# include <string.h>
+#endif
+
+#if HAVE_CTYPE_H
+# include <ctype.h>
+#endif
+
+#if HAVE_INTTYPES_H
+# include <inttypes.h>
+#else
+# if HAVE_STDINT_H
+#  include <stdint.h>
+# endif
+#endif
+
+#if HAVE_SYS_RESOURCE_H
+# include <sys/resource.h>
+#endif
+
+#include <stdlib.h>
+"; then :
+
+else
+  HTYPE_IS_INTEGRAL=0
+fi
+
+
+
+        if test "$HTYPE_IS_INTEGRAL" -eq 0
+        then
+                                                            cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+#include <stdbool.h>
+#include <stdio.h>
+#include <stddef.h>
+
+#if HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+
+#if HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+
+#if HAVE_SYS_STAT_H
+# include <sys/stat.h>
+#endif
+
+#if HAVE_FCNTL_H
+# include <fcntl.h>
+#endif
+
+#if HAVE_SIGNAL_H
+# include <signal.h>
+#endif
+
+#if HAVE_TIME_H
+# include <time.h>
+#endif
+
+#if HAVE_TERMIOS_H
+# include <termios.h>
+#endif
+
+#if HAVE_STRING_H
+# include <string.h>
+#endif
+
+#if HAVE_CTYPE_H
+# include <ctype.h>
+#endif
+
+#if HAVE_INTTYPES_H
+# include <inttypes.h>
+#else
+# if HAVE_STDINT_H
+#  include <stdint.h>
+# endif
+#endif
+
+#if HAVE_SYS_RESOURCE_H
+# include <sys/resource.h>
+#endif
+
+#include <stdlib.h>
+
+int
+main ()
+{
+long val; *val;
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  HTYPE_IS_POINTER=yes
+else
+  HTYPE_IS_POINTER=no
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+
+            if test "$HTYPE_IS_POINTER" = yes
+            then
+                fptools_cv_htype_long="Ptr ()"
+            else
+                if ac_fn_c_compute_int "$LINENO" "sizeof(long) == sizeof(float)" "HTYPE_IS_FLOAT"        "
+#include <stdbool.h>
+#include <stdio.h>
+#include <stddef.h>
+
+#if HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+
+#if HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+
+#if HAVE_SYS_STAT_H
+# include <sys/stat.h>
+#endif
+
+#if HAVE_FCNTL_H
+# include <fcntl.h>
+#endif
+
+#if HAVE_SIGNAL_H
+# include <signal.h>
+#endif
+
+#if HAVE_TIME_H
+# include <time.h>
+#endif
+
+#if HAVE_TERMIOS_H
+# include <termios.h>
+#endif
+
+#if HAVE_STRING_H
+# include <string.h>
+#endif
+
+#if HAVE_CTYPE_H
+# include <ctype.h>
+#endif
+
+#if HAVE_INTTYPES_H
+# include <inttypes.h>
+#else
+# if HAVE_STDINT_H
+#  include <stdint.h>
+# endif
+#endif
+
+#if HAVE_SYS_RESOURCE_H
+# include <sys/resource.h>
+#endif
+
+#include <stdlib.h>
+"; then :
+
+else
+  fptools_cv_htype_sup_long=no
+fi
+
+
+                if ac_fn_c_compute_int "$LINENO" "sizeof(long) == sizeof(double)" "HTYPE_IS_DOUBLE"        "
+#include <stdbool.h>
+#include <stdio.h>
+#include <stddef.h>
+
+#if HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+
+#if HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+
+#if HAVE_SYS_STAT_H
+# include <sys/stat.h>
+#endif
+
+#if HAVE_FCNTL_H
+# include <fcntl.h>
+#endif
+
+#if HAVE_SIGNAL_H
+# include <signal.h>
+#endif
+
+#if HAVE_TIME_H
+# include <time.h>
+#endif
+
+#if HAVE_TERMIOS_H
+# include <termios.h>
+#endif
+
+#if HAVE_STRING_H
+# include <string.h>
+#endif
+
+#if HAVE_CTYPE_H
+# include <ctype.h>
+#endif
+
+#if HAVE_INTTYPES_H
+# include <inttypes.h>
+#else
+# if HAVE_STDINT_H
+#  include <stdint.h>
+# endif
+#endif
+
+#if HAVE_SYS_RESOURCE_H
+# include <sys/resource.h>
+#endif
+
+#include <stdlib.h>
+"; then :
+
+else
+  fptools_cv_htype_sup_long=no
+fi
+
+
+                if ac_fn_c_compute_int "$LINENO" "sizeof(long) == sizeof(long double)" "HTYPE_IS_LDOUBLE"        "
+#include <stdbool.h>
+#include <stdio.h>
+#include <stddef.h>
+
+#if HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+
+#if HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+
+#if HAVE_SYS_STAT_H
+# include <sys/stat.h>
+#endif
+
+#if HAVE_FCNTL_H
+# include <fcntl.h>
+#endif
+
+#if HAVE_SIGNAL_H
+# include <signal.h>
+#endif
+
+#if HAVE_TIME_H
+# include <time.h>
+#endif
+
+#if HAVE_TERMIOS_H
+# include <termios.h>
+#endif
+
+#if HAVE_STRING_H
+# include <string.h>
+#endif
+
+#if HAVE_CTYPE_H
+# include <ctype.h>
+#endif
+
+#if HAVE_INTTYPES_H
+# include <inttypes.h>
+#else
+# if HAVE_STDINT_H
+#  include <stdint.h>
+# endif
+#endif
+
+#if HAVE_SYS_RESOURCE_H
+# include <sys/resource.h>
+#endif
+
+#include <stdlib.h>
+"; then :
+
+else
+  fptools_cv_htype_sup_long=no
+fi
+
+
+                if test "$HTYPE_IS_FLOAT" -eq 1
+                then
+                    fptools_cv_htype_long=Float
+                elif test "$HTYPE_IS_DOUBLE" -eq 1
+                then
+                    fptools_cv_htype_long=Double
+                elif test "$HTYPE_IS_LDOUBLE" -eq 1
+                then
+                    fptools_cv_htype_long=LDouble
+                else
+                    fptools_cv_htype_sup_long=no
+                fi
+            fi
+        else
+            if ac_fn_c_compute_int "$LINENO" "((long)(-1)) < ((long)0)" "HTYPE_IS_SIGNED"        "
+#include <stdbool.h>
+#include <stdio.h>
+#include <stddef.h>
+
+#if HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+
+#if HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+
+#if HAVE_SYS_STAT_H
+# include <sys/stat.h>
+#endif
+
+#if HAVE_FCNTL_H
+# include <fcntl.h>
+#endif
+
+#if HAVE_SIGNAL_H
+# include <signal.h>
+#endif
+
+#if HAVE_TIME_H
+# include <time.h>
+#endif
+
+#if HAVE_TERMIOS_H
+# include <termios.h>
+#endif
+
+#if HAVE_STRING_H
+# include <string.h>
+#endif
+
+#if HAVE_CTYPE_H
+# include <ctype.h>
+#endif
+
+#if HAVE_INTTYPES_H
+# include <inttypes.h>
+#else
+# if HAVE_STDINT_H
+#  include <stdint.h>
+# endif
+#endif
+
+#if HAVE_SYS_RESOURCE_H
+# include <sys/resource.h>
+#endif
+
+#include <stdlib.h>
+"; then :
+
+else
+  fptools_cv_htype_sup_long=no
+fi
+
+
+            if ac_fn_c_compute_int "$LINENO" "sizeof(long) * 8" "HTYPE_SIZE"        "
+#include <stdbool.h>
+#include <stdio.h>
+#include <stddef.h>
+
+#if HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+
+#if HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+
+#if HAVE_SYS_STAT_H
+# include <sys/stat.h>
+#endif
+
+#if HAVE_FCNTL_H
+# include <fcntl.h>
+#endif
+
+#if HAVE_SIGNAL_H
+# include <signal.h>
+#endif
+
+#if HAVE_TIME_H
+# include <time.h>
+#endif
+
+#if HAVE_TERMIOS_H
+# include <termios.h>
+#endif
+
+#if HAVE_STRING_H
+# include <string.h>
+#endif
+
+#if HAVE_CTYPE_H
+# include <ctype.h>
+#endif
+
+#if HAVE_INTTYPES_H
+# include <inttypes.h>
+#else
+# if HAVE_STDINT_H
+#  include <stdint.h>
+# endif
+#endif
+
+#if HAVE_SYS_RESOURCE_H
+# include <sys/resource.h>
+#endif
+
+#include <stdlib.h>
+"; then :
+
+else
+  fptools_cv_htype_sup_long=no
+fi
+
+
+            if test "$HTYPE_IS_SIGNED" -eq 0
+            then
+                fptools_cv_htype_long="Word$HTYPE_SIZE"
+            else
+                fptools_cv_htype_long="Int$HTYPE_SIZE"
+            fi
+        fi
+
+fi
+
+    if test "$fptools_cv_htype_sup_long" = no
+    then
+
+        fptools_cv_htype_long=NotReallyAType
+        { $as_echo "$as_me:${as_lineno-$LINENO}: result: not supported" >&5
+$as_echo "not supported" >&6; }
+
+    fi
+
+            if test "$fptools_cv_htype_sup_long" = yes; then
+        { $as_echo "$as_me:${as_lineno-$LINENO}: result: $fptools_cv_htype_long" >&5
+$as_echo "$fptools_cv_htype_long" >&6; }
+
+cat >>confdefs.h <<_ACEOF
+#define HTYPE_LONG $fptools_cv_htype_long
+_ACEOF
+
+    fi
+
+
+
+
+
+
+
+
+
+
+    { $as_echo "$as_me:${as_lineno-$LINENO}: checking Haskell type for unsigned long" >&5
+$as_echo_n "checking Haskell type for unsigned long... " >&6; }
+    if ${fptools_cv_htype_unsigned_long+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+
+        fptools_cv_htype_sup_unsigned_long=yes
+        if ac_fn_c_compute_int "$LINENO" "(unsigned long)0.2 - (unsigned long)0.4 < 0 ? 0 : 1" "HTYPE_IS_INTEGRAL"        "
+#include <stdbool.h>
+#include <stdio.h>
+#include <stddef.h>
+
+#if HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+
+#if HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+
+#if HAVE_SYS_STAT_H
+# include <sys/stat.h>
+#endif
+
+#if HAVE_FCNTL_H
+# include <fcntl.h>
+#endif
+
+#if HAVE_SIGNAL_H
+# include <signal.h>
+#endif
+
+#if HAVE_TIME_H
+# include <time.h>
+#endif
+
+#if HAVE_TERMIOS_H
+# include <termios.h>
+#endif
+
+#if HAVE_STRING_H
+# include <string.h>
+#endif
+
+#if HAVE_CTYPE_H
+# include <ctype.h>
+#endif
+
+#if HAVE_INTTYPES_H
+# include <inttypes.h>
+#else
+# if HAVE_STDINT_H
+#  include <stdint.h>
+# endif
+#endif
+
+#if HAVE_SYS_RESOURCE_H
+# include <sys/resource.h>
+#endif
+
+#include <stdlib.h>
+"; then :
+
+else
+  HTYPE_IS_INTEGRAL=0
+fi
+
+
+
+        if test "$HTYPE_IS_INTEGRAL" -eq 0
+        then
+                                                            cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+#include <stdbool.h>
+#include <stdio.h>
+#include <stddef.h>
+
+#if HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+
+#if HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+
+#if HAVE_SYS_STAT_H
+# include <sys/stat.h>
+#endif
+
+#if HAVE_FCNTL_H
+# include <fcntl.h>
+#endif
+
+#if HAVE_SIGNAL_H
+# include <signal.h>
+#endif
+
+#if HAVE_TIME_H
+# include <time.h>
+#endif
+
+#if HAVE_TERMIOS_H
+# include <termios.h>
+#endif
+
+#if HAVE_STRING_H
+# include <string.h>
+#endif
+
+#if HAVE_CTYPE_H
+# include <ctype.h>
+#endif
+
+#if HAVE_INTTYPES_H
+# include <inttypes.h>
+#else
+# if HAVE_STDINT_H
+#  include <stdint.h>
+# endif
+#endif
+
+#if HAVE_SYS_RESOURCE_H
+# include <sys/resource.h>
+#endif
+
+#include <stdlib.h>
+
+int
+main ()
+{
+unsigned long val; *val;
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  HTYPE_IS_POINTER=yes
+else
+  HTYPE_IS_POINTER=no
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+
+            if test "$HTYPE_IS_POINTER" = yes
+            then
+                fptools_cv_htype_unsigned_long="Ptr ()"
+            else
+                if ac_fn_c_compute_int "$LINENO" "sizeof(unsigned long) == sizeof(float)" "HTYPE_IS_FLOAT"        "
+#include <stdbool.h>
+#include <stdio.h>
+#include <stddef.h>
+
+#if HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+
+#if HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+
+#if HAVE_SYS_STAT_H
+# include <sys/stat.h>
+#endif
+
+#if HAVE_FCNTL_H
+# include <fcntl.h>
+#endif
+
+#if HAVE_SIGNAL_H
+# include <signal.h>
+#endif
+
+#if HAVE_TIME_H
+# include <time.h>
+#endif
+
+#if HAVE_TERMIOS_H
+# include <termios.h>
+#endif
+
+#if HAVE_STRING_H
+# include <string.h>
+#endif
+
+#if HAVE_CTYPE_H
+# include <ctype.h>
+#endif
+
+#if HAVE_INTTYPES_H
+# include <inttypes.h>
+#else
+# if HAVE_STDINT_H
+#  include <stdint.h>
+# endif
+#endif
+
+#if HAVE_SYS_RESOURCE_H
+# include <sys/resource.h>
+#endif
+
+#include <stdlib.h>
+"; then :
+
+else
+  fptools_cv_htype_sup_unsigned_long=no
+fi
+
+
+                if ac_fn_c_compute_int "$LINENO" "sizeof(unsigned long) == sizeof(double)" "HTYPE_IS_DOUBLE"        "
+#include <stdbool.h>
+#include <stdio.h>
+#include <stddef.h>
+
+#if HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+
+#if HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+
+#if HAVE_SYS_STAT_H
+# include <sys/stat.h>
+#endif
+
+#if HAVE_FCNTL_H
+# include <fcntl.h>
+#endif
+
+#if HAVE_SIGNAL_H
+# include <signal.h>
+#endif
+
+#if HAVE_TIME_H
+# include <time.h>
+#endif
+
+#if HAVE_TERMIOS_H
+# include <termios.h>
+#endif
+
+#if HAVE_STRING_H
+# include <string.h>
+#endif
+
+#if HAVE_CTYPE_H
+# include <ctype.h>
+#endif
+
+#if HAVE_INTTYPES_H
+# include <inttypes.h>
+#else
+# if HAVE_STDINT_H
+#  include <stdint.h>
+# endif
+#endif
+
+#if HAVE_SYS_RESOURCE_H
+# include <sys/resource.h>
+#endif
+
+#include <stdlib.h>
+"; then :
+
+else
+  fptools_cv_htype_sup_unsigned_long=no
+fi
+
+
+                if ac_fn_c_compute_int "$LINENO" "sizeof(unsigned long) == sizeof(long double)" "HTYPE_IS_LDOUBLE"        "
+#include <stdbool.h>
+#include <stdio.h>
+#include <stddef.h>
+
+#if HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+
+#if HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+
+#if HAVE_SYS_STAT_H
+# include <sys/stat.h>
+#endif
+
+#if HAVE_FCNTL_H
+# include <fcntl.h>
+#endif
+
+#if HAVE_SIGNAL_H
+# include <signal.h>
+#endif
+
+#if HAVE_TIME_H
+# include <time.h>
+#endif
+
+#if HAVE_TERMIOS_H
+# include <termios.h>
+#endif
+
+#if HAVE_STRING_H
+# include <string.h>
+#endif
+
+#if HAVE_CTYPE_H
+# include <ctype.h>
+#endif
+
+#if HAVE_INTTYPES_H
+# include <inttypes.h>
+#else
+# if HAVE_STDINT_H
+#  include <stdint.h>
+# endif
+#endif
+
+#if HAVE_SYS_RESOURCE_H
+# include <sys/resource.h>
+#endif
+
+#include <stdlib.h>
+"; then :
+
+else
+  fptools_cv_htype_sup_unsigned_long=no
+fi
+
+
+                if test "$HTYPE_IS_FLOAT" -eq 1
+                then
+                    fptools_cv_htype_unsigned_long=Float
+                elif test "$HTYPE_IS_DOUBLE" -eq 1
+                then
+                    fptools_cv_htype_unsigned_long=Double
+                elif test "$HTYPE_IS_LDOUBLE" -eq 1
+                then
+                    fptools_cv_htype_unsigned_long=LDouble
+                else
+                    fptools_cv_htype_sup_unsigned_long=no
+                fi
+            fi
+        else
+            if ac_fn_c_compute_int "$LINENO" "((unsigned long)(-1)) < ((unsigned long)0)" "HTYPE_IS_SIGNED"        "
+#include <stdbool.h>
+#include <stdio.h>
+#include <stddef.h>
+
+#if HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+
+#if HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+
+#if HAVE_SYS_STAT_H
+# include <sys/stat.h>
+#endif
+
+#if HAVE_FCNTL_H
+# include <fcntl.h>
+#endif
+
+#if HAVE_SIGNAL_H
+# include <signal.h>
+#endif
+
+#if HAVE_TIME_H
+# include <time.h>
+#endif
+
+#if HAVE_TERMIOS_H
+# include <termios.h>
+#endif
+
+#if HAVE_STRING_H
+# include <string.h>
+#endif
+
+#if HAVE_CTYPE_H
+# include <ctype.h>
+#endif
+
+#if HAVE_INTTYPES_H
+# include <inttypes.h>
+#else
+# if HAVE_STDINT_H
+#  include <stdint.h>
+# endif
+#endif
+
+#if HAVE_SYS_RESOURCE_H
+# include <sys/resource.h>
+#endif
+
+#include <stdlib.h>
+"; then :
+
+else
+  fptools_cv_htype_sup_unsigned_long=no
+fi
+
+
+            if ac_fn_c_compute_int "$LINENO" "sizeof(unsigned long) * 8" "HTYPE_SIZE"        "
+#include <stdbool.h>
+#include <stdio.h>
+#include <stddef.h>
+
+#if HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+
+#if HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+
+#if HAVE_SYS_STAT_H
+# include <sys/stat.h>
+#endif
+
+#if HAVE_FCNTL_H
+# include <fcntl.h>
+#endif
+
+#if HAVE_SIGNAL_H
+# include <signal.h>
+#endif
+
+#if HAVE_TIME_H
+# include <time.h>
+#endif
+
+#if HAVE_TERMIOS_H
+# include <termios.h>
+#endif
+
+#if HAVE_STRING_H
+# include <string.h>
+#endif
+
+#if HAVE_CTYPE_H
+# include <ctype.h>
+#endif
+
+#if HAVE_INTTYPES_H
+# include <inttypes.h>
+#else
+# if HAVE_STDINT_H
+#  include <stdint.h>
+# endif
+#endif
+
+#if HAVE_SYS_RESOURCE_H
+# include <sys/resource.h>
+#endif
+
+#include <stdlib.h>
+"; then :
+
+else
+  fptools_cv_htype_sup_unsigned_long=no
+fi
+
+
+            if test "$HTYPE_IS_SIGNED" -eq 0
+            then
+                fptools_cv_htype_unsigned_long="Word$HTYPE_SIZE"
+            else
+                fptools_cv_htype_unsigned_long="Int$HTYPE_SIZE"
+            fi
+        fi
+
+fi
+
+    if test "$fptools_cv_htype_sup_unsigned_long" = no
+    then
+
+        fptools_cv_htype_unsigned_long=NotReallyAType
+        { $as_echo "$as_me:${as_lineno-$LINENO}: result: not supported" >&5
+$as_echo "not supported" >&6; }
+
+    fi
+
+            if test "$fptools_cv_htype_sup_unsigned_long" = yes; then
+        { $as_echo "$as_me:${as_lineno-$LINENO}: result: $fptools_cv_htype_unsigned_long" >&5
+$as_echo "$fptools_cv_htype_unsigned_long" >&6; }
+
+cat >>confdefs.h <<_ACEOF
+#define HTYPE_UNSIGNED_LONG $fptools_cv_htype_unsigned_long
+_ACEOF
+
+    fi
+
+
+if test "$ac_cv_type_long_long" = yes; then
+
+
+
+
+
+
+
+
+    { $as_echo "$as_me:${as_lineno-$LINENO}: checking Haskell type for long long" >&5
+$as_echo_n "checking Haskell type for long long... " >&6; }
+    if ${fptools_cv_htype_long_long+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+
+        fptools_cv_htype_sup_long_long=yes
+        if ac_fn_c_compute_int "$LINENO" "(long long)0.2 - (long long)0.4 < 0 ? 0 : 1" "HTYPE_IS_INTEGRAL"        "
+#include <stdbool.h>
+#include <stdio.h>
+#include <stddef.h>
+
+#if HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+
+#if HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+
+#if HAVE_SYS_STAT_H
+# include <sys/stat.h>
+#endif
+
+#if HAVE_FCNTL_H
+# include <fcntl.h>
+#endif
+
+#if HAVE_SIGNAL_H
+# include <signal.h>
+#endif
+
+#if HAVE_TIME_H
+# include <time.h>
+#endif
+
+#if HAVE_TERMIOS_H
+# include <termios.h>
+#endif
+
+#if HAVE_STRING_H
+# include <string.h>
+#endif
+
+#if HAVE_CTYPE_H
+# include <ctype.h>
+#endif
+
+#if HAVE_INTTYPES_H
+# include <inttypes.h>
+#else
+# if HAVE_STDINT_H
+#  include <stdint.h>
+# endif
+#endif
+
+#if HAVE_SYS_RESOURCE_H
+# include <sys/resource.h>
+#endif
+
+#include <stdlib.h>
+"; then :
+
+else
+  HTYPE_IS_INTEGRAL=0
+fi
+
+
+
+        if test "$HTYPE_IS_INTEGRAL" -eq 0
+        then
+                                                            cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+#include <stdbool.h>
+#include <stdio.h>
+#include <stddef.h>
+
+#if HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+
+#if HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+
+#if HAVE_SYS_STAT_H
+# include <sys/stat.h>
+#endif
+
+#if HAVE_FCNTL_H
+# include <fcntl.h>
+#endif
+
+#if HAVE_SIGNAL_H
+# include <signal.h>
+#endif
+
+#if HAVE_TIME_H
+# include <time.h>
+#endif
+
+#if HAVE_TERMIOS_H
+# include <termios.h>
+#endif
+
+#if HAVE_STRING_H
+# include <string.h>
+#endif
+
+#if HAVE_CTYPE_H
+# include <ctype.h>
+#endif
+
+#if HAVE_INTTYPES_H
+# include <inttypes.h>
+#else
+# if HAVE_STDINT_H
+#  include <stdint.h>
+# endif
+#endif
+
+#if HAVE_SYS_RESOURCE_H
+# include <sys/resource.h>
+#endif
+
+#include <stdlib.h>
+
+int
+main ()
+{
+long long val; *val;
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  HTYPE_IS_POINTER=yes
+else
+  HTYPE_IS_POINTER=no
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+
+            if test "$HTYPE_IS_POINTER" = yes
+            then
+                fptools_cv_htype_long_long="Ptr ()"
+            else
+                if ac_fn_c_compute_int "$LINENO" "sizeof(long long) == sizeof(float)" "HTYPE_IS_FLOAT"        "
+#include <stdbool.h>
+#include <stdio.h>
+#include <stddef.h>
+
+#if HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+
+#if HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+
+#if HAVE_SYS_STAT_H
+# include <sys/stat.h>
+#endif
+
+#if HAVE_FCNTL_H
+# include <fcntl.h>
+#endif
+
+#if HAVE_SIGNAL_H
+# include <signal.h>
+#endif
+
+#if HAVE_TIME_H
+# include <time.h>
+#endif
+
+#if HAVE_TERMIOS_H
+# include <termios.h>
+#endif
+
+#if HAVE_STRING_H
+# include <string.h>
+#endif
+
+#if HAVE_CTYPE_H
+# include <ctype.h>
+#endif
+
+#if HAVE_INTTYPES_H
+# include <inttypes.h>
+#else
+# if HAVE_STDINT_H
+#  include <stdint.h>
+# endif
+#endif
+
+#if HAVE_SYS_RESOURCE_H
+# include <sys/resource.h>
+#endif
+
+#include <stdlib.h>
+"; then :
+
+else
+  fptools_cv_htype_sup_long_long=no
+fi
+
+
+                if ac_fn_c_compute_int "$LINENO" "sizeof(long long) == sizeof(double)" "HTYPE_IS_DOUBLE"        "
+#include <stdbool.h>
+#include <stdio.h>
+#include <stddef.h>
+
+#if HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+
+#if HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+
+#if HAVE_SYS_STAT_H
+# include <sys/stat.h>
+#endif
+
+#if HAVE_FCNTL_H
+# include <fcntl.h>
+#endif
+
+#if HAVE_SIGNAL_H
+# include <signal.h>
+#endif
+
+#if HAVE_TIME_H
+# include <time.h>
+#endif
+
+#if HAVE_TERMIOS_H
+# include <termios.h>
+#endif
+
+#if HAVE_STRING_H
+# include <string.h>
+#endif
+
+#if HAVE_CTYPE_H
+# include <ctype.h>
+#endif
+
+#if HAVE_INTTYPES_H
+# include <inttypes.h>
+#else
+# if HAVE_STDINT_H
+#  include <stdint.h>
+# endif
+#endif
+
+#if HAVE_SYS_RESOURCE_H
+# include <sys/resource.h>
+#endif
+
+#include <stdlib.h>
+"; then :
+
+else
+  fptools_cv_htype_sup_long_long=no
+fi
+
+
+                if ac_fn_c_compute_int "$LINENO" "sizeof(long long) == sizeof(long double)" "HTYPE_IS_LDOUBLE"        "
+#include <stdbool.h>
+#include <stdio.h>
+#include <stddef.h>
+
+#if HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+
+#if HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+
+#if HAVE_SYS_STAT_H
+# include <sys/stat.h>
+#endif
+
+#if HAVE_FCNTL_H
+# include <fcntl.h>
+#endif
+
+#if HAVE_SIGNAL_H
+# include <signal.h>
+#endif
+
+#if HAVE_TIME_H
+# include <time.h>
+#endif
+
+#if HAVE_TERMIOS_H
+# include <termios.h>
+#endif
+
+#if HAVE_STRING_H
+# include <string.h>
+#endif
+
+#if HAVE_CTYPE_H
+# include <ctype.h>
+#endif
+
+#if HAVE_INTTYPES_H
+# include <inttypes.h>
+#else
+# if HAVE_STDINT_H
+#  include <stdint.h>
+# endif
+#endif
+
+#if HAVE_SYS_RESOURCE_H
+# include <sys/resource.h>
+#endif
+
+#include <stdlib.h>
+"; then :
+
+else
+  fptools_cv_htype_sup_long_long=no
+fi
+
+
+                if test "$HTYPE_IS_FLOAT" -eq 1
+                then
+                    fptools_cv_htype_long_long=Float
+                elif test "$HTYPE_IS_DOUBLE" -eq 1
+                then
+                    fptools_cv_htype_long_long=Double
+                elif test "$HTYPE_IS_LDOUBLE" -eq 1
+                then
+                    fptools_cv_htype_long_long=LDouble
+                else
+                    fptools_cv_htype_sup_long_long=no
+                fi
+            fi
+        else
+            if ac_fn_c_compute_int "$LINENO" "((long long)(-1)) < ((long long)0)" "HTYPE_IS_SIGNED"        "
+#include <stdbool.h>
+#include <stdio.h>
+#include <stddef.h>
+
+#if HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+
+#if HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+
+#if HAVE_SYS_STAT_H
+# include <sys/stat.h>
+#endif
+
+#if HAVE_FCNTL_H
+# include <fcntl.h>
+#endif
+
+#if HAVE_SIGNAL_H
+# include <signal.h>
+#endif
+
+#if HAVE_TIME_H
+# include <time.h>
+#endif
+
+#if HAVE_TERMIOS_H
+# include <termios.h>
+#endif
+
+#if HAVE_STRING_H
+# include <string.h>
+#endif
+
+#if HAVE_CTYPE_H
+# include <ctype.h>
+#endif
+
+#if HAVE_INTTYPES_H
+# include <inttypes.h>
+#else
+# if HAVE_STDINT_H
+#  include <stdint.h>
+# endif
+#endif
+
+#if HAVE_SYS_RESOURCE_H
+# include <sys/resource.h>
+#endif
+
+#include <stdlib.h>
+"; then :
+
+else
+  fptools_cv_htype_sup_long_long=no
+fi
+
+
+            if ac_fn_c_compute_int "$LINENO" "sizeof(long long) * 8" "HTYPE_SIZE"        "
+#include <stdbool.h>
+#include <stdio.h>
+#include <stddef.h>
+
+#if HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+
+#if HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+
+#if HAVE_SYS_STAT_H
+# include <sys/stat.h>
+#endif
+
+#if HAVE_FCNTL_H
+# include <fcntl.h>
+#endif
+
+#if HAVE_SIGNAL_H
+# include <signal.h>
+#endif
+
+#if HAVE_TIME_H
+# include <time.h>
+#endif
+
+#if HAVE_TERMIOS_H
+# include <termios.h>
+#endif
+
+#if HAVE_STRING_H
+# include <string.h>
+#endif
+
+#if HAVE_CTYPE_H
+# include <ctype.h>
+#endif
+
+#if HAVE_INTTYPES_H
+# include <inttypes.h>
+#else
+# if HAVE_STDINT_H
+#  include <stdint.h>
+# endif
+#endif
+
+#if HAVE_SYS_RESOURCE_H
+# include <sys/resource.h>
+#endif
+
+#include <stdlib.h>
+"; then :
+
+else
+  fptools_cv_htype_sup_long_long=no
+fi
+
+
+            if test "$HTYPE_IS_SIGNED" -eq 0
+            then
+                fptools_cv_htype_long_long="Word$HTYPE_SIZE"
+            else
+                fptools_cv_htype_long_long="Int$HTYPE_SIZE"
+            fi
+        fi
+
+fi
+
+    if test "$fptools_cv_htype_sup_long_long" = no
+    then
+
+        fptools_cv_htype_long_long=NotReallyAType
+        { $as_echo "$as_me:${as_lineno-$LINENO}: result: not supported" >&5
+$as_echo "not supported" >&6; }
+
+    fi
+
+            if test "$fptools_cv_htype_sup_long_long" = yes; then
+        { $as_echo "$as_me:${as_lineno-$LINENO}: result: $fptools_cv_htype_long_long" >&5
+$as_echo "$fptools_cv_htype_long_long" >&6; }
+
+cat >>confdefs.h <<_ACEOF
+#define HTYPE_LONG_LONG $fptools_cv_htype_long_long
+_ACEOF
+
+    fi
+
+
+
+
+
+
+
+
+
+
+    { $as_echo "$as_me:${as_lineno-$LINENO}: checking Haskell type for unsigned long long" >&5
+$as_echo_n "checking Haskell type for unsigned long long... " >&6; }
+    if ${fptools_cv_htype_unsigned_long_long+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+
+        fptools_cv_htype_sup_unsigned_long_long=yes
+        if ac_fn_c_compute_int "$LINENO" "(unsigned long long)0.2 - (unsigned long long)0.4 < 0 ? 0 : 1" "HTYPE_IS_INTEGRAL"        "
+#include <stdbool.h>
+#include <stdio.h>
+#include <stddef.h>
+
+#if HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+
+#if HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+
+#if HAVE_SYS_STAT_H
+# include <sys/stat.h>
+#endif
+
+#if HAVE_FCNTL_H
+# include <fcntl.h>
+#endif
+
+#if HAVE_SIGNAL_H
+# include <signal.h>
+#endif
+
+#if HAVE_TIME_H
+# include <time.h>
+#endif
+
+#if HAVE_TERMIOS_H
+# include <termios.h>
+#endif
+
+#if HAVE_STRING_H
+# include <string.h>
+#endif
+
+#if HAVE_CTYPE_H
+# include <ctype.h>
+#endif
+
+#if HAVE_INTTYPES_H
+# include <inttypes.h>
+#else
+# if HAVE_STDINT_H
+#  include <stdint.h>
+# endif
+#endif
+
+#if HAVE_SYS_RESOURCE_H
+# include <sys/resource.h>
+#endif
+
+#include <stdlib.h>
+"; then :
+
+else
+  HTYPE_IS_INTEGRAL=0
+fi
+
+
+
+        if test "$HTYPE_IS_INTEGRAL" -eq 0
+        then
+                                                            cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+#include <stdbool.h>
+#include <stdio.h>
+#include <stddef.h>
+
+#if HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+
+#if HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+
+#if HAVE_SYS_STAT_H
+# include <sys/stat.h>
+#endif
+
+#if HAVE_FCNTL_H
+# include <fcntl.h>
+#endif
+
+#if HAVE_SIGNAL_H
+# include <signal.h>
+#endif
+
+#if HAVE_TIME_H
+# include <time.h>
+#endif
+
+#if HAVE_TERMIOS_H
+# include <termios.h>
+#endif
+
+#if HAVE_STRING_H
+# include <string.h>
+#endif
+
+#if HAVE_CTYPE_H
+# include <ctype.h>
+#endif
+
+#if HAVE_INTTYPES_H
+# include <inttypes.h>
+#else
+# if HAVE_STDINT_H
+#  include <stdint.h>
+# endif
+#endif
+
+#if HAVE_SYS_RESOURCE_H
+# include <sys/resource.h>
+#endif
+
+#include <stdlib.h>
+
+int
+main ()
+{
+unsigned long long val; *val;
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  HTYPE_IS_POINTER=yes
+else
+  HTYPE_IS_POINTER=no
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+
+            if test "$HTYPE_IS_POINTER" = yes
+            then
+                fptools_cv_htype_unsigned_long_long="Ptr ()"
+            else
+                if ac_fn_c_compute_int "$LINENO" "sizeof(unsigned long long) == sizeof(float)" "HTYPE_IS_FLOAT"        "
+#include <stdbool.h>
+#include <stdio.h>
+#include <stddef.h>
+
+#if HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+
+#if HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+
+#if HAVE_SYS_STAT_H
+# include <sys/stat.h>
+#endif
+
+#if HAVE_FCNTL_H
+# include <fcntl.h>
+#endif
+
+#if HAVE_SIGNAL_H
+# include <signal.h>
+#endif
+
+#if HAVE_TIME_H
+# include <time.h>
+#endif
+
+#if HAVE_TERMIOS_H
+# include <termios.h>
+#endif
+
+#if HAVE_STRING_H
+# include <string.h>
+#endif
+
+#if HAVE_CTYPE_H
+# include <ctype.h>
+#endif
+
+#if HAVE_INTTYPES_H
+# include <inttypes.h>
+#else
+# if HAVE_STDINT_H
+#  include <stdint.h>
+# endif
+#endif
+
+#if HAVE_SYS_RESOURCE_H
+# include <sys/resource.h>
+#endif
+
+#include <stdlib.h>
+"; then :
+
+else
+  fptools_cv_htype_sup_unsigned_long_long=no
+fi
+
+
+                if ac_fn_c_compute_int "$LINENO" "sizeof(unsigned long long) == sizeof(double)" "HTYPE_IS_DOUBLE"        "
+#include <stdbool.h>
+#include <stdio.h>
+#include <stddef.h>
+
+#if HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+
+#if HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+
+#if HAVE_SYS_STAT_H
+# include <sys/stat.h>
+#endif
+
+#if HAVE_FCNTL_H
+# include <fcntl.h>
+#endif
+
+#if HAVE_SIGNAL_H
+# include <signal.h>
+#endif
+
+#if HAVE_TIME_H
+# include <time.h>
+#endif
+
+#if HAVE_TERMIOS_H
+# include <termios.h>
+#endif
+
+#if HAVE_STRING_H
+# include <string.h>
+#endif
+
+#if HAVE_CTYPE_H
+# include <ctype.h>
+#endif
+
+#if HAVE_INTTYPES_H
+# include <inttypes.h>
+#else
+# if HAVE_STDINT_H
+#  include <stdint.h>
+# endif
+#endif
+
+#if HAVE_SYS_RESOURCE_H
+# include <sys/resource.h>
+#endif
+
+#include <stdlib.h>
+"; then :
+
+else
+  fptools_cv_htype_sup_unsigned_long_long=no
+fi
+
+
+                if ac_fn_c_compute_int "$LINENO" "sizeof(unsigned long long) == sizeof(long double)" "HTYPE_IS_LDOUBLE"        "
+#include <stdbool.h>
+#include <stdio.h>
+#include <stddef.h>
+
+#if HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+
+#if HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+
+#if HAVE_SYS_STAT_H
+# include <sys/stat.h>
+#endif
+
+#if HAVE_FCNTL_H
+# include <fcntl.h>
+#endif
+
+#if HAVE_SIGNAL_H
+# include <signal.h>
+#endif
+
+#if HAVE_TIME_H
+# include <time.h>
+#endif
+
+#if HAVE_TERMIOS_H
+# include <termios.h>
+#endif
+
+#if HAVE_STRING_H
+# include <string.h>
+#endif
+
+#if HAVE_CTYPE_H
+# include <ctype.h>
+#endif
+
+#if HAVE_INTTYPES_H
+# include <inttypes.h>
+#else
+# if HAVE_STDINT_H
+#  include <stdint.h>
+# endif
+#endif
+
+#if HAVE_SYS_RESOURCE_H
+# include <sys/resource.h>
+#endif
+
+#include <stdlib.h>
+"; then :
+
+else
+  fptools_cv_htype_sup_unsigned_long_long=no
+fi
+
+
+                if test "$HTYPE_IS_FLOAT" -eq 1
+                then
+                    fptools_cv_htype_unsigned_long_long=Float
+                elif test "$HTYPE_IS_DOUBLE" -eq 1
+                then
+                    fptools_cv_htype_unsigned_long_long=Double
+                elif test "$HTYPE_IS_LDOUBLE" -eq 1
+                then
+                    fptools_cv_htype_unsigned_long_long=LDouble
+                else
+                    fptools_cv_htype_sup_unsigned_long_long=no
+                fi
+            fi
+        else
+            if ac_fn_c_compute_int "$LINENO" "((unsigned long long)(-1)) < ((unsigned long long)0)" "HTYPE_IS_SIGNED"        "
+#include <stdbool.h>
+#include <stdio.h>
+#include <stddef.h>
+
+#if HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+
+#if HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+
+#if HAVE_SYS_STAT_H
+# include <sys/stat.h>
+#endif
+
+#if HAVE_FCNTL_H
+# include <fcntl.h>
+#endif
+
+#if HAVE_SIGNAL_H
+# include <signal.h>
+#endif
+
+#if HAVE_TIME_H
+# include <time.h>
+#endif
+
+#if HAVE_TERMIOS_H
+# include <termios.h>
+#endif
+
+#if HAVE_STRING_H
+# include <string.h>
+#endif
+
+#if HAVE_CTYPE_H
+# include <ctype.h>
+#endif
+
+#if HAVE_INTTYPES_H
+# include <inttypes.h>
+#else
+# if HAVE_STDINT_H
+#  include <stdint.h>
+# endif
+#endif
+
+#if HAVE_SYS_RESOURCE_H
+# include <sys/resource.h>
+#endif
+
+#include <stdlib.h>
+"; then :
+
+else
+  fptools_cv_htype_sup_unsigned_long_long=no
+fi
+
+
+            if ac_fn_c_compute_int "$LINENO" "sizeof(unsigned long long) * 8" "HTYPE_SIZE"        "
+#include <stdbool.h>
+#include <stdio.h>
+#include <stddef.h>
+
+#if HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+
+#if HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+
+#if HAVE_SYS_STAT_H
+# include <sys/stat.h>
+#endif
+
+#if HAVE_FCNTL_H
+# include <fcntl.h>
+#endif
+
+#if HAVE_SIGNAL_H
+# include <signal.h>
+#endif
+
+#if HAVE_TIME_H
+# include <time.h>
+#endif
+
+#if HAVE_TERMIOS_H
+# include <termios.h>
+#endif
+
+#if HAVE_STRING_H
+# include <string.h>
+#endif
+
+#if HAVE_CTYPE_H
+# include <ctype.h>
+#endif
+
+#if HAVE_INTTYPES_H
+# include <inttypes.h>
+#else
+# if HAVE_STDINT_H
+#  include <stdint.h>
+# endif
+#endif
+
+#if HAVE_SYS_RESOURCE_H
+# include <sys/resource.h>
+#endif
+
+#include <stdlib.h>
+"; then :
+
+else
+  fptools_cv_htype_sup_unsigned_long_long=no
+fi
+
+
+            if test "$HTYPE_IS_SIGNED" -eq 0
+            then
+                fptools_cv_htype_unsigned_long_long="Word$HTYPE_SIZE"
+            else
+                fptools_cv_htype_unsigned_long_long="Int$HTYPE_SIZE"
+            fi
+        fi
+
+fi
+
+    if test "$fptools_cv_htype_sup_unsigned_long_long" = no
+    then
+
+        fptools_cv_htype_unsigned_long_long=NotReallyAType
+        { $as_echo "$as_me:${as_lineno-$LINENO}: result: not supported" >&5
+$as_echo "not supported" >&6; }
+
+    fi
+
+            if test "$fptools_cv_htype_sup_unsigned_long_long" = yes; then
+        { $as_echo "$as_me:${as_lineno-$LINENO}: result: $fptools_cv_htype_unsigned_long_long" >&5
+$as_echo "$fptools_cv_htype_unsigned_long_long" >&6; }
+
+cat >>confdefs.h <<_ACEOF
+#define HTYPE_UNSIGNED_LONG_LONG $fptools_cv_htype_unsigned_long_long
+_ACEOF
+
+    fi
+
+
+fi
+
+
+
+
+
+
+
+
+    { $as_echo "$as_me:${as_lineno-$LINENO}: checking Haskell type for bool" >&5
+$as_echo_n "checking Haskell type for bool... " >&6; }
+    if ${fptools_cv_htype_bool+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+
+        fptools_cv_htype_sup_bool=yes
+        if ac_fn_c_compute_int "$LINENO" "(bool)0.2 - (bool)0.4 < 0 ? 0 : 1" "HTYPE_IS_INTEGRAL"        "
+#include <stdbool.h>
+#include <stdio.h>
+#include <stddef.h>
+
+#if HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+
+#if HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+
+#if HAVE_SYS_STAT_H
+# include <sys/stat.h>
+#endif
+
+#if HAVE_FCNTL_H
+# include <fcntl.h>
+#endif
+
+#if HAVE_SIGNAL_H
+# include <signal.h>
+#endif
+
+#if HAVE_TIME_H
+# include <time.h>
+#endif
+
+#if HAVE_TERMIOS_H
+# include <termios.h>
+#endif
+
+#if HAVE_STRING_H
+# include <string.h>
+#endif
+
+#if HAVE_CTYPE_H
+# include <ctype.h>
+#endif
+
+#if HAVE_INTTYPES_H
+# include <inttypes.h>
+#else
+# if HAVE_STDINT_H
+#  include <stdint.h>
+# endif
+#endif
+
+#if HAVE_SYS_RESOURCE_H
+# include <sys/resource.h>
+#endif
+
+#include <stdlib.h>
+"; then :
+
+else
+  HTYPE_IS_INTEGRAL=0
+fi
+
+
+
+        if test "$HTYPE_IS_INTEGRAL" -eq 0
+        then
+                                                            cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+#include <stdbool.h>
+#include <stdio.h>
+#include <stddef.h>
+
+#if HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+
+#if HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+
+#if HAVE_SYS_STAT_H
+# include <sys/stat.h>
+#endif
+
+#if HAVE_FCNTL_H
+# include <fcntl.h>
+#endif
+
+#if HAVE_SIGNAL_H
+# include <signal.h>
+#endif
+
+#if HAVE_TIME_H
+# include <time.h>
+#endif
+
+#if HAVE_TERMIOS_H
+# include <termios.h>
+#endif
+
+#if HAVE_STRING_H
+# include <string.h>
+#endif
+
+#if HAVE_CTYPE_H
+# include <ctype.h>
+#endif
+
+#if HAVE_INTTYPES_H
+# include <inttypes.h>
+#else
+# if HAVE_STDINT_H
+#  include <stdint.h>
+# endif
+#endif
+
+#if HAVE_SYS_RESOURCE_H
+# include <sys/resource.h>
+#endif
+
+#include <stdlib.h>
+
+int
+main ()
+{
+bool val; *val;
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  HTYPE_IS_POINTER=yes
+else
+  HTYPE_IS_POINTER=no
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+
+            if test "$HTYPE_IS_POINTER" = yes
+            then
+                fptools_cv_htype_bool="Ptr ()"
+            else
+                if ac_fn_c_compute_int "$LINENO" "sizeof(bool) == sizeof(float)" "HTYPE_IS_FLOAT"        "
+#include <stdbool.h>
+#include <stdio.h>
+#include <stddef.h>
+
+#if HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+
+#if HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+
+#if HAVE_SYS_STAT_H
+# include <sys/stat.h>
+#endif
+
+#if HAVE_FCNTL_H
+# include <fcntl.h>
+#endif
+
+#if HAVE_SIGNAL_H
+# include <signal.h>
+#endif
+
+#if HAVE_TIME_H
+# include <time.h>
+#endif
+
+#if HAVE_TERMIOS_H
+# include <termios.h>
+#endif
+
+#if HAVE_STRING_H
+# include <string.h>
+#endif
+
+#if HAVE_CTYPE_H
+# include <ctype.h>
+#endif
+
+#if HAVE_INTTYPES_H
+# include <inttypes.h>
+#else
+# if HAVE_STDINT_H
+#  include <stdint.h>
+# endif
+#endif
+
+#if HAVE_SYS_RESOURCE_H
+# include <sys/resource.h>
+#endif
+
+#include <stdlib.h>
+"; then :
+
+else
+  fptools_cv_htype_sup_bool=no
+fi
+
+
+                if ac_fn_c_compute_int "$LINENO" "sizeof(bool) == sizeof(double)" "HTYPE_IS_DOUBLE"        "
+#include <stdbool.h>
+#include <stdio.h>
+#include <stddef.h>
+
+#if HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+
+#if HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+
+#if HAVE_SYS_STAT_H
+# include <sys/stat.h>
+#endif
+
+#if HAVE_FCNTL_H
+# include <fcntl.h>
+#endif
+
+#if HAVE_SIGNAL_H
+# include <signal.h>
+#endif
+
+#if HAVE_TIME_H
+# include <time.h>
+#endif
+
+#if HAVE_TERMIOS_H
+# include <termios.h>
+#endif
+
+#if HAVE_STRING_H
+# include <string.h>
+#endif
+
+#if HAVE_CTYPE_H
+# include <ctype.h>
+#endif
+
+#if HAVE_INTTYPES_H
+# include <inttypes.h>
+#else
+# if HAVE_STDINT_H
+#  include <stdint.h>
+# endif
+#endif
+
+#if HAVE_SYS_RESOURCE_H
+# include <sys/resource.h>
+#endif
+
+#include <stdlib.h>
+"; then :
+
+else
+  fptools_cv_htype_sup_bool=no
+fi
+
+
+                if ac_fn_c_compute_int "$LINENO" "sizeof(bool) == sizeof(long double)" "HTYPE_IS_LDOUBLE"        "
+#include <stdbool.h>
+#include <stdio.h>
+#include <stddef.h>
+
+#if HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+
+#if HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+
+#if HAVE_SYS_STAT_H
+# include <sys/stat.h>
+#endif
+
+#if HAVE_FCNTL_H
+# include <fcntl.h>
+#endif
+
+#if HAVE_SIGNAL_H
+# include <signal.h>
+#endif
+
+#if HAVE_TIME_H
+# include <time.h>
+#endif
+
+#if HAVE_TERMIOS_H
+# include <termios.h>
+#endif
+
+#if HAVE_STRING_H
+# include <string.h>
+#endif
+
+#if HAVE_CTYPE_H
+# include <ctype.h>
+#endif
+
+#if HAVE_INTTYPES_H
+# include <inttypes.h>
+#else
+# if HAVE_STDINT_H
+#  include <stdint.h>
+# endif
+#endif
+
+#if HAVE_SYS_RESOURCE_H
+# include <sys/resource.h>
+#endif
+
+#include <stdlib.h>
+"; then :
+
+else
+  fptools_cv_htype_sup_bool=no
+fi
+
+
+                if test "$HTYPE_IS_FLOAT" -eq 1
+                then
+                    fptools_cv_htype_bool=Float
+                elif test "$HTYPE_IS_DOUBLE" -eq 1
+                then
+                    fptools_cv_htype_bool=Double
+                elif test "$HTYPE_IS_LDOUBLE" -eq 1
+                then
+                    fptools_cv_htype_bool=LDouble
+                else
+                    fptools_cv_htype_sup_bool=no
+                fi
+            fi
+        else
+            if ac_fn_c_compute_int "$LINENO" "((bool)(-1)) < ((bool)0)" "HTYPE_IS_SIGNED"        "
+#include <stdbool.h>
+#include <stdio.h>
+#include <stddef.h>
+
+#if HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+
+#if HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+
+#if HAVE_SYS_STAT_H
+# include <sys/stat.h>
+#endif
+
+#if HAVE_FCNTL_H
+# include <fcntl.h>
+#endif
+
+#if HAVE_SIGNAL_H
+# include <signal.h>
+#endif
+
+#if HAVE_TIME_H
+# include <time.h>
+#endif
+
+#if HAVE_TERMIOS_H
+# include <termios.h>
+#endif
+
+#if HAVE_STRING_H
+# include <string.h>
+#endif
+
+#if HAVE_CTYPE_H
+# include <ctype.h>
+#endif
+
+#if HAVE_INTTYPES_H
+# include <inttypes.h>
+#else
+# if HAVE_STDINT_H
+#  include <stdint.h>
+# endif
+#endif
+
+#if HAVE_SYS_RESOURCE_H
+# include <sys/resource.h>
+#endif
+
+#include <stdlib.h>
+"; then :
+
+else
+  fptools_cv_htype_sup_bool=no
+fi
+
+
+            if ac_fn_c_compute_int "$LINENO" "sizeof(bool) * 8" "HTYPE_SIZE"        "
+#include <stdbool.h>
+#include <stdio.h>
+#include <stddef.h>
+
+#if HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+
+#if HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+
+#if HAVE_SYS_STAT_H
+# include <sys/stat.h>
+#endif
+
+#if HAVE_FCNTL_H
+# include <fcntl.h>
+#endif
+
+#if HAVE_SIGNAL_H
+# include <signal.h>
+#endif
+
+#if HAVE_TIME_H
+# include <time.h>
+#endif
+
+#if HAVE_TERMIOS_H
+# include <termios.h>
+#endif
+
+#if HAVE_STRING_H
+# include <string.h>
+#endif
+
+#if HAVE_CTYPE_H
+# include <ctype.h>
+#endif
+
+#if HAVE_INTTYPES_H
+# include <inttypes.h>
+#else
+# if HAVE_STDINT_H
+#  include <stdint.h>
+# endif
+#endif
+
+#if HAVE_SYS_RESOURCE_H
+# include <sys/resource.h>
+#endif
+
+#include <stdlib.h>
+"; then :
+
+else
+  fptools_cv_htype_sup_bool=no
+fi
+
+
+            if test "$HTYPE_IS_SIGNED" -eq 0
+            then
+                fptools_cv_htype_bool="Word$HTYPE_SIZE"
+            else
+                fptools_cv_htype_bool="Int$HTYPE_SIZE"
+            fi
+        fi
+
+fi
+
+    if test "$fptools_cv_htype_sup_bool" = no
+    then
+
+        fptools_cv_htype_bool=NotReallyAType
+        { $as_echo "$as_me:${as_lineno-$LINENO}: result: not supported" >&5
+$as_echo "not supported" >&6; }
+
+    fi
+
+            if test "$fptools_cv_htype_sup_bool" = yes; then
+        { $as_echo "$as_me:${as_lineno-$LINENO}: result: $fptools_cv_htype_bool" >&5
+$as_echo "$fptools_cv_htype_bool" >&6; }
+
+cat >>confdefs.h <<_ACEOF
+#define HTYPE_BOOL $fptools_cv_htype_bool
+_ACEOF
+
+    fi
+
+
+
+
+
+
+
+
+
+
+    { $as_echo "$as_me:${as_lineno-$LINENO}: checking Haskell type for float" >&5
+$as_echo_n "checking Haskell type for float... " >&6; }
+    if ${fptools_cv_htype_float+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+
+        fptools_cv_htype_sup_float=yes
+        if ac_fn_c_compute_int "$LINENO" "(float)0.2 - (float)0.4 < 0 ? 0 : 1" "HTYPE_IS_INTEGRAL"        "
+#include <stdbool.h>
+#include <stdio.h>
+#include <stddef.h>
+
+#if HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+
+#if HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+
+#if HAVE_SYS_STAT_H
+# include <sys/stat.h>
+#endif
+
+#if HAVE_FCNTL_H
+# include <fcntl.h>
+#endif
+
+#if HAVE_SIGNAL_H
+# include <signal.h>
+#endif
+
+#if HAVE_TIME_H
+# include <time.h>
+#endif
+
+#if HAVE_TERMIOS_H
+# include <termios.h>
+#endif
+
+#if HAVE_STRING_H
+# include <string.h>
+#endif
+
+#if HAVE_CTYPE_H
+# include <ctype.h>
+#endif
+
+#if HAVE_INTTYPES_H
+# include <inttypes.h>
+#else
+# if HAVE_STDINT_H
+#  include <stdint.h>
+# endif
+#endif
+
+#if HAVE_SYS_RESOURCE_H
+# include <sys/resource.h>
+#endif
+
+#include <stdlib.h>
+"; then :
+
+else
+  HTYPE_IS_INTEGRAL=0
+fi
+
+
+
+        if test "$HTYPE_IS_INTEGRAL" -eq 0
+        then
+                                                            cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+#include <stdbool.h>
+#include <stdio.h>
+#include <stddef.h>
+
+#if HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+
+#if HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+
+#if HAVE_SYS_STAT_H
+# include <sys/stat.h>
+#endif
+
+#if HAVE_FCNTL_H
+# include <fcntl.h>
+#endif
+
+#if HAVE_SIGNAL_H
+# include <signal.h>
+#endif
+
+#if HAVE_TIME_H
+# include <time.h>
+#endif
+
+#if HAVE_TERMIOS_H
+# include <termios.h>
+#endif
+
+#if HAVE_STRING_H
+# include <string.h>
+#endif
+
+#if HAVE_CTYPE_H
+# include <ctype.h>
+#endif
+
+#if HAVE_INTTYPES_H
+# include <inttypes.h>
+#else
+# if HAVE_STDINT_H
+#  include <stdint.h>
+# endif
+#endif
+
+#if HAVE_SYS_RESOURCE_H
+# include <sys/resource.h>
+#endif
+
+#include <stdlib.h>
+
+int
+main ()
+{
+float val; *val;
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  HTYPE_IS_POINTER=yes
+else
+  HTYPE_IS_POINTER=no
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+
+            if test "$HTYPE_IS_POINTER" = yes
+            then
+                fptools_cv_htype_float="Ptr ()"
+            else
+                if ac_fn_c_compute_int "$LINENO" "sizeof(float) == sizeof(float)" "HTYPE_IS_FLOAT"        "
+#include <stdbool.h>
+#include <stdio.h>
+#include <stddef.h>
+
+#if HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+
+#if HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+
+#if HAVE_SYS_STAT_H
+# include <sys/stat.h>
+#endif
+
+#if HAVE_FCNTL_H
+# include <fcntl.h>
+#endif
+
+#if HAVE_SIGNAL_H
+# include <signal.h>
+#endif
+
+#if HAVE_TIME_H
+# include <time.h>
+#endif
+
+#if HAVE_TERMIOS_H
+# include <termios.h>
+#endif
+
+#if HAVE_STRING_H
+# include <string.h>
+#endif
+
+#if HAVE_CTYPE_H
+# include <ctype.h>
+#endif
+
+#if HAVE_INTTYPES_H
+# include <inttypes.h>
+#else
+# if HAVE_STDINT_H
+#  include <stdint.h>
+# endif
+#endif
+
+#if HAVE_SYS_RESOURCE_H
+# include <sys/resource.h>
+#endif
+
+#include <stdlib.h>
+"; then :
+
+else
+  fptools_cv_htype_sup_float=no
+fi
+
+
+                if ac_fn_c_compute_int "$LINENO" "sizeof(float) == sizeof(double)" "HTYPE_IS_DOUBLE"        "
+#include <stdbool.h>
+#include <stdio.h>
+#include <stddef.h>
+
+#if HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+
+#if HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+
+#if HAVE_SYS_STAT_H
+# include <sys/stat.h>
+#endif
+
+#if HAVE_FCNTL_H
+# include <fcntl.h>
+#endif
+
+#if HAVE_SIGNAL_H
+# include <signal.h>
+#endif
+
+#if HAVE_TIME_H
+# include <time.h>
+#endif
+
+#if HAVE_TERMIOS_H
+# include <termios.h>
+#endif
+
+#if HAVE_STRING_H
+# include <string.h>
+#endif
+
+#if HAVE_CTYPE_H
+# include <ctype.h>
+#endif
+
+#if HAVE_INTTYPES_H
+# include <inttypes.h>
+#else
+# if HAVE_STDINT_H
+#  include <stdint.h>
+# endif
+#endif
+
+#if HAVE_SYS_RESOURCE_H
+# include <sys/resource.h>
+#endif
+
+#include <stdlib.h>
+"; then :
+
+else
+  fptools_cv_htype_sup_float=no
+fi
+
+
+                if ac_fn_c_compute_int "$LINENO" "sizeof(float) == sizeof(long double)" "HTYPE_IS_LDOUBLE"        "
+#include <stdbool.h>
+#include <stdio.h>
+#include <stddef.h>
+
+#if HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+
+#if HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+
+#if HAVE_SYS_STAT_H
+# include <sys/stat.h>
+#endif
+
+#if HAVE_FCNTL_H
+# include <fcntl.h>
+#endif
+
+#if HAVE_SIGNAL_H
+# include <signal.h>
+#endif
+
+#if HAVE_TIME_H
+# include <time.h>
+#endif
+
+#if HAVE_TERMIOS_H
+# include <termios.h>
+#endif
+
+#if HAVE_STRING_H
+# include <string.h>
+#endif
+
+#if HAVE_CTYPE_H
+# include <ctype.h>
+#endif
+
+#if HAVE_INTTYPES_H
+# include <inttypes.h>
+#else
+# if HAVE_STDINT_H
+#  include <stdint.h>
+# endif
+#endif
+
+#if HAVE_SYS_RESOURCE_H
+# include <sys/resource.h>
+#endif
+
+#include <stdlib.h>
+"; then :
+
+else
+  fptools_cv_htype_sup_float=no
+fi
+
+
+                if test "$HTYPE_IS_FLOAT" -eq 1
+                then
+                    fptools_cv_htype_float=Float
+                elif test "$HTYPE_IS_DOUBLE" -eq 1
+                then
+                    fptools_cv_htype_float=Double
+                elif test "$HTYPE_IS_LDOUBLE" -eq 1
+                then
+                    fptools_cv_htype_float=LDouble
+                else
+                    fptools_cv_htype_sup_float=no
+                fi
+            fi
+        else
+            if ac_fn_c_compute_int "$LINENO" "((float)(-1)) < ((float)0)" "HTYPE_IS_SIGNED"        "
+#include <stdbool.h>
+#include <stdio.h>
+#include <stddef.h>
+
+#if HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+
+#if HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+
+#if HAVE_SYS_STAT_H
+# include <sys/stat.h>
+#endif
+
+#if HAVE_FCNTL_H
+# include <fcntl.h>
+#endif
+
+#if HAVE_SIGNAL_H
+# include <signal.h>
+#endif
+
+#if HAVE_TIME_H
+# include <time.h>
+#endif
+
+#if HAVE_TERMIOS_H
+# include <termios.h>
+#endif
+
+#if HAVE_STRING_H
+# include <string.h>
+#endif
+
+#if HAVE_CTYPE_H
+# include <ctype.h>
+#endif
+
+#if HAVE_INTTYPES_H
+# include <inttypes.h>
+#else
+# if HAVE_STDINT_H
+#  include <stdint.h>
+# endif
+#endif
+
+#if HAVE_SYS_RESOURCE_H
+# include <sys/resource.h>
+#endif
+
+#include <stdlib.h>
+"; then :
+
+else
+  fptools_cv_htype_sup_float=no
+fi
+
+
+            if ac_fn_c_compute_int "$LINENO" "sizeof(float) * 8" "HTYPE_SIZE"        "
+#include <stdbool.h>
+#include <stdio.h>
+#include <stddef.h>
+
+#if HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+
+#if HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+
+#if HAVE_SYS_STAT_H
+# include <sys/stat.h>
+#endif
+
+#if HAVE_FCNTL_H
+# include <fcntl.h>
+#endif
+
+#if HAVE_SIGNAL_H
+# include <signal.h>
+#endif
+
+#if HAVE_TIME_H
+# include <time.h>
+#endif
+
+#if HAVE_TERMIOS_H
+# include <termios.h>
+#endif
+
+#if HAVE_STRING_H
+# include <string.h>
+#endif
+
+#if HAVE_CTYPE_H
+# include <ctype.h>
+#endif
+
+#if HAVE_INTTYPES_H
+# include <inttypes.h>
+#else
+# if HAVE_STDINT_H
+#  include <stdint.h>
+# endif
+#endif
+
+#if HAVE_SYS_RESOURCE_H
+# include <sys/resource.h>
+#endif
+
+#include <stdlib.h>
+"; then :
+
+else
+  fptools_cv_htype_sup_float=no
+fi
+
+
+            if test "$HTYPE_IS_SIGNED" -eq 0
+            then
+                fptools_cv_htype_float="Word$HTYPE_SIZE"
+            else
+                fptools_cv_htype_float="Int$HTYPE_SIZE"
+            fi
+        fi
+
+fi
+
+    if test "$fptools_cv_htype_sup_float" = no
+    then
+
+        fptools_cv_htype_float=NotReallyAType
+        { $as_echo "$as_me:${as_lineno-$LINENO}: result: not supported" >&5
+$as_echo "not supported" >&6; }
+
+    fi
+
+            if test "$fptools_cv_htype_sup_float" = yes; then
+        { $as_echo "$as_me:${as_lineno-$LINENO}: result: $fptools_cv_htype_float" >&5
+$as_echo "$fptools_cv_htype_float" >&6; }
+
+cat >>confdefs.h <<_ACEOF
+#define HTYPE_FLOAT $fptools_cv_htype_float
+_ACEOF
+
+    fi
+
+
+
+
+
+
+
+
+
+
+    { $as_echo "$as_me:${as_lineno-$LINENO}: checking Haskell type for double" >&5
+$as_echo_n "checking Haskell type for double... " >&6; }
+    if ${fptools_cv_htype_double+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+
+        fptools_cv_htype_sup_double=yes
+        if ac_fn_c_compute_int "$LINENO" "(double)0.2 - (double)0.4 < 0 ? 0 : 1" "HTYPE_IS_INTEGRAL"        "
+#include <stdbool.h>
+#include <stdio.h>
+#include <stddef.h>
+
+#if HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+
+#if HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+
+#if HAVE_SYS_STAT_H
+# include <sys/stat.h>
+#endif
+
+#if HAVE_FCNTL_H
+# include <fcntl.h>
+#endif
+
+#if HAVE_SIGNAL_H
+# include <signal.h>
+#endif
+
+#if HAVE_TIME_H
+# include <time.h>
+#endif
+
+#if HAVE_TERMIOS_H
+# include <termios.h>
+#endif
+
+#if HAVE_STRING_H
+# include <string.h>
+#endif
+
+#if HAVE_CTYPE_H
+# include <ctype.h>
+#endif
+
+#if HAVE_INTTYPES_H
+# include <inttypes.h>
+#else
+# if HAVE_STDINT_H
+#  include <stdint.h>
+# endif
+#endif
+
+#if HAVE_SYS_RESOURCE_H
+# include <sys/resource.h>
+#endif
+
+#include <stdlib.h>
+"; then :
+
+else
+  HTYPE_IS_INTEGRAL=0
+fi
+
+
+
+        if test "$HTYPE_IS_INTEGRAL" -eq 0
+        then
+                                                            cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+#include <stdbool.h>
+#include <stdio.h>
+#include <stddef.h>
+
+#if HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+
+#if HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+
+#if HAVE_SYS_STAT_H
+# include <sys/stat.h>
+#endif
+
+#if HAVE_FCNTL_H
+# include <fcntl.h>
+#endif
+
+#if HAVE_SIGNAL_H
+# include <signal.h>
+#endif
+
+#if HAVE_TIME_H
+# include <time.h>
+#endif
+
+#if HAVE_TERMIOS_H
+# include <termios.h>
+#endif
+
+#if HAVE_STRING_H
+# include <string.h>
+#endif
+
+#if HAVE_CTYPE_H
+# include <ctype.h>
+#endif
+
+#if HAVE_INTTYPES_H
+# include <inttypes.h>
+#else
+# if HAVE_STDINT_H
+#  include <stdint.h>
+# endif
+#endif
+
+#if HAVE_SYS_RESOURCE_H
+# include <sys/resource.h>
+#endif
+
+#include <stdlib.h>
+
+int
+main ()
+{
+double val; *val;
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  HTYPE_IS_POINTER=yes
+else
+  HTYPE_IS_POINTER=no
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+
+            if test "$HTYPE_IS_POINTER" = yes
+            then
+                fptools_cv_htype_double="Ptr ()"
+            else
+                if ac_fn_c_compute_int "$LINENO" "sizeof(double) == sizeof(float)" "HTYPE_IS_FLOAT"        "
+#include <stdbool.h>
+#include <stdio.h>
+#include <stddef.h>
+
+#if HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+
+#if HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+
+#if HAVE_SYS_STAT_H
+# include <sys/stat.h>
+#endif
+
+#if HAVE_FCNTL_H
+# include <fcntl.h>
+#endif
+
+#if HAVE_SIGNAL_H
+# include <signal.h>
+#endif
+
+#if HAVE_TIME_H
+# include <time.h>
+#endif
+
+#if HAVE_TERMIOS_H
+# include <termios.h>
+#endif
+
+#if HAVE_STRING_H
+# include <string.h>
+#endif
+
+#if HAVE_CTYPE_H
+# include <ctype.h>
+#endif
+
+#if HAVE_INTTYPES_H
+# include <inttypes.h>
+#else
+# if HAVE_STDINT_H
+#  include <stdint.h>
+# endif
+#endif
+
+#if HAVE_SYS_RESOURCE_H
+# include <sys/resource.h>
+#endif
+
+#include <stdlib.h>
+"; then :
+
+else
+  fptools_cv_htype_sup_double=no
+fi
+
+
+                if ac_fn_c_compute_int "$LINENO" "sizeof(double) == sizeof(double)" "HTYPE_IS_DOUBLE"        "
+#include <stdbool.h>
+#include <stdio.h>
+#include <stddef.h>
+
+#if HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+
+#if HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+
+#if HAVE_SYS_STAT_H
+# include <sys/stat.h>
+#endif
+
+#if HAVE_FCNTL_H
+# include <fcntl.h>
+#endif
+
+#if HAVE_SIGNAL_H
+# include <signal.h>
+#endif
+
+#if HAVE_TIME_H
+# include <time.h>
+#endif
+
+#if HAVE_TERMIOS_H
+# include <termios.h>
+#endif
+
+#if HAVE_STRING_H
+# include <string.h>
+#endif
+
+#if HAVE_CTYPE_H
+# include <ctype.h>
+#endif
+
+#if HAVE_INTTYPES_H
+# include <inttypes.h>
+#else
+# if HAVE_STDINT_H
+#  include <stdint.h>
+# endif
+#endif
+
+#if HAVE_SYS_RESOURCE_H
+# include <sys/resource.h>
+#endif
+
+#include <stdlib.h>
+"; then :
+
+else
+  fptools_cv_htype_sup_double=no
+fi
+
+
+                if ac_fn_c_compute_int "$LINENO" "sizeof(double) == sizeof(long double)" "HTYPE_IS_LDOUBLE"        "
+#include <stdbool.h>
+#include <stdio.h>
+#include <stddef.h>
+
+#if HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+
+#if HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+
+#if HAVE_SYS_STAT_H
+# include <sys/stat.h>
+#endif
+
+#if HAVE_FCNTL_H
+# include <fcntl.h>
+#endif
+
+#if HAVE_SIGNAL_H
+# include <signal.h>
+#endif
+
+#if HAVE_TIME_H
+# include <time.h>
+#endif
+
+#if HAVE_TERMIOS_H
+# include <termios.h>
+#endif
+
+#if HAVE_STRING_H
+# include <string.h>
+#endif
+
+#if HAVE_CTYPE_H
+# include <ctype.h>
+#endif
+
+#if HAVE_INTTYPES_H
+# include <inttypes.h>
+#else
+# if HAVE_STDINT_H
+#  include <stdint.h>
+# endif
+#endif
+
+#if HAVE_SYS_RESOURCE_H
+# include <sys/resource.h>
+#endif
+
+#include <stdlib.h>
+"; then :
+
+else
+  fptools_cv_htype_sup_double=no
+fi
+
+
+                if test "$HTYPE_IS_FLOAT" -eq 1
+                then
+                    fptools_cv_htype_double=Float
+                elif test "$HTYPE_IS_DOUBLE" -eq 1
+                then
+                    fptools_cv_htype_double=Double
+                elif test "$HTYPE_IS_LDOUBLE" -eq 1
+                then
+                    fptools_cv_htype_double=LDouble
+                else
+                    fptools_cv_htype_sup_double=no
+                fi
+            fi
+        else
+            if ac_fn_c_compute_int "$LINENO" "((double)(-1)) < ((double)0)" "HTYPE_IS_SIGNED"        "
+#include <stdbool.h>
+#include <stdio.h>
+#include <stddef.h>
+
+#if HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+
+#if HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+
+#if HAVE_SYS_STAT_H
+# include <sys/stat.h>
+#endif
+
+#if HAVE_FCNTL_H
+# include <fcntl.h>
+#endif
+
+#if HAVE_SIGNAL_H
+# include <signal.h>
+#endif
+
+#if HAVE_TIME_H
+# include <time.h>
+#endif
+
+#if HAVE_TERMIOS_H
+# include <termios.h>
+#endif
+
+#if HAVE_STRING_H
+# include <string.h>
+#endif
+
+#if HAVE_CTYPE_H
+# include <ctype.h>
+#endif
+
+#if HAVE_INTTYPES_H
+# include <inttypes.h>
+#else
+# if HAVE_STDINT_H
+#  include <stdint.h>
+# endif
+#endif
+
+#if HAVE_SYS_RESOURCE_H
+# include <sys/resource.h>
+#endif
+
+#include <stdlib.h>
+"; then :
+
+else
+  fptools_cv_htype_sup_double=no
+fi
+
+
+            if ac_fn_c_compute_int "$LINENO" "sizeof(double) * 8" "HTYPE_SIZE"        "
+#include <stdbool.h>
+#include <stdio.h>
+#include <stddef.h>
+
+#if HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+
+#if HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+
+#if HAVE_SYS_STAT_H
+# include <sys/stat.h>
+#endif
+
+#if HAVE_FCNTL_H
+# include <fcntl.h>
+#endif
+
+#if HAVE_SIGNAL_H
+# include <signal.h>
+#endif
+
+#if HAVE_TIME_H
+# include <time.h>
+#endif
+
+#if HAVE_TERMIOS_H
+# include <termios.h>
+#endif
+
+#if HAVE_STRING_H
+# include <string.h>
+#endif
+
+#if HAVE_CTYPE_H
+# include <ctype.h>
+#endif
+
+#if HAVE_INTTYPES_H
+# include <inttypes.h>
+#else
+# if HAVE_STDINT_H
+#  include <stdint.h>
+# endif
+#endif
+
+#if HAVE_SYS_RESOURCE_H
+# include <sys/resource.h>
+#endif
+
+#include <stdlib.h>
+"; then :
+
+else
+  fptools_cv_htype_sup_double=no
+fi
+
+
+            if test "$HTYPE_IS_SIGNED" -eq 0
+            then
+                fptools_cv_htype_double="Word$HTYPE_SIZE"
+            else
+                fptools_cv_htype_double="Int$HTYPE_SIZE"
+            fi
+        fi
+
+fi
+
+    if test "$fptools_cv_htype_sup_double" = no
+    then
+
+        fptools_cv_htype_double=NotReallyAType
+        { $as_echo "$as_me:${as_lineno-$LINENO}: result: not supported" >&5
+$as_echo "not supported" >&6; }
+
+    fi
+
+            if test "$fptools_cv_htype_sup_double" = yes; then
+        { $as_echo "$as_me:${as_lineno-$LINENO}: result: $fptools_cv_htype_double" >&5
+$as_echo "$fptools_cv_htype_double" >&6; }
+
+cat >>confdefs.h <<_ACEOF
+#define HTYPE_DOUBLE $fptools_cv_htype_double
+_ACEOF
+
+    fi
+
+
+
+
+
+
+
+
+
+
+    { $as_echo "$as_me:${as_lineno-$LINENO}: checking Haskell type for ptrdiff_t" >&5
+$as_echo_n "checking Haskell type for ptrdiff_t... " >&6; }
+    if ${fptools_cv_htype_ptrdiff_t+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+
+        fptools_cv_htype_sup_ptrdiff_t=yes
+        if ac_fn_c_compute_int "$LINENO" "(ptrdiff_t)0.2 - (ptrdiff_t)0.4 < 0 ? 0 : 1" "HTYPE_IS_INTEGRAL"        "
+#include <stdbool.h>
+#include <stdio.h>
+#include <stddef.h>
+
+#if HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+
+#if HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+
+#if HAVE_SYS_STAT_H
+# include <sys/stat.h>
+#endif
+
+#if HAVE_FCNTL_H
+# include <fcntl.h>
+#endif
+
+#if HAVE_SIGNAL_H
+# include <signal.h>
+#endif
+
+#if HAVE_TIME_H
+# include <time.h>
+#endif
+
+#if HAVE_TERMIOS_H
+# include <termios.h>
+#endif
+
+#if HAVE_STRING_H
+# include <string.h>
+#endif
+
+#if HAVE_CTYPE_H
+# include <ctype.h>
+#endif
+
+#if HAVE_INTTYPES_H
+# include <inttypes.h>
+#else
+# if HAVE_STDINT_H
+#  include <stdint.h>
+# endif
+#endif
+
+#if HAVE_SYS_RESOURCE_H
+# include <sys/resource.h>
+#endif
+
+#include <stdlib.h>
+"; then :
+
+else
+  HTYPE_IS_INTEGRAL=0
+fi
+
+
+
+        if test "$HTYPE_IS_INTEGRAL" -eq 0
+        then
+                                                            cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+#include <stdbool.h>
+#include <stdio.h>
+#include <stddef.h>
+
+#if HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+
+#if HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+
+#if HAVE_SYS_STAT_H
+# include <sys/stat.h>
+#endif
+
+#if HAVE_FCNTL_H
+# include <fcntl.h>
+#endif
+
+#if HAVE_SIGNAL_H
+# include <signal.h>
+#endif
+
+#if HAVE_TIME_H
+# include <time.h>
+#endif
+
+#if HAVE_TERMIOS_H
+# include <termios.h>
+#endif
+
+#if HAVE_STRING_H
+# include <string.h>
+#endif
+
+#if HAVE_CTYPE_H
+# include <ctype.h>
+#endif
+
+#if HAVE_INTTYPES_H
+# include <inttypes.h>
+#else
+# if HAVE_STDINT_H
+#  include <stdint.h>
+# endif
+#endif
+
+#if HAVE_SYS_RESOURCE_H
+# include <sys/resource.h>
+#endif
+
+#include <stdlib.h>
+
+int
+main ()
+{
+ptrdiff_t val; *val;
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  HTYPE_IS_POINTER=yes
+else
+  HTYPE_IS_POINTER=no
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+
+            if test "$HTYPE_IS_POINTER" = yes
+            then
+                fptools_cv_htype_ptrdiff_t="Ptr ()"
+            else
+                if ac_fn_c_compute_int "$LINENO" "sizeof(ptrdiff_t) == sizeof(float)" "HTYPE_IS_FLOAT"        "
+#include <stdbool.h>
+#include <stdio.h>
+#include <stddef.h>
+
+#if HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+
+#if HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+
+#if HAVE_SYS_STAT_H
+# include <sys/stat.h>
+#endif
+
+#if HAVE_FCNTL_H
+# include <fcntl.h>
+#endif
+
+#if HAVE_SIGNAL_H
+# include <signal.h>
+#endif
+
+#if HAVE_TIME_H
+# include <time.h>
+#endif
+
+#if HAVE_TERMIOS_H
+# include <termios.h>
+#endif
+
+#if HAVE_STRING_H
+# include <string.h>
+#endif
+
+#if HAVE_CTYPE_H
+# include <ctype.h>
+#endif
+
+#if HAVE_INTTYPES_H
+# include <inttypes.h>
+#else
+# if HAVE_STDINT_H
+#  include <stdint.h>
+# endif
+#endif
+
+#if HAVE_SYS_RESOURCE_H
+# include <sys/resource.h>
+#endif
+
+#include <stdlib.h>
+"; then :
+
+else
+  fptools_cv_htype_sup_ptrdiff_t=no
+fi
+
+
+                if ac_fn_c_compute_int "$LINENO" "sizeof(ptrdiff_t) == sizeof(double)" "HTYPE_IS_DOUBLE"        "
+#include <stdbool.h>
+#include <stdio.h>
+#include <stddef.h>
+
+#if HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+
+#if HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+
+#if HAVE_SYS_STAT_H
+# include <sys/stat.h>
+#endif
+
+#if HAVE_FCNTL_H
+# include <fcntl.h>
+#endif
+
+#if HAVE_SIGNAL_H
+# include <signal.h>
+#endif
+
+#if HAVE_TIME_H
+# include <time.h>
+#endif
+
+#if HAVE_TERMIOS_H
+# include <termios.h>
+#endif
+
+#if HAVE_STRING_H
+# include <string.h>
+#endif
+
+#if HAVE_CTYPE_H
+# include <ctype.h>
+#endif
+
+#if HAVE_INTTYPES_H
+# include <inttypes.h>
+#else
+# if HAVE_STDINT_H
+#  include <stdint.h>
+# endif
+#endif
+
+#if HAVE_SYS_RESOURCE_H
+# include <sys/resource.h>
+#endif
+
+#include <stdlib.h>
+"; then :
+
+else
+  fptools_cv_htype_sup_ptrdiff_t=no
+fi
+
+
+                if ac_fn_c_compute_int "$LINENO" "sizeof(ptrdiff_t) == sizeof(long double)" "HTYPE_IS_LDOUBLE"        "
+#include <stdbool.h>
+#include <stdio.h>
+#include <stddef.h>
+
+#if HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+
+#if HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+
+#if HAVE_SYS_STAT_H
+# include <sys/stat.h>
+#endif
+
+#if HAVE_FCNTL_H
+# include <fcntl.h>
+#endif
+
+#if HAVE_SIGNAL_H
+# include <signal.h>
+#endif
+
+#if HAVE_TIME_H
+# include <time.h>
+#endif
+
+#if HAVE_TERMIOS_H
+# include <termios.h>
+#endif
+
+#if HAVE_STRING_H
+# include <string.h>
+#endif
+
+#if HAVE_CTYPE_H
+# include <ctype.h>
+#endif
+
+#if HAVE_INTTYPES_H
+# include <inttypes.h>
+#else
+# if HAVE_STDINT_H
+#  include <stdint.h>
+# endif
+#endif
+
+#if HAVE_SYS_RESOURCE_H
+# include <sys/resource.h>
+#endif
+
+#include <stdlib.h>
+"; then :
+
+else
+  fptools_cv_htype_sup_ptrdiff_t=no
+fi
+
+
+                if test "$HTYPE_IS_FLOAT" -eq 1
+                then
+                    fptools_cv_htype_ptrdiff_t=Float
+                elif test "$HTYPE_IS_DOUBLE" -eq 1
+                then
+                    fptools_cv_htype_ptrdiff_t=Double
+                elif test "$HTYPE_IS_LDOUBLE" -eq 1
+                then
+                    fptools_cv_htype_ptrdiff_t=LDouble
+                else
+                    fptools_cv_htype_sup_ptrdiff_t=no
+                fi
+            fi
+        else
+            if ac_fn_c_compute_int "$LINENO" "((ptrdiff_t)(-1)) < ((ptrdiff_t)0)" "HTYPE_IS_SIGNED"        "
+#include <stdbool.h>
+#include <stdio.h>
+#include <stddef.h>
+
+#if HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+
+#if HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+
+#if HAVE_SYS_STAT_H
+# include <sys/stat.h>
+#endif
+
+#if HAVE_FCNTL_H
+# include <fcntl.h>
+#endif
+
+#if HAVE_SIGNAL_H
+# include <signal.h>
+#endif
+
+#if HAVE_TIME_H
+# include <time.h>
+#endif
+
+#if HAVE_TERMIOS_H
+# include <termios.h>
+#endif
+
+#if HAVE_STRING_H
+# include <string.h>
+#endif
+
+#if HAVE_CTYPE_H
+# include <ctype.h>
+#endif
+
+#if HAVE_INTTYPES_H
+# include <inttypes.h>
+#else
+# if HAVE_STDINT_H
+#  include <stdint.h>
+# endif
+#endif
+
+#if HAVE_SYS_RESOURCE_H
+# include <sys/resource.h>
+#endif
+
+#include <stdlib.h>
+"; then :
+
+else
+  fptools_cv_htype_sup_ptrdiff_t=no
+fi
+
+
+            if ac_fn_c_compute_int "$LINENO" "sizeof(ptrdiff_t) * 8" "HTYPE_SIZE"        "
+#include <stdbool.h>
+#include <stdio.h>
+#include <stddef.h>
+
+#if HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+
+#if HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+
+#if HAVE_SYS_STAT_H
+# include <sys/stat.h>
+#endif
+
+#if HAVE_FCNTL_H
+# include <fcntl.h>
+#endif
+
+#if HAVE_SIGNAL_H
+# include <signal.h>
+#endif
+
+#if HAVE_TIME_H
+# include <time.h>
+#endif
+
+#if HAVE_TERMIOS_H
+# include <termios.h>
+#endif
+
+#if HAVE_STRING_H
+# include <string.h>
+#endif
+
+#if HAVE_CTYPE_H
+# include <ctype.h>
+#endif
+
+#if HAVE_INTTYPES_H
+# include <inttypes.h>
+#else
+# if HAVE_STDINT_H
+#  include <stdint.h>
+# endif
+#endif
+
+#if HAVE_SYS_RESOURCE_H
+# include <sys/resource.h>
+#endif
+
+#include <stdlib.h>
+"; then :
+
+else
+  fptools_cv_htype_sup_ptrdiff_t=no
+fi
+
+
+            if test "$HTYPE_IS_SIGNED" -eq 0
+            then
+                fptools_cv_htype_ptrdiff_t="Word$HTYPE_SIZE"
+            else
+                fptools_cv_htype_ptrdiff_t="Int$HTYPE_SIZE"
+            fi
+        fi
+
+fi
+
+    if test "$fptools_cv_htype_sup_ptrdiff_t" = no
+    then
+
+        fptools_cv_htype_ptrdiff_t=NotReallyAType
+        { $as_echo "$as_me:${as_lineno-$LINENO}: result: not supported" >&5
+$as_echo "not supported" >&6; }
+
+    fi
+
+            if test "$fptools_cv_htype_sup_ptrdiff_t" = yes; then
+        { $as_echo "$as_me:${as_lineno-$LINENO}: result: $fptools_cv_htype_ptrdiff_t" >&5
+$as_echo "$fptools_cv_htype_ptrdiff_t" >&6; }
+
+cat >>confdefs.h <<_ACEOF
+#define HTYPE_PTRDIFF_T $fptools_cv_htype_ptrdiff_t
+_ACEOF
+
+    fi
+
+
+
+
+
+
+
+
+
+
+    { $as_echo "$as_me:${as_lineno-$LINENO}: checking Haskell type for size_t" >&5
+$as_echo_n "checking Haskell type for size_t... " >&6; }
+    if ${fptools_cv_htype_size_t+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+
+        fptools_cv_htype_sup_size_t=yes
+        if ac_fn_c_compute_int "$LINENO" "(size_t)0.2 - (size_t)0.4 < 0 ? 0 : 1" "HTYPE_IS_INTEGRAL"        "
+#include <stdbool.h>
+#include <stdio.h>
+#include <stddef.h>
+
+#if HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+
+#if HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+
+#if HAVE_SYS_STAT_H
+# include <sys/stat.h>
+#endif
+
+#if HAVE_FCNTL_H
+# include <fcntl.h>
+#endif
+
+#if HAVE_SIGNAL_H
+# include <signal.h>
+#endif
+
+#if HAVE_TIME_H
+# include <time.h>
+#endif
+
+#if HAVE_TERMIOS_H
+# include <termios.h>
+#endif
+
+#if HAVE_STRING_H
+# include <string.h>
+#endif
+
+#if HAVE_CTYPE_H
+# include <ctype.h>
+#endif
+
+#if HAVE_INTTYPES_H
+# include <inttypes.h>
+#else
+# if HAVE_STDINT_H
+#  include <stdint.h>
+# endif
+#endif
+
+#if HAVE_SYS_RESOURCE_H
+# include <sys/resource.h>
+#endif
+
+#include <stdlib.h>
+"; then :
+
+else
+  HTYPE_IS_INTEGRAL=0
+fi
+
+
+
+        if test "$HTYPE_IS_INTEGRAL" -eq 0
+        then
+                                                            cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+#include <stdbool.h>
+#include <stdio.h>
+#include <stddef.h>
+
+#if HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+
+#if HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+
+#if HAVE_SYS_STAT_H
+# include <sys/stat.h>
+#endif
+
+#if HAVE_FCNTL_H
+# include <fcntl.h>
+#endif
+
+#if HAVE_SIGNAL_H
+# include <signal.h>
+#endif
+
+#if HAVE_TIME_H
+# include <time.h>
+#endif
+
+#if HAVE_TERMIOS_H
+# include <termios.h>
+#endif
+
+#if HAVE_STRING_H
+# include <string.h>
+#endif
+
+#if HAVE_CTYPE_H
+# include <ctype.h>
+#endif
+
+#if HAVE_INTTYPES_H
+# include <inttypes.h>
+#else
+# if HAVE_STDINT_H
+#  include <stdint.h>
+# endif
+#endif
+
+#if HAVE_SYS_RESOURCE_H
+# include <sys/resource.h>
+#endif
+
+#include <stdlib.h>
+
+int
+main ()
+{
+size_t val; *val;
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  HTYPE_IS_POINTER=yes
+else
+  HTYPE_IS_POINTER=no
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+
+            if test "$HTYPE_IS_POINTER" = yes
+            then
+                fptools_cv_htype_size_t="Ptr ()"
+            else
+                if ac_fn_c_compute_int "$LINENO" "sizeof(size_t) == sizeof(float)" "HTYPE_IS_FLOAT"        "
+#include <stdbool.h>
+#include <stdio.h>
+#include <stddef.h>
+
+#if HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+
+#if HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+
+#if HAVE_SYS_STAT_H
+# include <sys/stat.h>
+#endif
+
+#if HAVE_FCNTL_H
+# include <fcntl.h>
+#endif
+
+#if HAVE_SIGNAL_H
+# include <signal.h>
+#endif
+
+#if HAVE_TIME_H
+# include <time.h>
+#endif
+
+#if HAVE_TERMIOS_H
+# include <termios.h>
+#endif
+
+#if HAVE_STRING_H
+# include <string.h>
+#endif
+
+#if HAVE_CTYPE_H
+# include <ctype.h>
+#endif
+
+#if HAVE_INTTYPES_H
+# include <inttypes.h>
+#else
+# if HAVE_STDINT_H
+#  include <stdint.h>
+# endif
+#endif
+
+#if HAVE_SYS_RESOURCE_H
+# include <sys/resource.h>
+#endif
+
+#include <stdlib.h>
+"; then :
+
+else
+  fptools_cv_htype_sup_size_t=no
+fi
+
+
+                if ac_fn_c_compute_int "$LINENO" "sizeof(size_t) == sizeof(double)" "HTYPE_IS_DOUBLE"        "
+#include <stdbool.h>
+#include <stdio.h>
+#include <stddef.h>
+
+#if HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+
+#if HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+
+#if HAVE_SYS_STAT_H
+# include <sys/stat.h>
+#endif
+
+#if HAVE_FCNTL_H
+# include <fcntl.h>
+#endif
+
+#if HAVE_SIGNAL_H
+# include <signal.h>
+#endif
+
+#if HAVE_TIME_H
+# include <time.h>
+#endif
+
+#if HAVE_TERMIOS_H
+# include <termios.h>
+#endif
+
+#if HAVE_STRING_H
+# include <string.h>
+#endif
+
+#if HAVE_CTYPE_H
+# include <ctype.h>
+#endif
+
+#if HAVE_INTTYPES_H
+# include <inttypes.h>
+#else
+# if HAVE_STDINT_H
+#  include <stdint.h>
+# endif
+#endif
+
+#if HAVE_SYS_RESOURCE_H
+# include <sys/resource.h>
+#endif
+
+#include <stdlib.h>
+"; then :
+
+else
+  fptools_cv_htype_sup_size_t=no
+fi
+
+
+                if ac_fn_c_compute_int "$LINENO" "sizeof(size_t) == sizeof(long double)" "HTYPE_IS_LDOUBLE"        "
+#include <stdbool.h>
+#include <stdio.h>
+#include <stddef.h>
+
+#if HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+
+#if HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+
+#if HAVE_SYS_STAT_H
+# include <sys/stat.h>
+#endif
+
+#if HAVE_FCNTL_H
+# include <fcntl.h>
+#endif
+
+#if HAVE_SIGNAL_H
+# include <signal.h>
+#endif
+
+#if HAVE_TIME_H
+# include <time.h>
+#endif
+
+#if HAVE_TERMIOS_H
+# include <termios.h>
+#endif
+
+#if HAVE_STRING_H
+# include <string.h>
+#endif
+
+#if HAVE_CTYPE_H
+# include <ctype.h>
+#endif
+
+#if HAVE_INTTYPES_H
+# include <inttypes.h>
+#else
+# if HAVE_STDINT_H
+#  include <stdint.h>
+# endif
+#endif
+
+#if HAVE_SYS_RESOURCE_H
+# include <sys/resource.h>
+#endif
+
+#include <stdlib.h>
+"; then :
+
+else
+  fptools_cv_htype_sup_size_t=no
+fi
+
+
+                if test "$HTYPE_IS_FLOAT" -eq 1
+                then
+                    fptools_cv_htype_size_t=Float
+                elif test "$HTYPE_IS_DOUBLE" -eq 1
+                then
+                    fptools_cv_htype_size_t=Double
+                elif test "$HTYPE_IS_LDOUBLE" -eq 1
+                then
+                    fptools_cv_htype_size_t=LDouble
+                else
+                    fptools_cv_htype_sup_size_t=no
+                fi
+            fi
+        else
+            if ac_fn_c_compute_int "$LINENO" "((size_t)(-1)) < ((size_t)0)" "HTYPE_IS_SIGNED"        "
+#include <stdbool.h>
+#include <stdio.h>
+#include <stddef.h>
+
+#if HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+
+#if HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+
+#if HAVE_SYS_STAT_H
+# include <sys/stat.h>
+#endif
+
+#if HAVE_FCNTL_H
+# include <fcntl.h>
+#endif
+
+#if HAVE_SIGNAL_H
+# include <signal.h>
+#endif
+
+#if HAVE_TIME_H
+# include <time.h>
+#endif
+
+#if HAVE_TERMIOS_H
+# include <termios.h>
+#endif
+
+#if HAVE_STRING_H
+# include <string.h>
+#endif
+
+#if HAVE_CTYPE_H
+# include <ctype.h>
+#endif
+
+#if HAVE_INTTYPES_H
+# include <inttypes.h>
+#else
+# if HAVE_STDINT_H
+#  include <stdint.h>
+# endif
+#endif
+
+#if HAVE_SYS_RESOURCE_H
+# include <sys/resource.h>
+#endif
+
+#include <stdlib.h>
+"; then :
+
+else
+  fptools_cv_htype_sup_size_t=no
+fi
+
+
+            if ac_fn_c_compute_int "$LINENO" "sizeof(size_t) * 8" "HTYPE_SIZE"        "
+#include <stdbool.h>
+#include <stdio.h>
+#include <stddef.h>
+
+#if HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+
+#if HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+
+#if HAVE_SYS_STAT_H
+# include <sys/stat.h>
+#endif
+
+#if HAVE_FCNTL_H
+# include <fcntl.h>
+#endif
+
+#if HAVE_SIGNAL_H
+# include <signal.h>
+#endif
+
+#if HAVE_TIME_H
+# include <time.h>
+#endif
+
+#if HAVE_TERMIOS_H
+# include <termios.h>
+#endif
+
+#if HAVE_STRING_H
+# include <string.h>
+#endif
+
+#if HAVE_CTYPE_H
+# include <ctype.h>
+#endif
+
+#if HAVE_INTTYPES_H
+# include <inttypes.h>
+#else
+# if HAVE_STDINT_H
+#  include <stdint.h>
+# endif
+#endif
+
+#if HAVE_SYS_RESOURCE_H
+# include <sys/resource.h>
+#endif
+
+#include <stdlib.h>
+"; then :
+
+else
+  fptools_cv_htype_sup_size_t=no
+fi
+
+
+            if test "$HTYPE_IS_SIGNED" -eq 0
+            then
+                fptools_cv_htype_size_t="Word$HTYPE_SIZE"
+            else
+                fptools_cv_htype_size_t="Int$HTYPE_SIZE"
+            fi
+        fi
+
+fi
+
+    if test "$fptools_cv_htype_sup_size_t" = no
+    then
+
+        fptools_cv_htype_size_t=NotReallyAType
+        { $as_echo "$as_me:${as_lineno-$LINENO}: result: not supported" >&5
+$as_echo "not supported" >&6; }
+
+    fi
+
+            if test "$fptools_cv_htype_sup_size_t" = yes; then
+        { $as_echo "$as_me:${as_lineno-$LINENO}: result: $fptools_cv_htype_size_t" >&5
+$as_echo "$fptools_cv_htype_size_t" >&6; }
+
+cat >>confdefs.h <<_ACEOF
+#define HTYPE_SIZE_T $fptools_cv_htype_size_t
+_ACEOF
+
+    fi
+
+
+
+
+
+
+
+
+
+
+    { $as_echo "$as_me:${as_lineno-$LINENO}: checking Haskell type for wchar_t" >&5
+$as_echo_n "checking Haskell type for wchar_t... " >&6; }
+    if ${fptools_cv_htype_wchar_t+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+
+        fptools_cv_htype_sup_wchar_t=yes
+        if ac_fn_c_compute_int "$LINENO" "(wchar_t)0.2 - (wchar_t)0.4 < 0 ? 0 : 1" "HTYPE_IS_INTEGRAL"        "
+#include <stdbool.h>
+#include <stdio.h>
+#include <stddef.h>
+
+#if HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+
+#if HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+
+#if HAVE_SYS_STAT_H
+# include <sys/stat.h>
+#endif
+
+#if HAVE_FCNTL_H
+# include <fcntl.h>
+#endif
+
+#if HAVE_SIGNAL_H
+# include <signal.h>
+#endif
+
+#if HAVE_TIME_H
+# include <time.h>
+#endif
+
+#if HAVE_TERMIOS_H
+# include <termios.h>
+#endif
+
+#if HAVE_STRING_H
+# include <string.h>
+#endif
+
+#if HAVE_CTYPE_H
+# include <ctype.h>
+#endif
+
+#if HAVE_INTTYPES_H
+# include <inttypes.h>
+#else
+# if HAVE_STDINT_H
+#  include <stdint.h>
+# endif
+#endif
+
+#if HAVE_SYS_RESOURCE_H
+# include <sys/resource.h>
+#endif
+
+#include <stdlib.h>
+"; then :
+
+else
+  HTYPE_IS_INTEGRAL=0
+fi
+
+
+
+        if test "$HTYPE_IS_INTEGRAL" -eq 0
+        then
+                                                            cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+#include <stdbool.h>
+#include <stdio.h>
+#include <stddef.h>
+
+#if HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+
+#if HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+
+#if HAVE_SYS_STAT_H
+# include <sys/stat.h>
+#endif
+
+#if HAVE_FCNTL_H
+# include <fcntl.h>
+#endif
+
+#if HAVE_SIGNAL_H
+# include <signal.h>
+#endif
+
+#if HAVE_TIME_H
+# include <time.h>
+#endif
+
+#if HAVE_TERMIOS_H
+# include <termios.h>
+#endif
+
+#if HAVE_STRING_H
+# include <string.h>
+#endif
+
+#if HAVE_CTYPE_H
+# include <ctype.h>
+#endif
+
+#if HAVE_INTTYPES_H
+# include <inttypes.h>
+#else
+# if HAVE_STDINT_H
+#  include <stdint.h>
+# endif
+#endif
+
+#if HAVE_SYS_RESOURCE_H
+# include <sys/resource.h>
+#endif
+
+#include <stdlib.h>
+
+int
+main ()
+{
+wchar_t val; *val;
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  HTYPE_IS_POINTER=yes
+else
+  HTYPE_IS_POINTER=no
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+
+            if test "$HTYPE_IS_POINTER" = yes
+            then
+                fptools_cv_htype_wchar_t="Ptr ()"
+            else
+                if ac_fn_c_compute_int "$LINENO" "sizeof(wchar_t) == sizeof(float)" "HTYPE_IS_FLOAT"        "
+#include <stdbool.h>
+#include <stdio.h>
+#include <stddef.h>
+
+#if HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+
+#if HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+
+#if HAVE_SYS_STAT_H
+# include <sys/stat.h>
+#endif
+
+#if HAVE_FCNTL_H
+# include <fcntl.h>
+#endif
+
+#if HAVE_SIGNAL_H
+# include <signal.h>
+#endif
+
+#if HAVE_TIME_H
+# include <time.h>
+#endif
+
+#if HAVE_TERMIOS_H
+# include <termios.h>
+#endif
+
+#if HAVE_STRING_H
+# include <string.h>
+#endif
+
+#if HAVE_CTYPE_H
+# include <ctype.h>
+#endif
+
+#if HAVE_INTTYPES_H
+# include <inttypes.h>
+#else
+# if HAVE_STDINT_H
+#  include <stdint.h>
+# endif
+#endif
+
+#if HAVE_SYS_RESOURCE_H
+# include <sys/resource.h>
+#endif
+
+#include <stdlib.h>
+"; then :
+
+else
+  fptools_cv_htype_sup_wchar_t=no
+fi
+
+
+                if ac_fn_c_compute_int "$LINENO" "sizeof(wchar_t) == sizeof(double)" "HTYPE_IS_DOUBLE"        "
+#include <stdbool.h>
+#include <stdio.h>
+#include <stddef.h>
+
+#if HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+
+#if HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+
+#if HAVE_SYS_STAT_H
+# include <sys/stat.h>
+#endif
+
+#if HAVE_FCNTL_H
+# include <fcntl.h>
+#endif
+
+#if HAVE_SIGNAL_H
+# include <signal.h>
+#endif
+
+#if HAVE_TIME_H
+# include <time.h>
+#endif
+
+#if HAVE_TERMIOS_H
+# include <termios.h>
+#endif
+
+#if HAVE_STRING_H
+# include <string.h>
+#endif
+
+#if HAVE_CTYPE_H
+# include <ctype.h>
+#endif
+
+#if HAVE_INTTYPES_H
+# include <inttypes.h>
+#else
+# if HAVE_STDINT_H
+#  include <stdint.h>
+# endif
+#endif
+
+#if HAVE_SYS_RESOURCE_H
+# include <sys/resource.h>
+#endif
+
+#include <stdlib.h>
+"; then :
+
+else
+  fptools_cv_htype_sup_wchar_t=no
+fi
+
+
+                if ac_fn_c_compute_int "$LINENO" "sizeof(wchar_t) == sizeof(long double)" "HTYPE_IS_LDOUBLE"        "
+#include <stdbool.h>
+#include <stdio.h>
+#include <stddef.h>
+
+#if HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+
+#if HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+
+#if HAVE_SYS_STAT_H
+# include <sys/stat.h>
+#endif
+
+#if HAVE_FCNTL_H
+# include <fcntl.h>
+#endif
+
+#if HAVE_SIGNAL_H
+# include <signal.h>
+#endif
+
+#if HAVE_TIME_H
+# include <time.h>
+#endif
+
+#if HAVE_TERMIOS_H
+# include <termios.h>
+#endif
+
+#if HAVE_STRING_H
+# include <string.h>
+#endif
+
+#if HAVE_CTYPE_H
+# include <ctype.h>
+#endif
+
+#if HAVE_INTTYPES_H
+# include <inttypes.h>
+#else
+# if HAVE_STDINT_H
+#  include <stdint.h>
+# endif
+#endif
+
+#if HAVE_SYS_RESOURCE_H
+# include <sys/resource.h>
+#endif
+
+#include <stdlib.h>
+"; then :
+
+else
+  fptools_cv_htype_sup_wchar_t=no
+fi
+
+
+                if test "$HTYPE_IS_FLOAT" -eq 1
+                then
+                    fptools_cv_htype_wchar_t=Float
+                elif test "$HTYPE_IS_DOUBLE" -eq 1
+                then
+                    fptools_cv_htype_wchar_t=Double
+                elif test "$HTYPE_IS_LDOUBLE" -eq 1
+                then
+                    fptools_cv_htype_wchar_t=LDouble
+                else
+                    fptools_cv_htype_sup_wchar_t=no
+                fi
+            fi
+        else
+            if ac_fn_c_compute_int "$LINENO" "((wchar_t)(-1)) < ((wchar_t)0)" "HTYPE_IS_SIGNED"        "
+#include <stdbool.h>
+#include <stdio.h>
+#include <stddef.h>
+
+#if HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+
+#if HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+
+#if HAVE_SYS_STAT_H
+# include <sys/stat.h>
+#endif
+
+#if HAVE_FCNTL_H
+# include <fcntl.h>
+#endif
+
+#if HAVE_SIGNAL_H
+# include <signal.h>
+#endif
+
+#if HAVE_TIME_H
+# include <time.h>
+#endif
+
+#if HAVE_TERMIOS_H
+# include <termios.h>
+#endif
+
+#if HAVE_STRING_H
+# include <string.h>
+#endif
+
+#if HAVE_CTYPE_H
+# include <ctype.h>
+#endif
+
+#if HAVE_INTTYPES_H
+# include <inttypes.h>
+#else
+# if HAVE_STDINT_H
+#  include <stdint.h>
+# endif
+#endif
+
+#if HAVE_SYS_RESOURCE_H
+# include <sys/resource.h>
+#endif
+
+#include <stdlib.h>
+"; then :
+
+else
+  fptools_cv_htype_sup_wchar_t=no
+fi
+
+
+            if ac_fn_c_compute_int "$LINENO" "sizeof(wchar_t) * 8" "HTYPE_SIZE"        "
+#include <stdbool.h>
+#include <stdio.h>
+#include <stddef.h>
+
+#if HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+
+#if HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+
+#if HAVE_SYS_STAT_H
+# include <sys/stat.h>
+#endif
+
+#if HAVE_FCNTL_H
+# include <fcntl.h>
+#endif
+
+#if HAVE_SIGNAL_H
+# include <signal.h>
+#endif
+
+#if HAVE_TIME_H
+# include <time.h>
+#endif
+
+#if HAVE_TERMIOS_H
+# include <termios.h>
+#endif
+
+#if HAVE_STRING_H
+# include <string.h>
+#endif
+
+#if HAVE_CTYPE_H
+# include <ctype.h>
+#endif
+
+#if HAVE_INTTYPES_H
+# include <inttypes.h>
+#else
+# if HAVE_STDINT_H
+#  include <stdint.h>
+# endif
+#endif
+
+#if HAVE_SYS_RESOURCE_H
+# include <sys/resource.h>
+#endif
+
+#include <stdlib.h>
+"; then :
+
+else
+  fptools_cv_htype_sup_wchar_t=no
+fi
+
+
+            if test "$HTYPE_IS_SIGNED" -eq 0
+            then
+                fptools_cv_htype_wchar_t="Word$HTYPE_SIZE"
+            else
+                fptools_cv_htype_wchar_t="Int$HTYPE_SIZE"
+            fi
+        fi
+
+fi
+
+    if test "$fptools_cv_htype_sup_wchar_t" = no
+    then
+
+        fptools_cv_htype_wchar_t=NotReallyAType
+        { $as_echo "$as_me:${as_lineno-$LINENO}: result: not supported" >&5
+$as_echo "not supported" >&6; }
+
+    fi
+
+            if test "$fptools_cv_htype_sup_wchar_t" = yes; then
+        { $as_echo "$as_me:${as_lineno-$LINENO}: result: $fptools_cv_htype_wchar_t" >&5
+$as_echo "$fptools_cv_htype_wchar_t" >&6; }
+
+cat >>confdefs.h <<_ACEOF
+#define HTYPE_WCHAR_T $fptools_cv_htype_wchar_t
+_ACEOF
+
+    fi
+
+
+
+
+
+
+
+
+
+
+    { $as_echo "$as_me:${as_lineno-$LINENO}: checking Haskell type for sig_atomic_t" >&5
+$as_echo_n "checking Haskell type for sig_atomic_t... " >&6; }
+    if ${fptools_cv_htype_sig_atomic_t+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+
+        fptools_cv_htype_sup_sig_atomic_t=yes
+        if ac_fn_c_compute_int "$LINENO" "(sig_atomic_t)0.2 - (sig_atomic_t)0.4 < 0 ? 0 : 1" "HTYPE_IS_INTEGRAL"        "
+#include <stdbool.h>
+#include <stdio.h>
+#include <stddef.h>
+
+#if HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+
+#if HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+
+#if HAVE_SYS_STAT_H
+# include <sys/stat.h>
+#endif
+
+#if HAVE_FCNTL_H
+# include <fcntl.h>
+#endif
+
+#if HAVE_SIGNAL_H
+# include <signal.h>
+#endif
+
+#if HAVE_TIME_H
+# include <time.h>
+#endif
+
+#if HAVE_TERMIOS_H
+# include <termios.h>
+#endif
+
+#if HAVE_STRING_H
+# include <string.h>
+#endif
+
+#if HAVE_CTYPE_H
+# include <ctype.h>
+#endif
+
+#if HAVE_INTTYPES_H
+# include <inttypes.h>
+#else
+# if HAVE_STDINT_H
+#  include <stdint.h>
+# endif
+#endif
+
+#if HAVE_SYS_RESOURCE_H
+# include <sys/resource.h>
+#endif
+
+#include <stdlib.h>
+"; then :
+
+else
+  HTYPE_IS_INTEGRAL=0
+fi
+
+
+
+        if test "$HTYPE_IS_INTEGRAL" -eq 0
+        then
+                                                            cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+#include <stdbool.h>
+#include <stdio.h>
+#include <stddef.h>
+
+#if HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+
+#if HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+
+#if HAVE_SYS_STAT_H
+# include <sys/stat.h>
+#endif
+
+#if HAVE_FCNTL_H
+# include <fcntl.h>
+#endif
+
+#if HAVE_SIGNAL_H
+# include <signal.h>
+#endif
+
+#if HAVE_TIME_H
+# include <time.h>
+#endif
+
+#if HAVE_TERMIOS_H
+# include <termios.h>
+#endif
+
+#if HAVE_STRING_H
+# include <string.h>
+#endif
+
+#if HAVE_CTYPE_H
+# include <ctype.h>
+#endif
+
+#if HAVE_INTTYPES_H
+# include <inttypes.h>
+#else
+# if HAVE_STDINT_H
+#  include <stdint.h>
+# endif
+#endif
+
+#if HAVE_SYS_RESOURCE_H
+# include <sys/resource.h>
+#endif
+
+#include <stdlib.h>
+
+int
+main ()
+{
+sig_atomic_t val; *val;
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  HTYPE_IS_POINTER=yes
+else
+  HTYPE_IS_POINTER=no
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+
+            if test "$HTYPE_IS_POINTER" = yes
+            then
+                fptools_cv_htype_sig_atomic_t="Ptr ()"
+            else
+                if ac_fn_c_compute_int "$LINENO" "sizeof(sig_atomic_t) == sizeof(float)" "HTYPE_IS_FLOAT"        "
+#include <stdbool.h>
+#include <stdio.h>
+#include <stddef.h>
+
+#if HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+
+#if HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+
+#if HAVE_SYS_STAT_H
+# include <sys/stat.h>
+#endif
+
+#if HAVE_FCNTL_H
+# include <fcntl.h>
+#endif
+
+#if HAVE_SIGNAL_H
+# include <signal.h>
+#endif
+
+#if HAVE_TIME_H
+# include <time.h>
+#endif
+
+#if HAVE_TERMIOS_H
+# include <termios.h>
+#endif
+
+#if HAVE_STRING_H
+# include <string.h>
+#endif
+
+#if HAVE_CTYPE_H
+# include <ctype.h>
+#endif
+
+#if HAVE_INTTYPES_H
+# include <inttypes.h>
+#else
+# if HAVE_STDINT_H
+#  include <stdint.h>
+# endif
+#endif
+
+#if HAVE_SYS_RESOURCE_H
+# include <sys/resource.h>
+#endif
+
+#include <stdlib.h>
+"; then :
+
+else
+  fptools_cv_htype_sup_sig_atomic_t=no
+fi
+
+
+                if ac_fn_c_compute_int "$LINENO" "sizeof(sig_atomic_t) == sizeof(double)" "HTYPE_IS_DOUBLE"        "
+#include <stdbool.h>
+#include <stdio.h>
+#include <stddef.h>
+
+#if HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+
+#if HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+
+#if HAVE_SYS_STAT_H
+# include <sys/stat.h>
+#endif
+
+#if HAVE_FCNTL_H
+# include <fcntl.h>
+#endif
+
+#if HAVE_SIGNAL_H
+# include <signal.h>
+#endif
+
+#if HAVE_TIME_H
+# include <time.h>
+#endif
+
+#if HAVE_TERMIOS_H
+# include <termios.h>
+#endif
+
+#if HAVE_STRING_H
+# include <string.h>
+#endif
+
+#if HAVE_CTYPE_H
+# include <ctype.h>
+#endif
+
+#if HAVE_INTTYPES_H
+# include <inttypes.h>
+#else
+# if HAVE_STDINT_H
+#  include <stdint.h>
+# endif
+#endif
+
+#if HAVE_SYS_RESOURCE_H
+# include <sys/resource.h>
+#endif
+
+#include <stdlib.h>
+"; then :
+
+else
+  fptools_cv_htype_sup_sig_atomic_t=no
+fi
+
+
+                if ac_fn_c_compute_int "$LINENO" "sizeof(sig_atomic_t) == sizeof(long double)" "HTYPE_IS_LDOUBLE"        "
+#include <stdbool.h>
+#include <stdio.h>
+#include <stddef.h>
+
+#if HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+
+#if HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+
+#if HAVE_SYS_STAT_H
+# include <sys/stat.h>
+#endif
+
+#if HAVE_FCNTL_H
+# include <fcntl.h>
+#endif
+
+#if HAVE_SIGNAL_H
+# include <signal.h>
+#endif
+
+#if HAVE_TIME_H
+# include <time.h>
+#endif
+
+#if HAVE_TERMIOS_H
+# include <termios.h>
+#endif
+
+#if HAVE_STRING_H
+# include <string.h>
+#endif
+
+#if HAVE_CTYPE_H
+# include <ctype.h>
+#endif
+
+#if HAVE_INTTYPES_H
+# include <inttypes.h>
+#else
+# if HAVE_STDINT_H
+#  include <stdint.h>
+# endif
+#endif
+
+#if HAVE_SYS_RESOURCE_H
+# include <sys/resource.h>
+#endif
+
+#include <stdlib.h>
+"; then :
+
+else
+  fptools_cv_htype_sup_sig_atomic_t=no
+fi
+
+
+                if test "$HTYPE_IS_FLOAT" -eq 1
+                then
+                    fptools_cv_htype_sig_atomic_t=Float
+                elif test "$HTYPE_IS_DOUBLE" -eq 1
+                then
+                    fptools_cv_htype_sig_atomic_t=Double
+                elif test "$HTYPE_IS_LDOUBLE" -eq 1
+                then
+                    fptools_cv_htype_sig_atomic_t=LDouble
+                else
+                    fptools_cv_htype_sup_sig_atomic_t=no
+                fi
+            fi
+        else
+            if ac_fn_c_compute_int "$LINENO" "((sig_atomic_t)(-1)) < ((sig_atomic_t)0)" "HTYPE_IS_SIGNED"        "
+#include <stdbool.h>
+#include <stdio.h>
+#include <stddef.h>
+
+#if HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+
+#if HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+
+#if HAVE_SYS_STAT_H
+# include <sys/stat.h>
+#endif
+
+#if HAVE_FCNTL_H
+# include <fcntl.h>
+#endif
+
+#if HAVE_SIGNAL_H
+# include <signal.h>
+#endif
+
+#if HAVE_TIME_H
+# include <time.h>
+#endif
+
+#if HAVE_TERMIOS_H
+# include <termios.h>
+#endif
+
+#if HAVE_STRING_H
+# include <string.h>
+#endif
+
+#if HAVE_CTYPE_H
+# include <ctype.h>
+#endif
+
+#if HAVE_INTTYPES_H
+# include <inttypes.h>
+#else
+# if HAVE_STDINT_H
+#  include <stdint.h>
+# endif
+#endif
+
+#if HAVE_SYS_RESOURCE_H
+# include <sys/resource.h>
+#endif
+
+#include <stdlib.h>
+"; then :
+
+else
+  fptools_cv_htype_sup_sig_atomic_t=no
+fi
+
+
+            if ac_fn_c_compute_int "$LINENO" "sizeof(sig_atomic_t) * 8" "HTYPE_SIZE"        "
+#include <stdbool.h>
+#include <stdio.h>
+#include <stddef.h>
+
+#if HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+
+#if HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+
+#if HAVE_SYS_STAT_H
+# include <sys/stat.h>
+#endif
+
+#if HAVE_FCNTL_H
+# include <fcntl.h>
+#endif
+
+#if HAVE_SIGNAL_H
+# include <signal.h>
+#endif
+
+#if HAVE_TIME_H
+# include <time.h>
+#endif
+
+#if HAVE_TERMIOS_H
+# include <termios.h>
+#endif
+
+#if HAVE_STRING_H
+# include <string.h>
+#endif
+
+#if HAVE_CTYPE_H
+# include <ctype.h>
+#endif
+
+#if HAVE_INTTYPES_H
+# include <inttypes.h>
+#else
+# if HAVE_STDINT_H
+#  include <stdint.h>
+# endif
+#endif
+
+#if HAVE_SYS_RESOURCE_H
+# include <sys/resource.h>
+#endif
+
+#include <stdlib.h>
+"; then :
+
+else
+  fptools_cv_htype_sup_sig_atomic_t=no
+fi
+
+
+            if test "$HTYPE_IS_SIGNED" -eq 0
+            then
+                fptools_cv_htype_sig_atomic_t="Word$HTYPE_SIZE"
+            else
+                fptools_cv_htype_sig_atomic_t="Int$HTYPE_SIZE"
+            fi
+        fi
+
+fi
+
+    if test "$fptools_cv_htype_sup_sig_atomic_t" = no
+    then
+
+        fptools_cv_htype_sig_atomic_t=NotReallyAType
+        { $as_echo "$as_me:${as_lineno-$LINENO}: result: not supported" >&5
+$as_echo "not supported" >&6; }
+
+    fi
+
+            if test "$fptools_cv_htype_sup_sig_atomic_t" = yes; then
+        { $as_echo "$as_me:${as_lineno-$LINENO}: result: $fptools_cv_htype_sig_atomic_t" >&5
+$as_echo "$fptools_cv_htype_sig_atomic_t" >&6; }
+
+cat >>confdefs.h <<_ACEOF
+#define HTYPE_SIG_ATOMIC_T $fptools_cv_htype_sig_atomic_t
+_ACEOF
+
+    fi
+
+
+
+
+
+
+
+
+
+
+    { $as_echo "$as_me:${as_lineno-$LINENO}: checking Haskell type for clock_t" >&5
+$as_echo_n "checking Haskell type for clock_t... " >&6; }
+    if ${fptools_cv_htype_clock_t+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+
+        fptools_cv_htype_sup_clock_t=yes
+        if ac_fn_c_compute_int "$LINENO" "(clock_t)0.2 - (clock_t)0.4 < 0 ? 0 : 1" "HTYPE_IS_INTEGRAL"        "
+#include <stdbool.h>
+#include <stdio.h>
+#include <stddef.h>
+
+#if HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+
+#if HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+
+#if HAVE_SYS_STAT_H
+# include <sys/stat.h>
+#endif
+
+#if HAVE_FCNTL_H
+# include <fcntl.h>
+#endif
+
+#if HAVE_SIGNAL_H
+# include <signal.h>
+#endif
+
+#if HAVE_TIME_H
+# include <time.h>
+#endif
+
+#if HAVE_TERMIOS_H
+# include <termios.h>
+#endif
+
+#if HAVE_STRING_H
+# include <string.h>
+#endif
+
+#if HAVE_CTYPE_H
+# include <ctype.h>
+#endif
+
+#if HAVE_INTTYPES_H
+# include <inttypes.h>
+#else
+# if HAVE_STDINT_H
+#  include <stdint.h>
+# endif
+#endif
+
+#if HAVE_SYS_RESOURCE_H
+# include <sys/resource.h>
+#endif
+
+#include <stdlib.h>
+"; then :
+
+else
+  HTYPE_IS_INTEGRAL=0
+fi
+
+
+
+        if test "$HTYPE_IS_INTEGRAL" -eq 0
+        then
+                                                            cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+#include <stdbool.h>
+#include <stdio.h>
+#include <stddef.h>
+
+#if HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+
+#if HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+
+#if HAVE_SYS_STAT_H
+# include <sys/stat.h>
+#endif
+
+#if HAVE_FCNTL_H
+# include <fcntl.h>
+#endif
+
+#if HAVE_SIGNAL_H
+# include <signal.h>
+#endif
+
+#if HAVE_TIME_H
+# include <time.h>
+#endif
+
+#if HAVE_TERMIOS_H
+# include <termios.h>
+#endif
+
+#if HAVE_STRING_H
+# include <string.h>
+#endif
+
+#if HAVE_CTYPE_H
+# include <ctype.h>
+#endif
+
+#if HAVE_INTTYPES_H
+# include <inttypes.h>
+#else
+# if HAVE_STDINT_H
+#  include <stdint.h>
+# endif
+#endif
+
+#if HAVE_SYS_RESOURCE_H
+# include <sys/resource.h>
+#endif
+
+#include <stdlib.h>
+
+int
+main ()
+{
+clock_t val; *val;
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  HTYPE_IS_POINTER=yes
+else
+  HTYPE_IS_POINTER=no
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+
+            if test "$HTYPE_IS_POINTER" = yes
+            then
+                fptools_cv_htype_clock_t="Ptr ()"
+            else
+                if ac_fn_c_compute_int "$LINENO" "sizeof(clock_t) == sizeof(float)" "HTYPE_IS_FLOAT"        "
+#include <stdbool.h>
+#include <stdio.h>
+#include <stddef.h>
+
+#if HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+
+#if HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+
+#if HAVE_SYS_STAT_H
+# include <sys/stat.h>
+#endif
+
+#if HAVE_FCNTL_H
+# include <fcntl.h>
+#endif
+
+#if HAVE_SIGNAL_H
+# include <signal.h>
+#endif
+
+#if HAVE_TIME_H
+# include <time.h>
+#endif
+
+#if HAVE_TERMIOS_H
+# include <termios.h>
+#endif
+
+#if HAVE_STRING_H
+# include <string.h>
+#endif
+
+#if HAVE_CTYPE_H
+# include <ctype.h>
+#endif
+
+#if HAVE_INTTYPES_H
+# include <inttypes.h>
+#else
+# if HAVE_STDINT_H
+#  include <stdint.h>
+# endif
+#endif
+
+#if HAVE_SYS_RESOURCE_H
+# include <sys/resource.h>
+#endif
+
+#include <stdlib.h>
+"; then :
+
+else
+  fptools_cv_htype_sup_clock_t=no
+fi
+
+
+                if ac_fn_c_compute_int "$LINENO" "sizeof(clock_t) == sizeof(double)" "HTYPE_IS_DOUBLE"        "
+#include <stdbool.h>
+#include <stdio.h>
+#include <stddef.h>
+
+#if HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+
+#if HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+
+#if HAVE_SYS_STAT_H
+# include <sys/stat.h>
+#endif
+
+#if HAVE_FCNTL_H
+# include <fcntl.h>
+#endif
+
+#if HAVE_SIGNAL_H
+# include <signal.h>
+#endif
+
+#if HAVE_TIME_H
+# include <time.h>
+#endif
+
+#if HAVE_TERMIOS_H
+# include <termios.h>
+#endif
+
+#if HAVE_STRING_H
+# include <string.h>
+#endif
+
+#if HAVE_CTYPE_H
+# include <ctype.h>
+#endif
+
+#if HAVE_INTTYPES_H
+# include <inttypes.h>
+#else
+# if HAVE_STDINT_H
+#  include <stdint.h>
+# endif
+#endif
+
+#if HAVE_SYS_RESOURCE_H
+# include <sys/resource.h>
+#endif
+
+#include <stdlib.h>
+"; then :
+
+else
+  fptools_cv_htype_sup_clock_t=no
+fi
+
+
+                if ac_fn_c_compute_int "$LINENO" "sizeof(clock_t) == sizeof(long double)" "HTYPE_IS_LDOUBLE"        "
+#include <stdbool.h>
+#include <stdio.h>
+#include <stddef.h>
+
+#if HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+
+#if HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+
+#if HAVE_SYS_STAT_H
+# include <sys/stat.h>
+#endif
+
+#if HAVE_FCNTL_H
+# include <fcntl.h>
+#endif
+
+#if HAVE_SIGNAL_H
+# include <signal.h>
+#endif
+
+#if HAVE_TIME_H
+# include <time.h>
+#endif
+
+#if HAVE_TERMIOS_H
+# include <termios.h>
+#endif
+
+#if HAVE_STRING_H
+# include <string.h>
+#endif
+
+#if HAVE_CTYPE_H
+# include <ctype.h>
+#endif
+
+#if HAVE_INTTYPES_H
+# include <inttypes.h>
+#else
+# if HAVE_STDINT_H
+#  include <stdint.h>
+# endif
+#endif
+
+#if HAVE_SYS_RESOURCE_H
+# include <sys/resource.h>
+#endif
+
+#include <stdlib.h>
+"; then :
+
+else
+  fptools_cv_htype_sup_clock_t=no
+fi
+
+
+                if test "$HTYPE_IS_FLOAT" -eq 1
+                then
+                    fptools_cv_htype_clock_t=Float
+                elif test "$HTYPE_IS_DOUBLE" -eq 1
+                then
+                    fptools_cv_htype_clock_t=Double
+                elif test "$HTYPE_IS_LDOUBLE" -eq 1
+                then
+                    fptools_cv_htype_clock_t=LDouble
+                else
+                    fptools_cv_htype_sup_clock_t=no
+                fi
+            fi
+        else
+            if ac_fn_c_compute_int "$LINENO" "((clock_t)(-1)) < ((clock_t)0)" "HTYPE_IS_SIGNED"        "
+#include <stdbool.h>
+#include <stdio.h>
+#include <stddef.h>
+
+#if HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+
+#if HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+
+#if HAVE_SYS_STAT_H
+# include <sys/stat.h>
+#endif
+
+#if HAVE_FCNTL_H
+# include <fcntl.h>
+#endif
+
+#if HAVE_SIGNAL_H
+# include <signal.h>
+#endif
+
+#if HAVE_TIME_H
+# include <time.h>
+#endif
+
+#if HAVE_TERMIOS_H
+# include <termios.h>
+#endif
+
+#if HAVE_STRING_H
+# include <string.h>
+#endif
+
+#if HAVE_CTYPE_H
+# include <ctype.h>
+#endif
+
+#if HAVE_INTTYPES_H
+# include <inttypes.h>
+#else
+# if HAVE_STDINT_H
+#  include <stdint.h>
+# endif
+#endif
+
+#if HAVE_SYS_RESOURCE_H
+# include <sys/resource.h>
+#endif
+
+#include <stdlib.h>
+"; then :
+
+else
+  fptools_cv_htype_sup_clock_t=no
+fi
+
+
+            if ac_fn_c_compute_int "$LINENO" "sizeof(clock_t) * 8" "HTYPE_SIZE"        "
+#include <stdbool.h>
+#include <stdio.h>
+#include <stddef.h>
+
+#if HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+
+#if HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+
+#if HAVE_SYS_STAT_H
+# include <sys/stat.h>
+#endif
+
+#if HAVE_FCNTL_H
+# include <fcntl.h>
+#endif
+
+#if HAVE_SIGNAL_H
+# include <signal.h>
+#endif
+
+#if HAVE_TIME_H
+# include <time.h>
+#endif
+
+#if HAVE_TERMIOS_H
+# include <termios.h>
+#endif
+
+#if HAVE_STRING_H
+# include <string.h>
+#endif
+
+#if HAVE_CTYPE_H
+# include <ctype.h>
+#endif
+
+#if HAVE_INTTYPES_H
+# include <inttypes.h>
+#else
+# if HAVE_STDINT_H
+#  include <stdint.h>
+# endif
+#endif
+
+#if HAVE_SYS_RESOURCE_H
+# include <sys/resource.h>
+#endif
+
+#include <stdlib.h>
+"; then :
+
+else
+  fptools_cv_htype_sup_clock_t=no
+fi
+
+
+            if test "$HTYPE_IS_SIGNED" -eq 0
+            then
+                fptools_cv_htype_clock_t="Word$HTYPE_SIZE"
+            else
+                fptools_cv_htype_clock_t="Int$HTYPE_SIZE"
+            fi
+        fi
+
+fi
+
+    if test "$fptools_cv_htype_sup_clock_t" = no
+    then
+
+        fptools_cv_htype_clock_t=NotReallyAType
+        { $as_echo "$as_me:${as_lineno-$LINENO}: result: not supported" >&5
+$as_echo "not supported" >&6; }
+
+    fi
+
+            if test "$fptools_cv_htype_sup_clock_t" = yes; then
+        { $as_echo "$as_me:${as_lineno-$LINENO}: result: $fptools_cv_htype_clock_t" >&5
+$as_echo "$fptools_cv_htype_clock_t" >&6; }
+
+cat >>confdefs.h <<_ACEOF
+#define HTYPE_CLOCK_T $fptools_cv_htype_clock_t
+_ACEOF
+
+    fi
+
+
+
+
+
+
+
+
+
+
+    { $as_echo "$as_me:${as_lineno-$LINENO}: checking Haskell type for time_t" >&5
+$as_echo_n "checking Haskell type for time_t... " >&6; }
+    if ${fptools_cv_htype_time_t+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+
+        fptools_cv_htype_sup_time_t=yes
+        if ac_fn_c_compute_int "$LINENO" "(time_t)0.2 - (time_t)0.4 < 0 ? 0 : 1" "HTYPE_IS_INTEGRAL"        "
+#include <stdbool.h>
+#include <stdio.h>
+#include <stddef.h>
+
+#if HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+
+#if HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+
+#if HAVE_SYS_STAT_H
+# include <sys/stat.h>
+#endif
+
+#if HAVE_FCNTL_H
+# include <fcntl.h>
+#endif
+
+#if HAVE_SIGNAL_H
+# include <signal.h>
+#endif
+
+#if HAVE_TIME_H
+# include <time.h>
+#endif
+
+#if HAVE_TERMIOS_H
+# include <termios.h>
+#endif
+
+#if HAVE_STRING_H
+# include <string.h>
+#endif
+
+#if HAVE_CTYPE_H
+# include <ctype.h>
+#endif
+
+#if HAVE_INTTYPES_H
+# include <inttypes.h>
+#else
+# if HAVE_STDINT_H
+#  include <stdint.h>
+# endif
+#endif
+
+#if HAVE_SYS_RESOURCE_H
+# include <sys/resource.h>
+#endif
+
+#include <stdlib.h>
+"; then :
+
+else
+  HTYPE_IS_INTEGRAL=0
+fi
+
+
+
+        if test "$HTYPE_IS_INTEGRAL" -eq 0
+        then
+                                                            cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+#include <stdbool.h>
+#include <stdio.h>
+#include <stddef.h>
+
+#if HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+
+#if HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+
+#if HAVE_SYS_STAT_H
+# include <sys/stat.h>
+#endif
+
+#if HAVE_FCNTL_H
+# include <fcntl.h>
+#endif
+
+#if HAVE_SIGNAL_H
+# include <signal.h>
+#endif
+
+#if HAVE_TIME_H
+# include <time.h>
+#endif
+
+#if HAVE_TERMIOS_H
+# include <termios.h>
+#endif
+
+#if HAVE_STRING_H
+# include <string.h>
+#endif
+
+#if HAVE_CTYPE_H
+# include <ctype.h>
+#endif
+
+#if HAVE_INTTYPES_H
+# include <inttypes.h>
+#else
+# if HAVE_STDINT_H
+#  include <stdint.h>
+# endif
+#endif
+
+#if HAVE_SYS_RESOURCE_H
+# include <sys/resource.h>
+#endif
+
+#include <stdlib.h>
+
+int
+main ()
+{
+time_t val; *val;
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  HTYPE_IS_POINTER=yes
+else
+  HTYPE_IS_POINTER=no
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+
+            if test "$HTYPE_IS_POINTER" = yes
+            then
+                fptools_cv_htype_time_t="Ptr ()"
+            else
+                if ac_fn_c_compute_int "$LINENO" "sizeof(time_t) == sizeof(float)" "HTYPE_IS_FLOAT"        "
+#include <stdbool.h>
+#include <stdio.h>
+#include <stddef.h>
+
+#if HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+
+#if HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+
+#if HAVE_SYS_STAT_H
+# include <sys/stat.h>
+#endif
+
+#if HAVE_FCNTL_H
+# include <fcntl.h>
+#endif
+
+#if HAVE_SIGNAL_H
+# include <signal.h>
+#endif
+
+#if HAVE_TIME_H
+# include <time.h>
+#endif
+
+#if HAVE_TERMIOS_H
+# include <termios.h>
+#endif
+
+#if HAVE_STRING_H
+# include <string.h>
+#endif
+
+#if HAVE_CTYPE_H
+# include <ctype.h>
+#endif
+
+#if HAVE_INTTYPES_H
+# include <inttypes.h>
+#else
+# if HAVE_STDINT_H
+#  include <stdint.h>
+# endif
+#endif
+
+#if HAVE_SYS_RESOURCE_H
+# include <sys/resource.h>
+#endif
+
+#include <stdlib.h>
+"; then :
+
+else
+  fptools_cv_htype_sup_time_t=no
+fi
+
+
+                if ac_fn_c_compute_int "$LINENO" "sizeof(time_t) == sizeof(double)" "HTYPE_IS_DOUBLE"        "
+#include <stdbool.h>
+#include <stdio.h>
+#include <stddef.h>
+
+#if HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+
+#if HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+
+#if HAVE_SYS_STAT_H
+# include <sys/stat.h>
+#endif
+
+#if HAVE_FCNTL_H
+# include <fcntl.h>
+#endif
+
+#if HAVE_SIGNAL_H
+# include <signal.h>
+#endif
+
+#if HAVE_TIME_H
+# include <time.h>
+#endif
+
+#if HAVE_TERMIOS_H
+# include <termios.h>
+#endif
+
+#if HAVE_STRING_H
+# include <string.h>
+#endif
+
+#if HAVE_CTYPE_H
+# include <ctype.h>
+#endif
+
+#if HAVE_INTTYPES_H
+# include <inttypes.h>
+#else
+# if HAVE_STDINT_H
+#  include <stdint.h>
+# endif
+#endif
+
+#if HAVE_SYS_RESOURCE_H
+# include <sys/resource.h>
+#endif
+
+#include <stdlib.h>
+"; then :
+
+else
+  fptools_cv_htype_sup_time_t=no
+fi
+
+
+                if ac_fn_c_compute_int "$LINENO" "sizeof(time_t) == sizeof(long double)" "HTYPE_IS_LDOUBLE"        "
+#include <stdbool.h>
+#include <stdio.h>
+#include <stddef.h>
+
+#if HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+
+#if HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+
+#if HAVE_SYS_STAT_H
+# include <sys/stat.h>
+#endif
+
+#if HAVE_FCNTL_H
+# include <fcntl.h>
+#endif
+
+#if HAVE_SIGNAL_H
+# include <signal.h>
+#endif
+
+#if HAVE_TIME_H
+# include <time.h>
+#endif
+
+#if HAVE_TERMIOS_H
+# include <termios.h>
+#endif
+
+#if HAVE_STRING_H
+# include <string.h>
+#endif
+
+#if HAVE_CTYPE_H
+# include <ctype.h>
+#endif
+
+#if HAVE_INTTYPES_H
+# include <inttypes.h>
+#else
+# if HAVE_STDINT_H
+#  include <stdint.h>
+# endif
+#endif
+
+#if HAVE_SYS_RESOURCE_H
+# include <sys/resource.h>
+#endif
+
+#include <stdlib.h>
+"; then :
+
+else
+  fptools_cv_htype_sup_time_t=no
+fi
+
+
+                if test "$HTYPE_IS_FLOAT" -eq 1
+                then
+                    fptools_cv_htype_time_t=Float
+                elif test "$HTYPE_IS_DOUBLE" -eq 1
+                then
+                    fptools_cv_htype_time_t=Double
+                elif test "$HTYPE_IS_LDOUBLE" -eq 1
+                then
+                    fptools_cv_htype_time_t=LDouble
+                else
+                    fptools_cv_htype_sup_time_t=no
+                fi
+            fi
+        else
+            if ac_fn_c_compute_int "$LINENO" "((time_t)(-1)) < ((time_t)0)" "HTYPE_IS_SIGNED"        "
+#include <stdbool.h>
+#include <stdio.h>
+#include <stddef.h>
+
+#if HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+
+#if HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+
+#if HAVE_SYS_STAT_H
+# include <sys/stat.h>
+#endif
+
+#if HAVE_FCNTL_H
+# include <fcntl.h>
+#endif
+
+#if HAVE_SIGNAL_H
+# include <signal.h>
+#endif
+
+#if HAVE_TIME_H
+# include <time.h>
+#endif
+
+#if HAVE_TERMIOS_H
+# include <termios.h>
+#endif
+
+#if HAVE_STRING_H
+# include <string.h>
+#endif
+
+#if HAVE_CTYPE_H
+# include <ctype.h>
+#endif
+
+#if HAVE_INTTYPES_H
+# include <inttypes.h>
+#else
+# if HAVE_STDINT_H
+#  include <stdint.h>
+# endif
+#endif
+
+#if HAVE_SYS_RESOURCE_H
+# include <sys/resource.h>
+#endif
+
+#include <stdlib.h>
+"; then :
+
+else
+  fptools_cv_htype_sup_time_t=no
+fi
+
+
+            if ac_fn_c_compute_int "$LINENO" "sizeof(time_t) * 8" "HTYPE_SIZE"        "
+#include <stdbool.h>
+#include <stdio.h>
+#include <stddef.h>
+
+#if HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+
+#if HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+
+#if HAVE_SYS_STAT_H
+# include <sys/stat.h>
+#endif
+
+#if HAVE_FCNTL_H
+# include <fcntl.h>
+#endif
+
+#if HAVE_SIGNAL_H
+# include <signal.h>
+#endif
+
+#if HAVE_TIME_H
+# include <time.h>
+#endif
+
+#if HAVE_TERMIOS_H
+# include <termios.h>
+#endif
+
+#if HAVE_STRING_H
+# include <string.h>
+#endif
+
+#if HAVE_CTYPE_H
+# include <ctype.h>
+#endif
+
+#if HAVE_INTTYPES_H
+# include <inttypes.h>
+#else
+# if HAVE_STDINT_H
+#  include <stdint.h>
+# endif
+#endif
+
+#if HAVE_SYS_RESOURCE_H
+# include <sys/resource.h>
+#endif
+
+#include <stdlib.h>
+"; then :
+
+else
+  fptools_cv_htype_sup_time_t=no
+fi
+
+
+            if test "$HTYPE_IS_SIGNED" -eq 0
+            then
+                fptools_cv_htype_time_t="Word$HTYPE_SIZE"
+            else
+                fptools_cv_htype_time_t="Int$HTYPE_SIZE"
+            fi
+        fi
+
+fi
+
+    if test "$fptools_cv_htype_sup_time_t" = no
+    then
+
+        fptools_cv_htype_time_t=NotReallyAType
+        { $as_echo "$as_me:${as_lineno-$LINENO}: result: not supported" >&5
+$as_echo "not supported" >&6; }
+
+    fi
+
+            if test "$fptools_cv_htype_sup_time_t" = yes; then
+        { $as_echo "$as_me:${as_lineno-$LINENO}: result: $fptools_cv_htype_time_t" >&5
+$as_echo "$fptools_cv_htype_time_t" >&6; }
+
+cat >>confdefs.h <<_ACEOF
+#define HTYPE_TIME_T $fptools_cv_htype_time_t
+_ACEOF
+
+    fi
+
+
+
+
+
+
+
+
+
+
+    { $as_echo "$as_me:${as_lineno-$LINENO}: checking Haskell type for useconds_t" >&5
+$as_echo_n "checking Haskell type for useconds_t... " >&6; }
+    if ${fptools_cv_htype_useconds_t+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+
+        fptools_cv_htype_sup_useconds_t=yes
+        if ac_fn_c_compute_int "$LINENO" "(useconds_t)0.2 - (useconds_t)0.4 < 0 ? 0 : 1" "HTYPE_IS_INTEGRAL"        "
+#include <stdbool.h>
+#include <stdio.h>
+#include <stddef.h>
+
+#if HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+
+#if HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+
+#if HAVE_SYS_STAT_H
+# include <sys/stat.h>
+#endif
+
+#if HAVE_FCNTL_H
+# include <fcntl.h>
+#endif
+
+#if HAVE_SIGNAL_H
+# include <signal.h>
+#endif
+
+#if HAVE_TIME_H
+# include <time.h>
+#endif
+
+#if HAVE_TERMIOS_H
+# include <termios.h>
+#endif
+
+#if HAVE_STRING_H
+# include <string.h>
+#endif
+
+#if HAVE_CTYPE_H
+# include <ctype.h>
+#endif
+
+#if HAVE_INTTYPES_H
+# include <inttypes.h>
+#else
+# if HAVE_STDINT_H
+#  include <stdint.h>
+# endif
+#endif
+
+#if HAVE_SYS_RESOURCE_H
+# include <sys/resource.h>
+#endif
+
+#include <stdlib.h>
+"; then :
+
+else
+  HTYPE_IS_INTEGRAL=0
+fi
+
+
+
+        if test "$HTYPE_IS_INTEGRAL" -eq 0
+        then
+                                                            cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+#include <stdbool.h>
+#include <stdio.h>
+#include <stddef.h>
+
+#if HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+
+#if HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+
+#if HAVE_SYS_STAT_H
+# include <sys/stat.h>
+#endif
+
+#if HAVE_FCNTL_H
+# include <fcntl.h>
+#endif
+
+#if HAVE_SIGNAL_H
+# include <signal.h>
+#endif
+
+#if HAVE_TIME_H
+# include <time.h>
+#endif
+
+#if HAVE_TERMIOS_H
+# include <termios.h>
+#endif
+
+#if HAVE_STRING_H
+# include <string.h>
+#endif
+
+#if HAVE_CTYPE_H
+# include <ctype.h>
+#endif
+
+#if HAVE_INTTYPES_H
+# include <inttypes.h>
+#else
+# if HAVE_STDINT_H
+#  include <stdint.h>
+# endif
+#endif
+
+#if HAVE_SYS_RESOURCE_H
+# include <sys/resource.h>
+#endif
+
+#include <stdlib.h>
+
+int
+main ()
+{
+useconds_t val; *val;
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  HTYPE_IS_POINTER=yes
+else
+  HTYPE_IS_POINTER=no
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+
+            if test "$HTYPE_IS_POINTER" = yes
+            then
+                fptools_cv_htype_useconds_t="Ptr ()"
+            else
+                if ac_fn_c_compute_int "$LINENO" "sizeof(useconds_t) == sizeof(float)" "HTYPE_IS_FLOAT"        "
+#include <stdbool.h>
+#include <stdio.h>
+#include <stddef.h>
+
+#if HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+
+#if HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+
+#if HAVE_SYS_STAT_H
+# include <sys/stat.h>
+#endif
+
+#if HAVE_FCNTL_H
+# include <fcntl.h>
+#endif
+
+#if HAVE_SIGNAL_H
+# include <signal.h>
+#endif
+
+#if HAVE_TIME_H
+# include <time.h>
+#endif
+
+#if HAVE_TERMIOS_H
+# include <termios.h>
+#endif
+
+#if HAVE_STRING_H
+# include <string.h>
+#endif
+
+#if HAVE_CTYPE_H
+# include <ctype.h>
+#endif
+
+#if HAVE_INTTYPES_H
+# include <inttypes.h>
+#else
+# if HAVE_STDINT_H
+#  include <stdint.h>
+# endif
+#endif
+
+#if HAVE_SYS_RESOURCE_H
+# include <sys/resource.h>
+#endif
+
+#include <stdlib.h>
+"; then :
+
+else
+  fptools_cv_htype_sup_useconds_t=no
+fi
+
+
+                if ac_fn_c_compute_int "$LINENO" "sizeof(useconds_t) == sizeof(double)" "HTYPE_IS_DOUBLE"        "
+#include <stdbool.h>
+#include <stdio.h>
+#include <stddef.h>
+
+#if HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+
+#if HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+
+#if HAVE_SYS_STAT_H
+# include <sys/stat.h>
+#endif
+
+#if HAVE_FCNTL_H
+# include <fcntl.h>
+#endif
+
+#if HAVE_SIGNAL_H
+# include <signal.h>
+#endif
+
+#if HAVE_TIME_H
+# include <time.h>
+#endif
+
+#if HAVE_TERMIOS_H
+# include <termios.h>
+#endif
+
+#if HAVE_STRING_H
+# include <string.h>
+#endif
+
+#if HAVE_CTYPE_H
+# include <ctype.h>
+#endif
+
+#if HAVE_INTTYPES_H
+# include <inttypes.h>
+#else
+# if HAVE_STDINT_H
+#  include <stdint.h>
+# endif
+#endif
+
+#if HAVE_SYS_RESOURCE_H
+# include <sys/resource.h>
+#endif
+
+#include <stdlib.h>
+"; then :
+
+else
+  fptools_cv_htype_sup_useconds_t=no
+fi
+
+
+                if ac_fn_c_compute_int "$LINENO" "sizeof(useconds_t) == sizeof(long double)" "HTYPE_IS_LDOUBLE"        "
+#include <stdbool.h>
+#include <stdio.h>
+#include <stddef.h>
+
+#if HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+
+#if HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+
+#if HAVE_SYS_STAT_H
+# include <sys/stat.h>
+#endif
+
+#if HAVE_FCNTL_H
+# include <fcntl.h>
+#endif
+
+#if HAVE_SIGNAL_H
+# include <signal.h>
+#endif
+
+#if HAVE_TIME_H
+# include <time.h>
+#endif
+
+#if HAVE_TERMIOS_H
+# include <termios.h>
+#endif
+
+#if HAVE_STRING_H
+# include <string.h>
+#endif
+
+#if HAVE_CTYPE_H
+# include <ctype.h>
+#endif
+
+#if HAVE_INTTYPES_H
+# include <inttypes.h>
+#else
+# if HAVE_STDINT_H
+#  include <stdint.h>
+# endif
+#endif
+
+#if HAVE_SYS_RESOURCE_H
+# include <sys/resource.h>
+#endif
+
+#include <stdlib.h>
+"; then :
+
+else
+  fptools_cv_htype_sup_useconds_t=no
+fi
+
+
+                if test "$HTYPE_IS_FLOAT" -eq 1
+                then
+                    fptools_cv_htype_useconds_t=Float
+                elif test "$HTYPE_IS_DOUBLE" -eq 1
+                then
+                    fptools_cv_htype_useconds_t=Double
+                elif test "$HTYPE_IS_LDOUBLE" -eq 1
+                then
+                    fptools_cv_htype_useconds_t=LDouble
+                else
+                    fptools_cv_htype_sup_useconds_t=no
+                fi
+            fi
+        else
+            if ac_fn_c_compute_int "$LINENO" "((useconds_t)(-1)) < ((useconds_t)0)" "HTYPE_IS_SIGNED"        "
+#include <stdbool.h>
+#include <stdio.h>
+#include <stddef.h>
+
+#if HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+
+#if HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+
+#if HAVE_SYS_STAT_H
+# include <sys/stat.h>
+#endif
+
+#if HAVE_FCNTL_H
+# include <fcntl.h>
+#endif
+
+#if HAVE_SIGNAL_H
+# include <signal.h>
+#endif
+
+#if HAVE_TIME_H
+# include <time.h>
+#endif
+
+#if HAVE_TERMIOS_H
+# include <termios.h>
+#endif
+
+#if HAVE_STRING_H
+# include <string.h>
+#endif
+
+#if HAVE_CTYPE_H
+# include <ctype.h>
+#endif
+
+#if HAVE_INTTYPES_H
+# include <inttypes.h>
+#else
+# if HAVE_STDINT_H
+#  include <stdint.h>
+# endif
+#endif
+
+#if HAVE_SYS_RESOURCE_H
+# include <sys/resource.h>
+#endif
+
+#include <stdlib.h>
+"; then :
+
+else
+  fptools_cv_htype_sup_useconds_t=no
+fi
+
+
+            if ac_fn_c_compute_int "$LINENO" "sizeof(useconds_t) * 8" "HTYPE_SIZE"        "
+#include <stdbool.h>
+#include <stdio.h>
+#include <stddef.h>
+
+#if HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+
+#if HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+
+#if HAVE_SYS_STAT_H
+# include <sys/stat.h>
+#endif
+
+#if HAVE_FCNTL_H
+# include <fcntl.h>
+#endif
+
+#if HAVE_SIGNAL_H
+# include <signal.h>
+#endif
+
+#if HAVE_TIME_H
+# include <time.h>
+#endif
+
+#if HAVE_TERMIOS_H
+# include <termios.h>
+#endif
+
+#if HAVE_STRING_H
+# include <string.h>
+#endif
+
+#if HAVE_CTYPE_H
+# include <ctype.h>
+#endif
+
+#if HAVE_INTTYPES_H
+# include <inttypes.h>
+#else
+# if HAVE_STDINT_H
+#  include <stdint.h>
+# endif
+#endif
+
+#if HAVE_SYS_RESOURCE_H
+# include <sys/resource.h>
+#endif
+
+#include <stdlib.h>
+"; then :
+
+else
+  fptools_cv_htype_sup_useconds_t=no
+fi
+
+
+            if test "$HTYPE_IS_SIGNED" -eq 0
+            then
+                fptools_cv_htype_useconds_t="Word$HTYPE_SIZE"
+            else
+                fptools_cv_htype_useconds_t="Int$HTYPE_SIZE"
+            fi
+        fi
+
+fi
+
+    if test "$fptools_cv_htype_sup_useconds_t" = no
+    then
+
+        fptools_cv_htype_useconds_t=NotReallyAType
+        { $as_echo "$as_me:${as_lineno-$LINENO}: result: not supported" >&5
+$as_echo "not supported" >&6; }
+
+    fi
+
+            if test "$fptools_cv_htype_sup_useconds_t" = yes; then
+        { $as_echo "$as_me:${as_lineno-$LINENO}: result: $fptools_cv_htype_useconds_t" >&5
+$as_echo "$fptools_cv_htype_useconds_t" >&6; }
+
+cat >>confdefs.h <<_ACEOF
+#define HTYPE_USECONDS_T $fptools_cv_htype_useconds_t
+_ACEOF
+
+    fi
+
+
+
+
+
+
+
+
+
+    { $as_echo "$as_me:${as_lineno-$LINENO}: checking Haskell type for suseconds_t" >&5
+$as_echo_n "checking Haskell type for suseconds_t... " >&6; }
+    if ${fptools_cv_htype_suseconds_t+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+
+        fptools_cv_htype_sup_suseconds_t=yes
+        if ac_fn_c_compute_int "$LINENO" "(suseconds_t)0.2 - (suseconds_t)0.4 < 0 ? 0 : 1" "HTYPE_IS_INTEGRAL"        "
+#include <stdbool.h>
+#include <stdio.h>
+#include <stddef.h>
+
+#if HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+
+#if HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+
+#if HAVE_SYS_STAT_H
+# include <sys/stat.h>
+#endif
+
+#if HAVE_FCNTL_H
+# include <fcntl.h>
+#endif
+
+#if HAVE_SIGNAL_H
+# include <signal.h>
+#endif
+
+#if HAVE_TIME_H
+# include <time.h>
+#endif
+
+#if HAVE_TERMIOS_H
+# include <termios.h>
+#endif
+
+#if HAVE_STRING_H
+# include <string.h>
+#endif
+
+#if HAVE_CTYPE_H
+# include <ctype.h>
+#endif
+
+#if HAVE_INTTYPES_H
+# include <inttypes.h>
+#else
+# if HAVE_STDINT_H
+#  include <stdint.h>
+# endif
+#endif
+
+#if HAVE_SYS_RESOURCE_H
+# include <sys/resource.h>
+#endif
+
+#include <stdlib.h>
+"; then :
+
+else
+  HTYPE_IS_INTEGRAL=0
+fi
+
+
+
+        if test "$HTYPE_IS_INTEGRAL" -eq 0
+        then
+                                                            cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+#include <stdbool.h>
+#include <stdio.h>
+#include <stddef.h>
+
+#if HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+
+#if HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+
+#if HAVE_SYS_STAT_H
+# include <sys/stat.h>
+#endif
+
+#if HAVE_FCNTL_H
+# include <fcntl.h>
+#endif
+
+#if HAVE_SIGNAL_H
+# include <signal.h>
+#endif
+
+#if HAVE_TIME_H
+# include <time.h>
+#endif
+
+#if HAVE_TERMIOS_H
+# include <termios.h>
+#endif
+
+#if HAVE_STRING_H
+# include <string.h>
+#endif
+
+#if HAVE_CTYPE_H
+# include <ctype.h>
+#endif
+
+#if HAVE_INTTYPES_H
+# include <inttypes.h>
+#else
+# if HAVE_STDINT_H
+#  include <stdint.h>
+# endif
+#endif
+
+#if HAVE_SYS_RESOURCE_H
+# include <sys/resource.h>
+#endif
+
+#include <stdlib.h>
+
+int
+main ()
+{
+suseconds_t val; *val;
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  HTYPE_IS_POINTER=yes
+else
+  HTYPE_IS_POINTER=no
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+
+            if test "$HTYPE_IS_POINTER" = yes
+            then
+                fptools_cv_htype_suseconds_t="Ptr ()"
+            else
+                if ac_fn_c_compute_int "$LINENO" "sizeof(suseconds_t) == sizeof(float)" "HTYPE_IS_FLOAT"        "
+#include <stdbool.h>
+#include <stdio.h>
+#include <stddef.h>
+
+#if HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+
+#if HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+
+#if HAVE_SYS_STAT_H
+# include <sys/stat.h>
+#endif
+
+#if HAVE_FCNTL_H
+# include <fcntl.h>
+#endif
+
+#if HAVE_SIGNAL_H
+# include <signal.h>
+#endif
+
+#if HAVE_TIME_H
+# include <time.h>
+#endif
+
+#if HAVE_TERMIOS_H
+# include <termios.h>
+#endif
+
+#if HAVE_STRING_H
+# include <string.h>
+#endif
+
+#if HAVE_CTYPE_H
+# include <ctype.h>
+#endif
+
+#if HAVE_INTTYPES_H
+# include <inttypes.h>
+#else
+# if HAVE_STDINT_H
+#  include <stdint.h>
+# endif
+#endif
+
+#if HAVE_SYS_RESOURCE_H
+# include <sys/resource.h>
+#endif
+
+#include <stdlib.h>
+"; then :
+
+else
+  fptools_cv_htype_sup_suseconds_t=no
+fi
+
+
+                if ac_fn_c_compute_int "$LINENO" "sizeof(suseconds_t) == sizeof(double)" "HTYPE_IS_DOUBLE"        "
+#include <stdbool.h>
+#include <stdio.h>
+#include <stddef.h>
+
+#if HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+
+#if HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+
+#if HAVE_SYS_STAT_H
+# include <sys/stat.h>
+#endif
+
+#if HAVE_FCNTL_H
+# include <fcntl.h>
+#endif
+
+#if HAVE_SIGNAL_H
+# include <signal.h>
+#endif
+
+#if HAVE_TIME_H
+# include <time.h>
+#endif
+
+#if HAVE_TERMIOS_H
+# include <termios.h>
+#endif
+
+#if HAVE_STRING_H
+# include <string.h>
+#endif
+
+#if HAVE_CTYPE_H
+# include <ctype.h>
+#endif
+
+#if HAVE_INTTYPES_H
+# include <inttypes.h>
+#else
+# if HAVE_STDINT_H
+#  include <stdint.h>
+# endif
+#endif
+
+#if HAVE_SYS_RESOURCE_H
+# include <sys/resource.h>
+#endif
+
+#include <stdlib.h>
+"; then :
+
+else
+  fptools_cv_htype_sup_suseconds_t=no
+fi
+
+
+                if ac_fn_c_compute_int "$LINENO" "sizeof(suseconds_t) == sizeof(long double)" "HTYPE_IS_LDOUBLE"        "
+#include <stdbool.h>
+#include <stdio.h>
+#include <stddef.h>
+
+#if HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+
+#if HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+
+#if HAVE_SYS_STAT_H
+# include <sys/stat.h>
+#endif
+
+#if HAVE_FCNTL_H
+# include <fcntl.h>
+#endif
+
+#if HAVE_SIGNAL_H
+# include <signal.h>
+#endif
+
+#if HAVE_TIME_H
+# include <time.h>
+#endif
+
+#if HAVE_TERMIOS_H
+# include <termios.h>
+#endif
+
+#if HAVE_STRING_H
+# include <string.h>
+#endif
+
+#if HAVE_CTYPE_H
+# include <ctype.h>
+#endif
+
+#if HAVE_INTTYPES_H
+# include <inttypes.h>
+#else
+# if HAVE_STDINT_H
+#  include <stdint.h>
+# endif
+#endif
+
+#if HAVE_SYS_RESOURCE_H
+# include <sys/resource.h>
+#endif
+
+#include <stdlib.h>
+"; then :
+
+else
+  fptools_cv_htype_sup_suseconds_t=no
+fi
+
+
+                if test "$HTYPE_IS_FLOAT" -eq 1
+                then
+                    fptools_cv_htype_suseconds_t=Float
+                elif test "$HTYPE_IS_DOUBLE" -eq 1
+                then
+                    fptools_cv_htype_suseconds_t=Double
+                elif test "$HTYPE_IS_LDOUBLE" -eq 1
+                then
+                    fptools_cv_htype_suseconds_t=LDouble
+                else
+                    fptools_cv_htype_sup_suseconds_t=no
+                fi
+            fi
+        else
+            if ac_fn_c_compute_int "$LINENO" "((suseconds_t)(-1)) < ((suseconds_t)0)" "HTYPE_IS_SIGNED"        "
+#include <stdbool.h>
+#include <stdio.h>
+#include <stddef.h>
+
+#if HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+
+#if HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+
+#if HAVE_SYS_STAT_H
+# include <sys/stat.h>
+#endif
+
+#if HAVE_FCNTL_H
+# include <fcntl.h>
+#endif
+
+#if HAVE_SIGNAL_H
+# include <signal.h>
+#endif
+
+#if HAVE_TIME_H
+# include <time.h>
+#endif
+
+#if HAVE_TERMIOS_H
+# include <termios.h>
+#endif
+
+#if HAVE_STRING_H
+# include <string.h>
+#endif
+
+#if HAVE_CTYPE_H
+# include <ctype.h>
+#endif
+
+#if HAVE_INTTYPES_H
+# include <inttypes.h>
+#else
+# if HAVE_STDINT_H
+#  include <stdint.h>
+# endif
+#endif
+
+#if HAVE_SYS_RESOURCE_H
+# include <sys/resource.h>
+#endif
+
+#include <stdlib.h>
+"; then :
+
+else
+  fptools_cv_htype_sup_suseconds_t=no
+fi
+
+
+            if ac_fn_c_compute_int "$LINENO" "sizeof(suseconds_t) * 8" "HTYPE_SIZE"        "
+#include <stdbool.h>
+#include <stdio.h>
+#include <stddef.h>
+
+#if HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+
+#if HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+
+#if HAVE_SYS_STAT_H
+# include <sys/stat.h>
+#endif
+
+#if HAVE_FCNTL_H
+# include <fcntl.h>
+#endif
+
+#if HAVE_SIGNAL_H
+# include <signal.h>
+#endif
+
+#if HAVE_TIME_H
+# include <time.h>
+#endif
+
+#if HAVE_TERMIOS_H
+# include <termios.h>
+#endif
+
+#if HAVE_STRING_H
+# include <string.h>
+#endif
+
+#if HAVE_CTYPE_H
+# include <ctype.h>
+#endif
+
+#if HAVE_INTTYPES_H
+# include <inttypes.h>
+#else
+# if HAVE_STDINT_H
+#  include <stdint.h>
+# endif
+#endif
+
+#if HAVE_SYS_RESOURCE_H
+# include <sys/resource.h>
+#endif
+
+#include <stdlib.h>
+"; then :
+
+else
+  fptools_cv_htype_sup_suseconds_t=no
+fi
+
+
+            if test "$HTYPE_IS_SIGNED" -eq 0
+            then
+                fptools_cv_htype_suseconds_t="Word$HTYPE_SIZE"
+            else
+                fptools_cv_htype_suseconds_t="Int$HTYPE_SIZE"
+            fi
+        fi
+
+fi
+
+    if test "$fptools_cv_htype_sup_suseconds_t" = no
+    then
+        if test "$WINDOWS" = "YES"
+                          then
+                              fptools_cv_htype_suseconds_t=Int32
+                              fptools_cv_htype_sup_suseconds_t=yes
+                          else
+                              as_fn_error $? "type not found" "$LINENO" 5
+                          fi
+    fi
+
+            if test "$fptools_cv_htype_sup_suseconds_t" = yes; then
+        { $as_echo "$as_me:${as_lineno-$LINENO}: result: $fptools_cv_htype_suseconds_t" >&5
+$as_echo "$fptools_cv_htype_suseconds_t" >&6; }
+
+cat >>confdefs.h <<_ACEOF
+#define HTYPE_SUSECONDS_T $fptools_cv_htype_suseconds_t
+_ACEOF
+
+    fi
+
+
+
+
+
+
+
+
+
+    { $as_echo "$as_me:${as_lineno-$LINENO}: checking Haskell type for dev_t" >&5
+$as_echo_n "checking Haskell type for dev_t... " >&6; }
+    if ${fptools_cv_htype_dev_t+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+
+        fptools_cv_htype_sup_dev_t=yes
+        if ac_fn_c_compute_int "$LINENO" "(dev_t)0.2 - (dev_t)0.4 < 0 ? 0 : 1" "HTYPE_IS_INTEGRAL"        "
+#include <stdbool.h>
+#include <stdio.h>
+#include <stddef.h>
+
+#if HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+
+#if HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+
+#if HAVE_SYS_STAT_H
+# include <sys/stat.h>
+#endif
+
+#if HAVE_FCNTL_H
+# include <fcntl.h>
+#endif
+
+#if HAVE_SIGNAL_H
+# include <signal.h>
+#endif
+
+#if HAVE_TIME_H
+# include <time.h>
+#endif
+
+#if HAVE_TERMIOS_H
+# include <termios.h>
+#endif
+
+#if HAVE_STRING_H
+# include <string.h>
+#endif
+
+#if HAVE_CTYPE_H
+# include <ctype.h>
+#endif
+
+#if HAVE_INTTYPES_H
+# include <inttypes.h>
+#else
+# if HAVE_STDINT_H
+#  include <stdint.h>
+# endif
+#endif
+
+#if HAVE_SYS_RESOURCE_H
+# include <sys/resource.h>
+#endif
+
+#include <stdlib.h>
+"; then :
+
+else
+  HTYPE_IS_INTEGRAL=0
+fi
+
+
+
+        if test "$HTYPE_IS_INTEGRAL" -eq 0
+        then
+                                                            cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+#include <stdbool.h>
+#include <stdio.h>
+#include <stddef.h>
+
+#if HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+
+#if HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+
+#if HAVE_SYS_STAT_H
+# include <sys/stat.h>
+#endif
+
+#if HAVE_FCNTL_H
+# include <fcntl.h>
+#endif
+
+#if HAVE_SIGNAL_H
+# include <signal.h>
+#endif
+
+#if HAVE_TIME_H
+# include <time.h>
+#endif
+
+#if HAVE_TERMIOS_H
+# include <termios.h>
+#endif
+
+#if HAVE_STRING_H
+# include <string.h>
+#endif
+
+#if HAVE_CTYPE_H
+# include <ctype.h>
+#endif
+
+#if HAVE_INTTYPES_H
+# include <inttypes.h>
+#else
+# if HAVE_STDINT_H
+#  include <stdint.h>
+# endif
+#endif
+
+#if HAVE_SYS_RESOURCE_H
+# include <sys/resource.h>
+#endif
+
+#include <stdlib.h>
+
+int
+main ()
+{
+dev_t val; *val;
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  HTYPE_IS_POINTER=yes
+else
+  HTYPE_IS_POINTER=no
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+
+            if test "$HTYPE_IS_POINTER" = yes
+            then
+                fptools_cv_htype_dev_t="Ptr ()"
+            else
+                if ac_fn_c_compute_int "$LINENO" "sizeof(dev_t) == sizeof(float)" "HTYPE_IS_FLOAT"        "
+#include <stdbool.h>
+#include <stdio.h>
+#include <stddef.h>
+
+#if HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+
+#if HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+
+#if HAVE_SYS_STAT_H
+# include <sys/stat.h>
+#endif
+
+#if HAVE_FCNTL_H
+# include <fcntl.h>
+#endif
+
+#if HAVE_SIGNAL_H
+# include <signal.h>
+#endif
+
+#if HAVE_TIME_H
+# include <time.h>
+#endif
+
+#if HAVE_TERMIOS_H
+# include <termios.h>
+#endif
+
+#if HAVE_STRING_H
+# include <string.h>
+#endif
+
+#if HAVE_CTYPE_H
+# include <ctype.h>
+#endif
+
+#if HAVE_INTTYPES_H
+# include <inttypes.h>
+#else
+# if HAVE_STDINT_H
+#  include <stdint.h>
+# endif
+#endif
+
+#if HAVE_SYS_RESOURCE_H
+# include <sys/resource.h>
+#endif
+
+#include <stdlib.h>
+"; then :
+
+else
+  fptools_cv_htype_sup_dev_t=no
+fi
+
+
+                if ac_fn_c_compute_int "$LINENO" "sizeof(dev_t) == sizeof(double)" "HTYPE_IS_DOUBLE"        "
+#include <stdbool.h>
+#include <stdio.h>
+#include <stddef.h>
+
+#if HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+
+#if HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+
+#if HAVE_SYS_STAT_H
+# include <sys/stat.h>
+#endif
+
+#if HAVE_FCNTL_H
+# include <fcntl.h>
+#endif
+
+#if HAVE_SIGNAL_H
+# include <signal.h>
+#endif
+
+#if HAVE_TIME_H
+# include <time.h>
+#endif
+
+#if HAVE_TERMIOS_H
+# include <termios.h>
+#endif
+
+#if HAVE_STRING_H
+# include <string.h>
+#endif
+
+#if HAVE_CTYPE_H
+# include <ctype.h>
+#endif
+
+#if HAVE_INTTYPES_H
+# include <inttypes.h>
+#else
+# if HAVE_STDINT_H
+#  include <stdint.h>
+# endif
+#endif
+
+#if HAVE_SYS_RESOURCE_H
+# include <sys/resource.h>
+#endif
+
+#include <stdlib.h>
+"; then :
+
+else
+  fptools_cv_htype_sup_dev_t=no
+fi
+
+
+                if ac_fn_c_compute_int "$LINENO" "sizeof(dev_t) == sizeof(long double)" "HTYPE_IS_LDOUBLE"        "
+#include <stdbool.h>
+#include <stdio.h>
+#include <stddef.h>
+
+#if HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+
+#if HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+
+#if HAVE_SYS_STAT_H
+# include <sys/stat.h>
+#endif
+
+#if HAVE_FCNTL_H
+# include <fcntl.h>
+#endif
+
+#if HAVE_SIGNAL_H
+# include <signal.h>
+#endif
+
+#if HAVE_TIME_H
+# include <time.h>
+#endif
+
+#if HAVE_TERMIOS_H
+# include <termios.h>
+#endif
+
+#if HAVE_STRING_H
+# include <string.h>
+#endif
+
+#if HAVE_CTYPE_H
+# include <ctype.h>
+#endif
+
+#if HAVE_INTTYPES_H
+# include <inttypes.h>
+#else
+# if HAVE_STDINT_H
+#  include <stdint.h>
+# endif
+#endif
+
+#if HAVE_SYS_RESOURCE_H
+# include <sys/resource.h>
+#endif
+
+#include <stdlib.h>
+"; then :
+
+else
+  fptools_cv_htype_sup_dev_t=no
+fi
+
+
+                if test "$HTYPE_IS_FLOAT" -eq 1
+                then
+                    fptools_cv_htype_dev_t=Float
+                elif test "$HTYPE_IS_DOUBLE" -eq 1
+                then
+                    fptools_cv_htype_dev_t=Double
+                elif test "$HTYPE_IS_LDOUBLE" -eq 1
+                then
+                    fptools_cv_htype_dev_t=LDouble
+                else
+                    fptools_cv_htype_sup_dev_t=no
+                fi
+            fi
+        else
+            if ac_fn_c_compute_int "$LINENO" "((dev_t)(-1)) < ((dev_t)0)" "HTYPE_IS_SIGNED"        "
+#include <stdbool.h>
+#include <stdio.h>
+#include <stddef.h>
+
+#if HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+
+#if HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+
+#if HAVE_SYS_STAT_H
+# include <sys/stat.h>
+#endif
+
+#if HAVE_FCNTL_H
+# include <fcntl.h>
+#endif
+
+#if HAVE_SIGNAL_H
+# include <signal.h>
+#endif
+
+#if HAVE_TIME_H
+# include <time.h>
+#endif
+
+#if HAVE_TERMIOS_H
+# include <termios.h>
+#endif
+
+#if HAVE_STRING_H
+# include <string.h>
+#endif
+
+#if HAVE_CTYPE_H
+# include <ctype.h>
+#endif
+
+#if HAVE_INTTYPES_H
+# include <inttypes.h>
+#else
+# if HAVE_STDINT_H
+#  include <stdint.h>
+# endif
+#endif
+
+#if HAVE_SYS_RESOURCE_H
+# include <sys/resource.h>
+#endif
+
+#include <stdlib.h>
+"; then :
+
+else
+  fptools_cv_htype_sup_dev_t=no
+fi
+
+
+            if ac_fn_c_compute_int "$LINENO" "sizeof(dev_t) * 8" "HTYPE_SIZE"        "
+#include <stdbool.h>
+#include <stdio.h>
+#include <stddef.h>
+
+#if HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+
+#if HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+
+#if HAVE_SYS_STAT_H
+# include <sys/stat.h>
+#endif
+
+#if HAVE_FCNTL_H
+# include <fcntl.h>
+#endif
+
+#if HAVE_SIGNAL_H
+# include <signal.h>
+#endif
+
+#if HAVE_TIME_H
+# include <time.h>
+#endif
+
+#if HAVE_TERMIOS_H
+# include <termios.h>
+#endif
+
+#if HAVE_STRING_H
+# include <string.h>
+#endif
+
+#if HAVE_CTYPE_H
+# include <ctype.h>
+#endif
+
+#if HAVE_INTTYPES_H
+# include <inttypes.h>
+#else
+# if HAVE_STDINT_H
+#  include <stdint.h>
+# endif
+#endif
+
+#if HAVE_SYS_RESOURCE_H
+# include <sys/resource.h>
+#endif
+
+#include <stdlib.h>
+"; then :
+
+else
+  fptools_cv_htype_sup_dev_t=no
+fi
+
+
+            if test "$HTYPE_IS_SIGNED" -eq 0
+            then
+                fptools_cv_htype_dev_t="Word$HTYPE_SIZE"
+            else
+                fptools_cv_htype_dev_t="Int$HTYPE_SIZE"
+            fi
+        fi
+
+fi
+
+    if test "$fptools_cv_htype_sup_dev_t" = no
+    then
+
+        fptools_cv_htype_dev_t=NotReallyAType
+        { $as_echo "$as_me:${as_lineno-$LINENO}: result: not supported" >&5
+$as_echo "not supported" >&6; }
+
+    fi
+
+            if test "$fptools_cv_htype_sup_dev_t" = yes; then
+        { $as_echo "$as_me:${as_lineno-$LINENO}: result: $fptools_cv_htype_dev_t" >&5
+$as_echo "$fptools_cv_htype_dev_t" >&6; }
+
+cat >>confdefs.h <<_ACEOF
+#define HTYPE_DEV_T $fptools_cv_htype_dev_t
+_ACEOF
+
+    fi
+
+
+
+
+
+
+
+
+
+
+    { $as_echo "$as_me:${as_lineno-$LINENO}: checking Haskell type for ino_t" >&5
+$as_echo_n "checking Haskell type for ino_t... " >&6; }
+    if ${fptools_cv_htype_ino_t+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+
+        fptools_cv_htype_sup_ino_t=yes
+        if ac_fn_c_compute_int "$LINENO" "(ino_t)0.2 - (ino_t)0.4 < 0 ? 0 : 1" "HTYPE_IS_INTEGRAL"        "
+#include <stdbool.h>
+#include <stdio.h>
+#include <stddef.h>
+
+#if HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+
+#if HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+
+#if HAVE_SYS_STAT_H
+# include <sys/stat.h>
+#endif
+
+#if HAVE_FCNTL_H
+# include <fcntl.h>
+#endif
+
+#if HAVE_SIGNAL_H
+# include <signal.h>
+#endif
+
+#if HAVE_TIME_H
+# include <time.h>
+#endif
+
+#if HAVE_TERMIOS_H
+# include <termios.h>
+#endif
+
+#if HAVE_STRING_H
+# include <string.h>
+#endif
+
+#if HAVE_CTYPE_H
+# include <ctype.h>
+#endif
+
+#if HAVE_INTTYPES_H
+# include <inttypes.h>
+#else
+# if HAVE_STDINT_H
+#  include <stdint.h>
+# endif
+#endif
+
+#if HAVE_SYS_RESOURCE_H
+# include <sys/resource.h>
+#endif
+
+#include <stdlib.h>
+"; then :
+
+else
+  HTYPE_IS_INTEGRAL=0
+fi
+
+
+
+        if test "$HTYPE_IS_INTEGRAL" -eq 0
+        then
+                                                            cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+#include <stdbool.h>
+#include <stdio.h>
+#include <stddef.h>
+
+#if HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+
+#if HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+
+#if HAVE_SYS_STAT_H
+# include <sys/stat.h>
+#endif
+
+#if HAVE_FCNTL_H
+# include <fcntl.h>
+#endif
+
+#if HAVE_SIGNAL_H
+# include <signal.h>
+#endif
+
+#if HAVE_TIME_H
+# include <time.h>
+#endif
+
+#if HAVE_TERMIOS_H
+# include <termios.h>
+#endif
+
+#if HAVE_STRING_H
+# include <string.h>
+#endif
+
+#if HAVE_CTYPE_H
+# include <ctype.h>
+#endif
+
+#if HAVE_INTTYPES_H
+# include <inttypes.h>
+#else
+# if HAVE_STDINT_H
+#  include <stdint.h>
+# endif
+#endif
+
+#if HAVE_SYS_RESOURCE_H
+# include <sys/resource.h>
+#endif
+
+#include <stdlib.h>
+
+int
+main ()
+{
+ino_t val; *val;
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  HTYPE_IS_POINTER=yes
+else
+  HTYPE_IS_POINTER=no
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+
+            if test "$HTYPE_IS_POINTER" = yes
+            then
+                fptools_cv_htype_ino_t="Ptr ()"
+            else
+                if ac_fn_c_compute_int "$LINENO" "sizeof(ino_t) == sizeof(float)" "HTYPE_IS_FLOAT"        "
+#include <stdbool.h>
+#include <stdio.h>
+#include <stddef.h>
+
+#if HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+
+#if HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+
+#if HAVE_SYS_STAT_H
+# include <sys/stat.h>
+#endif
+
+#if HAVE_FCNTL_H
+# include <fcntl.h>
+#endif
+
+#if HAVE_SIGNAL_H
+# include <signal.h>
+#endif
+
+#if HAVE_TIME_H
+# include <time.h>
+#endif
+
+#if HAVE_TERMIOS_H
+# include <termios.h>
+#endif
+
+#if HAVE_STRING_H
+# include <string.h>
+#endif
+
+#if HAVE_CTYPE_H
+# include <ctype.h>
+#endif
+
+#if HAVE_INTTYPES_H
+# include <inttypes.h>
+#else
+# if HAVE_STDINT_H
+#  include <stdint.h>
+# endif
+#endif
+
+#if HAVE_SYS_RESOURCE_H
+# include <sys/resource.h>
+#endif
+
+#include <stdlib.h>
+"; then :
+
+else
+  fptools_cv_htype_sup_ino_t=no
+fi
+
+
+                if ac_fn_c_compute_int "$LINENO" "sizeof(ino_t) == sizeof(double)" "HTYPE_IS_DOUBLE"        "
+#include <stdbool.h>
+#include <stdio.h>
+#include <stddef.h>
+
+#if HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+
+#if HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+
+#if HAVE_SYS_STAT_H
+# include <sys/stat.h>
+#endif
+
+#if HAVE_FCNTL_H
+# include <fcntl.h>
+#endif
+
+#if HAVE_SIGNAL_H
+# include <signal.h>
+#endif
+
+#if HAVE_TIME_H
+# include <time.h>
+#endif
+
+#if HAVE_TERMIOS_H
+# include <termios.h>
+#endif
+
+#if HAVE_STRING_H
+# include <string.h>
+#endif
+
+#if HAVE_CTYPE_H
+# include <ctype.h>
+#endif
+
+#if HAVE_INTTYPES_H
+# include <inttypes.h>
+#else
+# if HAVE_STDINT_H
+#  include <stdint.h>
+# endif
+#endif
+
+#if HAVE_SYS_RESOURCE_H
+# include <sys/resource.h>
+#endif
+
+#include <stdlib.h>
+"; then :
+
+else
+  fptools_cv_htype_sup_ino_t=no
+fi
+
+
+                if ac_fn_c_compute_int "$LINENO" "sizeof(ino_t) == sizeof(long double)" "HTYPE_IS_LDOUBLE"        "
+#include <stdbool.h>
+#include <stdio.h>
+#include <stddef.h>
+
+#if HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+
+#if HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+
+#if HAVE_SYS_STAT_H
+# include <sys/stat.h>
+#endif
+
+#if HAVE_FCNTL_H
+# include <fcntl.h>
+#endif
+
+#if HAVE_SIGNAL_H
+# include <signal.h>
+#endif
+
+#if HAVE_TIME_H
+# include <time.h>
+#endif
+
+#if HAVE_TERMIOS_H
+# include <termios.h>
+#endif
+
+#if HAVE_STRING_H
+# include <string.h>
+#endif
+
+#if HAVE_CTYPE_H
+# include <ctype.h>
+#endif
+
+#if HAVE_INTTYPES_H
+# include <inttypes.h>
+#else
+# if HAVE_STDINT_H
+#  include <stdint.h>
+# endif
+#endif
+
+#if HAVE_SYS_RESOURCE_H
+# include <sys/resource.h>
+#endif
+
+#include <stdlib.h>
+"; then :
+
+else
+  fptools_cv_htype_sup_ino_t=no
+fi
+
+
+                if test "$HTYPE_IS_FLOAT" -eq 1
+                then
+                    fptools_cv_htype_ino_t=Float
+                elif test "$HTYPE_IS_DOUBLE" -eq 1
+                then
+                    fptools_cv_htype_ino_t=Double
+                elif test "$HTYPE_IS_LDOUBLE" -eq 1
+                then
+                    fptools_cv_htype_ino_t=LDouble
+                else
+                    fptools_cv_htype_sup_ino_t=no
+                fi
+            fi
+        else
+            if ac_fn_c_compute_int "$LINENO" "((ino_t)(-1)) < ((ino_t)0)" "HTYPE_IS_SIGNED"        "
+#include <stdbool.h>
+#include <stdio.h>
+#include <stddef.h>
+
+#if HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+
+#if HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+
+#if HAVE_SYS_STAT_H
+# include <sys/stat.h>
+#endif
+
+#if HAVE_FCNTL_H
+# include <fcntl.h>
+#endif
+
+#if HAVE_SIGNAL_H
+# include <signal.h>
+#endif
+
+#if HAVE_TIME_H
+# include <time.h>
+#endif
+
+#if HAVE_TERMIOS_H
+# include <termios.h>
+#endif
+
+#if HAVE_STRING_H
+# include <string.h>
+#endif
+
+#if HAVE_CTYPE_H
+# include <ctype.h>
+#endif
+
+#if HAVE_INTTYPES_H
+# include <inttypes.h>
+#else
+# if HAVE_STDINT_H
+#  include <stdint.h>
+# endif
+#endif
+
+#if HAVE_SYS_RESOURCE_H
+# include <sys/resource.h>
+#endif
+
+#include <stdlib.h>
+"; then :
+
+else
+  fptools_cv_htype_sup_ino_t=no
+fi
+
+
+            if ac_fn_c_compute_int "$LINENO" "sizeof(ino_t) * 8" "HTYPE_SIZE"        "
+#include <stdbool.h>
+#include <stdio.h>
+#include <stddef.h>
+
+#if HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+
+#if HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+
+#if HAVE_SYS_STAT_H
+# include <sys/stat.h>
+#endif
+
+#if HAVE_FCNTL_H
+# include <fcntl.h>
+#endif
+
+#if HAVE_SIGNAL_H
+# include <signal.h>
+#endif
+
+#if HAVE_TIME_H
+# include <time.h>
+#endif
+
+#if HAVE_TERMIOS_H
+# include <termios.h>
+#endif
+
+#if HAVE_STRING_H
+# include <string.h>
+#endif
+
+#if HAVE_CTYPE_H
+# include <ctype.h>
+#endif
+
+#if HAVE_INTTYPES_H
+# include <inttypes.h>
+#else
+# if HAVE_STDINT_H
+#  include <stdint.h>
+# endif
+#endif
+
+#if HAVE_SYS_RESOURCE_H
+# include <sys/resource.h>
+#endif
+
+#include <stdlib.h>
+"; then :
+
+else
+  fptools_cv_htype_sup_ino_t=no
+fi
+
+
+            if test "$HTYPE_IS_SIGNED" -eq 0
+            then
+                fptools_cv_htype_ino_t="Word$HTYPE_SIZE"
+            else
+                fptools_cv_htype_ino_t="Int$HTYPE_SIZE"
+            fi
+        fi
+
+fi
+
+    if test "$fptools_cv_htype_sup_ino_t" = no
+    then
+
+        fptools_cv_htype_ino_t=NotReallyAType
+        { $as_echo "$as_me:${as_lineno-$LINENO}: result: not supported" >&5
+$as_echo "not supported" >&6; }
+
+    fi
+
+            if test "$fptools_cv_htype_sup_ino_t" = yes; then
+        { $as_echo "$as_me:${as_lineno-$LINENO}: result: $fptools_cv_htype_ino_t" >&5
+$as_echo "$fptools_cv_htype_ino_t" >&6; }
+
+cat >>confdefs.h <<_ACEOF
+#define HTYPE_INO_T $fptools_cv_htype_ino_t
+_ACEOF
+
+    fi
+
+
+
+
+
+
+
+
+
+
+    { $as_echo "$as_me:${as_lineno-$LINENO}: checking Haskell type for mode_t" >&5
+$as_echo_n "checking Haskell type for mode_t... " >&6; }
+    if ${fptools_cv_htype_mode_t+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+
+        fptools_cv_htype_sup_mode_t=yes
+        if ac_fn_c_compute_int "$LINENO" "(mode_t)0.2 - (mode_t)0.4 < 0 ? 0 : 1" "HTYPE_IS_INTEGRAL"        "
+#include <stdbool.h>
+#include <stdio.h>
+#include <stddef.h>
+
+#if HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+
+#if HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+
+#if HAVE_SYS_STAT_H
+# include <sys/stat.h>
+#endif
+
+#if HAVE_FCNTL_H
+# include <fcntl.h>
+#endif
+
+#if HAVE_SIGNAL_H
+# include <signal.h>
+#endif
+
+#if HAVE_TIME_H
+# include <time.h>
+#endif
+
+#if HAVE_TERMIOS_H
+# include <termios.h>
+#endif
+
+#if HAVE_STRING_H
+# include <string.h>
+#endif
+
+#if HAVE_CTYPE_H
+# include <ctype.h>
+#endif
+
+#if HAVE_INTTYPES_H
+# include <inttypes.h>
+#else
+# if HAVE_STDINT_H
+#  include <stdint.h>
+# endif
+#endif
+
+#if HAVE_SYS_RESOURCE_H
+# include <sys/resource.h>
+#endif
+
+#include <stdlib.h>
+"; then :
+
+else
+  HTYPE_IS_INTEGRAL=0
+fi
+
+
+
+        if test "$HTYPE_IS_INTEGRAL" -eq 0
+        then
+                                                            cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+#include <stdbool.h>
+#include <stdio.h>
+#include <stddef.h>
+
+#if HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+
+#if HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+
+#if HAVE_SYS_STAT_H
+# include <sys/stat.h>
+#endif
+
+#if HAVE_FCNTL_H
+# include <fcntl.h>
+#endif
+
+#if HAVE_SIGNAL_H
+# include <signal.h>
+#endif
+
+#if HAVE_TIME_H
+# include <time.h>
+#endif
+
+#if HAVE_TERMIOS_H
+# include <termios.h>
+#endif
+
+#if HAVE_STRING_H
+# include <string.h>
+#endif
+
+#if HAVE_CTYPE_H
+# include <ctype.h>
+#endif
+
+#if HAVE_INTTYPES_H
+# include <inttypes.h>
+#else
+# if HAVE_STDINT_H
+#  include <stdint.h>
+# endif
+#endif
+
+#if HAVE_SYS_RESOURCE_H
+# include <sys/resource.h>
+#endif
+
+#include <stdlib.h>
+
+int
+main ()
+{
+mode_t val; *val;
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  HTYPE_IS_POINTER=yes
+else
+  HTYPE_IS_POINTER=no
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+
+            if test "$HTYPE_IS_POINTER" = yes
+            then
+                fptools_cv_htype_mode_t="Ptr ()"
+            else
+                if ac_fn_c_compute_int "$LINENO" "sizeof(mode_t) == sizeof(float)" "HTYPE_IS_FLOAT"        "
+#include <stdbool.h>
+#include <stdio.h>
+#include <stddef.h>
+
+#if HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+
+#if HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+
+#if HAVE_SYS_STAT_H
+# include <sys/stat.h>
+#endif
+
+#if HAVE_FCNTL_H
+# include <fcntl.h>
+#endif
+
+#if HAVE_SIGNAL_H
+# include <signal.h>
+#endif
+
+#if HAVE_TIME_H
+# include <time.h>
+#endif
+
+#if HAVE_TERMIOS_H
+# include <termios.h>
+#endif
+
+#if HAVE_STRING_H
+# include <string.h>
+#endif
+
+#if HAVE_CTYPE_H
+# include <ctype.h>
+#endif
+
+#if HAVE_INTTYPES_H
+# include <inttypes.h>
+#else
+# if HAVE_STDINT_H
+#  include <stdint.h>
+# endif
+#endif
+
+#if HAVE_SYS_RESOURCE_H
+# include <sys/resource.h>
+#endif
+
+#include <stdlib.h>
+"; then :
+
+else
+  fptools_cv_htype_sup_mode_t=no
+fi
+
+
+                if ac_fn_c_compute_int "$LINENO" "sizeof(mode_t) == sizeof(double)" "HTYPE_IS_DOUBLE"        "
+#include <stdbool.h>
+#include <stdio.h>
+#include <stddef.h>
+
+#if HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+
+#if HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+
+#if HAVE_SYS_STAT_H
+# include <sys/stat.h>
+#endif
+
+#if HAVE_FCNTL_H
+# include <fcntl.h>
+#endif
+
+#if HAVE_SIGNAL_H
+# include <signal.h>
+#endif
+
+#if HAVE_TIME_H
+# include <time.h>
+#endif
+
+#if HAVE_TERMIOS_H
+# include <termios.h>
+#endif
+
+#if HAVE_STRING_H
+# include <string.h>
+#endif
+
+#if HAVE_CTYPE_H
+# include <ctype.h>
+#endif
+
+#if HAVE_INTTYPES_H
+# include <inttypes.h>
+#else
+# if HAVE_STDINT_H
+#  include <stdint.h>
+# endif
+#endif
+
+#if HAVE_SYS_RESOURCE_H
+# include <sys/resource.h>
+#endif
+
+#include <stdlib.h>
+"; then :
+
+else
+  fptools_cv_htype_sup_mode_t=no
+fi
+
+
+                if ac_fn_c_compute_int "$LINENO" "sizeof(mode_t) == sizeof(long double)" "HTYPE_IS_LDOUBLE"        "
+#include <stdbool.h>
+#include <stdio.h>
+#include <stddef.h>
+
+#if HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+
+#if HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+
+#if HAVE_SYS_STAT_H
+# include <sys/stat.h>
+#endif
+
+#if HAVE_FCNTL_H
+# include <fcntl.h>
+#endif
+
+#if HAVE_SIGNAL_H
+# include <signal.h>
+#endif
+
+#if HAVE_TIME_H
+# include <time.h>
+#endif
+
+#if HAVE_TERMIOS_H
+# include <termios.h>
+#endif
+
+#if HAVE_STRING_H
+# include <string.h>
+#endif
+
+#if HAVE_CTYPE_H
+# include <ctype.h>
+#endif
+
+#if HAVE_INTTYPES_H
+# include <inttypes.h>
+#else
+# if HAVE_STDINT_H
+#  include <stdint.h>
+# endif
+#endif
+
+#if HAVE_SYS_RESOURCE_H
+# include <sys/resource.h>
+#endif
+
+#include <stdlib.h>
+"; then :
+
+else
+  fptools_cv_htype_sup_mode_t=no
+fi
+
+
+                if test "$HTYPE_IS_FLOAT" -eq 1
+                then
+                    fptools_cv_htype_mode_t=Float
+                elif test "$HTYPE_IS_DOUBLE" -eq 1
+                then
+                    fptools_cv_htype_mode_t=Double
+                elif test "$HTYPE_IS_LDOUBLE" -eq 1
+                then
+                    fptools_cv_htype_mode_t=LDouble
+                else
+                    fptools_cv_htype_sup_mode_t=no
+                fi
+            fi
+        else
+            if ac_fn_c_compute_int "$LINENO" "((mode_t)(-1)) < ((mode_t)0)" "HTYPE_IS_SIGNED"        "
+#include <stdbool.h>
+#include <stdio.h>
+#include <stddef.h>
+
+#if HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+
+#if HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+
+#if HAVE_SYS_STAT_H
+# include <sys/stat.h>
+#endif
+
+#if HAVE_FCNTL_H
+# include <fcntl.h>
+#endif
+
+#if HAVE_SIGNAL_H
+# include <signal.h>
+#endif
+
+#if HAVE_TIME_H
+# include <time.h>
+#endif
+
+#if HAVE_TERMIOS_H
+# include <termios.h>
+#endif
+
+#if HAVE_STRING_H
+# include <string.h>
+#endif
+
+#if HAVE_CTYPE_H
+# include <ctype.h>
+#endif
+
+#if HAVE_INTTYPES_H
+# include <inttypes.h>
+#else
+# if HAVE_STDINT_H
+#  include <stdint.h>
+# endif
+#endif
+
+#if HAVE_SYS_RESOURCE_H
+# include <sys/resource.h>
+#endif
+
+#include <stdlib.h>
+"; then :
+
+else
+  fptools_cv_htype_sup_mode_t=no
+fi
+
+
+            if ac_fn_c_compute_int "$LINENO" "sizeof(mode_t) * 8" "HTYPE_SIZE"        "
+#include <stdbool.h>
+#include <stdio.h>
+#include <stddef.h>
+
+#if HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+
+#if HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+
+#if HAVE_SYS_STAT_H
+# include <sys/stat.h>
+#endif
+
+#if HAVE_FCNTL_H
+# include <fcntl.h>
+#endif
+
+#if HAVE_SIGNAL_H
+# include <signal.h>
+#endif
+
+#if HAVE_TIME_H
+# include <time.h>
+#endif
+
+#if HAVE_TERMIOS_H
+# include <termios.h>
+#endif
+
+#if HAVE_STRING_H
+# include <string.h>
+#endif
+
+#if HAVE_CTYPE_H
+# include <ctype.h>
+#endif
+
+#if HAVE_INTTYPES_H
+# include <inttypes.h>
+#else
+# if HAVE_STDINT_H
+#  include <stdint.h>
+# endif
+#endif
+
+#if HAVE_SYS_RESOURCE_H
+# include <sys/resource.h>
+#endif
+
+#include <stdlib.h>
+"; then :
+
+else
+  fptools_cv_htype_sup_mode_t=no
+fi
+
+
+            if test "$HTYPE_IS_SIGNED" -eq 0
+            then
+                fptools_cv_htype_mode_t="Word$HTYPE_SIZE"
+            else
+                fptools_cv_htype_mode_t="Int$HTYPE_SIZE"
+            fi
+        fi
+
+fi
+
+    if test "$fptools_cv_htype_sup_mode_t" = no
+    then
+
+        fptools_cv_htype_mode_t=NotReallyAType
+        { $as_echo "$as_me:${as_lineno-$LINENO}: result: not supported" >&5
+$as_echo "not supported" >&6; }
+
+    fi
+
+            if test "$fptools_cv_htype_sup_mode_t" = yes; then
+        { $as_echo "$as_me:${as_lineno-$LINENO}: result: $fptools_cv_htype_mode_t" >&5
+$as_echo "$fptools_cv_htype_mode_t" >&6; }
+
+cat >>confdefs.h <<_ACEOF
+#define HTYPE_MODE_T $fptools_cv_htype_mode_t
+_ACEOF
+
+    fi
+
+
+
+
+
+
+
+
+
+
+    { $as_echo "$as_me:${as_lineno-$LINENO}: checking Haskell type for off_t" >&5
+$as_echo_n "checking Haskell type for off_t... " >&6; }
+    if ${fptools_cv_htype_off_t+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+
+        fptools_cv_htype_sup_off_t=yes
+        if ac_fn_c_compute_int "$LINENO" "(off_t)0.2 - (off_t)0.4 < 0 ? 0 : 1" "HTYPE_IS_INTEGRAL"        "
+#include <stdbool.h>
+#include <stdio.h>
+#include <stddef.h>
+
+#if HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+
+#if HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+
+#if HAVE_SYS_STAT_H
+# include <sys/stat.h>
+#endif
+
+#if HAVE_FCNTL_H
+# include <fcntl.h>
+#endif
+
+#if HAVE_SIGNAL_H
+# include <signal.h>
+#endif
+
+#if HAVE_TIME_H
+# include <time.h>
+#endif
+
+#if HAVE_TERMIOS_H
+# include <termios.h>
+#endif
+
+#if HAVE_STRING_H
+# include <string.h>
+#endif
+
+#if HAVE_CTYPE_H
+# include <ctype.h>
+#endif
+
+#if HAVE_INTTYPES_H
+# include <inttypes.h>
+#else
+# if HAVE_STDINT_H
+#  include <stdint.h>
+# endif
+#endif
+
+#if HAVE_SYS_RESOURCE_H
+# include <sys/resource.h>
+#endif
+
+#include <stdlib.h>
+"; then :
+
+else
+  HTYPE_IS_INTEGRAL=0
+fi
+
+
+
+        if test "$HTYPE_IS_INTEGRAL" -eq 0
+        then
+                                                            cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+#include <stdbool.h>
+#include <stdio.h>
+#include <stddef.h>
+
+#if HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+
+#if HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+
+#if HAVE_SYS_STAT_H
+# include <sys/stat.h>
+#endif
+
+#if HAVE_FCNTL_H
+# include <fcntl.h>
+#endif
+
+#if HAVE_SIGNAL_H
+# include <signal.h>
+#endif
+
+#if HAVE_TIME_H
+# include <time.h>
+#endif
+
+#if HAVE_TERMIOS_H
+# include <termios.h>
+#endif
+
+#if HAVE_STRING_H
+# include <string.h>
+#endif
+
+#if HAVE_CTYPE_H
+# include <ctype.h>
+#endif
+
+#if HAVE_INTTYPES_H
+# include <inttypes.h>
+#else
+# if HAVE_STDINT_H
+#  include <stdint.h>
+# endif
+#endif
+
+#if HAVE_SYS_RESOURCE_H
+# include <sys/resource.h>
+#endif
+
+#include <stdlib.h>
+
+int
+main ()
+{
+off_t val; *val;
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  HTYPE_IS_POINTER=yes
+else
+  HTYPE_IS_POINTER=no
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+
+            if test "$HTYPE_IS_POINTER" = yes
+            then
+                fptools_cv_htype_off_t="Ptr ()"
+            else
+                if ac_fn_c_compute_int "$LINENO" "sizeof(off_t) == sizeof(float)" "HTYPE_IS_FLOAT"        "
+#include <stdbool.h>
+#include <stdio.h>
+#include <stddef.h>
+
+#if HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+
+#if HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+
+#if HAVE_SYS_STAT_H
+# include <sys/stat.h>
+#endif
+
+#if HAVE_FCNTL_H
+# include <fcntl.h>
+#endif
+
+#if HAVE_SIGNAL_H
+# include <signal.h>
+#endif
+
+#if HAVE_TIME_H
+# include <time.h>
+#endif
+
+#if HAVE_TERMIOS_H
+# include <termios.h>
+#endif
+
+#if HAVE_STRING_H
+# include <string.h>
+#endif
+
+#if HAVE_CTYPE_H
+# include <ctype.h>
+#endif
+
+#if HAVE_INTTYPES_H
+# include <inttypes.h>
+#else
+# if HAVE_STDINT_H
+#  include <stdint.h>
+# endif
+#endif
+
+#if HAVE_SYS_RESOURCE_H
+# include <sys/resource.h>
+#endif
+
+#include <stdlib.h>
+"; then :
+
+else
+  fptools_cv_htype_sup_off_t=no
+fi
+
+
+                if ac_fn_c_compute_int "$LINENO" "sizeof(off_t) == sizeof(double)" "HTYPE_IS_DOUBLE"        "
+#include <stdbool.h>
+#include <stdio.h>
+#include <stddef.h>
+
+#if HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+
+#if HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+
+#if HAVE_SYS_STAT_H
+# include <sys/stat.h>
+#endif
+
+#if HAVE_FCNTL_H
+# include <fcntl.h>
+#endif
+
+#if HAVE_SIGNAL_H
+# include <signal.h>
+#endif
+
+#if HAVE_TIME_H
+# include <time.h>
+#endif
+
+#if HAVE_TERMIOS_H
+# include <termios.h>
+#endif
+
+#if HAVE_STRING_H
+# include <string.h>
+#endif
+
+#if HAVE_CTYPE_H
+# include <ctype.h>
+#endif
+
+#if HAVE_INTTYPES_H
+# include <inttypes.h>
+#else
+# if HAVE_STDINT_H
+#  include <stdint.h>
+# endif
+#endif
+
+#if HAVE_SYS_RESOURCE_H
+# include <sys/resource.h>
+#endif
+
+#include <stdlib.h>
+"; then :
+
+else
+  fptools_cv_htype_sup_off_t=no
+fi
+
+
+                if ac_fn_c_compute_int "$LINENO" "sizeof(off_t) == sizeof(long double)" "HTYPE_IS_LDOUBLE"        "
+#include <stdbool.h>
+#include <stdio.h>
+#include <stddef.h>
+
+#if HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+
+#if HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+
+#if HAVE_SYS_STAT_H
+# include <sys/stat.h>
+#endif
+
+#if HAVE_FCNTL_H
+# include <fcntl.h>
+#endif
+
+#if HAVE_SIGNAL_H
+# include <signal.h>
+#endif
+
+#if HAVE_TIME_H
+# include <time.h>
+#endif
+
+#if HAVE_TERMIOS_H
+# include <termios.h>
+#endif
+
+#if HAVE_STRING_H
+# include <string.h>
+#endif
+
+#if HAVE_CTYPE_H
+# include <ctype.h>
+#endif
+
+#if HAVE_INTTYPES_H
+# include <inttypes.h>
+#else
+# if HAVE_STDINT_H
+#  include <stdint.h>
+# endif
+#endif
+
+#if HAVE_SYS_RESOURCE_H
+# include <sys/resource.h>
+#endif
+
+#include <stdlib.h>
+"; then :
+
+else
+  fptools_cv_htype_sup_off_t=no
+fi
+
+
+                if test "$HTYPE_IS_FLOAT" -eq 1
+                then
+                    fptools_cv_htype_off_t=Float
+                elif test "$HTYPE_IS_DOUBLE" -eq 1
+                then
+                    fptools_cv_htype_off_t=Double
+                elif test "$HTYPE_IS_LDOUBLE" -eq 1
+                then
+                    fptools_cv_htype_off_t=LDouble
+                else
+                    fptools_cv_htype_sup_off_t=no
+                fi
+            fi
+        else
+            if ac_fn_c_compute_int "$LINENO" "((off_t)(-1)) < ((off_t)0)" "HTYPE_IS_SIGNED"        "
+#include <stdbool.h>
+#include <stdio.h>
+#include <stddef.h>
+
+#if HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+
+#if HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+
+#if HAVE_SYS_STAT_H
+# include <sys/stat.h>
+#endif
+
+#if HAVE_FCNTL_H
+# include <fcntl.h>
+#endif
+
+#if HAVE_SIGNAL_H
+# include <signal.h>
+#endif
+
+#if HAVE_TIME_H
+# include <time.h>
+#endif
+
+#if HAVE_TERMIOS_H
+# include <termios.h>
+#endif
+
+#if HAVE_STRING_H
+# include <string.h>
+#endif
+
+#if HAVE_CTYPE_H
+# include <ctype.h>
+#endif
+
+#if HAVE_INTTYPES_H
+# include <inttypes.h>
+#else
+# if HAVE_STDINT_H
+#  include <stdint.h>
+# endif
+#endif
+
+#if HAVE_SYS_RESOURCE_H
+# include <sys/resource.h>
+#endif
+
+#include <stdlib.h>
+"; then :
+
+else
+  fptools_cv_htype_sup_off_t=no
+fi
+
+
+            if ac_fn_c_compute_int "$LINENO" "sizeof(off_t) * 8" "HTYPE_SIZE"        "
+#include <stdbool.h>
+#include <stdio.h>
+#include <stddef.h>
+
+#if HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+
+#if HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+
+#if HAVE_SYS_STAT_H
+# include <sys/stat.h>
+#endif
+
+#if HAVE_FCNTL_H
+# include <fcntl.h>
+#endif
+
+#if HAVE_SIGNAL_H
+# include <signal.h>
+#endif
+
+#if HAVE_TIME_H
+# include <time.h>
+#endif
+
+#if HAVE_TERMIOS_H
+# include <termios.h>
+#endif
+
+#if HAVE_STRING_H
+# include <string.h>
+#endif
+
+#if HAVE_CTYPE_H
+# include <ctype.h>
+#endif
+
+#if HAVE_INTTYPES_H
+# include <inttypes.h>
+#else
+# if HAVE_STDINT_H
+#  include <stdint.h>
+# endif
+#endif
+
+#if HAVE_SYS_RESOURCE_H
+# include <sys/resource.h>
+#endif
+
+#include <stdlib.h>
+"; then :
+
+else
+  fptools_cv_htype_sup_off_t=no
+fi
+
+
+            if test "$HTYPE_IS_SIGNED" -eq 0
+            then
+                fptools_cv_htype_off_t="Word$HTYPE_SIZE"
+            else
+                fptools_cv_htype_off_t="Int$HTYPE_SIZE"
+            fi
+        fi
+
+fi
+
+    if test "$fptools_cv_htype_sup_off_t" = no
+    then
+
+        fptools_cv_htype_off_t=NotReallyAType
+        { $as_echo "$as_me:${as_lineno-$LINENO}: result: not supported" >&5
+$as_echo "not supported" >&6; }
+
+    fi
+
+            if test "$fptools_cv_htype_sup_off_t" = yes; then
+        { $as_echo "$as_me:${as_lineno-$LINENO}: result: $fptools_cv_htype_off_t" >&5
+$as_echo "$fptools_cv_htype_off_t" >&6; }
+
+cat >>confdefs.h <<_ACEOF
+#define HTYPE_OFF_T $fptools_cv_htype_off_t
+_ACEOF
+
+    fi
+
+
+
+
+
+
+
+
+
+
+    { $as_echo "$as_me:${as_lineno-$LINENO}: checking Haskell type for pid_t" >&5
+$as_echo_n "checking Haskell type for pid_t... " >&6; }
+    if ${fptools_cv_htype_pid_t+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+
+        fptools_cv_htype_sup_pid_t=yes
+        if ac_fn_c_compute_int "$LINENO" "(pid_t)0.2 - (pid_t)0.4 < 0 ? 0 : 1" "HTYPE_IS_INTEGRAL"        "
+#include <stdbool.h>
+#include <stdio.h>
+#include <stddef.h>
+
+#if HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+
+#if HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+
+#if HAVE_SYS_STAT_H
+# include <sys/stat.h>
+#endif
+
+#if HAVE_FCNTL_H
+# include <fcntl.h>
+#endif
+
+#if HAVE_SIGNAL_H
+# include <signal.h>
+#endif
+
+#if HAVE_TIME_H
+# include <time.h>
+#endif
+
+#if HAVE_TERMIOS_H
+# include <termios.h>
+#endif
+
+#if HAVE_STRING_H
+# include <string.h>
+#endif
+
+#if HAVE_CTYPE_H
+# include <ctype.h>
+#endif
+
+#if HAVE_INTTYPES_H
+# include <inttypes.h>
+#else
+# if HAVE_STDINT_H
+#  include <stdint.h>
+# endif
+#endif
+
+#if HAVE_SYS_RESOURCE_H
+# include <sys/resource.h>
+#endif
+
+#include <stdlib.h>
+"; then :
+
+else
+  HTYPE_IS_INTEGRAL=0
+fi
+
+
+
+        if test "$HTYPE_IS_INTEGRAL" -eq 0
+        then
+                                                            cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+#include <stdbool.h>
+#include <stdio.h>
+#include <stddef.h>
+
+#if HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+
+#if HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+
+#if HAVE_SYS_STAT_H
+# include <sys/stat.h>
+#endif
+
+#if HAVE_FCNTL_H
+# include <fcntl.h>
+#endif
+
+#if HAVE_SIGNAL_H
+# include <signal.h>
+#endif
+
+#if HAVE_TIME_H
+# include <time.h>
+#endif
+
+#if HAVE_TERMIOS_H
+# include <termios.h>
+#endif
+
+#if HAVE_STRING_H
+# include <string.h>
+#endif
+
+#if HAVE_CTYPE_H
+# include <ctype.h>
+#endif
+
+#if HAVE_INTTYPES_H
+# include <inttypes.h>
+#else
+# if HAVE_STDINT_H
+#  include <stdint.h>
+# endif
+#endif
+
+#if HAVE_SYS_RESOURCE_H
+# include <sys/resource.h>
+#endif
+
+#include <stdlib.h>
+
+int
+main ()
+{
+pid_t val; *val;
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  HTYPE_IS_POINTER=yes
+else
+  HTYPE_IS_POINTER=no
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+
+            if test "$HTYPE_IS_POINTER" = yes
+            then
+                fptools_cv_htype_pid_t="Ptr ()"
+            else
+                if ac_fn_c_compute_int "$LINENO" "sizeof(pid_t) == sizeof(float)" "HTYPE_IS_FLOAT"        "
+#include <stdbool.h>
+#include <stdio.h>
+#include <stddef.h>
+
+#if HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+
+#if HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+
+#if HAVE_SYS_STAT_H
+# include <sys/stat.h>
+#endif
+
+#if HAVE_FCNTL_H
+# include <fcntl.h>
+#endif
+
+#if HAVE_SIGNAL_H
+# include <signal.h>
+#endif
+
+#if HAVE_TIME_H
+# include <time.h>
+#endif
+
+#if HAVE_TERMIOS_H
+# include <termios.h>
+#endif
+
+#if HAVE_STRING_H
+# include <string.h>
+#endif
+
+#if HAVE_CTYPE_H
+# include <ctype.h>
+#endif
+
+#if HAVE_INTTYPES_H
+# include <inttypes.h>
+#else
+# if HAVE_STDINT_H
+#  include <stdint.h>
+# endif
+#endif
+
+#if HAVE_SYS_RESOURCE_H
+# include <sys/resource.h>
+#endif
+
+#include <stdlib.h>
+"; then :
+
+else
+  fptools_cv_htype_sup_pid_t=no
+fi
+
+
+                if ac_fn_c_compute_int "$LINENO" "sizeof(pid_t) == sizeof(double)" "HTYPE_IS_DOUBLE"        "
+#include <stdbool.h>
+#include <stdio.h>
+#include <stddef.h>
+
+#if HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+
+#if HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+
+#if HAVE_SYS_STAT_H
+# include <sys/stat.h>
+#endif
+
+#if HAVE_FCNTL_H
+# include <fcntl.h>
+#endif
+
+#if HAVE_SIGNAL_H
+# include <signal.h>
+#endif
+
+#if HAVE_TIME_H
+# include <time.h>
+#endif
+
+#if HAVE_TERMIOS_H
+# include <termios.h>
+#endif
+
+#if HAVE_STRING_H
+# include <string.h>
+#endif
+
+#if HAVE_CTYPE_H
+# include <ctype.h>
+#endif
+
+#if HAVE_INTTYPES_H
+# include <inttypes.h>
+#else
+# if HAVE_STDINT_H
+#  include <stdint.h>
+# endif
+#endif
+
+#if HAVE_SYS_RESOURCE_H
+# include <sys/resource.h>
+#endif
+
+#include <stdlib.h>
+"; then :
+
+else
+  fptools_cv_htype_sup_pid_t=no
+fi
+
+
+                if ac_fn_c_compute_int "$LINENO" "sizeof(pid_t) == sizeof(long double)" "HTYPE_IS_LDOUBLE"        "
+#include <stdbool.h>
+#include <stdio.h>
+#include <stddef.h>
+
+#if HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+
+#if HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+
+#if HAVE_SYS_STAT_H
+# include <sys/stat.h>
+#endif
+
+#if HAVE_FCNTL_H
+# include <fcntl.h>
+#endif
+
+#if HAVE_SIGNAL_H
+# include <signal.h>
+#endif
+
+#if HAVE_TIME_H
+# include <time.h>
+#endif
+
+#if HAVE_TERMIOS_H
+# include <termios.h>
+#endif
+
+#if HAVE_STRING_H
+# include <string.h>
+#endif
+
+#if HAVE_CTYPE_H
+# include <ctype.h>
+#endif
+
+#if HAVE_INTTYPES_H
+# include <inttypes.h>
+#else
+# if HAVE_STDINT_H
+#  include <stdint.h>
+# endif
+#endif
+
+#if HAVE_SYS_RESOURCE_H
+# include <sys/resource.h>
+#endif
+
+#include <stdlib.h>
+"; then :
+
+else
+  fptools_cv_htype_sup_pid_t=no
+fi
+
+
+                if test "$HTYPE_IS_FLOAT" -eq 1
+                then
+                    fptools_cv_htype_pid_t=Float
+                elif test "$HTYPE_IS_DOUBLE" -eq 1
+                then
+                    fptools_cv_htype_pid_t=Double
+                elif test "$HTYPE_IS_LDOUBLE" -eq 1
+                then
+                    fptools_cv_htype_pid_t=LDouble
+                else
+                    fptools_cv_htype_sup_pid_t=no
+                fi
+            fi
+        else
+            if ac_fn_c_compute_int "$LINENO" "((pid_t)(-1)) < ((pid_t)0)" "HTYPE_IS_SIGNED"        "
+#include <stdbool.h>
+#include <stdio.h>
+#include <stddef.h>
+
+#if HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+
+#if HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+
+#if HAVE_SYS_STAT_H
+# include <sys/stat.h>
+#endif
+
+#if HAVE_FCNTL_H
+# include <fcntl.h>
+#endif
+
+#if HAVE_SIGNAL_H
+# include <signal.h>
+#endif
+
+#if HAVE_TIME_H
+# include <time.h>
+#endif
+
+#if HAVE_TERMIOS_H
+# include <termios.h>
+#endif
+
+#if HAVE_STRING_H
+# include <string.h>
+#endif
+
+#if HAVE_CTYPE_H
+# include <ctype.h>
+#endif
+
+#if HAVE_INTTYPES_H
+# include <inttypes.h>
+#else
+# if HAVE_STDINT_H
+#  include <stdint.h>
+# endif
+#endif
+
+#if HAVE_SYS_RESOURCE_H
+# include <sys/resource.h>
+#endif
+
+#include <stdlib.h>
+"; then :
+
+else
+  fptools_cv_htype_sup_pid_t=no
+fi
+
+
+            if ac_fn_c_compute_int "$LINENO" "sizeof(pid_t) * 8" "HTYPE_SIZE"        "
+#include <stdbool.h>
+#include <stdio.h>
+#include <stddef.h>
+
+#if HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+
+#if HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+
+#if HAVE_SYS_STAT_H
+# include <sys/stat.h>
+#endif
+
+#if HAVE_FCNTL_H
+# include <fcntl.h>
+#endif
+
+#if HAVE_SIGNAL_H
+# include <signal.h>
+#endif
+
+#if HAVE_TIME_H
+# include <time.h>
+#endif
+
+#if HAVE_TERMIOS_H
+# include <termios.h>
+#endif
+
+#if HAVE_STRING_H
+# include <string.h>
+#endif
+
+#if HAVE_CTYPE_H
+# include <ctype.h>
+#endif
+
+#if HAVE_INTTYPES_H
+# include <inttypes.h>
+#else
+# if HAVE_STDINT_H
+#  include <stdint.h>
+# endif
+#endif
+
+#if HAVE_SYS_RESOURCE_H
+# include <sys/resource.h>
+#endif
+
+#include <stdlib.h>
+"; then :
+
+else
+  fptools_cv_htype_sup_pid_t=no
+fi
+
+
+            if test "$HTYPE_IS_SIGNED" -eq 0
+            then
+                fptools_cv_htype_pid_t="Word$HTYPE_SIZE"
+            else
+                fptools_cv_htype_pid_t="Int$HTYPE_SIZE"
+            fi
+        fi
+
+fi
+
+    if test "$fptools_cv_htype_sup_pid_t" = no
+    then
+
+        fptools_cv_htype_pid_t=NotReallyAType
+        { $as_echo "$as_me:${as_lineno-$LINENO}: result: not supported" >&5
+$as_echo "not supported" >&6; }
+
+    fi
+
+            if test "$fptools_cv_htype_sup_pid_t" = yes; then
+        { $as_echo "$as_me:${as_lineno-$LINENO}: result: $fptools_cv_htype_pid_t" >&5
+$as_echo "$fptools_cv_htype_pid_t" >&6; }
+
+cat >>confdefs.h <<_ACEOF
+#define HTYPE_PID_T $fptools_cv_htype_pid_t
+_ACEOF
+
+    fi
+
+
+
+
+
+
+
+
+
+
+    { $as_echo "$as_me:${as_lineno-$LINENO}: checking Haskell type for gid_t" >&5
+$as_echo_n "checking Haskell type for gid_t... " >&6; }
+    if ${fptools_cv_htype_gid_t+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+
+        fptools_cv_htype_sup_gid_t=yes
+        if ac_fn_c_compute_int "$LINENO" "(gid_t)0.2 - (gid_t)0.4 < 0 ? 0 : 1" "HTYPE_IS_INTEGRAL"        "
+#include <stdbool.h>
+#include <stdio.h>
+#include <stddef.h>
+
+#if HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+
+#if HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+
+#if HAVE_SYS_STAT_H
+# include <sys/stat.h>
+#endif
+
+#if HAVE_FCNTL_H
+# include <fcntl.h>
+#endif
+
+#if HAVE_SIGNAL_H
+# include <signal.h>
+#endif
+
+#if HAVE_TIME_H
+# include <time.h>
+#endif
+
+#if HAVE_TERMIOS_H
+# include <termios.h>
+#endif
+
+#if HAVE_STRING_H
+# include <string.h>
+#endif
+
+#if HAVE_CTYPE_H
+# include <ctype.h>
+#endif
+
+#if HAVE_INTTYPES_H
+# include <inttypes.h>
+#else
+# if HAVE_STDINT_H
+#  include <stdint.h>
+# endif
+#endif
+
+#if HAVE_SYS_RESOURCE_H
+# include <sys/resource.h>
+#endif
+
+#include <stdlib.h>
+"; then :
+
+else
+  HTYPE_IS_INTEGRAL=0
+fi
+
+
+
+        if test "$HTYPE_IS_INTEGRAL" -eq 0
+        then
+                                                            cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+#include <stdbool.h>
+#include <stdio.h>
+#include <stddef.h>
+
+#if HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+
+#if HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+
+#if HAVE_SYS_STAT_H
+# include <sys/stat.h>
+#endif
+
+#if HAVE_FCNTL_H
+# include <fcntl.h>
+#endif
+
+#if HAVE_SIGNAL_H
+# include <signal.h>
+#endif
+
+#if HAVE_TIME_H
+# include <time.h>
+#endif
+
+#if HAVE_TERMIOS_H
+# include <termios.h>
+#endif
+
+#if HAVE_STRING_H
+# include <string.h>
+#endif
+
+#if HAVE_CTYPE_H
+# include <ctype.h>
+#endif
+
+#if HAVE_INTTYPES_H
+# include <inttypes.h>
+#else
+# if HAVE_STDINT_H
+#  include <stdint.h>
+# endif
+#endif
+
+#if HAVE_SYS_RESOURCE_H
+# include <sys/resource.h>
+#endif
+
+#include <stdlib.h>
+
+int
+main ()
+{
+gid_t val; *val;
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  HTYPE_IS_POINTER=yes
+else
+  HTYPE_IS_POINTER=no
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+
+            if test "$HTYPE_IS_POINTER" = yes
+            then
+                fptools_cv_htype_gid_t="Ptr ()"
+            else
+                if ac_fn_c_compute_int "$LINENO" "sizeof(gid_t) == sizeof(float)" "HTYPE_IS_FLOAT"        "
+#include <stdbool.h>
+#include <stdio.h>
+#include <stddef.h>
+
+#if HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+
+#if HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+
+#if HAVE_SYS_STAT_H
+# include <sys/stat.h>
+#endif
+
+#if HAVE_FCNTL_H
+# include <fcntl.h>
+#endif
+
+#if HAVE_SIGNAL_H
+# include <signal.h>
+#endif
+
+#if HAVE_TIME_H
+# include <time.h>
+#endif
+
+#if HAVE_TERMIOS_H
+# include <termios.h>
+#endif
+
+#if HAVE_STRING_H
+# include <string.h>
+#endif
+
+#if HAVE_CTYPE_H
+# include <ctype.h>
+#endif
+
+#if HAVE_INTTYPES_H
+# include <inttypes.h>
+#else
+# if HAVE_STDINT_H
+#  include <stdint.h>
+# endif
+#endif
+
+#if HAVE_SYS_RESOURCE_H
+# include <sys/resource.h>
+#endif
+
+#include <stdlib.h>
+"; then :
+
+else
+  fptools_cv_htype_sup_gid_t=no
+fi
+
+
+                if ac_fn_c_compute_int "$LINENO" "sizeof(gid_t) == sizeof(double)" "HTYPE_IS_DOUBLE"        "
+#include <stdbool.h>
+#include <stdio.h>
+#include <stddef.h>
+
+#if HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+
+#if HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+
+#if HAVE_SYS_STAT_H
+# include <sys/stat.h>
+#endif
+
+#if HAVE_FCNTL_H
+# include <fcntl.h>
+#endif
+
+#if HAVE_SIGNAL_H
+# include <signal.h>
+#endif
+
+#if HAVE_TIME_H
+# include <time.h>
+#endif
+
+#if HAVE_TERMIOS_H
+# include <termios.h>
+#endif
+
+#if HAVE_STRING_H
+# include <string.h>
+#endif
+
+#if HAVE_CTYPE_H
+# include <ctype.h>
+#endif
+
+#if HAVE_INTTYPES_H
+# include <inttypes.h>
+#else
+# if HAVE_STDINT_H
+#  include <stdint.h>
+# endif
+#endif
+
+#if HAVE_SYS_RESOURCE_H
+# include <sys/resource.h>
+#endif
+
+#include <stdlib.h>
+"; then :
+
+else
+  fptools_cv_htype_sup_gid_t=no
+fi
+
+
+                if ac_fn_c_compute_int "$LINENO" "sizeof(gid_t) == sizeof(long double)" "HTYPE_IS_LDOUBLE"        "
+#include <stdbool.h>
+#include <stdio.h>
+#include <stddef.h>
+
+#if HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+
+#if HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+
+#if HAVE_SYS_STAT_H
+# include <sys/stat.h>
+#endif
+
+#if HAVE_FCNTL_H
+# include <fcntl.h>
+#endif
+
+#if HAVE_SIGNAL_H
+# include <signal.h>
+#endif
+
+#if HAVE_TIME_H
+# include <time.h>
+#endif
+
+#if HAVE_TERMIOS_H
+# include <termios.h>
+#endif
+
+#if HAVE_STRING_H
+# include <string.h>
+#endif
+
+#if HAVE_CTYPE_H
+# include <ctype.h>
+#endif
+
+#if HAVE_INTTYPES_H
+# include <inttypes.h>
+#else
+# if HAVE_STDINT_H
+#  include <stdint.h>
+# endif
+#endif
+
+#if HAVE_SYS_RESOURCE_H
+# include <sys/resource.h>
+#endif
+
+#include <stdlib.h>
+"; then :
+
+else
+  fptools_cv_htype_sup_gid_t=no
+fi
+
+
+                if test "$HTYPE_IS_FLOAT" -eq 1
+                then
+                    fptools_cv_htype_gid_t=Float
+                elif test "$HTYPE_IS_DOUBLE" -eq 1
+                then
+                    fptools_cv_htype_gid_t=Double
+                elif test "$HTYPE_IS_LDOUBLE" -eq 1
+                then
+                    fptools_cv_htype_gid_t=LDouble
+                else
+                    fptools_cv_htype_sup_gid_t=no
+                fi
+            fi
+        else
+            if ac_fn_c_compute_int "$LINENO" "((gid_t)(-1)) < ((gid_t)0)" "HTYPE_IS_SIGNED"        "
+#include <stdbool.h>
+#include <stdio.h>
+#include <stddef.h>
+
+#if HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+
+#if HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+
+#if HAVE_SYS_STAT_H
+# include <sys/stat.h>
+#endif
+
+#if HAVE_FCNTL_H
+# include <fcntl.h>
+#endif
+
+#if HAVE_SIGNAL_H
+# include <signal.h>
+#endif
+
+#if HAVE_TIME_H
+# include <time.h>
+#endif
+
+#if HAVE_TERMIOS_H
+# include <termios.h>
+#endif
+
+#if HAVE_STRING_H
+# include <string.h>
+#endif
+
+#if HAVE_CTYPE_H
+# include <ctype.h>
+#endif
+
+#if HAVE_INTTYPES_H
+# include <inttypes.h>
+#else
+# if HAVE_STDINT_H
+#  include <stdint.h>
+# endif
+#endif
+
+#if HAVE_SYS_RESOURCE_H
+# include <sys/resource.h>
+#endif
+
+#include <stdlib.h>
+"; then :
+
+else
+  fptools_cv_htype_sup_gid_t=no
+fi
+
+
+            if ac_fn_c_compute_int "$LINENO" "sizeof(gid_t) * 8" "HTYPE_SIZE"        "
+#include <stdbool.h>
+#include <stdio.h>
+#include <stddef.h>
+
+#if HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+
+#if HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+
+#if HAVE_SYS_STAT_H
+# include <sys/stat.h>
+#endif
+
+#if HAVE_FCNTL_H
+# include <fcntl.h>
+#endif
+
+#if HAVE_SIGNAL_H
+# include <signal.h>
+#endif
+
+#if HAVE_TIME_H
+# include <time.h>
+#endif
+
+#if HAVE_TERMIOS_H
+# include <termios.h>
+#endif
+
+#if HAVE_STRING_H
+# include <string.h>
+#endif
+
+#if HAVE_CTYPE_H
+# include <ctype.h>
+#endif
+
+#if HAVE_INTTYPES_H
+# include <inttypes.h>
+#else
+# if HAVE_STDINT_H
+#  include <stdint.h>
+# endif
+#endif
+
+#if HAVE_SYS_RESOURCE_H
+# include <sys/resource.h>
+#endif
+
+#include <stdlib.h>
+"; then :
+
+else
+  fptools_cv_htype_sup_gid_t=no
+fi
+
+
+            if test "$HTYPE_IS_SIGNED" -eq 0
+            then
+                fptools_cv_htype_gid_t="Word$HTYPE_SIZE"
+            else
+                fptools_cv_htype_gid_t="Int$HTYPE_SIZE"
+            fi
+        fi
+
+fi
+
+    if test "$fptools_cv_htype_sup_gid_t" = no
+    then
+
+        fptools_cv_htype_gid_t=NotReallyAType
+        { $as_echo "$as_me:${as_lineno-$LINENO}: result: not supported" >&5
+$as_echo "not supported" >&6; }
+
+    fi
+
+            if test "$fptools_cv_htype_sup_gid_t" = yes; then
+        { $as_echo "$as_me:${as_lineno-$LINENO}: result: $fptools_cv_htype_gid_t" >&5
+$as_echo "$fptools_cv_htype_gid_t" >&6; }
+
+cat >>confdefs.h <<_ACEOF
+#define HTYPE_GID_T $fptools_cv_htype_gid_t
+_ACEOF
+
+    fi
+
+
+
+
+
+
+
+
+
+
+    { $as_echo "$as_me:${as_lineno-$LINENO}: checking Haskell type for uid_t" >&5
+$as_echo_n "checking Haskell type for uid_t... " >&6; }
+    if ${fptools_cv_htype_uid_t+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+
+        fptools_cv_htype_sup_uid_t=yes
+        if ac_fn_c_compute_int "$LINENO" "(uid_t)0.2 - (uid_t)0.4 < 0 ? 0 : 1" "HTYPE_IS_INTEGRAL"        "
+#include <stdbool.h>
+#include <stdio.h>
+#include <stddef.h>
+
+#if HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+
+#if HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+
+#if HAVE_SYS_STAT_H
+# include <sys/stat.h>
+#endif
+
+#if HAVE_FCNTL_H
+# include <fcntl.h>
+#endif
+
+#if HAVE_SIGNAL_H
+# include <signal.h>
+#endif
+
+#if HAVE_TIME_H
+# include <time.h>
+#endif
+
+#if HAVE_TERMIOS_H
+# include <termios.h>
+#endif
+
+#if HAVE_STRING_H
+# include <string.h>
+#endif
+
+#if HAVE_CTYPE_H
+# include <ctype.h>
+#endif
+
+#if HAVE_INTTYPES_H
+# include <inttypes.h>
+#else
+# if HAVE_STDINT_H
+#  include <stdint.h>
+# endif
+#endif
+
+#if HAVE_SYS_RESOURCE_H
+# include <sys/resource.h>
+#endif
+
+#include <stdlib.h>
+"; then :
+
+else
+  HTYPE_IS_INTEGRAL=0
+fi
+
+
+
+        if test "$HTYPE_IS_INTEGRAL" -eq 0
+        then
+                                                            cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+#include <stdbool.h>
+#include <stdio.h>
+#include <stddef.h>
+
+#if HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+
+#if HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+
+#if HAVE_SYS_STAT_H
+# include <sys/stat.h>
+#endif
+
+#if HAVE_FCNTL_H
+# include <fcntl.h>
+#endif
+
+#if HAVE_SIGNAL_H
+# include <signal.h>
+#endif
+
+#if HAVE_TIME_H
+# include <time.h>
+#endif
+
+#if HAVE_TERMIOS_H
+# include <termios.h>
+#endif
+
+#if HAVE_STRING_H
+# include <string.h>
+#endif
+
+#if HAVE_CTYPE_H
+# include <ctype.h>
+#endif
+
+#if HAVE_INTTYPES_H
+# include <inttypes.h>
+#else
+# if HAVE_STDINT_H
+#  include <stdint.h>
+# endif
+#endif
+
+#if HAVE_SYS_RESOURCE_H
+# include <sys/resource.h>
+#endif
+
+#include <stdlib.h>
+
+int
+main ()
+{
+uid_t val; *val;
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  HTYPE_IS_POINTER=yes
+else
+  HTYPE_IS_POINTER=no
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+
+            if test "$HTYPE_IS_POINTER" = yes
+            then
+                fptools_cv_htype_uid_t="Ptr ()"
+            else
+                if ac_fn_c_compute_int "$LINENO" "sizeof(uid_t) == sizeof(float)" "HTYPE_IS_FLOAT"        "
+#include <stdbool.h>
+#include <stdio.h>
+#include <stddef.h>
+
+#if HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+
+#if HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+
+#if HAVE_SYS_STAT_H
+# include <sys/stat.h>
+#endif
+
+#if HAVE_FCNTL_H
+# include <fcntl.h>
+#endif
+
+#if HAVE_SIGNAL_H
+# include <signal.h>
+#endif
+
+#if HAVE_TIME_H
+# include <time.h>
+#endif
+
+#if HAVE_TERMIOS_H
+# include <termios.h>
+#endif
+
+#if HAVE_STRING_H
+# include <string.h>
+#endif
+
+#if HAVE_CTYPE_H
+# include <ctype.h>
+#endif
+
+#if HAVE_INTTYPES_H
+# include <inttypes.h>
+#else
+# if HAVE_STDINT_H
+#  include <stdint.h>
+# endif
+#endif
+
+#if HAVE_SYS_RESOURCE_H
+# include <sys/resource.h>
+#endif
+
+#include <stdlib.h>
+"; then :
+
+else
+  fptools_cv_htype_sup_uid_t=no
+fi
+
+
+                if ac_fn_c_compute_int "$LINENO" "sizeof(uid_t) == sizeof(double)" "HTYPE_IS_DOUBLE"        "
+#include <stdbool.h>
+#include <stdio.h>
+#include <stddef.h>
+
+#if HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+
+#if HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+
+#if HAVE_SYS_STAT_H
+# include <sys/stat.h>
+#endif
+
+#if HAVE_FCNTL_H
+# include <fcntl.h>
+#endif
+
+#if HAVE_SIGNAL_H
+# include <signal.h>
+#endif
+
+#if HAVE_TIME_H
+# include <time.h>
+#endif
+
+#if HAVE_TERMIOS_H
+# include <termios.h>
+#endif
+
+#if HAVE_STRING_H
+# include <string.h>
+#endif
+
+#if HAVE_CTYPE_H
+# include <ctype.h>
+#endif
+
+#if HAVE_INTTYPES_H
+# include <inttypes.h>
+#else
+# if HAVE_STDINT_H
+#  include <stdint.h>
+# endif
+#endif
+
+#if HAVE_SYS_RESOURCE_H
+# include <sys/resource.h>
+#endif
+
+#include <stdlib.h>
+"; then :
+
+else
+  fptools_cv_htype_sup_uid_t=no
+fi
+
+
+                if ac_fn_c_compute_int "$LINENO" "sizeof(uid_t) == sizeof(long double)" "HTYPE_IS_LDOUBLE"        "
+#include <stdbool.h>
+#include <stdio.h>
+#include <stddef.h>
+
+#if HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+
+#if HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+
+#if HAVE_SYS_STAT_H
+# include <sys/stat.h>
+#endif
+
+#if HAVE_FCNTL_H
+# include <fcntl.h>
+#endif
+
+#if HAVE_SIGNAL_H
+# include <signal.h>
+#endif
+
+#if HAVE_TIME_H
+# include <time.h>
+#endif
+
+#if HAVE_TERMIOS_H
+# include <termios.h>
+#endif
+
+#if HAVE_STRING_H
+# include <string.h>
+#endif
+
+#if HAVE_CTYPE_H
+# include <ctype.h>
+#endif
+
+#if HAVE_INTTYPES_H
+# include <inttypes.h>
+#else
+# if HAVE_STDINT_H
+#  include <stdint.h>
+# endif
+#endif
+
+#if HAVE_SYS_RESOURCE_H
+# include <sys/resource.h>
+#endif
+
+#include <stdlib.h>
+"; then :
+
+else
+  fptools_cv_htype_sup_uid_t=no
+fi
+
+
+                if test "$HTYPE_IS_FLOAT" -eq 1
+                then
+                    fptools_cv_htype_uid_t=Float
+                elif test "$HTYPE_IS_DOUBLE" -eq 1
+                then
+                    fptools_cv_htype_uid_t=Double
+                elif test "$HTYPE_IS_LDOUBLE" -eq 1
+                then
+                    fptools_cv_htype_uid_t=LDouble
+                else
+                    fptools_cv_htype_sup_uid_t=no
+                fi
+            fi
+        else
+            if ac_fn_c_compute_int "$LINENO" "((uid_t)(-1)) < ((uid_t)0)" "HTYPE_IS_SIGNED"        "
+#include <stdbool.h>
+#include <stdio.h>
+#include <stddef.h>
+
+#if HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+
+#if HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+
+#if HAVE_SYS_STAT_H
+# include <sys/stat.h>
+#endif
+
+#if HAVE_FCNTL_H
+# include <fcntl.h>
+#endif
+
+#if HAVE_SIGNAL_H
+# include <signal.h>
+#endif
+
+#if HAVE_TIME_H
+# include <time.h>
+#endif
+
+#if HAVE_TERMIOS_H
+# include <termios.h>
+#endif
+
+#if HAVE_STRING_H
+# include <string.h>
+#endif
+
+#if HAVE_CTYPE_H
+# include <ctype.h>
+#endif
+
+#if HAVE_INTTYPES_H
+# include <inttypes.h>
+#else
+# if HAVE_STDINT_H
+#  include <stdint.h>
+# endif
+#endif
+
+#if HAVE_SYS_RESOURCE_H
+# include <sys/resource.h>
+#endif
+
+#include <stdlib.h>
+"; then :
+
+else
+  fptools_cv_htype_sup_uid_t=no
+fi
+
+
+            if ac_fn_c_compute_int "$LINENO" "sizeof(uid_t) * 8" "HTYPE_SIZE"        "
+#include <stdbool.h>
+#include <stdio.h>
+#include <stddef.h>
+
+#if HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+
+#if HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+
+#if HAVE_SYS_STAT_H
+# include <sys/stat.h>
+#endif
+
+#if HAVE_FCNTL_H
+# include <fcntl.h>
+#endif
+
+#if HAVE_SIGNAL_H
+# include <signal.h>
+#endif
+
+#if HAVE_TIME_H
+# include <time.h>
+#endif
+
+#if HAVE_TERMIOS_H
+# include <termios.h>
+#endif
+
+#if HAVE_STRING_H
+# include <string.h>
+#endif
+
+#if HAVE_CTYPE_H
+# include <ctype.h>
+#endif
+
+#if HAVE_INTTYPES_H
+# include <inttypes.h>
+#else
+# if HAVE_STDINT_H
+#  include <stdint.h>
+# endif
+#endif
+
+#if HAVE_SYS_RESOURCE_H
+# include <sys/resource.h>
+#endif
+
+#include <stdlib.h>
+"; then :
+
+else
+  fptools_cv_htype_sup_uid_t=no
+fi
+
+
+            if test "$HTYPE_IS_SIGNED" -eq 0
+            then
+                fptools_cv_htype_uid_t="Word$HTYPE_SIZE"
+            else
+                fptools_cv_htype_uid_t="Int$HTYPE_SIZE"
+            fi
+        fi
+
+fi
+
+    if test "$fptools_cv_htype_sup_uid_t" = no
+    then
+
+        fptools_cv_htype_uid_t=NotReallyAType
+        { $as_echo "$as_me:${as_lineno-$LINENO}: result: not supported" >&5
+$as_echo "not supported" >&6; }
+
+    fi
+
+            if test "$fptools_cv_htype_sup_uid_t" = yes; then
+        { $as_echo "$as_me:${as_lineno-$LINENO}: result: $fptools_cv_htype_uid_t" >&5
+$as_echo "$fptools_cv_htype_uid_t" >&6; }
+
+cat >>confdefs.h <<_ACEOF
+#define HTYPE_UID_T $fptools_cv_htype_uid_t
+_ACEOF
+
+    fi
+
+
+
+
+
+
+
+
+
+
+    { $as_echo "$as_me:${as_lineno-$LINENO}: checking Haskell type for cc_t" >&5
+$as_echo_n "checking Haskell type for cc_t... " >&6; }
+    if ${fptools_cv_htype_cc_t+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+
+        fptools_cv_htype_sup_cc_t=yes
+        if ac_fn_c_compute_int "$LINENO" "(cc_t)0.2 - (cc_t)0.4 < 0 ? 0 : 1" "HTYPE_IS_INTEGRAL"        "
+#include <stdbool.h>
+#include <stdio.h>
+#include <stddef.h>
+
+#if HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+
+#if HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+
+#if HAVE_SYS_STAT_H
+# include <sys/stat.h>
+#endif
+
+#if HAVE_FCNTL_H
+# include <fcntl.h>
+#endif
+
+#if HAVE_SIGNAL_H
+# include <signal.h>
+#endif
+
+#if HAVE_TIME_H
+# include <time.h>
+#endif
+
+#if HAVE_TERMIOS_H
+# include <termios.h>
+#endif
+
+#if HAVE_STRING_H
+# include <string.h>
+#endif
+
+#if HAVE_CTYPE_H
+# include <ctype.h>
+#endif
+
+#if HAVE_INTTYPES_H
+# include <inttypes.h>
+#else
+# if HAVE_STDINT_H
+#  include <stdint.h>
+# endif
+#endif
+
+#if HAVE_SYS_RESOURCE_H
+# include <sys/resource.h>
+#endif
+
+#include <stdlib.h>
+"; then :
+
+else
+  HTYPE_IS_INTEGRAL=0
+fi
+
+
+
+        if test "$HTYPE_IS_INTEGRAL" -eq 0
+        then
+                                                            cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+#include <stdbool.h>
+#include <stdio.h>
+#include <stddef.h>
+
+#if HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+
+#if HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+
+#if HAVE_SYS_STAT_H
+# include <sys/stat.h>
+#endif
+
+#if HAVE_FCNTL_H
+# include <fcntl.h>
+#endif
+
+#if HAVE_SIGNAL_H
+# include <signal.h>
+#endif
+
+#if HAVE_TIME_H
+# include <time.h>
+#endif
+
+#if HAVE_TERMIOS_H
+# include <termios.h>
+#endif
+
+#if HAVE_STRING_H
+# include <string.h>
+#endif
+
+#if HAVE_CTYPE_H
+# include <ctype.h>
+#endif
+
+#if HAVE_INTTYPES_H
+# include <inttypes.h>
+#else
+# if HAVE_STDINT_H
+#  include <stdint.h>
+# endif
+#endif
+
+#if HAVE_SYS_RESOURCE_H
+# include <sys/resource.h>
+#endif
+
+#include <stdlib.h>
+
+int
+main ()
+{
+cc_t val; *val;
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  HTYPE_IS_POINTER=yes
+else
+  HTYPE_IS_POINTER=no
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+
+            if test "$HTYPE_IS_POINTER" = yes
+            then
+                fptools_cv_htype_cc_t="Ptr ()"
+            else
+                if ac_fn_c_compute_int "$LINENO" "sizeof(cc_t) == sizeof(float)" "HTYPE_IS_FLOAT"        "
+#include <stdbool.h>
+#include <stdio.h>
+#include <stddef.h>
+
+#if HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+
+#if HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+
+#if HAVE_SYS_STAT_H
+# include <sys/stat.h>
+#endif
+
+#if HAVE_FCNTL_H
+# include <fcntl.h>
+#endif
+
+#if HAVE_SIGNAL_H
+# include <signal.h>
+#endif
+
+#if HAVE_TIME_H
+# include <time.h>
+#endif
+
+#if HAVE_TERMIOS_H
+# include <termios.h>
+#endif
+
+#if HAVE_STRING_H
+# include <string.h>
+#endif
+
+#if HAVE_CTYPE_H
+# include <ctype.h>
+#endif
+
+#if HAVE_INTTYPES_H
+# include <inttypes.h>
+#else
+# if HAVE_STDINT_H
+#  include <stdint.h>
+# endif
+#endif
+
+#if HAVE_SYS_RESOURCE_H
+# include <sys/resource.h>
+#endif
+
+#include <stdlib.h>
+"; then :
+
+else
+  fptools_cv_htype_sup_cc_t=no
+fi
+
+
+                if ac_fn_c_compute_int "$LINENO" "sizeof(cc_t) == sizeof(double)" "HTYPE_IS_DOUBLE"        "
+#include <stdbool.h>
+#include <stdio.h>
+#include <stddef.h>
+
+#if HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+
+#if HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+
+#if HAVE_SYS_STAT_H
+# include <sys/stat.h>
+#endif
+
+#if HAVE_FCNTL_H
+# include <fcntl.h>
+#endif
+
+#if HAVE_SIGNAL_H
+# include <signal.h>
+#endif
+
+#if HAVE_TIME_H
+# include <time.h>
+#endif
+
+#if HAVE_TERMIOS_H
+# include <termios.h>
+#endif
+
+#if HAVE_STRING_H
+# include <string.h>
+#endif
+
+#if HAVE_CTYPE_H
+# include <ctype.h>
+#endif
+
+#if HAVE_INTTYPES_H
+# include <inttypes.h>
+#else
+# if HAVE_STDINT_H
+#  include <stdint.h>
+# endif
+#endif
+
+#if HAVE_SYS_RESOURCE_H
+# include <sys/resource.h>
+#endif
+
+#include <stdlib.h>
+"; then :
+
+else
+  fptools_cv_htype_sup_cc_t=no
+fi
+
+
+                if ac_fn_c_compute_int "$LINENO" "sizeof(cc_t) == sizeof(long double)" "HTYPE_IS_LDOUBLE"        "
+#include <stdbool.h>
+#include <stdio.h>
+#include <stddef.h>
+
+#if HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+
+#if HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+
+#if HAVE_SYS_STAT_H
+# include <sys/stat.h>
+#endif
+
+#if HAVE_FCNTL_H
+# include <fcntl.h>
+#endif
+
+#if HAVE_SIGNAL_H
+# include <signal.h>
+#endif
+
+#if HAVE_TIME_H
+# include <time.h>
+#endif
+
+#if HAVE_TERMIOS_H
+# include <termios.h>
+#endif
+
+#if HAVE_STRING_H
+# include <string.h>
+#endif
+
+#if HAVE_CTYPE_H
+# include <ctype.h>
+#endif
+
+#if HAVE_INTTYPES_H
+# include <inttypes.h>
+#else
+# if HAVE_STDINT_H
+#  include <stdint.h>
+# endif
+#endif
+
+#if HAVE_SYS_RESOURCE_H
+# include <sys/resource.h>
+#endif
+
+#include <stdlib.h>
+"; then :
+
+else
+  fptools_cv_htype_sup_cc_t=no
+fi
+
+
+                if test "$HTYPE_IS_FLOAT" -eq 1
+                then
+                    fptools_cv_htype_cc_t=Float
+                elif test "$HTYPE_IS_DOUBLE" -eq 1
+                then
+                    fptools_cv_htype_cc_t=Double
+                elif test "$HTYPE_IS_LDOUBLE" -eq 1
+                then
+                    fptools_cv_htype_cc_t=LDouble
+                else
+                    fptools_cv_htype_sup_cc_t=no
+                fi
+            fi
+        else
+            if ac_fn_c_compute_int "$LINENO" "((cc_t)(-1)) < ((cc_t)0)" "HTYPE_IS_SIGNED"        "
+#include <stdbool.h>
+#include <stdio.h>
+#include <stddef.h>
+
+#if HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+
+#if HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+
+#if HAVE_SYS_STAT_H
+# include <sys/stat.h>
+#endif
+
+#if HAVE_FCNTL_H
+# include <fcntl.h>
+#endif
+
+#if HAVE_SIGNAL_H
+# include <signal.h>
+#endif
+
+#if HAVE_TIME_H
+# include <time.h>
+#endif
+
+#if HAVE_TERMIOS_H
+# include <termios.h>
+#endif
+
+#if HAVE_STRING_H
+# include <string.h>
+#endif
+
+#if HAVE_CTYPE_H
+# include <ctype.h>
+#endif
+
+#if HAVE_INTTYPES_H
+# include <inttypes.h>
+#else
+# if HAVE_STDINT_H
+#  include <stdint.h>
+# endif
+#endif
+
+#if HAVE_SYS_RESOURCE_H
+# include <sys/resource.h>
+#endif
+
+#include <stdlib.h>
+"; then :
+
+else
+  fptools_cv_htype_sup_cc_t=no
+fi
+
+
+            if ac_fn_c_compute_int "$LINENO" "sizeof(cc_t) * 8" "HTYPE_SIZE"        "
+#include <stdbool.h>
+#include <stdio.h>
+#include <stddef.h>
+
+#if HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+
+#if HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+
+#if HAVE_SYS_STAT_H
+# include <sys/stat.h>
+#endif
+
+#if HAVE_FCNTL_H
+# include <fcntl.h>
+#endif
+
+#if HAVE_SIGNAL_H
+# include <signal.h>
+#endif
+
+#if HAVE_TIME_H
+# include <time.h>
+#endif
+
+#if HAVE_TERMIOS_H
+# include <termios.h>
+#endif
+
+#if HAVE_STRING_H
+# include <string.h>
+#endif
+
+#if HAVE_CTYPE_H
+# include <ctype.h>
+#endif
+
+#if HAVE_INTTYPES_H
+# include <inttypes.h>
+#else
+# if HAVE_STDINT_H
+#  include <stdint.h>
+# endif
+#endif
+
+#if HAVE_SYS_RESOURCE_H
+# include <sys/resource.h>
+#endif
+
+#include <stdlib.h>
+"; then :
+
+else
+  fptools_cv_htype_sup_cc_t=no
+fi
+
+
+            if test "$HTYPE_IS_SIGNED" -eq 0
+            then
+                fptools_cv_htype_cc_t="Word$HTYPE_SIZE"
+            else
+                fptools_cv_htype_cc_t="Int$HTYPE_SIZE"
+            fi
+        fi
+
+fi
+
+    if test "$fptools_cv_htype_sup_cc_t" = no
+    then
+
+        fptools_cv_htype_cc_t=NotReallyAType
+        { $as_echo "$as_me:${as_lineno-$LINENO}: result: not supported" >&5
+$as_echo "not supported" >&6; }
+
+    fi
+
+            if test "$fptools_cv_htype_sup_cc_t" = yes; then
+        { $as_echo "$as_me:${as_lineno-$LINENO}: result: $fptools_cv_htype_cc_t" >&5
+$as_echo "$fptools_cv_htype_cc_t" >&6; }
+
+cat >>confdefs.h <<_ACEOF
+#define HTYPE_CC_T $fptools_cv_htype_cc_t
+_ACEOF
+
+    fi
+
+
+
+
+
+
+
+
+
+
+    { $as_echo "$as_me:${as_lineno-$LINENO}: checking Haskell type for speed_t" >&5
+$as_echo_n "checking Haskell type for speed_t... " >&6; }
+    if ${fptools_cv_htype_speed_t+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+
+        fptools_cv_htype_sup_speed_t=yes
+        if ac_fn_c_compute_int "$LINENO" "(speed_t)0.2 - (speed_t)0.4 < 0 ? 0 : 1" "HTYPE_IS_INTEGRAL"        "
+#include <stdbool.h>
+#include <stdio.h>
+#include <stddef.h>
+
+#if HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+
+#if HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+
+#if HAVE_SYS_STAT_H
+# include <sys/stat.h>
+#endif
+
+#if HAVE_FCNTL_H
+# include <fcntl.h>
+#endif
+
+#if HAVE_SIGNAL_H
+# include <signal.h>
+#endif
+
+#if HAVE_TIME_H
+# include <time.h>
+#endif
+
+#if HAVE_TERMIOS_H
+# include <termios.h>
+#endif
+
+#if HAVE_STRING_H
+# include <string.h>
+#endif
+
+#if HAVE_CTYPE_H
+# include <ctype.h>
+#endif
+
+#if HAVE_INTTYPES_H
+# include <inttypes.h>
+#else
+# if HAVE_STDINT_H
+#  include <stdint.h>
+# endif
+#endif
+
+#if HAVE_SYS_RESOURCE_H
+# include <sys/resource.h>
+#endif
+
+#include <stdlib.h>
+"; then :
+
+else
+  HTYPE_IS_INTEGRAL=0
+fi
+
+
+
+        if test "$HTYPE_IS_INTEGRAL" -eq 0
+        then
+                                                            cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+#include <stdbool.h>
+#include <stdio.h>
+#include <stddef.h>
+
+#if HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+
+#if HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+
+#if HAVE_SYS_STAT_H
+# include <sys/stat.h>
+#endif
+
+#if HAVE_FCNTL_H
+# include <fcntl.h>
+#endif
+
+#if HAVE_SIGNAL_H
+# include <signal.h>
+#endif
+
+#if HAVE_TIME_H
+# include <time.h>
+#endif
+
+#if HAVE_TERMIOS_H
+# include <termios.h>
+#endif
+
+#if HAVE_STRING_H
+# include <string.h>
+#endif
+
+#if HAVE_CTYPE_H
+# include <ctype.h>
+#endif
+
+#if HAVE_INTTYPES_H
+# include <inttypes.h>
+#else
+# if HAVE_STDINT_H
+#  include <stdint.h>
+# endif
+#endif
+
+#if HAVE_SYS_RESOURCE_H
+# include <sys/resource.h>
+#endif
+
+#include <stdlib.h>
+
+int
+main ()
+{
+speed_t val; *val;
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  HTYPE_IS_POINTER=yes
+else
+  HTYPE_IS_POINTER=no
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+
+            if test "$HTYPE_IS_POINTER" = yes
+            then
+                fptools_cv_htype_speed_t="Ptr ()"
+            else
+                if ac_fn_c_compute_int "$LINENO" "sizeof(speed_t) == sizeof(float)" "HTYPE_IS_FLOAT"        "
+#include <stdbool.h>
+#include <stdio.h>
+#include <stddef.h>
+
+#if HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+
+#if HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+
+#if HAVE_SYS_STAT_H
+# include <sys/stat.h>
+#endif
+
+#if HAVE_FCNTL_H
+# include <fcntl.h>
+#endif
+
+#if HAVE_SIGNAL_H
+# include <signal.h>
+#endif
+
+#if HAVE_TIME_H
+# include <time.h>
+#endif
+
+#if HAVE_TERMIOS_H
+# include <termios.h>
+#endif
+
+#if HAVE_STRING_H
+# include <string.h>
+#endif
+
+#if HAVE_CTYPE_H
+# include <ctype.h>
+#endif
+
+#if HAVE_INTTYPES_H
+# include <inttypes.h>
+#else
+# if HAVE_STDINT_H
+#  include <stdint.h>
+# endif
+#endif
+
+#if HAVE_SYS_RESOURCE_H
+# include <sys/resource.h>
+#endif
+
+#include <stdlib.h>
+"; then :
+
+else
+  fptools_cv_htype_sup_speed_t=no
+fi
+
+
+                if ac_fn_c_compute_int "$LINENO" "sizeof(speed_t) == sizeof(double)" "HTYPE_IS_DOUBLE"        "
+#include <stdbool.h>
+#include <stdio.h>
+#include <stddef.h>
+
+#if HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+
+#if HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+
+#if HAVE_SYS_STAT_H
+# include <sys/stat.h>
+#endif
+
+#if HAVE_FCNTL_H
+# include <fcntl.h>
+#endif
+
+#if HAVE_SIGNAL_H
+# include <signal.h>
+#endif
+
+#if HAVE_TIME_H
+# include <time.h>
+#endif
+
+#if HAVE_TERMIOS_H
+# include <termios.h>
+#endif
+
+#if HAVE_STRING_H
+# include <string.h>
+#endif
+
+#if HAVE_CTYPE_H
+# include <ctype.h>
+#endif
+
+#if HAVE_INTTYPES_H
+# include <inttypes.h>
+#else
+# if HAVE_STDINT_H
+#  include <stdint.h>
+# endif
+#endif
+
+#if HAVE_SYS_RESOURCE_H
+# include <sys/resource.h>
+#endif
+
+#include <stdlib.h>
+"; then :
+
+else
+  fptools_cv_htype_sup_speed_t=no
+fi
+
+
+                if ac_fn_c_compute_int "$LINENO" "sizeof(speed_t) == sizeof(long double)" "HTYPE_IS_LDOUBLE"        "
+#include <stdbool.h>
+#include <stdio.h>
+#include <stddef.h>
+
+#if HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+
+#if HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+
+#if HAVE_SYS_STAT_H
+# include <sys/stat.h>
+#endif
+
+#if HAVE_FCNTL_H
+# include <fcntl.h>
+#endif
+
+#if HAVE_SIGNAL_H
+# include <signal.h>
+#endif
+
+#if HAVE_TIME_H
+# include <time.h>
+#endif
+
+#if HAVE_TERMIOS_H
+# include <termios.h>
+#endif
+
+#if HAVE_STRING_H
+# include <string.h>
+#endif
+
+#if HAVE_CTYPE_H
+# include <ctype.h>
+#endif
+
+#if HAVE_INTTYPES_H
+# include <inttypes.h>
+#else
+# if HAVE_STDINT_H
+#  include <stdint.h>
+# endif
+#endif
+
+#if HAVE_SYS_RESOURCE_H
+# include <sys/resource.h>
+#endif
+
+#include <stdlib.h>
+"; then :
+
+else
+  fptools_cv_htype_sup_speed_t=no
+fi
+
+
+                if test "$HTYPE_IS_FLOAT" -eq 1
+                then
+                    fptools_cv_htype_speed_t=Float
+                elif test "$HTYPE_IS_DOUBLE" -eq 1
+                then
+                    fptools_cv_htype_speed_t=Double
+                elif test "$HTYPE_IS_LDOUBLE" -eq 1
+                then
+                    fptools_cv_htype_speed_t=LDouble
+                else
+                    fptools_cv_htype_sup_speed_t=no
+                fi
+            fi
+        else
+            if ac_fn_c_compute_int "$LINENO" "((speed_t)(-1)) < ((speed_t)0)" "HTYPE_IS_SIGNED"        "
+#include <stdbool.h>
+#include <stdio.h>
+#include <stddef.h>
+
+#if HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+
+#if HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+
+#if HAVE_SYS_STAT_H
+# include <sys/stat.h>
+#endif
+
+#if HAVE_FCNTL_H
+# include <fcntl.h>
+#endif
+
+#if HAVE_SIGNAL_H
+# include <signal.h>
+#endif
+
+#if HAVE_TIME_H
+# include <time.h>
+#endif
+
+#if HAVE_TERMIOS_H
+# include <termios.h>
+#endif
+
+#if HAVE_STRING_H
+# include <string.h>
+#endif
+
+#if HAVE_CTYPE_H
+# include <ctype.h>
+#endif
+
+#if HAVE_INTTYPES_H
+# include <inttypes.h>
+#else
+# if HAVE_STDINT_H
+#  include <stdint.h>
+# endif
+#endif
+
+#if HAVE_SYS_RESOURCE_H
+# include <sys/resource.h>
+#endif
+
+#include <stdlib.h>
+"; then :
+
+else
+  fptools_cv_htype_sup_speed_t=no
+fi
+
+
+            if ac_fn_c_compute_int "$LINENO" "sizeof(speed_t) * 8" "HTYPE_SIZE"        "
+#include <stdbool.h>
+#include <stdio.h>
+#include <stddef.h>
+
+#if HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+
+#if HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+
+#if HAVE_SYS_STAT_H
+# include <sys/stat.h>
+#endif
+
+#if HAVE_FCNTL_H
+# include <fcntl.h>
+#endif
+
+#if HAVE_SIGNAL_H
+# include <signal.h>
+#endif
+
+#if HAVE_TIME_H
+# include <time.h>
+#endif
+
+#if HAVE_TERMIOS_H
+# include <termios.h>
+#endif
+
+#if HAVE_STRING_H
+# include <string.h>
+#endif
+
+#if HAVE_CTYPE_H
+# include <ctype.h>
+#endif
+
+#if HAVE_INTTYPES_H
+# include <inttypes.h>
+#else
+# if HAVE_STDINT_H
+#  include <stdint.h>
+# endif
+#endif
+
+#if HAVE_SYS_RESOURCE_H
+# include <sys/resource.h>
+#endif
+
+#include <stdlib.h>
+"; then :
+
+else
+  fptools_cv_htype_sup_speed_t=no
+fi
+
+
+            if test "$HTYPE_IS_SIGNED" -eq 0
+            then
+                fptools_cv_htype_speed_t="Word$HTYPE_SIZE"
+            else
+                fptools_cv_htype_speed_t="Int$HTYPE_SIZE"
+            fi
+        fi
+
+fi
+
+    if test "$fptools_cv_htype_sup_speed_t" = no
+    then
+
+        fptools_cv_htype_speed_t=NotReallyAType
+        { $as_echo "$as_me:${as_lineno-$LINENO}: result: not supported" >&5
+$as_echo "not supported" >&6; }
+
+    fi
+
+            if test "$fptools_cv_htype_sup_speed_t" = yes; then
+        { $as_echo "$as_me:${as_lineno-$LINENO}: result: $fptools_cv_htype_speed_t" >&5
+$as_echo "$fptools_cv_htype_speed_t" >&6; }
+
+cat >>confdefs.h <<_ACEOF
+#define HTYPE_SPEED_T $fptools_cv_htype_speed_t
+_ACEOF
+
+    fi
+
+
+
+
+
+
+
+
+
+
+    { $as_echo "$as_me:${as_lineno-$LINENO}: checking Haskell type for tcflag_t" >&5
+$as_echo_n "checking Haskell type for tcflag_t... " >&6; }
+    if ${fptools_cv_htype_tcflag_t+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+
+        fptools_cv_htype_sup_tcflag_t=yes
+        if ac_fn_c_compute_int "$LINENO" "(tcflag_t)0.2 - (tcflag_t)0.4 < 0 ? 0 : 1" "HTYPE_IS_INTEGRAL"        "
+#include <stdbool.h>
+#include <stdio.h>
+#include <stddef.h>
+
+#if HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+
+#if HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+
+#if HAVE_SYS_STAT_H
+# include <sys/stat.h>
+#endif
+
+#if HAVE_FCNTL_H
+# include <fcntl.h>
+#endif
+
+#if HAVE_SIGNAL_H
+# include <signal.h>
+#endif
+
+#if HAVE_TIME_H
+# include <time.h>
+#endif
+
+#if HAVE_TERMIOS_H
+# include <termios.h>
+#endif
+
+#if HAVE_STRING_H
+# include <string.h>
+#endif
+
+#if HAVE_CTYPE_H
+# include <ctype.h>
+#endif
+
+#if HAVE_INTTYPES_H
+# include <inttypes.h>
+#else
+# if HAVE_STDINT_H
+#  include <stdint.h>
+# endif
+#endif
+
+#if HAVE_SYS_RESOURCE_H
+# include <sys/resource.h>
+#endif
+
+#include <stdlib.h>
+"; then :
+
+else
+  HTYPE_IS_INTEGRAL=0
+fi
+
+
+
+        if test "$HTYPE_IS_INTEGRAL" -eq 0
+        then
+                                                            cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+#include <stdbool.h>
+#include <stdio.h>
+#include <stddef.h>
+
+#if HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+
+#if HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+
+#if HAVE_SYS_STAT_H
+# include <sys/stat.h>
+#endif
+
+#if HAVE_FCNTL_H
+# include <fcntl.h>
+#endif
+
+#if HAVE_SIGNAL_H
+# include <signal.h>
+#endif
+
+#if HAVE_TIME_H
+# include <time.h>
+#endif
+
+#if HAVE_TERMIOS_H
+# include <termios.h>
+#endif
+
+#if HAVE_STRING_H
+# include <string.h>
+#endif
+
+#if HAVE_CTYPE_H
+# include <ctype.h>
+#endif
+
+#if HAVE_INTTYPES_H
+# include <inttypes.h>
+#else
+# if HAVE_STDINT_H
+#  include <stdint.h>
+# endif
+#endif
+
+#if HAVE_SYS_RESOURCE_H
+# include <sys/resource.h>
+#endif
+
+#include <stdlib.h>
+
+int
+main ()
+{
+tcflag_t val; *val;
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  HTYPE_IS_POINTER=yes
+else
+  HTYPE_IS_POINTER=no
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+
+            if test "$HTYPE_IS_POINTER" = yes
+            then
+                fptools_cv_htype_tcflag_t="Ptr ()"
+            else
+                if ac_fn_c_compute_int "$LINENO" "sizeof(tcflag_t) == sizeof(float)" "HTYPE_IS_FLOAT"        "
+#include <stdbool.h>
+#include <stdio.h>
+#include <stddef.h>
+
+#if HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+
+#if HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+
+#if HAVE_SYS_STAT_H
+# include <sys/stat.h>
+#endif
+
+#if HAVE_FCNTL_H
+# include <fcntl.h>
+#endif
+
+#if HAVE_SIGNAL_H
+# include <signal.h>
+#endif
+
+#if HAVE_TIME_H
+# include <time.h>
+#endif
+
+#if HAVE_TERMIOS_H
+# include <termios.h>
+#endif
+
+#if HAVE_STRING_H
+# include <string.h>
+#endif
+
+#if HAVE_CTYPE_H
+# include <ctype.h>
+#endif
+
+#if HAVE_INTTYPES_H
+# include <inttypes.h>
+#else
+# if HAVE_STDINT_H
+#  include <stdint.h>
+# endif
+#endif
+
+#if HAVE_SYS_RESOURCE_H
+# include <sys/resource.h>
+#endif
+
+#include <stdlib.h>
+"; then :
+
+else
+  fptools_cv_htype_sup_tcflag_t=no
+fi
+
+
+                if ac_fn_c_compute_int "$LINENO" "sizeof(tcflag_t) == sizeof(double)" "HTYPE_IS_DOUBLE"        "
+#include <stdbool.h>
+#include <stdio.h>
+#include <stddef.h>
+
+#if HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+
+#if HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+
+#if HAVE_SYS_STAT_H
+# include <sys/stat.h>
+#endif
+
+#if HAVE_FCNTL_H
+# include <fcntl.h>
+#endif
+
+#if HAVE_SIGNAL_H
+# include <signal.h>
+#endif
+
+#if HAVE_TIME_H
+# include <time.h>
+#endif
+
+#if HAVE_TERMIOS_H
+# include <termios.h>
+#endif
+
+#if HAVE_STRING_H
+# include <string.h>
+#endif
+
+#if HAVE_CTYPE_H
+# include <ctype.h>
+#endif
+
+#if HAVE_INTTYPES_H
+# include <inttypes.h>
+#else
+# if HAVE_STDINT_H
+#  include <stdint.h>
+# endif
+#endif
+
+#if HAVE_SYS_RESOURCE_H
+# include <sys/resource.h>
+#endif
+
+#include <stdlib.h>
+"; then :
+
+else
+  fptools_cv_htype_sup_tcflag_t=no
+fi
+
+
+                if ac_fn_c_compute_int "$LINENO" "sizeof(tcflag_t) == sizeof(long double)" "HTYPE_IS_LDOUBLE"        "
+#include <stdbool.h>
+#include <stdio.h>
+#include <stddef.h>
+
+#if HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+
+#if HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+
+#if HAVE_SYS_STAT_H
+# include <sys/stat.h>
+#endif
+
+#if HAVE_FCNTL_H
+# include <fcntl.h>
+#endif
+
+#if HAVE_SIGNAL_H
+# include <signal.h>
+#endif
+
+#if HAVE_TIME_H
+# include <time.h>
+#endif
+
+#if HAVE_TERMIOS_H
+# include <termios.h>
+#endif
+
+#if HAVE_STRING_H
+# include <string.h>
+#endif
+
+#if HAVE_CTYPE_H
+# include <ctype.h>
+#endif
+
+#if HAVE_INTTYPES_H
+# include <inttypes.h>
+#else
+# if HAVE_STDINT_H
+#  include <stdint.h>
+# endif
+#endif
+
+#if HAVE_SYS_RESOURCE_H
+# include <sys/resource.h>
+#endif
+
+#include <stdlib.h>
+"; then :
+
+else
+  fptools_cv_htype_sup_tcflag_t=no
+fi
+
+
+                if test "$HTYPE_IS_FLOAT" -eq 1
+                then
+                    fptools_cv_htype_tcflag_t=Float
+                elif test "$HTYPE_IS_DOUBLE" -eq 1
+                then
+                    fptools_cv_htype_tcflag_t=Double
+                elif test "$HTYPE_IS_LDOUBLE" -eq 1
+                then
+                    fptools_cv_htype_tcflag_t=LDouble
+                else
+                    fptools_cv_htype_sup_tcflag_t=no
+                fi
+            fi
+        else
+            if ac_fn_c_compute_int "$LINENO" "((tcflag_t)(-1)) < ((tcflag_t)0)" "HTYPE_IS_SIGNED"        "
+#include <stdbool.h>
+#include <stdio.h>
+#include <stddef.h>
+
+#if HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+
+#if HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+
+#if HAVE_SYS_STAT_H
+# include <sys/stat.h>
+#endif
+
+#if HAVE_FCNTL_H
+# include <fcntl.h>
+#endif
+
+#if HAVE_SIGNAL_H
+# include <signal.h>
+#endif
+
+#if HAVE_TIME_H
+# include <time.h>
+#endif
+
+#if HAVE_TERMIOS_H
+# include <termios.h>
+#endif
+
+#if HAVE_STRING_H
+# include <string.h>
+#endif
+
+#if HAVE_CTYPE_H
+# include <ctype.h>
+#endif
+
+#if HAVE_INTTYPES_H
+# include <inttypes.h>
+#else
+# if HAVE_STDINT_H
+#  include <stdint.h>
+# endif
+#endif
+
+#if HAVE_SYS_RESOURCE_H
+# include <sys/resource.h>
+#endif
+
+#include <stdlib.h>
+"; then :
+
+else
+  fptools_cv_htype_sup_tcflag_t=no
+fi
+
+
+            if ac_fn_c_compute_int "$LINENO" "sizeof(tcflag_t) * 8" "HTYPE_SIZE"        "
+#include <stdbool.h>
+#include <stdio.h>
+#include <stddef.h>
+
+#if HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+
+#if HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+
+#if HAVE_SYS_STAT_H
+# include <sys/stat.h>
+#endif
+
+#if HAVE_FCNTL_H
+# include <fcntl.h>
+#endif
+
+#if HAVE_SIGNAL_H
+# include <signal.h>
+#endif
+
+#if HAVE_TIME_H
+# include <time.h>
+#endif
+
+#if HAVE_TERMIOS_H
+# include <termios.h>
+#endif
+
+#if HAVE_STRING_H
+# include <string.h>
+#endif
+
+#if HAVE_CTYPE_H
+# include <ctype.h>
+#endif
+
+#if HAVE_INTTYPES_H
+# include <inttypes.h>
+#else
+# if HAVE_STDINT_H
+#  include <stdint.h>
+# endif
+#endif
+
+#if HAVE_SYS_RESOURCE_H
+# include <sys/resource.h>
+#endif
+
+#include <stdlib.h>
+"; then :
+
+else
+  fptools_cv_htype_sup_tcflag_t=no
+fi
+
+
+            if test "$HTYPE_IS_SIGNED" -eq 0
+            then
+                fptools_cv_htype_tcflag_t="Word$HTYPE_SIZE"
+            else
+                fptools_cv_htype_tcflag_t="Int$HTYPE_SIZE"
+            fi
+        fi
+
+fi
+
+    if test "$fptools_cv_htype_sup_tcflag_t" = no
+    then
+
+        fptools_cv_htype_tcflag_t=NotReallyAType
+        { $as_echo "$as_me:${as_lineno-$LINENO}: result: not supported" >&5
+$as_echo "not supported" >&6; }
+
+    fi
+
+            if test "$fptools_cv_htype_sup_tcflag_t" = yes; then
+        { $as_echo "$as_me:${as_lineno-$LINENO}: result: $fptools_cv_htype_tcflag_t" >&5
+$as_echo "$fptools_cv_htype_tcflag_t" >&6; }
+
+cat >>confdefs.h <<_ACEOF
+#define HTYPE_TCFLAG_T $fptools_cv_htype_tcflag_t
+_ACEOF
+
+    fi
+
+
+
+
+
+
+
+
+
+
+    { $as_echo "$as_me:${as_lineno-$LINENO}: checking Haskell type for nlink_t" >&5
+$as_echo_n "checking Haskell type for nlink_t... " >&6; }
+    if ${fptools_cv_htype_nlink_t+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+
+        fptools_cv_htype_sup_nlink_t=yes
+        if ac_fn_c_compute_int "$LINENO" "(nlink_t)0.2 - (nlink_t)0.4 < 0 ? 0 : 1" "HTYPE_IS_INTEGRAL"        "
+#include <stdbool.h>
+#include <stdio.h>
+#include <stddef.h>
+
+#if HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+
+#if HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+
+#if HAVE_SYS_STAT_H
+# include <sys/stat.h>
+#endif
+
+#if HAVE_FCNTL_H
+# include <fcntl.h>
+#endif
+
+#if HAVE_SIGNAL_H
+# include <signal.h>
+#endif
+
+#if HAVE_TIME_H
+# include <time.h>
+#endif
+
+#if HAVE_TERMIOS_H
+# include <termios.h>
+#endif
+
+#if HAVE_STRING_H
+# include <string.h>
+#endif
+
+#if HAVE_CTYPE_H
+# include <ctype.h>
+#endif
+
+#if HAVE_INTTYPES_H
+# include <inttypes.h>
+#else
+# if HAVE_STDINT_H
+#  include <stdint.h>
+# endif
+#endif
+
+#if HAVE_SYS_RESOURCE_H
+# include <sys/resource.h>
+#endif
+
+#include <stdlib.h>
+"; then :
+
+else
+  HTYPE_IS_INTEGRAL=0
+fi
+
+
+
+        if test "$HTYPE_IS_INTEGRAL" -eq 0
+        then
+                                                            cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+#include <stdbool.h>
+#include <stdio.h>
+#include <stddef.h>
+
+#if HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+
+#if HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+
+#if HAVE_SYS_STAT_H
+# include <sys/stat.h>
+#endif
+
+#if HAVE_FCNTL_H
+# include <fcntl.h>
+#endif
+
+#if HAVE_SIGNAL_H
+# include <signal.h>
+#endif
+
+#if HAVE_TIME_H
+# include <time.h>
+#endif
+
+#if HAVE_TERMIOS_H
+# include <termios.h>
+#endif
+
+#if HAVE_STRING_H
+# include <string.h>
+#endif
+
+#if HAVE_CTYPE_H
+# include <ctype.h>
+#endif
+
+#if HAVE_INTTYPES_H
+# include <inttypes.h>
+#else
+# if HAVE_STDINT_H
+#  include <stdint.h>
+# endif
+#endif
+
+#if HAVE_SYS_RESOURCE_H
+# include <sys/resource.h>
+#endif
+
+#include <stdlib.h>
+
+int
+main ()
+{
+nlink_t val; *val;
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  HTYPE_IS_POINTER=yes
+else
+  HTYPE_IS_POINTER=no
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+
+            if test "$HTYPE_IS_POINTER" = yes
+            then
+                fptools_cv_htype_nlink_t="Ptr ()"
+            else
+                if ac_fn_c_compute_int "$LINENO" "sizeof(nlink_t) == sizeof(float)" "HTYPE_IS_FLOAT"        "
+#include <stdbool.h>
+#include <stdio.h>
+#include <stddef.h>
+
+#if HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+
+#if HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+
+#if HAVE_SYS_STAT_H
+# include <sys/stat.h>
+#endif
+
+#if HAVE_FCNTL_H
+# include <fcntl.h>
+#endif
+
+#if HAVE_SIGNAL_H
+# include <signal.h>
+#endif
+
+#if HAVE_TIME_H
+# include <time.h>
+#endif
+
+#if HAVE_TERMIOS_H
+# include <termios.h>
+#endif
+
+#if HAVE_STRING_H
+# include <string.h>
+#endif
+
+#if HAVE_CTYPE_H
+# include <ctype.h>
+#endif
+
+#if HAVE_INTTYPES_H
+# include <inttypes.h>
+#else
+# if HAVE_STDINT_H
+#  include <stdint.h>
+# endif
+#endif
+
+#if HAVE_SYS_RESOURCE_H
+# include <sys/resource.h>
+#endif
+
+#include <stdlib.h>
+"; then :
+
+else
+  fptools_cv_htype_sup_nlink_t=no
+fi
+
+
+                if ac_fn_c_compute_int "$LINENO" "sizeof(nlink_t) == sizeof(double)" "HTYPE_IS_DOUBLE"        "
+#include <stdbool.h>
+#include <stdio.h>
+#include <stddef.h>
+
+#if HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+
+#if HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+
+#if HAVE_SYS_STAT_H
+# include <sys/stat.h>
+#endif
+
+#if HAVE_FCNTL_H
+# include <fcntl.h>
+#endif
+
+#if HAVE_SIGNAL_H
+# include <signal.h>
+#endif
+
+#if HAVE_TIME_H
+# include <time.h>
+#endif
+
+#if HAVE_TERMIOS_H
+# include <termios.h>
+#endif
+
+#if HAVE_STRING_H
+# include <string.h>
+#endif
+
+#if HAVE_CTYPE_H
+# include <ctype.h>
+#endif
+
+#if HAVE_INTTYPES_H
+# include <inttypes.h>
+#else
+# if HAVE_STDINT_H
+#  include <stdint.h>
+# endif
+#endif
+
+#if HAVE_SYS_RESOURCE_H
+# include <sys/resource.h>
+#endif
+
+#include <stdlib.h>
+"; then :
+
+else
+  fptools_cv_htype_sup_nlink_t=no
+fi
+
+
+                if ac_fn_c_compute_int "$LINENO" "sizeof(nlink_t) == sizeof(long double)" "HTYPE_IS_LDOUBLE"        "
+#include <stdbool.h>
+#include <stdio.h>
+#include <stddef.h>
+
+#if HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+
+#if HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+
+#if HAVE_SYS_STAT_H
+# include <sys/stat.h>
+#endif
+
+#if HAVE_FCNTL_H
+# include <fcntl.h>
+#endif
+
+#if HAVE_SIGNAL_H
+# include <signal.h>
+#endif
+
+#if HAVE_TIME_H
+# include <time.h>
+#endif
+
+#if HAVE_TERMIOS_H
+# include <termios.h>
+#endif
+
+#if HAVE_STRING_H
+# include <string.h>
+#endif
+
+#if HAVE_CTYPE_H
+# include <ctype.h>
+#endif
+
+#if HAVE_INTTYPES_H
+# include <inttypes.h>
+#else
+# if HAVE_STDINT_H
+#  include <stdint.h>
+# endif
+#endif
+
+#if HAVE_SYS_RESOURCE_H
+# include <sys/resource.h>
+#endif
+
+#include <stdlib.h>
+"; then :
+
+else
+  fptools_cv_htype_sup_nlink_t=no
+fi
+
+
+                if test "$HTYPE_IS_FLOAT" -eq 1
+                then
+                    fptools_cv_htype_nlink_t=Float
+                elif test "$HTYPE_IS_DOUBLE" -eq 1
+                then
+                    fptools_cv_htype_nlink_t=Double
+                elif test "$HTYPE_IS_LDOUBLE" -eq 1
+                then
+                    fptools_cv_htype_nlink_t=LDouble
+                else
+                    fptools_cv_htype_sup_nlink_t=no
+                fi
+            fi
+        else
+            if ac_fn_c_compute_int "$LINENO" "((nlink_t)(-1)) < ((nlink_t)0)" "HTYPE_IS_SIGNED"        "
+#include <stdbool.h>
+#include <stdio.h>
+#include <stddef.h>
+
+#if HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+
+#if HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+
+#if HAVE_SYS_STAT_H
+# include <sys/stat.h>
+#endif
+
+#if HAVE_FCNTL_H
+# include <fcntl.h>
+#endif
+
+#if HAVE_SIGNAL_H
+# include <signal.h>
+#endif
+
+#if HAVE_TIME_H
+# include <time.h>
+#endif
+
+#if HAVE_TERMIOS_H
+# include <termios.h>
+#endif
+
+#if HAVE_STRING_H
+# include <string.h>
+#endif
+
+#if HAVE_CTYPE_H
+# include <ctype.h>
+#endif
+
+#if HAVE_INTTYPES_H
+# include <inttypes.h>
+#else
+# if HAVE_STDINT_H
+#  include <stdint.h>
+# endif
+#endif
+
+#if HAVE_SYS_RESOURCE_H
+# include <sys/resource.h>
+#endif
+
+#include <stdlib.h>
+"; then :
+
+else
+  fptools_cv_htype_sup_nlink_t=no
+fi
+
+
+            if ac_fn_c_compute_int "$LINENO" "sizeof(nlink_t) * 8" "HTYPE_SIZE"        "
+#include <stdbool.h>
+#include <stdio.h>
+#include <stddef.h>
+
+#if HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+
+#if HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+
+#if HAVE_SYS_STAT_H
+# include <sys/stat.h>
+#endif
+
+#if HAVE_FCNTL_H
+# include <fcntl.h>
+#endif
+
+#if HAVE_SIGNAL_H
+# include <signal.h>
+#endif
+
+#if HAVE_TIME_H
+# include <time.h>
+#endif
+
+#if HAVE_TERMIOS_H
+# include <termios.h>
+#endif
+
+#if HAVE_STRING_H
+# include <string.h>
+#endif
+
+#if HAVE_CTYPE_H
+# include <ctype.h>
+#endif
+
+#if HAVE_INTTYPES_H
+# include <inttypes.h>
+#else
+# if HAVE_STDINT_H
+#  include <stdint.h>
+# endif
+#endif
+
+#if HAVE_SYS_RESOURCE_H
+# include <sys/resource.h>
+#endif
+
+#include <stdlib.h>
+"; then :
+
+else
+  fptools_cv_htype_sup_nlink_t=no
+fi
+
+
+            if test "$HTYPE_IS_SIGNED" -eq 0
+            then
+                fptools_cv_htype_nlink_t="Word$HTYPE_SIZE"
+            else
+                fptools_cv_htype_nlink_t="Int$HTYPE_SIZE"
+            fi
+        fi
+
+fi
+
+    if test "$fptools_cv_htype_sup_nlink_t" = no
+    then
+
+        fptools_cv_htype_nlink_t=NotReallyAType
+        { $as_echo "$as_me:${as_lineno-$LINENO}: result: not supported" >&5
+$as_echo "not supported" >&6; }
+
+    fi
+
+            if test "$fptools_cv_htype_sup_nlink_t" = yes; then
+        { $as_echo "$as_me:${as_lineno-$LINENO}: result: $fptools_cv_htype_nlink_t" >&5
+$as_echo "$fptools_cv_htype_nlink_t" >&6; }
+
+cat >>confdefs.h <<_ACEOF
+#define HTYPE_NLINK_T $fptools_cv_htype_nlink_t
+_ACEOF
+
+    fi
+
+
+
+
+
+
+
+
+
+
+    { $as_echo "$as_me:${as_lineno-$LINENO}: checking Haskell type for ssize_t" >&5
+$as_echo_n "checking Haskell type for ssize_t... " >&6; }
+    if ${fptools_cv_htype_ssize_t+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+
+        fptools_cv_htype_sup_ssize_t=yes
+        if ac_fn_c_compute_int "$LINENO" "(ssize_t)0.2 - (ssize_t)0.4 < 0 ? 0 : 1" "HTYPE_IS_INTEGRAL"        "
+#include <stdbool.h>
+#include <stdio.h>
+#include <stddef.h>
+
+#if HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+
+#if HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+
+#if HAVE_SYS_STAT_H
+# include <sys/stat.h>
+#endif
+
+#if HAVE_FCNTL_H
+# include <fcntl.h>
+#endif
+
+#if HAVE_SIGNAL_H
+# include <signal.h>
+#endif
+
+#if HAVE_TIME_H
+# include <time.h>
+#endif
+
+#if HAVE_TERMIOS_H
+# include <termios.h>
+#endif
+
+#if HAVE_STRING_H
+# include <string.h>
+#endif
+
+#if HAVE_CTYPE_H
+# include <ctype.h>
+#endif
+
+#if HAVE_INTTYPES_H
+# include <inttypes.h>
+#else
+# if HAVE_STDINT_H
+#  include <stdint.h>
+# endif
+#endif
+
+#if HAVE_SYS_RESOURCE_H
+# include <sys/resource.h>
+#endif
+
+#include <stdlib.h>
+"; then :
+
+else
+  HTYPE_IS_INTEGRAL=0
+fi
+
+
+
+        if test "$HTYPE_IS_INTEGRAL" -eq 0
+        then
+                                                            cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+#include <stdbool.h>
+#include <stdio.h>
+#include <stddef.h>
+
+#if HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+
+#if HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+
+#if HAVE_SYS_STAT_H
+# include <sys/stat.h>
+#endif
+
+#if HAVE_FCNTL_H
+# include <fcntl.h>
+#endif
+
+#if HAVE_SIGNAL_H
+# include <signal.h>
+#endif
+
+#if HAVE_TIME_H
+# include <time.h>
+#endif
+
+#if HAVE_TERMIOS_H
+# include <termios.h>
+#endif
+
+#if HAVE_STRING_H
+# include <string.h>
+#endif
+
+#if HAVE_CTYPE_H
+# include <ctype.h>
+#endif
+
+#if HAVE_INTTYPES_H
+# include <inttypes.h>
+#else
+# if HAVE_STDINT_H
+#  include <stdint.h>
+# endif
+#endif
+
+#if HAVE_SYS_RESOURCE_H
+# include <sys/resource.h>
+#endif
+
+#include <stdlib.h>
+
+int
+main ()
+{
+ssize_t val; *val;
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  HTYPE_IS_POINTER=yes
+else
+  HTYPE_IS_POINTER=no
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+
+            if test "$HTYPE_IS_POINTER" = yes
+            then
+                fptools_cv_htype_ssize_t="Ptr ()"
+            else
+                if ac_fn_c_compute_int "$LINENO" "sizeof(ssize_t) == sizeof(float)" "HTYPE_IS_FLOAT"        "
+#include <stdbool.h>
+#include <stdio.h>
+#include <stddef.h>
+
+#if HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+
+#if HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+
+#if HAVE_SYS_STAT_H
+# include <sys/stat.h>
+#endif
+
+#if HAVE_FCNTL_H
+# include <fcntl.h>
+#endif
+
+#if HAVE_SIGNAL_H
+# include <signal.h>
+#endif
+
+#if HAVE_TIME_H
+# include <time.h>
+#endif
+
+#if HAVE_TERMIOS_H
+# include <termios.h>
+#endif
+
+#if HAVE_STRING_H
+# include <string.h>
+#endif
+
+#if HAVE_CTYPE_H
+# include <ctype.h>
+#endif
+
+#if HAVE_INTTYPES_H
+# include <inttypes.h>
+#else
+# if HAVE_STDINT_H
+#  include <stdint.h>
+# endif
+#endif
+
+#if HAVE_SYS_RESOURCE_H
+# include <sys/resource.h>
+#endif
+
+#include <stdlib.h>
+"; then :
+
+else
+  fptools_cv_htype_sup_ssize_t=no
+fi
+
+
+                if ac_fn_c_compute_int "$LINENO" "sizeof(ssize_t) == sizeof(double)" "HTYPE_IS_DOUBLE"        "
+#include <stdbool.h>
+#include <stdio.h>
+#include <stddef.h>
+
+#if HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+
+#if HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+
+#if HAVE_SYS_STAT_H
+# include <sys/stat.h>
+#endif
+
+#if HAVE_FCNTL_H
+# include <fcntl.h>
+#endif
+
+#if HAVE_SIGNAL_H
+# include <signal.h>
+#endif
+
+#if HAVE_TIME_H
+# include <time.h>
+#endif
+
+#if HAVE_TERMIOS_H
+# include <termios.h>
+#endif
+
+#if HAVE_STRING_H
+# include <string.h>
+#endif
+
+#if HAVE_CTYPE_H
+# include <ctype.h>
+#endif
+
+#if HAVE_INTTYPES_H
+# include <inttypes.h>
+#else
+# if HAVE_STDINT_H
+#  include <stdint.h>
+# endif
+#endif
+
+#if HAVE_SYS_RESOURCE_H
+# include <sys/resource.h>
+#endif
+
+#include <stdlib.h>
+"; then :
+
+else
+  fptools_cv_htype_sup_ssize_t=no
+fi
+
+
+                if ac_fn_c_compute_int "$LINENO" "sizeof(ssize_t) == sizeof(long double)" "HTYPE_IS_LDOUBLE"        "
+#include <stdbool.h>
+#include <stdio.h>
+#include <stddef.h>
+
+#if HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+
+#if HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+
+#if HAVE_SYS_STAT_H
+# include <sys/stat.h>
+#endif
+
+#if HAVE_FCNTL_H
+# include <fcntl.h>
+#endif
+
+#if HAVE_SIGNAL_H
+# include <signal.h>
+#endif
+
+#if HAVE_TIME_H
+# include <time.h>
+#endif
+
+#if HAVE_TERMIOS_H
+# include <termios.h>
+#endif
+
+#if HAVE_STRING_H
+# include <string.h>
+#endif
+
+#if HAVE_CTYPE_H
+# include <ctype.h>
+#endif
+
+#if HAVE_INTTYPES_H
+# include <inttypes.h>
+#else
+# if HAVE_STDINT_H
+#  include <stdint.h>
+# endif
+#endif
+
+#if HAVE_SYS_RESOURCE_H
+# include <sys/resource.h>
+#endif
+
+#include <stdlib.h>
+"; then :
+
+else
+  fptools_cv_htype_sup_ssize_t=no
+fi
+
+
+                if test "$HTYPE_IS_FLOAT" -eq 1
+                then
+                    fptools_cv_htype_ssize_t=Float
+                elif test "$HTYPE_IS_DOUBLE" -eq 1
+                then
+                    fptools_cv_htype_ssize_t=Double
+                elif test "$HTYPE_IS_LDOUBLE" -eq 1
+                then
+                    fptools_cv_htype_ssize_t=LDouble
+                else
+                    fptools_cv_htype_sup_ssize_t=no
+                fi
+            fi
+        else
+            if ac_fn_c_compute_int "$LINENO" "((ssize_t)(-1)) < ((ssize_t)0)" "HTYPE_IS_SIGNED"        "
+#include <stdbool.h>
+#include <stdio.h>
+#include <stddef.h>
+
+#if HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+
+#if HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+
+#if HAVE_SYS_STAT_H
+# include <sys/stat.h>
+#endif
+
+#if HAVE_FCNTL_H
+# include <fcntl.h>
+#endif
+
+#if HAVE_SIGNAL_H
+# include <signal.h>
+#endif
+
+#if HAVE_TIME_H
+# include <time.h>
+#endif
+
+#if HAVE_TERMIOS_H
+# include <termios.h>
+#endif
+
+#if HAVE_STRING_H
+# include <string.h>
+#endif
+
+#if HAVE_CTYPE_H
+# include <ctype.h>
+#endif
+
+#if HAVE_INTTYPES_H
+# include <inttypes.h>
+#else
+# if HAVE_STDINT_H
+#  include <stdint.h>
+# endif
+#endif
+
+#if HAVE_SYS_RESOURCE_H
+# include <sys/resource.h>
+#endif
+
+#include <stdlib.h>
+"; then :
+
+else
+  fptools_cv_htype_sup_ssize_t=no
+fi
+
+
+            if ac_fn_c_compute_int "$LINENO" "sizeof(ssize_t) * 8" "HTYPE_SIZE"        "
+#include <stdbool.h>
+#include <stdio.h>
+#include <stddef.h>
+
+#if HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+
+#if HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+
+#if HAVE_SYS_STAT_H
+# include <sys/stat.h>
+#endif
+
+#if HAVE_FCNTL_H
+# include <fcntl.h>
+#endif
+
+#if HAVE_SIGNAL_H
+# include <signal.h>
+#endif
+
+#if HAVE_TIME_H
+# include <time.h>
+#endif
+
+#if HAVE_TERMIOS_H
+# include <termios.h>
+#endif
+
+#if HAVE_STRING_H
+# include <string.h>
+#endif
+
+#if HAVE_CTYPE_H
+# include <ctype.h>
+#endif
+
+#if HAVE_INTTYPES_H
+# include <inttypes.h>
+#else
+# if HAVE_STDINT_H
+#  include <stdint.h>
+# endif
+#endif
+
+#if HAVE_SYS_RESOURCE_H
+# include <sys/resource.h>
+#endif
+
+#include <stdlib.h>
+"; then :
+
+else
+  fptools_cv_htype_sup_ssize_t=no
+fi
+
+
+            if test "$HTYPE_IS_SIGNED" -eq 0
+            then
+                fptools_cv_htype_ssize_t="Word$HTYPE_SIZE"
+            else
+                fptools_cv_htype_ssize_t="Int$HTYPE_SIZE"
+            fi
+        fi
+
+fi
+
+    if test "$fptools_cv_htype_sup_ssize_t" = no
+    then
+
+        fptools_cv_htype_ssize_t=NotReallyAType
+        { $as_echo "$as_me:${as_lineno-$LINENO}: result: not supported" >&5
+$as_echo "not supported" >&6; }
+
+    fi
+
+            if test "$fptools_cv_htype_sup_ssize_t" = yes; then
+        { $as_echo "$as_me:${as_lineno-$LINENO}: result: $fptools_cv_htype_ssize_t" >&5
+$as_echo "$fptools_cv_htype_ssize_t" >&6; }
+
+cat >>confdefs.h <<_ACEOF
+#define HTYPE_SSIZE_T $fptools_cv_htype_ssize_t
+_ACEOF
+
+    fi
+
+
+
+
+
+
+
+
+
+
+    { $as_echo "$as_me:${as_lineno-$LINENO}: checking Haskell type for rlim_t" >&5
+$as_echo_n "checking Haskell type for rlim_t... " >&6; }
+    if ${fptools_cv_htype_rlim_t+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+
+        fptools_cv_htype_sup_rlim_t=yes
+        if ac_fn_c_compute_int "$LINENO" "(rlim_t)0.2 - (rlim_t)0.4 < 0 ? 0 : 1" "HTYPE_IS_INTEGRAL"        "
+#include <stdbool.h>
+#include <stdio.h>
+#include <stddef.h>
+
+#if HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+
+#if HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+
+#if HAVE_SYS_STAT_H
+# include <sys/stat.h>
+#endif
+
+#if HAVE_FCNTL_H
+# include <fcntl.h>
+#endif
+
+#if HAVE_SIGNAL_H
+# include <signal.h>
+#endif
+
+#if HAVE_TIME_H
+# include <time.h>
+#endif
+
+#if HAVE_TERMIOS_H
+# include <termios.h>
+#endif
+
+#if HAVE_STRING_H
+# include <string.h>
+#endif
+
+#if HAVE_CTYPE_H
+# include <ctype.h>
+#endif
+
+#if HAVE_INTTYPES_H
+# include <inttypes.h>
+#else
+# if HAVE_STDINT_H
+#  include <stdint.h>
+# endif
+#endif
+
+#if HAVE_SYS_RESOURCE_H
+# include <sys/resource.h>
+#endif
+
+#include <stdlib.h>
+"; then :
+
+else
+  HTYPE_IS_INTEGRAL=0
+fi
+
+
+
+        if test "$HTYPE_IS_INTEGRAL" -eq 0
+        then
+                                                            cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+#include <stdbool.h>
+#include <stdio.h>
+#include <stddef.h>
+
+#if HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+
+#if HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+
+#if HAVE_SYS_STAT_H
+# include <sys/stat.h>
+#endif
+
+#if HAVE_FCNTL_H
+# include <fcntl.h>
+#endif
+
+#if HAVE_SIGNAL_H
+# include <signal.h>
+#endif
+
+#if HAVE_TIME_H
+# include <time.h>
+#endif
+
+#if HAVE_TERMIOS_H
+# include <termios.h>
+#endif
+
+#if HAVE_STRING_H
+# include <string.h>
+#endif
+
+#if HAVE_CTYPE_H
+# include <ctype.h>
+#endif
+
+#if HAVE_INTTYPES_H
+# include <inttypes.h>
+#else
+# if HAVE_STDINT_H
+#  include <stdint.h>
+# endif
+#endif
+
+#if HAVE_SYS_RESOURCE_H
+# include <sys/resource.h>
+#endif
+
+#include <stdlib.h>
+
+int
+main ()
+{
+rlim_t val; *val;
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  HTYPE_IS_POINTER=yes
+else
+  HTYPE_IS_POINTER=no
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+
+            if test "$HTYPE_IS_POINTER" = yes
+            then
+                fptools_cv_htype_rlim_t="Ptr ()"
+            else
+                if ac_fn_c_compute_int "$LINENO" "sizeof(rlim_t) == sizeof(float)" "HTYPE_IS_FLOAT"        "
+#include <stdbool.h>
+#include <stdio.h>
+#include <stddef.h>
+
+#if HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+
+#if HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+
+#if HAVE_SYS_STAT_H
+# include <sys/stat.h>
+#endif
+
+#if HAVE_FCNTL_H
+# include <fcntl.h>
+#endif
+
+#if HAVE_SIGNAL_H
+# include <signal.h>
+#endif
+
+#if HAVE_TIME_H
+# include <time.h>
+#endif
+
+#if HAVE_TERMIOS_H
+# include <termios.h>
+#endif
+
+#if HAVE_STRING_H
+# include <string.h>
+#endif
+
+#if HAVE_CTYPE_H
+# include <ctype.h>
+#endif
+
+#if HAVE_INTTYPES_H
+# include <inttypes.h>
+#else
+# if HAVE_STDINT_H
+#  include <stdint.h>
+# endif
+#endif
+
+#if HAVE_SYS_RESOURCE_H
+# include <sys/resource.h>
+#endif
+
+#include <stdlib.h>
+"; then :
+
+else
+  fptools_cv_htype_sup_rlim_t=no
+fi
+
+
+                if ac_fn_c_compute_int "$LINENO" "sizeof(rlim_t) == sizeof(double)" "HTYPE_IS_DOUBLE"        "
+#include <stdbool.h>
+#include <stdio.h>
+#include <stddef.h>
+
+#if HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+
+#if HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+
+#if HAVE_SYS_STAT_H
+# include <sys/stat.h>
+#endif
+
+#if HAVE_FCNTL_H
+# include <fcntl.h>
+#endif
+
+#if HAVE_SIGNAL_H
+# include <signal.h>
+#endif
+
+#if HAVE_TIME_H
+# include <time.h>
+#endif
+
+#if HAVE_TERMIOS_H
+# include <termios.h>
+#endif
+
+#if HAVE_STRING_H
+# include <string.h>
+#endif
+
+#if HAVE_CTYPE_H
+# include <ctype.h>
+#endif
+
+#if HAVE_INTTYPES_H
+# include <inttypes.h>
+#else
+# if HAVE_STDINT_H
+#  include <stdint.h>
+# endif
+#endif
+
+#if HAVE_SYS_RESOURCE_H
+# include <sys/resource.h>
+#endif
+
+#include <stdlib.h>
+"; then :
+
+else
+  fptools_cv_htype_sup_rlim_t=no
+fi
+
+
+                if ac_fn_c_compute_int "$LINENO" "sizeof(rlim_t) == sizeof(long double)" "HTYPE_IS_LDOUBLE"        "
+#include <stdbool.h>
+#include <stdio.h>
+#include <stddef.h>
+
+#if HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+
+#if HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+
+#if HAVE_SYS_STAT_H
+# include <sys/stat.h>
+#endif
+
+#if HAVE_FCNTL_H
+# include <fcntl.h>
+#endif
+
+#if HAVE_SIGNAL_H
+# include <signal.h>
+#endif
+
+#if HAVE_TIME_H
+# include <time.h>
+#endif
+
+#if HAVE_TERMIOS_H
+# include <termios.h>
+#endif
+
+#if HAVE_STRING_H
+# include <string.h>
+#endif
+
+#if HAVE_CTYPE_H
+# include <ctype.h>
+#endif
+
+#if HAVE_INTTYPES_H
+# include <inttypes.h>
+#else
+# if HAVE_STDINT_H
+#  include <stdint.h>
+# endif
+#endif
+
+#if HAVE_SYS_RESOURCE_H
+# include <sys/resource.h>
+#endif
+
+#include <stdlib.h>
+"; then :
+
+else
+  fptools_cv_htype_sup_rlim_t=no
+fi
+
+
+                if test "$HTYPE_IS_FLOAT" -eq 1
+                then
+                    fptools_cv_htype_rlim_t=Float
+                elif test "$HTYPE_IS_DOUBLE" -eq 1
+                then
+                    fptools_cv_htype_rlim_t=Double
+                elif test "$HTYPE_IS_LDOUBLE" -eq 1
+                then
+                    fptools_cv_htype_rlim_t=LDouble
+                else
+                    fptools_cv_htype_sup_rlim_t=no
+                fi
+            fi
+        else
+            if ac_fn_c_compute_int "$LINENO" "((rlim_t)(-1)) < ((rlim_t)0)" "HTYPE_IS_SIGNED"        "
+#include <stdbool.h>
+#include <stdio.h>
+#include <stddef.h>
+
+#if HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+
+#if HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+
+#if HAVE_SYS_STAT_H
+# include <sys/stat.h>
+#endif
+
+#if HAVE_FCNTL_H
+# include <fcntl.h>
+#endif
+
+#if HAVE_SIGNAL_H
+# include <signal.h>
+#endif
+
+#if HAVE_TIME_H
+# include <time.h>
+#endif
+
+#if HAVE_TERMIOS_H
+# include <termios.h>
+#endif
+
+#if HAVE_STRING_H
+# include <string.h>
+#endif
+
+#if HAVE_CTYPE_H
+# include <ctype.h>
+#endif
+
+#if HAVE_INTTYPES_H
+# include <inttypes.h>
+#else
+# if HAVE_STDINT_H
+#  include <stdint.h>
+# endif
+#endif
+
+#if HAVE_SYS_RESOURCE_H
+# include <sys/resource.h>
+#endif
+
+#include <stdlib.h>
+"; then :
+
+else
+  fptools_cv_htype_sup_rlim_t=no
+fi
+
+
+            if ac_fn_c_compute_int "$LINENO" "sizeof(rlim_t) * 8" "HTYPE_SIZE"        "
+#include <stdbool.h>
+#include <stdio.h>
+#include <stddef.h>
+
+#if HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+
+#if HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+
+#if HAVE_SYS_STAT_H
+# include <sys/stat.h>
+#endif
+
+#if HAVE_FCNTL_H
+# include <fcntl.h>
+#endif
+
+#if HAVE_SIGNAL_H
+# include <signal.h>
+#endif
+
+#if HAVE_TIME_H
+# include <time.h>
+#endif
+
+#if HAVE_TERMIOS_H
+# include <termios.h>
+#endif
+
+#if HAVE_STRING_H
+# include <string.h>
+#endif
+
+#if HAVE_CTYPE_H
+# include <ctype.h>
+#endif
+
+#if HAVE_INTTYPES_H
+# include <inttypes.h>
+#else
+# if HAVE_STDINT_H
+#  include <stdint.h>
+# endif
+#endif
+
+#if HAVE_SYS_RESOURCE_H
+# include <sys/resource.h>
+#endif
+
+#include <stdlib.h>
+"; then :
+
+else
+  fptools_cv_htype_sup_rlim_t=no
+fi
+
+
+            if test "$HTYPE_IS_SIGNED" -eq 0
+            then
+                fptools_cv_htype_rlim_t="Word$HTYPE_SIZE"
+            else
+                fptools_cv_htype_rlim_t="Int$HTYPE_SIZE"
+            fi
+        fi
+
+fi
+
+    if test "$fptools_cv_htype_sup_rlim_t" = no
+    then
+
+        fptools_cv_htype_rlim_t=NotReallyAType
+        { $as_echo "$as_me:${as_lineno-$LINENO}: result: not supported" >&5
+$as_echo "not supported" >&6; }
+
+    fi
+
+            if test "$fptools_cv_htype_sup_rlim_t" = yes; then
+        { $as_echo "$as_me:${as_lineno-$LINENO}: result: $fptools_cv_htype_rlim_t" >&5
+$as_echo "$fptools_cv_htype_rlim_t" >&6; }
+
+cat >>confdefs.h <<_ACEOF
+#define HTYPE_RLIM_T $fptools_cv_htype_rlim_t
+_ACEOF
+
+    fi
+
+
+
+
+
+
+
+
+
+
+    { $as_echo "$as_me:${as_lineno-$LINENO}: checking Haskell type for blksize_t" >&5
+$as_echo_n "checking Haskell type for blksize_t... " >&6; }
+    if ${fptools_cv_htype_blksize_t+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+
+        fptools_cv_htype_sup_blksize_t=yes
+        if ac_fn_c_compute_int "$LINENO" "(blksize_t)0.2 - (blksize_t)0.4 < 0 ? 0 : 1" "HTYPE_IS_INTEGRAL"        "
+#include <stdbool.h>
+#include <stdio.h>
+#include <stddef.h>
+
+#if HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+
+#if HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+
+#if HAVE_SYS_STAT_H
+# include <sys/stat.h>
+#endif
+
+#if HAVE_FCNTL_H
+# include <fcntl.h>
+#endif
+
+#if HAVE_SIGNAL_H
+# include <signal.h>
+#endif
+
+#if HAVE_TIME_H
+# include <time.h>
+#endif
+
+#if HAVE_TERMIOS_H
+# include <termios.h>
+#endif
+
+#if HAVE_STRING_H
+# include <string.h>
+#endif
+
+#if HAVE_CTYPE_H
+# include <ctype.h>
+#endif
+
+#if HAVE_INTTYPES_H
+# include <inttypes.h>
+#else
+# if HAVE_STDINT_H
+#  include <stdint.h>
+# endif
+#endif
+
+#if HAVE_SYS_RESOURCE_H
+# include <sys/resource.h>
+#endif
+
+#include <stdlib.h>
+"; then :
+
+else
+  HTYPE_IS_INTEGRAL=0
+fi
+
+
+
+        if test "$HTYPE_IS_INTEGRAL" -eq 0
+        then
+                                                            cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+#include <stdbool.h>
+#include <stdio.h>
+#include <stddef.h>
+
+#if HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+
+#if HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+
+#if HAVE_SYS_STAT_H
+# include <sys/stat.h>
+#endif
+
+#if HAVE_FCNTL_H
+# include <fcntl.h>
+#endif
+
+#if HAVE_SIGNAL_H
+# include <signal.h>
+#endif
+
+#if HAVE_TIME_H
+# include <time.h>
+#endif
+
+#if HAVE_TERMIOS_H
+# include <termios.h>
+#endif
+
+#if HAVE_STRING_H
+# include <string.h>
+#endif
+
+#if HAVE_CTYPE_H
+# include <ctype.h>
+#endif
+
+#if HAVE_INTTYPES_H
+# include <inttypes.h>
+#else
+# if HAVE_STDINT_H
+#  include <stdint.h>
+# endif
+#endif
+
+#if HAVE_SYS_RESOURCE_H
+# include <sys/resource.h>
+#endif
+
+#include <stdlib.h>
+
+int
+main ()
+{
+blksize_t val; *val;
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  HTYPE_IS_POINTER=yes
+else
+  HTYPE_IS_POINTER=no
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+
+            if test "$HTYPE_IS_POINTER" = yes
+            then
+                fptools_cv_htype_blksize_t="Ptr ()"
+            else
+                if ac_fn_c_compute_int "$LINENO" "sizeof(blksize_t) == sizeof(float)" "HTYPE_IS_FLOAT"        "
+#include <stdbool.h>
+#include <stdio.h>
+#include <stddef.h>
+
+#if HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+
+#if HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+
+#if HAVE_SYS_STAT_H
+# include <sys/stat.h>
+#endif
+
+#if HAVE_FCNTL_H
+# include <fcntl.h>
+#endif
+
+#if HAVE_SIGNAL_H
+# include <signal.h>
+#endif
+
+#if HAVE_TIME_H
+# include <time.h>
+#endif
+
+#if HAVE_TERMIOS_H
+# include <termios.h>
+#endif
+
+#if HAVE_STRING_H
+# include <string.h>
+#endif
+
+#if HAVE_CTYPE_H
+# include <ctype.h>
+#endif
+
+#if HAVE_INTTYPES_H
+# include <inttypes.h>
+#else
+# if HAVE_STDINT_H
+#  include <stdint.h>
+# endif
+#endif
+
+#if HAVE_SYS_RESOURCE_H
+# include <sys/resource.h>
+#endif
+
+#include <stdlib.h>
+"; then :
+
+else
+  fptools_cv_htype_sup_blksize_t=no
+fi
+
+
+                if ac_fn_c_compute_int "$LINENO" "sizeof(blksize_t) == sizeof(double)" "HTYPE_IS_DOUBLE"        "
+#include <stdbool.h>
+#include <stdio.h>
+#include <stddef.h>
+
+#if HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+
+#if HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+
+#if HAVE_SYS_STAT_H
+# include <sys/stat.h>
+#endif
+
+#if HAVE_FCNTL_H
+# include <fcntl.h>
+#endif
+
+#if HAVE_SIGNAL_H
+# include <signal.h>
+#endif
+
+#if HAVE_TIME_H
+# include <time.h>
+#endif
+
+#if HAVE_TERMIOS_H
+# include <termios.h>
+#endif
+
+#if HAVE_STRING_H
+# include <string.h>
+#endif
+
+#if HAVE_CTYPE_H
+# include <ctype.h>
+#endif
+
+#if HAVE_INTTYPES_H
+# include <inttypes.h>
+#else
+# if HAVE_STDINT_H
+#  include <stdint.h>
+# endif
+#endif
+
+#if HAVE_SYS_RESOURCE_H
+# include <sys/resource.h>
+#endif
+
+#include <stdlib.h>
+"; then :
+
+else
+  fptools_cv_htype_sup_blksize_t=no
+fi
+
+
+                if ac_fn_c_compute_int "$LINENO" "sizeof(blksize_t) == sizeof(long double)" "HTYPE_IS_LDOUBLE"        "
+#include <stdbool.h>
+#include <stdio.h>
+#include <stddef.h>
+
+#if HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+
+#if HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+
+#if HAVE_SYS_STAT_H
+# include <sys/stat.h>
+#endif
+
+#if HAVE_FCNTL_H
+# include <fcntl.h>
+#endif
+
+#if HAVE_SIGNAL_H
+# include <signal.h>
+#endif
+
+#if HAVE_TIME_H
+# include <time.h>
+#endif
+
+#if HAVE_TERMIOS_H
+# include <termios.h>
+#endif
+
+#if HAVE_STRING_H
+# include <string.h>
+#endif
+
+#if HAVE_CTYPE_H
+# include <ctype.h>
+#endif
+
+#if HAVE_INTTYPES_H
+# include <inttypes.h>
+#else
+# if HAVE_STDINT_H
+#  include <stdint.h>
+# endif
+#endif
+
+#if HAVE_SYS_RESOURCE_H
+# include <sys/resource.h>
+#endif
+
+#include <stdlib.h>
+"; then :
+
+else
+  fptools_cv_htype_sup_blksize_t=no
+fi
+
+
+                if test "$HTYPE_IS_FLOAT" -eq 1
+                then
+                    fptools_cv_htype_blksize_t=Float
+                elif test "$HTYPE_IS_DOUBLE" -eq 1
+                then
+                    fptools_cv_htype_blksize_t=Double
+                elif test "$HTYPE_IS_LDOUBLE" -eq 1
+                then
+                    fptools_cv_htype_blksize_t=LDouble
+                else
+                    fptools_cv_htype_sup_blksize_t=no
+                fi
+            fi
+        else
+            if ac_fn_c_compute_int "$LINENO" "((blksize_t)(-1)) < ((blksize_t)0)" "HTYPE_IS_SIGNED"        "
+#include <stdbool.h>
+#include <stdio.h>
+#include <stddef.h>
+
+#if HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+
+#if HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+
+#if HAVE_SYS_STAT_H
+# include <sys/stat.h>
+#endif
+
+#if HAVE_FCNTL_H
+# include <fcntl.h>
+#endif
+
+#if HAVE_SIGNAL_H
+# include <signal.h>
+#endif
+
+#if HAVE_TIME_H
+# include <time.h>
+#endif
+
+#if HAVE_TERMIOS_H
+# include <termios.h>
+#endif
+
+#if HAVE_STRING_H
+# include <string.h>
+#endif
+
+#if HAVE_CTYPE_H
+# include <ctype.h>
+#endif
+
+#if HAVE_INTTYPES_H
+# include <inttypes.h>
+#else
+# if HAVE_STDINT_H
+#  include <stdint.h>
+# endif
+#endif
+
+#if HAVE_SYS_RESOURCE_H
+# include <sys/resource.h>
+#endif
+
+#include <stdlib.h>
+"; then :
+
+else
+  fptools_cv_htype_sup_blksize_t=no
+fi
+
+
+            if ac_fn_c_compute_int "$LINENO" "sizeof(blksize_t) * 8" "HTYPE_SIZE"        "
+#include <stdbool.h>
+#include <stdio.h>
+#include <stddef.h>
+
+#if HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+
+#if HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+
+#if HAVE_SYS_STAT_H
+# include <sys/stat.h>
+#endif
+
+#if HAVE_FCNTL_H
+# include <fcntl.h>
+#endif
+
+#if HAVE_SIGNAL_H
+# include <signal.h>
+#endif
+
+#if HAVE_TIME_H
+# include <time.h>
+#endif
+
+#if HAVE_TERMIOS_H
+# include <termios.h>
+#endif
+
+#if HAVE_STRING_H
+# include <string.h>
+#endif
+
+#if HAVE_CTYPE_H
+# include <ctype.h>
+#endif
+
+#if HAVE_INTTYPES_H
+# include <inttypes.h>
+#else
+# if HAVE_STDINT_H
+#  include <stdint.h>
+# endif
+#endif
+
+#if HAVE_SYS_RESOURCE_H
+# include <sys/resource.h>
+#endif
+
+#include <stdlib.h>
+"; then :
+
+else
+  fptools_cv_htype_sup_blksize_t=no
+fi
+
+
+            if test "$HTYPE_IS_SIGNED" -eq 0
+            then
+                fptools_cv_htype_blksize_t="Word$HTYPE_SIZE"
+            else
+                fptools_cv_htype_blksize_t="Int$HTYPE_SIZE"
+            fi
+        fi
+
+fi
+
+    if test "$fptools_cv_htype_sup_blksize_t" = no
+    then
+
+        fptools_cv_htype_blksize_t=NotReallyAType
+        { $as_echo "$as_me:${as_lineno-$LINENO}: result: not supported" >&5
+$as_echo "not supported" >&6; }
+
+    fi
+
+            if test "$fptools_cv_htype_sup_blksize_t" = yes; then
+        { $as_echo "$as_me:${as_lineno-$LINENO}: result: $fptools_cv_htype_blksize_t" >&5
+$as_echo "$fptools_cv_htype_blksize_t" >&6; }
+
+cat >>confdefs.h <<_ACEOF
+#define HTYPE_BLKSIZE_T $fptools_cv_htype_blksize_t
+_ACEOF
+
+    fi
+
+
+
+
+
+
+
+
+
+
+    { $as_echo "$as_me:${as_lineno-$LINENO}: checking Haskell type for blkcnt_t" >&5
+$as_echo_n "checking Haskell type for blkcnt_t... " >&6; }
+    if ${fptools_cv_htype_blkcnt_t+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+
+        fptools_cv_htype_sup_blkcnt_t=yes
+        if ac_fn_c_compute_int "$LINENO" "(blkcnt_t)0.2 - (blkcnt_t)0.4 < 0 ? 0 : 1" "HTYPE_IS_INTEGRAL"        "
+#include <stdbool.h>
+#include <stdio.h>
+#include <stddef.h>
+
+#if HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+
+#if HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+
+#if HAVE_SYS_STAT_H
+# include <sys/stat.h>
+#endif
+
+#if HAVE_FCNTL_H
+# include <fcntl.h>
+#endif
+
+#if HAVE_SIGNAL_H
+# include <signal.h>
+#endif
+
+#if HAVE_TIME_H
+# include <time.h>
+#endif
+
+#if HAVE_TERMIOS_H
+# include <termios.h>
+#endif
+
+#if HAVE_STRING_H
+# include <string.h>
+#endif
+
+#if HAVE_CTYPE_H
+# include <ctype.h>
+#endif
+
+#if HAVE_INTTYPES_H
+# include <inttypes.h>
+#else
+# if HAVE_STDINT_H
+#  include <stdint.h>
+# endif
+#endif
+
+#if HAVE_SYS_RESOURCE_H
+# include <sys/resource.h>
+#endif
+
+#include <stdlib.h>
+"; then :
+
+else
+  HTYPE_IS_INTEGRAL=0
+fi
+
+
+
+        if test "$HTYPE_IS_INTEGRAL" -eq 0
+        then
+                                                            cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+#include <stdbool.h>
+#include <stdio.h>
+#include <stddef.h>
+
+#if HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+
+#if HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+
+#if HAVE_SYS_STAT_H
+# include <sys/stat.h>
+#endif
+
+#if HAVE_FCNTL_H
+# include <fcntl.h>
+#endif
+
+#if HAVE_SIGNAL_H
+# include <signal.h>
+#endif
+
+#if HAVE_TIME_H
+# include <time.h>
+#endif
+
+#if HAVE_TERMIOS_H
+# include <termios.h>
+#endif
+
+#if HAVE_STRING_H
+# include <string.h>
+#endif
+
+#if HAVE_CTYPE_H
+# include <ctype.h>
+#endif
+
+#if HAVE_INTTYPES_H
+# include <inttypes.h>
+#else
+# if HAVE_STDINT_H
+#  include <stdint.h>
+# endif
+#endif
+
+#if HAVE_SYS_RESOURCE_H
+# include <sys/resource.h>
+#endif
+
+#include <stdlib.h>
+
+int
+main ()
+{
+blkcnt_t val; *val;
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  HTYPE_IS_POINTER=yes
+else
+  HTYPE_IS_POINTER=no
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+
+            if test "$HTYPE_IS_POINTER" = yes
+            then
+                fptools_cv_htype_blkcnt_t="Ptr ()"
+            else
+                if ac_fn_c_compute_int "$LINENO" "sizeof(blkcnt_t) == sizeof(float)" "HTYPE_IS_FLOAT"        "
+#include <stdbool.h>
+#include <stdio.h>
+#include <stddef.h>
+
+#if HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+
+#if HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+
+#if HAVE_SYS_STAT_H
+# include <sys/stat.h>
+#endif
+
+#if HAVE_FCNTL_H
+# include <fcntl.h>
+#endif
+
+#if HAVE_SIGNAL_H
+# include <signal.h>
+#endif
+
+#if HAVE_TIME_H
+# include <time.h>
+#endif
+
+#if HAVE_TERMIOS_H
+# include <termios.h>
+#endif
+
+#if HAVE_STRING_H
+# include <string.h>
+#endif
+
+#if HAVE_CTYPE_H
+# include <ctype.h>
+#endif
+
+#if HAVE_INTTYPES_H
+# include <inttypes.h>
+#else
+# if HAVE_STDINT_H
+#  include <stdint.h>
+# endif
+#endif
+
+#if HAVE_SYS_RESOURCE_H
+# include <sys/resource.h>
+#endif
+
+#include <stdlib.h>
+"; then :
+
+else
+  fptools_cv_htype_sup_blkcnt_t=no
+fi
+
+
+                if ac_fn_c_compute_int "$LINENO" "sizeof(blkcnt_t) == sizeof(double)" "HTYPE_IS_DOUBLE"        "
+#include <stdbool.h>
+#include <stdio.h>
+#include <stddef.h>
+
+#if HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+
+#if HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+
+#if HAVE_SYS_STAT_H
+# include <sys/stat.h>
+#endif
+
+#if HAVE_FCNTL_H
+# include <fcntl.h>
+#endif
+
+#if HAVE_SIGNAL_H
+# include <signal.h>
+#endif
+
+#if HAVE_TIME_H
+# include <time.h>
+#endif
+
+#if HAVE_TERMIOS_H
+# include <termios.h>
+#endif
+
+#if HAVE_STRING_H
+# include <string.h>
+#endif
+
+#if HAVE_CTYPE_H
+# include <ctype.h>
+#endif
+
+#if HAVE_INTTYPES_H
+# include <inttypes.h>
+#else
+# if HAVE_STDINT_H
+#  include <stdint.h>
+# endif
+#endif
+
+#if HAVE_SYS_RESOURCE_H
+# include <sys/resource.h>
+#endif
+
+#include <stdlib.h>
+"; then :
+
+else
+  fptools_cv_htype_sup_blkcnt_t=no
+fi
+
+
+                if ac_fn_c_compute_int "$LINENO" "sizeof(blkcnt_t) == sizeof(long double)" "HTYPE_IS_LDOUBLE"        "
+#include <stdbool.h>
+#include <stdio.h>
+#include <stddef.h>
+
+#if HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+
+#if HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+
+#if HAVE_SYS_STAT_H
+# include <sys/stat.h>
+#endif
+
+#if HAVE_FCNTL_H
+# include <fcntl.h>
+#endif
+
+#if HAVE_SIGNAL_H
+# include <signal.h>
+#endif
+
+#if HAVE_TIME_H
+# include <time.h>
+#endif
+
+#if HAVE_TERMIOS_H
+# include <termios.h>
+#endif
+
+#if HAVE_STRING_H
+# include <string.h>
+#endif
+
+#if HAVE_CTYPE_H
+# include <ctype.h>
+#endif
+
+#if HAVE_INTTYPES_H
+# include <inttypes.h>
+#else
+# if HAVE_STDINT_H
+#  include <stdint.h>
+# endif
+#endif
+
+#if HAVE_SYS_RESOURCE_H
+# include <sys/resource.h>
+#endif
+
+#include <stdlib.h>
+"; then :
+
+else
+  fptools_cv_htype_sup_blkcnt_t=no
+fi
+
+
+                if test "$HTYPE_IS_FLOAT" -eq 1
+                then
+                    fptools_cv_htype_blkcnt_t=Float
+                elif test "$HTYPE_IS_DOUBLE" -eq 1
+                then
+                    fptools_cv_htype_blkcnt_t=Double
+                elif test "$HTYPE_IS_LDOUBLE" -eq 1
+                then
+                    fptools_cv_htype_blkcnt_t=LDouble
+                else
+                    fptools_cv_htype_sup_blkcnt_t=no
+                fi
+            fi
+        else
+            if ac_fn_c_compute_int "$LINENO" "((blkcnt_t)(-1)) < ((blkcnt_t)0)" "HTYPE_IS_SIGNED"        "
+#include <stdbool.h>
+#include <stdio.h>
+#include <stddef.h>
+
+#if HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+
+#if HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+
+#if HAVE_SYS_STAT_H
+# include <sys/stat.h>
+#endif
+
+#if HAVE_FCNTL_H
+# include <fcntl.h>
+#endif
+
+#if HAVE_SIGNAL_H
+# include <signal.h>
+#endif
+
+#if HAVE_TIME_H
+# include <time.h>
+#endif
+
+#if HAVE_TERMIOS_H
+# include <termios.h>
+#endif
+
+#if HAVE_STRING_H
+# include <string.h>
+#endif
+
+#if HAVE_CTYPE_H
+# include <ctype.h>
+#endif
+
+#if HAVE_INTTYPES_H
+# include <inttypes.h>
+#else
+# if HAVE_STDINT_H
+#  include <stdint.h>
+# endif
+#endif
+
+#if HAVE_SYS_RESOURCE_H
+# include <sys/resource.h>
+#endif
+
+#include <stdlib.h>
+"; then :
+
+else
+  fptools_cv_htype_sup_blkcnt_t=no
+fi
+
+
+            if ac_fn_c_compute_int "$LINENO" "sizeof(blkcnt_t) * 8" "HTYPE_SIZE"        "
+#include <stdbool.h>
+#include <stdio.h>
+#include <stddef.h>
+
+#if HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+
+#if HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+
+#if HAVE_SYS_STAT_H
+# include <sys/stat.h>
+#endif
+
+#if HAVE_FCNTL_H
+# include <fcntl.h>
+#endif
+
+#if HAVE_SIGNAL_H
+# include <signal.h>
+#endif
+
+#if HAVE_TIME_H
+# include <time.h>
+#endif
+
+#if HAVE_TERMIOS_H
+# include <termios.h>
+#endif
+
+#if HAVE_STRING_H
+# include <string.h>
+#endif
+
+#if HAVE_CTYPE_H
+# include <ctype.h>
+#endif
+
+#if HAVE_INTTYPES_H
+# include <inttypes.h>
+#else
+# if HAVE_STDINT_H
+#  include <stdint.h>
+# endif
+#endif
+
+#if HAVE_SYS_RESOURCE_H
+# include <sys/resource.h>
+#endif
+
+#include <stdlib.h>
+"; then :
+
+else
+  fptools_cv_htype_sup_blkcnt_t=no
+fi
+
+
+            if test "$HTYPE_IS_SIGNED" -eq 0
+            then
+                fptools_cv_htype_blkcnt_t="Word$HTYPE_SIZE"
+            else
+                fptools_cv_htype_blkcnt_t="Int$HTYPE_SIZE"
+            fi
+        fi
+
+fi
+
+    if test "$fptools_cv_htype_sup_blkcnt_t" = no
+    then
+
+        fptools_cv_htype_blkcnt_t=NotReallyAType
+        { $as_echo "$as_me:${as_lineno-$LINENO}: result: not supported" >&5
+$as_echo "not supported" >&6; }
+
+    fi
+
+            if test "$fptools_cv_htype_sup_blkcnt_t" = yes; then
+        { $as_echo "$as_me:${as_lineno-$LINENO}: result: $fptools_cv_htype_blkcnt_t" >&5
+$as_echo "$fptools_cv_htype_blkcnt_t" >&6; }
+
+cat >>confdefs.h <<_ACEOF
+#define HTYPE_BLKCNT_T $fptools_cv_htype_blkcnt_t
+_ACEOF
+
+    fi
+
+
+
+
+
+
+
+
+
+
+    { $as_echo "$as_me:${as_lineno-$LINENO}: checking Haskell type for clockid_t" >&5
+$as_echo_n "checking Haskell type for clockid_t... " >&6; }
+    if ${fptools_cv_htype_clockid_t+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+
+        fptools_cv_htype_sup_clockid_t=yes
+        if ac_fn_c_compute_int "$LINENO" "(clockid_t)0.2 - (clockid_t)0.4 < 0 ? 0 : 1" "HTYPE_IS_INTEGRAL"        "
+#include <stdbool.h>
+#include <stdio.h>
+#include <stddef.h>
+
+#if HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+
+#if HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+
+#if HAVE_SYS_STAT_H
+# include <sys/stat.h>
+#endif
+
+#if HAVE_FCNTL_H
+# include <fcntl.h>
+#endif
+
+#if HAVE_SIGNAL_H
+# include <signal.h>
+#endif
+
+#if HAVE_TIME_H
+# include <time.h>
+#endif
+
+#if HAVE_TERMIOS_H
+# include <termios.h>
+#endif
+
+#if HAVE_STRING_H
+# include <string.h>
+#endif
+
+#if HAVE_CTYPE_H
+# include <ctype.h>
+#endif
+
+#if HAVE_INTTYPES_H
+# include <inttypes.h>
+#else
+# if HAVE_STDINT_H
+#  include <stdint.h>
+# endif
+#endif
+
+#if HAVE_SYS_RESOURCE_H
+# include <sys/resource.h>
+#endif
+
+#include <stdlib.h>
+"; then :
+
+else
+  HTYPE_IS_INTEGRAL=0
+fi
+
+
+
+        if test "$HTYPE_IS_INTEGRAL" -eq 0
+        then
+                                                            cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+#include <stdbool.h>
+#include <stdio.h>
+#include <stddef.h>
+
+#if HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+
+#if HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+
+#if HAVE_SYS_STAT_H
+# include <sys/stat.h>
+#endif
+
+#if HAVE_FCNTL_H
+# include <fcntl.h>
+#endif
+
+#if HAVE_SIGNAL_H
+# include <signal.h>
+#endif
+
+#if HAVE_TIME_H
+# include <time.h>
+#endif
+
+#if HAVE_TERMIOS_H
+# include <termios.h>
+#endif
+
+#if HAVE_STRING_H
+# include <string.h>
+#endif
+
+#if HAVE_CTYPE_H
+# include <ctype.h>
+#endif
+
+#if HAVE_INTTYPES_H
+# include <inttypes.h>
+#else
+# if HAVE_STDINT_H
+#  include <stdint.h>
+# endif
+#endif
+
+#if HAVE_SYS_RESOURCE_H
+# include <sys/resource.h>
+#endif
+
+#include <stdlib.h>
+
+int
+main ()
+{
+clockid_t val; *val;
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  HTYPE_IS_POINTER=yes
+else
+  HTYPE_IS_POINTER=no
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+
+            if test "$HTYPE_IS_POINTER" = yes
+            then
+                fptools_cv_htype_clockid_t="Ptr ()"
+            else
+                if ac_fn_c_compute_int "$LINENO" "sizeof(clockid_t) == sizeof(float)" "HTYPE_IS_FLOAT"        "
+#include <stdbool.h>
+#include <stdio.h>
+#include <stddef.h>
+
+#if HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+
+#if HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+
+#if HAVE_SYS_STAT_H
+# include <sys/stat.h>
+#endif
+
+#if HAVE_FCNTL_H
+# include <fcntl.h>
+#endif
+
+#if HAVE_SIGNAL_H
+# include <signal.h>
+#endif
+
+#if HAVE_TIME_H
+# include <time.h>
+#endif
+
+#if HAVE_TERMIOS_H
+# include <termios.h>
+#endif
+
+#if HAVE_STRING_H
+# include <string.h>
+#endif
+
+#if HAVE_CTYPE_H
+# include <ctype.h>
+#endif
+
+#if HAVE_INTTYPES_H
+# include <inttypes.h>
+#else
+# if HAVE_STDINT_H
+#  include <stdint.h>
+# endif
+#endif
+
+#if HAVE_SYS_RESOURCE_H
+# include <sys/resource.h>
+#endif
+
+#include <stdlib.h>
+"; then :
+
+else
+  fptools_cv_htype_sup_clockid_t=no
+fi
+
+
+                if ac_fn_c_compute_int "$LINENO" "sizeof(clockid_t) == sizeof(double)" "HTYPE_IS_DOUBLE"        "
+#include <stdbool.h>
+#include <stdio.h>
+#include <stddef.h>
+
+#if HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+
+#if HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+
+#if HAVE_SYS_STAT_H
+# include <sys/stat.h>
+#endif
+
+#if HAVE_FCNTL_H
+# include <fcntl.h>
+#endif
+
+#if HAVE_SIGNAL_H
+# include <signal.h>
+#endif
+
+#if HAVE_TIME_H
+# include <time.h>
+#endif
+
+#if HAVE_TERMIOS_H
+# include <termios.h>
+#endif
+
+#if HAVE_STRING_H
+# include <string.h>
+#endif
+
+#if HAVE_CTYPE_H
+# include <ctype.h>
+#endif
+
+#if HAVE_INTTYPES_H
+# include <inttypes.h>
+#else
+# if HAVE_STDINT_H
+#  include <stdint.h>
+# endif
+#endif
+
+#if HAVE_SYS_RESOURCE_H
+# include <sys/resource.h>
+#endif
+
+#include <stdlib.h>
+"; then :
+
+else
+  fptools_cv_htype_sup_clockid_t=no
+fi
+
+
+                if ac_fn_c_compute_int "$LINENO" "sizeof(clockid_t) == sizeof(long double)" "HTYPE_IS_LDOUBLE"        "
+#include <stdbool.h>
+#include <stdio.h>
+#include <stddef.h>
+
+#if HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+
+#if HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+
+#if HAVE_SYS_STAT_H
+# include <sys/stat.h>
+#endif
+
+#if HAVE_FCNTL_H
+# include <fcntl.h>
+#endif
+
+#if HAVE_SIGNAL_H
+# include <signal.h>
+#endif
+
+#if HAVE_TIME_H
+# include <time.h>
+#endif
+
+#if HAVE_TERMIOS_H
+# include <termios.h>
+#endif
+
+#if HAVE_STRING_H
+# include <string.h>
+#endif
+
+#if HAVE_CTYPE_H
+# include <ctype.h>
+#endif
+
+#if HAVE_INTTYPES_H
+# include <inttypes.h>
+#else
+# if HAVE_STDINT_H
+#  include <stdint.h>
+# endif
+#endif
+
+#if HAVE_SYS_RESOURCE_H
+# include <sys/resource.h>
+#endif
+
+#include <stdlib.h>
+"; then :
+
+else
+  fptools_cv_htype_sup_clockid_t=no
+fi
+
+
+                if test "$HTYPE_IS_FLOAT" -eq 1
+                then
+                    fptools_cv_htype_clockid_t=Float
+                elif test "$HTYPE_IS_DOUBLE" -eq 1
+                then
+                    fptools_cv_htype_clockid_t=Double
+                elif test "$HTYPE_IS_LDOUBLE" -eq 1
+                then
+                    fptools_cv_htype_clockid_t=LDouble
+                else
+                    fptools_cv_htype_sup_clockid_t=no
+                fi
+            fi
+        else
+            if ac_fn_c_compute_int "$LINENO" "((clockid_t)(-1)) < ((clockid_t)0)" "HTYPE_IS_SIGNED"        "
+#include <stdbool.h>
+#include <stdio.h>
+#include <stddef.h>
+
+#if HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+
+#if HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+
+#if HAVE_SYS_STAT_H
+# include <sys/stat.h>
+#endif
+
+#if HAVE_FCNTL_H
+# include <fcntl.h>
+#endif
+
+#if HAVE_SIGNAL_H
+# include <signal.h>
+#endif
+
+#if HAVE_TIME_H
+# include <time.h>
+#endif
+
+#if HAVE_TERMIOS_H
+# include <termios.h>
+#endif
+
+#if HAVE_STRING_H
+# include <string.h>
+#endif
+
+#if HAVE_CTYPE_H
+# include <ctype.h>
+#endif
+
+#if HAVE_INTTYPES_H
+# include <inttypes.h>
+#else
+# if HAVE_STDINT_H
+#  include <stdint.h>
+# endif
+#endif
+
+#if HAVE_SYS_RESOURCE_H
+# include <sys/resource.h>
+#endif
+
+#include <stdlib.h>
+"; then :
+
+else
+  fptools_cv_htype_sup_clockid_t=no
+fi
+
+
+            if ac_fn_c_compute_int "$LINENO" "sizeof(clockid_t) * 8" "HTYPE_SIZE"        "
+#include <stdbool.h>
+#include <stdio.h>
+#include <stddef.h>
+
+#if HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+
+#if HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+
+#if HAVE_SYS_STAT_H
+# include <sys/stat.h>
+#endif
+
+#if HAVE_FCNTL_H
+# include <fcntl.h>
+#endif
+
+#if HAVE_SIGNAL_H
+# include <signal.h>
+#endif
+
+#if HAVE_TIME_H
+# include <time.h>
+#endif
+
+#if HAVE_TERMIOS_H
+# include <termios.h>
+#endif
+
+#if HAVE_STRING_H
+# include <string.h>
+#endif
+
+#if HAVE_CTYPE_H
+# include <ctype.h>
+#endif
+
+#if HAVE_INTTYPES_H
+# include <inttypes.h>
+#else
+# if HAVE_STDINT_H
+#  include <stdint.h>
+# endif
+#endif
+
+#if HAVE_SYS_RESOURCE_H
+# include <sys/resource.h>
+#endif
+
+#include <stdlib.h>
+"; then :
+
+else
+  fptools_cv_htype_sup_clockid_t=no
+fi
+
+
+            if test "$HTYPE_IS_SIGNED" -eq 0
+            then
+                fptools_cv_htype_clockid_t="Word$HTYPE_SIZE"
+            else
+                fptools_cv_htype_clockid_t="Int$HTYPE_SIZE"
+            fi
+        fi
+
+fi
+
+    if test "$fptools_cv_htype_sup_clockid_t" = no
+    then
+
+        fptools_cv_htype_clockid_t=NotReallyAType
+        { $as_echo "$as_me:${as_lineno-$LINENO}: result: not supported" >&5
+$as_echo "not supported" >&6; }
+
+    fi
+
+            if test "$fptools_cv_htype_sup_clockid_t" = yes; then
+        { $as_echo "$as_me:${as_lineno-$LINENO}: result: $fptools_cv_htype_clockid_t" >&5
+$as_echo "$fptools_cv_htype_clockid_t" >&6; }
+
+cat >>confdefs.h <<_ACEOF
+#define HTYPE_CLOCKID_T $fptools_cv_htype_clockid_t
+_ACEOF
+
+    fi
+
+
+
+
+
+
+
+
+
+
+    { $as_echo "$as_me:${as_lineno-$LINENO}: checking Haskell type for fsblkcnt_t" >&5
+$as_echo_n "checking Haskell type for fsblkcnt_t... " >&6; }
+    if ${fptools_cv_htype_fsblkcnt_t+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+
+        fptools_cv_htype_sup_fsblkcnt_t=yes
+        if ac_fn_c_compute_int "$LINENO" "(fsblkcnt_t)0.2 - (fsblkcnt_t)0.4 < 0 ? 0 : 1" "HTYPE_IS_INTEGRAL"        "
+#include <stdbool.h>
+#include <stdio.h>
+#include <stddef.h>
+
+#if HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+
+#if HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+
+#if HAVE_SYS_STAT_H
+# include <sys/stat.h>
+#endif
+
+#if HAVE_FCNTL_H
+# include <fcntl.h>
+#endif
+
+#if HAVE_SIGNAL_H
+# include <signal.h>
+#endif
+
+#if HAVE_TIME_H
+# include <time.h>
+#endif
+
+#if HAVE_TERMIOS_H
+# include <termios.h>
+#endif
+
+#if HAVE_STRING_H
+# include <string.h>
+#endif
+
+#if HAVE_CTYPE_H
+# include <ctype.h>
+#endif
+
+#if HAVE_INTTYPES_H
+# include <inttypes.h>
+#else
+# if HAVE_STDINT_H
+#  include <stdint.h>
+# endif
+#endif
+
+#if HAVE_SYS_RESOURCE_H
+# include <sys/resource.h>
+#endif
+
+#include <stdlib.h>
+"; then :
+
+else
+  HTYPE_IS_INTEGRAL=0
+fi
+
+
+
+        if test "$HTYPE_IS_INTEGRAL" -eq 0
+        then
+                                                            cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+#include <stdbool.h>
+#include <stdio.h>
+#include <stddef.h>
+
+#if HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+
+#if HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+
+#if HAVE_SYS_STAT_H
+# include <sys/stat.h>
+#endif
+
+#if HAVE_FCNTL_H
+# include <fcntl.h>
+#endif
+
+#if HAVE_SIGNAL_H
+# include <signal.h>
+#endif
+
+#if HAVE_TIME_H
+# include <time.h>
+#endif
+
+#if HAVE_TERMIOS_H
+# include <termios.h>
+#endif
+
+#if HAVE_STRING_H
+# include <string.h>
+#endif
+
+#if HAVE_CTYPE_H
+# include <ctype.h>
+#endif
+
+#if HAVE_INTTYPES_H
+# include <inttypes.h>
+#else
+# if HAVE_STDINT_H
+#  include <stdint.h>
+# endif
+#endif
+
+#if HAVE_SYS_RESOURCE_H
+# include <sys/resource.h>
+#endif
+
+#include <stdlib.h>
+
+int
+main ()
+{
+fsblkcnt_t val; *val;
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  HTYPE_IS_POINTER=yes
+else
+  HTYPE_IS_POINTER=no
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+
+            if test "$HTYPE_IS_POINTER" = yes
+            then
+                fptools_cv_htype_fsblkcnt_t="Ptr ()"
+            else
+                if ac_fn_c_compute_int "$LINENO" "sizeof(fsblkcnt_t) == sizeof(float)" "HTYPE_IS_FLOAT"        "
+#include <stdbool.h>
+#include <stdio.h>
+#include <stddef.h>
+
+#if HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+
+#if HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+
+#if HAVE_SYS_STAT_H
+# include <sys/stat.h>
+#endif
+
+#if HAVE_FCNTL_H
+# include <fcntl.h>
+#endif
+
+#if HAVE_SIGNAL_H
+# include <signal.h>
+#endif
+
+#if HAVE_TIME_H
+# include <time.h>
+#endif
+
+#if HAVE_TERMIOS_H
+# include <termios.h>
+#endif
+
+#if HAVE_STRING_H
+# include <string.h>
+#endif
+
+#if HAVE_CTYPE_H
+# include <ctype.h>
+#endif
+
+#if HAVE_INTTYPES_H
+# include <inttypes.h>
+#else
+# if HAVE_STDINT_H
+#  include <stdint.h>
+# endif
+#endif
+
+#if HAVE_SYS_RESOURCE_H
+# include <sys/resource.h>
+#endif
+
+#include <stdlib.h>
+"; then :
+
+else
+  fptools_cv_htype_sup_fsblkcnt_t=no
+fi
+
+
+                if ac_fn_c_compute_int "$LINENO" "sizeof(fsblkcnt_t) == sizeof(double)" "HTYPE_IS_DOUBLE"        "
+#include <stdbool.h>
+#include <stdio.h>
+#include <stddef.h>
+
+#if HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+
+#if HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+
+#if HAVE_SYS_STAT_H
+# include <sys/stat.h>
+#endif
+
+#if HAVE_FCNTL_H
+# include <fcntl.h>
+#endif
+
+#if HAVE_SIGNAL_H
+# include <signal.h>
+#endif
+
+#if HAVE_TIME_H
+# include <time.h>
+#endif
+
+#if HAVE_TERMIOS_H
+# include <termios.h>
+#endif
+
+#if HAVE_STRING_H
+# include <string.h>
+#endif
+
+#if HAVE_CTYPE_H
+# include <ctype.h>
+#endif
+
+#if HAVE_INTTYPES_H
+# include <inttypes.h>
+#else
+# if HAVE_STDINT_H
+#  include <stdint.h>
+# endif
+#endif
+
+#if HAVE_SYS_RESOURCE_H
+# include <sys/resource.h>
+#endif
+
+#include <stdlib.h>
+"; then :
+
+else
+  fptools_cv_htype_sup_fsblkcnt_t=no
+fi
+
+
+                if ac_fn_c_compute_int "$LINENO" "sizeof(fsblkcnt_t) == sizeof(long double)" "HTYPE_IS_LDOUBLE"        "
+#include <stdbool.h>
+#include <stdio.h>
+#include <stddef.h>
+
+#if HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+
+#if HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+
+#if HAVE_SYS_STAT_H
+# include <sys/stat.h>
+#endif
+
+#if HAVE_FCNTL_H
+# include <fcntl.h>
+#endif
+
+#if HAVE_SIGNAL_H
+# include <signal.h>
+#endif
+
+#if HAVE_TIME_H
+# include <time.h>
+#endif
+
+#if HAVE_TERMIOS_H
+# include <termios.h>
+#endif
+
+#if HAVE_STRING_H
+# include <string.h>
+#endif
+
+#if HAVE_CTYPE_H
+# include <ctype.h>
+#endif
+
+#if HAVE_INTTYPES_H
+# include <inttypes.h>
+#else
+# if HAVE_STDINT_H
+#  include <stdint.h>
+# endif
+#endif
+
+#if HAVE_SYS_RESOURCE_H
+# include <sys/resource.h>
+#endif
+
+#include <stdlib.h>
+"; then :
+
+else
+  fptools_cv_htype_sup_fsblkcnt_t=no
+fi
+
+
+                if test "$HTYPE_IS_FLOAT" -eq 1
+                then
+                    fptools_cv_htype_fsblkcnt_t=Float
+                elif test "$HTYPE_IS_DOUBLE" -eq 1
+                then
+                    fptools_cv_htype_fsblkcnt_t=Double
+                elif test "$HTYPE_IS_LDOUBLE" -eq 1
+                then
+                    fptools_cv_htype_fsblkcnt_t=LDouble
+                else
+                    fptools_cv_htype_sup_fsblkcnt_t=no
+                fi
+            fi
+        else
+            if ac_fn_c_compute_int "$LINENO" "((fsblkcnt_t)(-1)) < ((fsblkcnt_t)0)" "HTYPE_IS_SIGNED"        "
+#include <stdbool.h>
+#include <stdio.h>
+#include <stddef.h>
+
+#if HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+
+#if HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+
+#if HAVE_SYS_STAT_H
+# include <sys/stat.h>
+#endif
+
+#if HAVE_FCNTL_H
+# include <fcntl.h>
+#endif
+
+#if HAVE_SIGNAL_H
+# include <signal.h>
+#endif
+
+#if HAVE_TIME_H
+# include <time.h>
+#endif
+
+#if HAVE_TERMIOS_H
+# include <termios.h>
+#endif
+
+#if HAVE_STRING_H
+# include <string.h>
+#endif
+
+#if HAVE_CTYPE_H
+# include <ctype.h>
+#endif
+
+#if HAVE_INTTYPES_H
+# include <inttypes.h>
+#else
+# if HAVE_STDINT_H
+#  include <stdint.h>
+# endif
+#endif
+
+#if HAVE_SYS_RESOURCE_H
+# include <sys/resource.h>
+#endif
+
+#include <stdlib.h>
+"; then :
+
+else
+  fptools_cv_htype_sup_fsblkcnt_t=no
+fi
+
+
+            if ac_fn_c_compute_int "$LINENO" "sizeof(fsblkcnt_t) * 8" "HTYPE_SIZE"        "
+#include <stdbool.h>
+#include <stdio.h>
+#include <stddef.h>
+
+#if HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+
+#if HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+
+#if HAVE_SYS_STAT_H
+# include <sys/stat.h>
+#endif
+
+#if HAVE_FCNTL_H
+# include <fcntl.h>
+#endif
+
+#if HAVE_SIGNAL_H
+# include <signal.h>
+#endif
+
+#if HAVE_TIME_H
+# include <time.h>
+#endif
+
+#if HAVE_TERMIOS_H
+# include <termios.h>
+#endif
+
+#if HAVE_STRING_H
+# include <string.h>
+#endif
+
+#if HAVE_CTYPE_H
+# include <ctype.h>
+#endif
+
+#if HAVE_INTTYPES_H
+# include <inttypes.h>
+#else
+# if HAVE_STDINT_H
+#  include <stdint.h>
+# endif
+#endif
+
+#if HAVE_SYS_RESOURCE_H
+# include <sys/resource.h>
+#endif
+
+#include <stdlib.h>
+"; then :
+
+else
+  fptools_cv_htype_sup_fsblkcnt_t=no
+fi
+
+
+            if test "$HTYPE_IS_SIGNED" -eq 0
+            then
+                fptools_cv_htype_fsblkcnt_t="Word$HTYPE_SIZE"
+            else
+                fptools_cv_htype_fsblkcnt_t="Int$HTYPE_SIZE"
+            fi
+        fi
+
+fi
+
+    if test "$fptools_cv_htype_sup_fsblkcnt_t" = no
+    then
+
+        fptools_cv_htype_fsblkcnt_t=NotReallyAType
+        { $as_echo "$as_me:${as_lineno-$LINENO}: result: not supported" >&5
+$as_echo "not supported" >&6; }
+
+    fi
+
+            if test "$fptools_cv_htype_sup_fsblkcnt_t" = yes; then
+        { $as_echo "$as_me:${as_lineno-$LINENO}: result: $fptools_cv_htype_fsblkcnt_t" >&5
+$as_echo "$fptools_cv_htype_fsblkcnt_t" >&6; }
+
+cat >>confdefs.h <<_ACEOF
+#define HTYPE_FSBLKCNT_T $fptools_cv_htype_fsblkcnt_t
+_ACEOF
+
+    fi
+
+
+
+
+
+
+
+
+
+
+    { $as_echo "$as_me:${as_lineno-$LINENO}: checking Haskell type for fsfilcnt_t" >&5
+$as_echo_n "checking Haskell type for fsfilcnt_t... " >&6; }
+    if ${fptools_cv_htype_fsfilcnt_t+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+
+        fptools_cv_htype_sup_fsfilcnt_t=yes
+        if ac_fn_c_compute_int "$LINENO" "(fsfilcnt_t)0.2 - (fsfilcnt_t)0.4 < 0 ? 0 : 1" "HTYPE_IS_INTEGRAL"        "
+#include <stdbool.h>
+#include <stdio.h>
+#include <stddef.h>
+
+#if HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+
+#if HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+
+#if HAVE_SYS_STAT_H
+# include <sys/stat.h>
+#endif
+
+#if HAVE_FCNTL_H
+# include <fcntl.h>
+#endif
+
+#if HAVE_SIGNAL_H
+# include <signal.h>
+#endif
+
+#if HAVE_TIME_H
+# include <time.h>
+#endif
+
+#if HAVE_TERMIOS_H
+# include <termios.h>
+#endif
+
+#if HAVE_STRING_H
+# include <string.h>
+#endif
+
+#if HAVE_CTYPE_H
+# include <ctype.h>
+#endif
+
+#if HAVE_INTTYPES_H
+# include <inttypes.h>
+#else
+# if HAVE_STDINT_H
+#  include <stdint.h>
+# endif
+#endif
+
+#if HAVE_SYS_RESOURCE_H
+# include <sys/resource.h>
+#endif
+
+#include <stdlib.h>
+"; then :
+
+else
+  HTYPE_IS_INTEGRAL=0
+fi
+
+
+
+        if test "$HTYPE_IS_INTEGRAL" -eq 0
+        then
+                                                            cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+#include <stdbool.h>
+#include <stdio.h>
+#include <stddef.h>
+
+#if HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+
+#if HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+
+#if HAVE_SYS_STAT_H
+# include <sys/stat.h>
+#endif
+
+#if HAVE_FCNTL_H
+# include <fcntl.h>
+#endif
+
+#if HAVE_SIGNAL_H
+# include <signal.h>
+#endif
+
+#if HAVE_TIME_H
+# include <time.h>
+#endif
+
+#if HAVE_TERMIOS_H
+# include <termios.h>
+#endif
+
+#if HAVE_STRING_H
+# include <string.h>
+#endif
+
+#if HAVE_CTYPE_H
+# include <ctype.h>
+#endif
+
+#if HAVE_INTTYPES_H
+# include <inttypes.h>
+#else
+# if HAVE_STDINT_H
+#  include <stdint.h>
+# endif
+#endif
+
+#if HAVE_SYS_RESOURCE_H
+# include <sys/resource.h>
+#endif
+
+#include <stdlib.h>
+
+int
+main ()
+{
+fsfilcnt_t val; *val;
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  HTYPE_IS_POINTER=yes
+else
+  HTYPE_IS_POINTER=no
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+
+            if test "$HTYPE_IS_POINTER" = yes
+            then
+                fptools_cv_htype_fsfilcnt_t="Ptr ()"
+            else
+                if ac_fn_c_compute_int "$LINENO" "sizeof(fsfilcnt_t) == sizeof(float)" "HTYPE_IS_FLOAT"        "
+#include <stdbool.h>
+#include <stdio.h>
+#include <stddef.h>
+
+#if HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+
+#if HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+
+#if HAVE_SYS_STAT_H
+# include <sys/stat.h>
+#endif
+
+#if HAVE_FCNTL_H
+# include <fcntl.h>
+#endif
+
+#if HAVE_SIGNAL_H
+# include <signal.h>
+#endif
+
+#if HAVE_TIME_H
+# include <time.h>
+#endif
+
+#if HAVE_TERMIOS_H
+# include <termios.h>
+#endif
+
+#if HAVE_STRING_H
+# include <string.h>
+#endif
+
+#if HAVE_CTYPE_H
+# include <ctype.h>
+#endif
+
+#if HAVE_INTTYPES_H
+# include <inttypes.h>
+#else
+# if HAVE_STDINT_H
+#  include <stdint.h>
+# endif
+#endif
+
+#if HAVE_SYS_RESOURCE_H
+# include <sys/resource.h>
+#endif
+
+#include <stdlib.h>
+"; then :
+
+else
+  fptools_cv_htype_sup_fsfilcnt_t=no
+fi
+
+
+                if ac_fn_c_compute_int "$LINENO" "sizeof(fsfilcnt_t) == sizeof(double)" "HTYPE_IS_DOUBLE"        "
+#include <stdbool.h>
+#include <stdio.h>
+#include <stddef.h>
+
+#if HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+
+#if HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+
+#if HAVE_SYS_STAT_H
+# include <sys/stat.h>
+#endif
+
+#if HAVE_FCNTL_H
+# include <fcntl.h>
+#endif
+
+#if HAVE_SIGNAL_H
+# include <signal.h>
+#endif
+
+#if HAVE_TIME_H
+# include <time.h>
+#endif
+
+#if HAVE_TERMIOS_H
+# include <termios.h>
+#endif
+
+#if HAVE_STRING_H
+# include <string.h>
+#endif
+
+#if HAVE_CTYPE_H
+# include <ctype.h>
+#endif
+
+#if HAVE_INTTYPES_H
+# include <inttypes.h>
+#else
+# if HAVE_STDINT_H
+#  include <stdint.h>
+# endif
+#endif
+
+#if HAVE_SYS_RESOURCE_H
+# include <sys/resource.h>
+#endif
+
+#include <stdlib.h>
+"; then :
+
+else
+  fptools_cv_htype_sup_fsfilcnt_t=no
+fi
+
+
+                if ac_fn_c_compute_int "$LINENO" "sizeof(fsfilcnt_t) == sizeof(long double)" "HTYPE_IS_LDOUBLE"        "
+#include <stdbool.h>
+#include <stdio.h>
+#include <stddef.h>
+
+#if HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+
+#if HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+
+#if HAVE_SYS_STAT_H
+# include <sys/stat.h>
+#endif
+
+#if HAVE_FCNTL_H
+# include <fcntl.h>
+#endif
+
+#if HAVE_SIGNAL_H
+# include <signal.h>
+#endif
+
+#if HAVE_TIME_H
+# include <time.h>
+#endif
+
+#if HAVE_TERMIOS_H
+# include <termios.h>
+#endif
+
+#if HAVE_STRING_H
+# include <string.h>
+#endif
+
+#if HAVE_CTYPE_H
+# include <ctype.h>
+#endif
+
+#if HAVE_INTTYPES_H
+# include <inttypes.h>
+#else
+# if HAVE_STDINT_H
+#  include <stdint.h>
+# endif
+#endif
+
+#if HAVE_SYS_RESOURCE_H
+# include <sys/resource.h>
+#endif
+
+#include <stdlib.h>
+"; then :
+
+else
+  fptools_cv_htype_sup_fsfilcnt_t=no
+fi
+
+
+                if test "$HTYPE_IS_FLOAT" -eq 1
+                then
+                    fptools_cv_htype_fsfilcnt_t=Float
+                elif test "$HTYPE_IS_DOUBLE" -eq 1
+                then
+                    fptools_cv_htype_fsfilcnt_t=Double
+                elif test "$HTYPE_IS_LDOUBLE" -eq 1
+                then
+                    fptools_cv_htype_fsfilcnt_t=LDouble
+                else
+                    fptools_cv_htype_sup_fsfilcnt_t=no
+                fi
+            fi
+        else
+            if ac_fn_c_compute_int "$LINENO" "((fsfilcnt_t)(-1)) < ((fsfilcnt_t)0)" "HTYPE_IS_SIGNED"        "
+#include <stdbool.h>
+#include <stdio.h>
+#include <stddef.h>
+
+#if HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+
+#if HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+
+#if HAVE_SYS_STAT_H
+# include <sys/stat.h>
+#endif
+
+#if HAVE_FCNTL_H
+# include <fcntl.h>
+#endif
+
+#if HAVE_SIGNAL_H
+# include <signal.h>
+#endif
+
+#if HAVE_TIME_H
+# include <time.h>
+#endif
+
+#if HAVE_TERMIOS_H
+# include <termios.h>
+#endif
+
+#if HAVE_STRING_H
+# include <string.h>
+#endif
+
+#if HAVE_CTYPE_H
+# include <ctype.h>
+#endif
+
+#if HAVE_INTTYPES_H
+# include <inttypes.h>
+#else
+# if HAVE_STDINT_H
+#  include <stdint.h>
+# endif
+#endif
+
+#if HAVE_SYS_RESOURCE_H
+# include <sys/resource.h>
+#endif
+
+#include <stdlib.h>
+"; then :
+
+else
+  fptools_cv_htype_sup_fsfilcnt_t=no
+fi
+
+
+            if ac_fn_c_compute_int "$LINENO" "sizeof(fsfilcnt_t) * 8" "HTYPE_SIZE"        "
+#include <stdbool.h>
+#include <stdio.h>
+#include <stddef.h>
+
+#if HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+
+#if HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+
+#if HAVE_SYS_STAT_H
+# include <sys/stat.h>
+#endif
+
+#if HAVE_FCNTL_H
+# include <fcntl.h>
+#endif
+
+#if HAVE_SIGNAL_H
+# include <signal.h>
+#endif
+
+#if HAVE_TIME_H
+# include <time.h>
+#endif
+
+#if HAVE_TERMIOS_H
+# include <termios.h>
+#endif
+
+#if HAVE_STRING_H
+# include <string.h>
+#endif
+
+#if HAVE_CTYPE_H
+# include <ctype.h>
+#endif
+
+#if HAVE_INTTYPES_H
+# include <inttypes.h>
+#else
+# if HAVE_STDINT_H
+#  include <stdint.h>
+# endif
+#endif
+
+#if HAVE_SYS_RESOURCE_H
+# include <sys/resource.h>
+#endif
+
+#include <stdlib.h>
+"; then :
+
+else
+  fptools_cv_htype_sup_fsfilcnt_t=no
+fi
+
+
+            if test "$HTYPE_IS_SIGNED" -eq 0
+            then
+                fptools_cv_htype_fsfilcnt_t="Word$HTYPE_SIZE"
+            else
+                fptools_cv_htype_fsfilcnt_t="Int$HTYPE_SIZE"
+            fi
+        fi
+
+fi
+
+    if test "$fptools_cv_htype_sup_fsfilcnt_t" = no
+    then
+
+        fptools_cv_htype_fsfilcnt_t=NotReallyAType
+        { $as_echo "$as_me:${as_lineno-$LINENO}: result: not supported" >&5
+$as_echo "not supported" >&6; }
+
+    fi
+
+            if test "$fptools_cv_htype_sup_fsfilcnt_t" = yes; then
+        { $as_echo "$as_me:${as_lineno-$LINENO}: result: $fptools_cv_htype_fsfilcnt_t" >&5
+$as_echo "$fptools_cv_htype_fsfilcnt_t" >&6; }
+
+cat >>confdefs.h <<_ACEOF
+#define HTYPE_FSFILCNT_T $fptools_cv_htype_fsfilcnt_t
+_ACEOF
+
+    fi
+
+
+
+
+
+
+
+
+
+
+    { $as_echo "$as_me:${as_lineno-$LINENO}: checking Haskell type for id_t" >&5
+$as_echo_n "checking Haskell type for id_t... " >&6; }
+    if ${fptools_cv_htype_id_t+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+
+        fptools_cv_htype_sup_id_t=yes
+        if ac_fn_c_compute_int "$LINENO" "(id_t)0.2 - (id_t)0.4 < 0 ? 0 : 1" "HTYPE_IS_INTEGRAL"        "
+#include <stdbool.h>
+#include <stdio.h>
+#include <stddef.h>
+
+#if HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+
+#if HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+
+#if HAVE_SYS_STAT_H
+# include <sys/stat.h>
+#endif
+
+#if HAVE_FCNTL_H
+# include <fcntl.h>
+#endif
+
+#if HAVE_SIGNAL_H
+# include <signal.h>
+#endif
+
+#if HAVE_TIME_H
+# include <time.h>
+#endif
+
+#if HAVE_TERMIOS_H
+# include <termios.h>
+#endif
+
+#if HAVE_STRING_H
+# include <string.h>
+#endif
+
+#if HAVE_CTYPE_H
+# include <ctype.h>
+#endif
+
+#if HAVE_INTTYPES_H
+# include <inttypes.h>
+#else
+# if HAVE_STDINT_H
+#  include <stdint.h>
+# endif
+#endif
+
+#if HAVE_SYS_RESOURCE_H
+# include <sys/resource.h>
+#endif
+
+#include <stdlib.h>
+"; then :
+
+else
+  HTYPE_IS_INTEGRAL=0
+fi
+
+
+
+        if test "$HTYPE_IS_INTEGRAL" -eq 0
+        then
+                                                            cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+#include <stdbool.h>
+#include <stdio.h>
+#include <stddef.h>
+
+#if HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+
+#if HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+
+#if HAVE_SYS_STAT_H
+# include <sys/stat.h>
+#endif
+
+#if HAVE_FCNTL_H
+# include <fcntl.h>
+#endif
+
+#if HAVE_SIGNAL_H
+# include <signal.h>
+#endif
+
+#if HAVE_TIME_H
+# include <time.h>
+#endif
+
+#if HAVE_TERMIOS_H
+# include <termios.h>
+#endif
+
+#if HAVE_STRING_H
+# include <string.h>
+#endif
+
+#if HAVE_CTYPE_H
+# include <ctype.h>
+#endif
+
+#if HAVE_INTTYPES_H
+# include <inttypes.h>
+#else
+# if HAVE_STDINT_H
+#  include <stdint.h>
+# endif
+#endif
+
+#if HAVE_SYS_RESOURCE_H
+# include <sys/resource.h>
+#endif
+
+#include <stdlib.h>
+
+int
+main ()
+{
+id_t val; *val;
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  HTYPE_IS_POINTER=yes
+else
+  HTYPE_IS_POINTER=no
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+
+            if test "$HTYPE_IS_POINTER" = yes
+            then
+                fptools_cv_htype_id_t="Ptr ()"
+            else
+                if ac_fn_c_compute_int "$LINENO" "sizeof(id_t) == sizeof(float)" "HTYPE_IS_FLOAT"        "
+#include <stdbool.h>
+#include <stdio.h>
+#include <stddef.h>
+
+#if HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+
+#if HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+
+#if HAVE_SYS_STAT_H
+# include <sys/stat.h>
+#endif
+
+#if HAVE_FCNTL_H
+# include <fcntl.h>
+#endif
+
+#if HAVE_SIGNAL_H
+# include <signal.h>
+#endif
+
+#if HAVE_TIME_H
+# include <time.h>
+#endif
+
+#if HAVE_TERMIOS_H
+# include <termios.h>
+#endif
+
+#if HAVE_STRING_H
+# include <string.h>
+#endif
+
+#if HAVE_CTYPE_H
+# include <ctype.h>
+#endif
+
+#if HAVE_INTTYPES_H
+# include <inttypes.h>
+#else
+# if HAVE_STDINT_H
+#  include <stdint.h>
+# endif
+#endif
+
+#if HAVE_SYS_RESOURCE_H
+# include <sys/resource.h>
+#endif
+
+#include <stdlib.h>
+"; then :
+
+else
+  fptools_cv_htype_sup_id_t=no
+fi
+
+
+                if ac_fn_c_compute_int "$LINENO" "sizeof(id_t) == sizeof(double)" "HTYPE_IS_DOUBLE"        "
+#include <stdbool.h>
+#include <stdio.h>
+#include <stddef.h>
+
+#if HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+
+#if HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+
+#if HAVE_SYS_STAT_H
+# include <sys/stat.h>
+#endif
+
+#if HAVE_FCNTL_H
+# include <fcntl.h>
+#endif
+
+#if HAVE_SIGNAL_H
+# include <signal.h>
+#endif
+
+#if HAVE_TIME_H
+# include <time.h>
+#endif
+
+#if HAVE_TERMIOS_H
+# include <termios.h>
+#endif
+
+#if HAVE_STRING_H
+# include <string.h>
+#endif
+
+#if HAVE_CTYPE_H
+# include <ctype.h>
+#endif
+
+#if HAVE_INTTYPES_H
+# include <inttypes.h>
+#else
+# if HAVE_STDINT_H
+#  include <stdint.h>
+# endif
+#endif
+
+#if HAVE_SYS_RESOURCE_H
+# include <sys/resource.h>
+#endif
+
+#include <stdlib.h>
+"; then :
+
+else
+  fptools_cv_htype_sup_id_t=no
+fi
+
+
+                if ac_fn_c_compute_int "$LINENO" "sizeof(id_t) == sizeof(long double)" "HTYPE_IS_LDOUBLE"        "
+#include <stdbool.h>
+#include <stdio.h>
+#include <stddef.h>
+
+#if HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+
+#if HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+
+#if HAVE_SYS_STAT_H
+# include <sys/stat.h>
+#endif
+
+#if HAVE_FCNTL_H
+# include <fcntl.h>
+#endif
+
+#if HAVE_SIGNAL_H
+# include <signal.h>
+#endif
+
+#if HAVE_TIME_H
+# include <time.h>
+#endif
+
+#if HAVE_TERMIOS_H
+# include <termios.h>
+#endif
+
+#if HAVE_STRING_H
+# include <string.h>
+#endif
+
+#if HAVE_CTYPE_H
+# include <ctype.h>
+#endif
+
+#if HAVE_INTTYPES_H
+# include <inttypes.h>
+#else
+# if HAVE_STDINT_H
+#  include <stdint.h>
+# endif
+#endif
+
+#if HAVE_SYS_RESOURCE_H
+# include <sys/resource.h>
+#endif
+
+#include <stdlib.h>
+"; then :
+
+else
+  fptools_cv_htype_sup_id_t=no
+fi
+
+
+                if test "$HTYPE_IS_FLOAT" -eq 1
+                then
+                    fptools_cv_htype_id_t=Float
+                elif test "$HTYPE_IS_DOUBLE" -eq 1
+                then
+                    fptools_cv_htype_id_t=Double
+                elif test "$HTYPE_IS_LDOUBLE" -eq 1
+                then
+                    fptools_cv_htype_id_t=LDouble
+                else
+                    fptools_cv_htype_sup_id_t=no
+                fi
+            fi
+        else
+            if ac_fn_c_compute_int "$LINENO" "((id_t)(-1)) < ((id_t)0)" "HTYPE_IS_SIGNED"        "
+#include <stdbool.h>
+#include <stdio.h>
+#include <stddef.h>
+
+#if HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+
+#if HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+
+#if HAVE_SYS_STAT_H
+# include <sys/stat.h>
+#endif
+
+#if HAVE_FCNTL_H
+# include <fcntl.h>
+#endif
+
+#if HAVE_SIGNAL_H
+# include <signal.h>
+#endif
+
+#if HAVE_TIME_H
+# include <time.h>
+#endif
+
+#if HAVE_TERMIOS_H
+# include <termios.h>
+#endif
+
+#if HAVE_STRING_H
+# include <string.h>
+#endif
+
+#if HAVE_CTYPE_H
+# include <ctype.h>
+#endif
+
+#if HAVE_INTTYPES_H
+# include <inttypes.h>
+#else
+# if HAVE_STDINT_H
+#  include <stdint.h>
+# endif
+#endif
+
+#if HAVE_SYS_RESOURCE_H
+# include <sys/resource.h>
+#endif
+
+#include <stdlib.h>
+"; then :
+
+else
+  fptools_cv_htype_sup_id_t=no
+fi
+
+
+            if ac_fn_c_compute_int "$LINENO" "sizeof(id_t) * 8" "HTYPE_SIZE"        "
+#include <stdbool.h>
+#include <stdio.h>
+#include <stddef.h>
+
+#if HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+
+#if HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+
+#if HAVE_SYS_STAT_H
+# include <sys/stat.h>
+#endif
+
+#if HAVE_FCNTL_H
+# include <fcntl.h>
+#endif
+
+#if HAVE_SIGNAL_H
+# include <signal.h>
+#endif
+
+#if HAVE_TIME_H
+# include <time.h>
+#endif
+
+#if HAVE_TERMIOS_H
+# include <termios.h>
+#endif
+
+#if HAVE_STRING_H
+# include <string.h>
+#endif
+
+#if HAVE_CTYPE_H
+# include <ctype.h>
+#endif
+
+#if HAVE_INTTYPES_H
+# include <inttypes.h>
+#else
+# if HAVE_STDINT_H
+#  include <stdint.h>
+# endif
+#endif
+
+#if HAVE_SYS_RESOURCE_H
+# include <sys/resource.h>
+#endif
+
+#include <stdlib.h>
+"; then :
+
+else
+  fptools_cv_htype_sup_id_t=no
+fi
+
+
+            if test "$HTYPE_IS_SIGNED" -eq 0
+            then
+                fptools_cv_htype_id_t="Word$HTYPE_SIZE"
+            else
+                fptools_cv_htype_id_t="Int$HTYPE_SIZE"
+            fi
+        fi
+
+fi
+
+    if test "$fptools_cv_htype_sup_id_t" = no
+    then
+
+        fptools_cv_htype_id_t=NotReallyAType
+        { $as_echo "$as_me:${as_lineno-$LINENO}: result: not supported" >&5
+$as_echo "not supported" >&6; }
+
+    fi
+
+            if test "$fptools_cv_htype_sup_id_t" = yes; then
+        { $as_echo "$as_me:${as_lineno-$LINENO}: result: $fptools_cv_htype_id_t" >&5
+$as_echo "$fptools_cv_htype_id_t" >&6; }
+
+cat >>confdefs.h <<_ACEOF
+#define HTYPE_ID_T $fptools_cv_htype_id_t
+_ACEOF
+
+    fi
+
+
+
+
+
+
+
+
+
+
+    { $as_echo "$as_me:${as_lineno-$LINENO}: checking Haskell type for key_t" >&5
+$as_echo_n "checking Haskell type for key_t... " >&6; }
+    if ${fptools_cv_htype_key_t+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+
+        fptools_cv_htype_sup_key_t=yes
+        if ac_fn_c_compute_int "$LINENO" "(key_t)0.2 - (key_t)0.4 < 0 ? 0 : 1" "HTYPE_IS_INTEGRAL"        "
+#include <stdbool.h>
+#include <stdio.h>
+#include <stddef.h>
+
+#if HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+
+#if HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+
+#if HAVE_SYS_STAT_H
+# include <sys/stat.h>
+#endif
+
+#if HAVE_FCNTL_H
+# include <fcntl.h>
+#endif
+
+#if HAVE_SIGNAL_H
+# include <signal.h>
+#endif
+
+#if HAVE_TIME_H
+# include <time.h>
+#endif
+
+#if HAVE_TERMIOS_H
+# include <termios.h>
+#endif
+
+#if HAVE_STRING_H
+# include <string.h>
+#endif
+
+#if HAVE_CTYPE_H
+# include <ctype.h>
+#endif
+
+#if HAVE_INTTYPES_H
+# include <inttypes.h>
+#else
+# if HAVE_STDINT_H
+#  include <stdint.h>
+# endif
+#endif
+
+#if HAVE_SYS_RESOURCE_H
+# include <sys/resource.h>
+#endif
+
+#include <stdlib.h>
+"; then :
+
+else
+  HTYPE_IS_INTEGRAL=0
+fi
+
+
+
+        if test "$HTYPE_IS_INTEGRAL" -eq 0
+        then
+                                                            cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+#include <stdbool.h>
+#include <stdio.h>
+#include <stddef.h>
+
+#if HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+
+#if HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+
+#if HAVE_SYS_STAT_H
+# include <sys/stat.h>
+#endif
+
+#if HAVE_FCNTL_H
+# include <fcntl.h>
+#endif
+
+#if HAVE_SIGNAL_H
+# include <signal.h>
+#endif
+
+#if HAVE_TIME_H
+# include <time.h>
+#endif
+
+#if HAVE_TERMIOS_H
+# include <termios.h>
+#endif
+
+#if HAVE_STRING_H
+# include <string.h>
+#endif
+
+#if HAVE_CTYPE_H
+# include <ctype.h>
+#endif
+
+#if HAVE_INTTYPES_H
+# include <inttypes.h>
+#else
+# if HAVE_STDINT_H
+#  include <stdint.h>
+# endif
+#endif
+
+#if HAVE_SYS_RESOURCE_H
+# include <sys/resource.h>
+#endif
+
+#include <stdlib.h>
+
+int
+main ()
+{
+key_t val; *val;
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  HTYPE_IS_POINTER=yes
+else
+  HTYPE_IS_POINTER=no
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+
+            if test "$HTYPE_IS_POINTER" = yes
+            then
+                fptools_cv_htype_key_t="Ptr ()"
+            else
+                if ac_fn_c_compute_int "$LINENO" "sizeof(key_t) == sizeof(float)" "HTYPE_IS_FLOAT"        "
+#include <stdbool.h>
+#include <stdio.h>
+#include <stddef.h>
+
+#if HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+
+#if HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+
+#if HAVE_SYS_STAT_H
+# include <sys/stat.h>
+#endif
+
+#if HAVE_FCNTL_H
+# include <fcntl.h>
+#endif
+
+#if HAVE_SIGNAL_H
+# include <signal.h>
+#endif
+
+#if HAVE_TIME_H
+# include <time.h>
+#endif
+
+#if HAVE_TERMIOS_H
+# include <termios.h>
+#endif
+
+#if HAVE_STRING_H
+# include <string.h>
+#endif
+
+#if HAVE_CTYPE_H
+# include <ctype.h>
+#endif
+
+#if HAVE_INTTYPES_H
+# include <inttypes.h>
+#else
+# if HAVE_STDINT_H
+#  include <stdint.h>
+# endif
+#endif
+
+#if HAVE_SYS_RESOURCE_H
+# include <sys/resource.h>
+#endif
+
+#include <stdlib.h>
+"; then :
+
+else
+  fptools_cv_htype_sup_key_t=no
+fi
+
+
+                if ac_fn_c_compute_int "$LINENO" "sizeof(key_t) == sizeof(double)" "HTYPE_IS_DOUBLE"        "
+#include <stdbool.h>
+#include <stdio.h>
+#include <stddef.h>
+
+#if HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+
+#if HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+
+#if HAVE_SYS_STAT_H
+# include <sys/stat.h>
+#endif
+
+#if HAVE_FCNTL_H
+# include <fcntl.h>
+#endif
+
+#if HAVE_SIGNAL_H
+# include <signal.h>
+#endif
+
+#if HAVE_TIME_H
+# include <time.h>
+#endif
+
+#if HAVE_TERMIOS_H
+# include <termios.h>
+#endif
+
+#if HAVE_STRING_H
+# include <string.h>
+#endif
+
+#if HAVE_CTYPE_H
+# include <ctype.h>
+#endif
+
+#if HAVE_INTTYPES_H
+# include <inttypes.h>
+#else
+# if HAVE_STDINT_H
+#  include <stdint.h>
+# endif
+#endif
+
+#if HAVE_SYS_RESOURCE_H
+# include <sys/resource.h>
+#endif
+
+#include <stdlib.h>
+"; then :
+
+else
+  fptools_cv_htype_sup_key_t=no
+fi
+
+
+                if ac_fn_c_compute_int "$LINENO" "sizeof(key_t) == sizeof(long double)" "HTYPE_IS_LDOUBLE"        "
+#include <stdbool.h>
+#include <stdio.h>
+#include <stddef.h>
+
+#if HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+
+#if HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+
+#if HAVE_SYS_STAT_H
+# include <sys/stat.h>
+#endif
+
+#if HAVE_FCNTL_H
+# include <fcntl.h>
+#endif
+
+#if HAVE_SIGNAL_H
+# include <signal.h>
+#endif
+
+#if HAVE_TIME_H
+# include <time.h>
+#endif
+
+#if HAVE_TERMIOS_H
+# include <termios.h>
+#endif
+
+#if HAVE_STRING_H
+# include <string.h>
+#endif
+
+#if HAVE_CTYPE_H
+# include <ctype.h>
+#endif
+
+#if HAVE_INTTYPES_H
+# include <inttypes.h>
+#else
+# if HAVE_STDINT_H
+#  include <stdint.h>
+# endif
+#endif
+
+#if HAVE_SYS_RESOURCE_H
+# include <sys/resource.h>
+#endif
+
+#include <stdlib.h>
+"; then :
+
+else
+  fptools_cv_htype_sup_key_t=no
+fi
+
+
+                if test "$HTYPE_IS_FLOAT" -eq 1
+                then
+                    fptools_cv_htype_key_t=Float
+                elif test "$HTYPE_IS_DOUBLE" -eq 1
+                then
+                    fptools_cv_htype_key_t=Double
+                elif test "$HTYPE_IS_LDOUBLE" -eq 1
+                then
+                    fptools_cv_htype_key_t=LDouble
+                else
+                    fptools_cv_htype_sup_key_t=no
+                fi
+            fi
+        else
+            if ac_fn_c_compute_int "$LINENO" "((key_t)(-1)) < ((key_t)0)" "HTYPE_IS_SIGNED"        "
+#include <stdbool.h>
+#include <stdio.h>
+#include <stddef.h>
+
+#if HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+
+#if HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+
+#if HAVE_SYS_STAT_H
+# include <sys/stat.h>
+#endif
+
+#if HAVE_FCNTL_H
+# include <fcntl.h>
+#endif
+
+#if HAVE_SIGNAL_H
+# include <signal.h>
+#endif
+
+#if HAVE_TIME_H
+# include <time.h>
+#endif
+
+#if HAVE_TERMIOS_H
+# include <termios.h>
+#endif
+
+#if HAVE_STRING_H
+# include <string.h>
+#endif
+
+#if HAVE_CTYPE_H
+# include <ctype.h>
+#endif
+
+#if HAVE_INTTYPES_H
+# include <inttypes.h>
+#else
+# if HAVE_STDINT_H
+#  include <stdint.h>
+# endif
+#endif
+
+#if HAVE_SYS_RESOURCE_H
+# include <sys/resource.h>
+#endif
+
+#include <stdlib.h>
+"; then :
+
+else
+  fptools_cv_htype_sup_key_t=no
+fi
+
+
+            if ac_fn_c_compute_int "$LINENO" "sizeof(key_t) * 8" "HTYPE_SIZE"        "
+#include <stdbool.h>
+#include <stdio.h>
+#include <stddef.h>
+
+#if HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+
+#if HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+
+#if HAVE_SYS_STAT_H
+# include <sys/stat.h>
+#endif
+
+#if HAVE_FCNTL_H
+# include <fcntl.h>
+#endif
+
+#if HAVE_SIGNAL_H
+# include <signal.h>
+#endif
+
+#if HAVE_TIME_H
+# include <time.h>
+#endif
+
+#if HAVE_TERMIOS_H
+# include <termios.h>
+#endif
+
+#if HAVE_STRING_H
+# include <string.h>
+#endif
+
+#if HAVE_CTYPE_H
+# include <ctype.h>
+#endif
+
+#if HAVE_INTTYPES_H
+# include <inttypes.h>
+#else
+# if HAVE_STDINT_H
+#  include <stdint.h>
+# endif
+#endif
+
+#if HAVE_SYS_RESOURCE_H
+# include <sys/resource.h>
+#endif
+
+#include <stdlib.h>
+"; then :
+
+else
+  fptools_cv_htype_sup_key_t=no
+fi
+
+
+            if test "$HTYPE_IS_SIGNED" -eq 0
+            then
+                fptools_cv_htype_key_t="Word$HTYPE_SIZE"
+            else
+                fptools_cv_htype_key_t="Int$HTYPE_SIZE"
+            fi
+        fi
+
+fi
+
+    if test "$fptools_cv_htype_sup_key_t" = no
+    then
+
+        fptools_cv_htype_key_t=NotReallyAType
+        { $as_echo "$as_me:${as_lineno-$LINENO}: result: not supported" >&5
+$as_echo "not supported" >&6; }
+
+    fi
+
+            if test "$fptools_cv_htype_sup_key_t" = yes; then
+        { $as_echo "$as_me:${as_lineno-$LINENO}: result: $fptools_cv_htype_key_t" >&5
+$as_echo "$fptools_cv_htype_key_t" >&6; }
+
+cat >>confdefs.h <<_ACEOF
+#define HTYPE_KEY_T $fptools_cv_htype_key_t
+_ACEOF
+
+    fi
+
+
+
+
+
+
+
+
+
+
+    { $as_echo "$as_me:${as_lineno-$LINENO}: checking Haskell type for timer_t" >&5
+$as_echo_n "checking Haskell type for timer_t... " >&6; }
+    if ${fptools_cv_htype_timer_t+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+
+        fptools_cv_htype_sup_timer_t=yes
+        if ac_fn_c_compute_int "$LINENO" "(timer_t)0.2 - (timer_t)0.4 < 0 ? 0 : 1" "HTYPE_IS_INTEGRAL"        "
+#include <stdbool.h>
+#include <stdio.h>
+#include <stddef.h>
+
+#if HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+
+#if HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+
+#if HAVE_SYS_STAT_H
+# include <sys/stat.h>
+#endif
+
+#if HAVE_FCNTL_H
+# include <fcntl.h>
+#endif
+
+#if HAVE_SIGNAL_H
+# include <signal.h>
+#endif
+
+#if HAVE_TIME_H
+# include <time.h>
+#endif
+
+#if HAVE_TERMIOS_H
+# include <termios.h>
+#endif
+
+#if HAVE_STRING_H
+# include <string.h>
+#endif
+
+#if HAVE_CTYPE_H
+# include <ctype.h>
+#endif
+
+#if HAVE_INTTYPES_H
+# include <inttypes.h>
+#else
+# if HAVE_STDINT_H
+#  include <stdint.h>
+# endif
+#endif
+
+#if HAVE_SYS_RESOURCE_H
+# include <sys/resource.h>
+#endif
+
+#include <stdlib.h>
+"; then :
+
+else
+  HTYPE_IS_INTEGRAL=0
+fi
+
+
+
+        if test "$HTYPE_IS_INTEGRAL" -eq 0
+        then
+                                                            cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+#include <stdbool.h>
+#include <stdio.h>
+#include <stddef.h>
+
+#if HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+
+#if HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+
+#if HAVE_SYS_STAT_H
+# include <sys/stat.h>
+#endif
+
+#if HAVE_FCNTL_H
+# include <fcntl.h>
+#endif
+
+#if HAVE_SIGNAL_H
+# include <signal.h>
+#endif
+
+#if HAVE_TIME_H
+# include <time.h>
+#endif
+
+#if HAVE_TERMIOS_H
+# include <termios.h>
+#endif
+
+#if HAVE_STRING_H
+# include <string.h>
+#endif
+
+#if HAVE_CTYPE_H
+# include <ctype.h>
+#endif
+
+#if HAVE_INTTYPES_H
+# include <inttypes.h>
+#else
+# if HAVE_STDINT_H
+#  include <stdint.h>
+# endif
+#endif
+
+#if HAVE_SYS_RESOURCE_H
+# include <sys/resource.h>
+#endif
+
+#include <stdlib.h>
+
+int
+main ()
+{
+timer_t val; *val;
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  HTYPE_IS_POINTER=yes
+else
+  HTYPE_IS_POINTER=no
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+
+            if test "$HTYPE_IS_POINTER" = yes
+            then
+                fptools_cv_htype_timer_t="Ptr ()"
+            else
+                if ac_fn_c_compute_int "$LINENO" "sizeof(timer_t) == sizeof(float)" "HTYPE_IS_FLOAT"        "
+#include <stdbool.h>
+#include <stdio.h>
+#include <stddef.h>
+
+#if HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+
+#if HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+
+#if HAVE_SYS_STAT_H
+# include <sys/stat.h>
+#endif
+
+#if HAVE_FCNTL_H
+# include <fcntl.h>
+#endif
+
+#if HAVE_SIGNAL_H
+# include <signal.h>
+#endif
+
+#if HAVE_TIME_H
+# include <time.h>
+#endif
+
+#if HAVE_TERMIOS_H
+# include <termios.h>
+#endif
+
+#if HAVE_STRING_H
+# include <string.h>
+#endif
+
+#if HAVE_CTYPE_H
+# include <ctype.h>
+#endif
+
+#if HAVE_INTTYPES_H
+# include <inttypes.h>
+#else
+# if HAVE_STDINT_H
+#  include <stdint.h>
+# endif
+#endif
+
+#if HAVE_SYS_RESOURCE_H
+# include <sys/resource.h>
+#endif
+
+#include <stdlib.h>
+"; then :
+
+else
+  fptools_cv_htype_sup_timer_t=no
+fi
+
+
+                if ac_fn_c_compute_int "$LINENO" "sizeof(timer_t) == sizeof(double)" "HTYPE_IS_DOUBLE"        "
+#include <stdbool.h>
+#include <stdio.h>
+#include <stddef.h>
+
+#if HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+
+#if HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+
+#if HAVE_SYS_STAT_H
+# include <sys/stat.h>
+#endif
+
+#if HAVE_FCNTL_H
+# include <fcntl.h>
+#endif
+
+#if HAVE_SIGNAL_H
+# include <signal.h>
+#endif
+
+#if HAVE_TIME_H
+# include <time.h>
+#endif
+
+#if HAVE_TERMIOS_H
+# include <termios.h>
+#endif
+
+#if HAVE_STRING_H
+# include <string.h>
+#endif
+
+#if HAVE_CTYPE_H
+# include <ctype.h>
+#endif
+
+#if HAVE_INTTYPES_H
+# include <inttypes.h>
+#else
+# if HAVE_STDINT_H
+#  include <stdint.h>
+# endif
+#endif
+
+#if HAVE_SYS_RESOURCE_H
+# include <sys/resource.h>
+#endif
+
+#include <stdlib.h>
+"; then :
+
+else
+  fptools_cv_htype_sup_timer_t=no
+fi
+
+
+                if ac_fn_c_compute_int "$LINENO" "sizeof(timer_t) == sizeof(long double)" "HTYPE_IS_LDOUBLE"        "
+#include <stdbool.h>
+#include <stdio.h>
+#include <stddef.h>
+
+#if HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+
+#if HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+
+#if HAVE_SYS_STAT_H
+# include <sys/stat.h>
+#endif
+
+#if HAVE_FCNTL_H
+# include <fcntl.h>
+#endif
+
+#if HAVE_SIGNAL_H
+# include <signal.h>
+#endif
+
+#if HAVE_TIME_H
+# include <time.h>
+#endif
+
+#if HAVE_TERMIOS_H
+# include <termios.h>
+#endif
+
+#if HAVE_STRING_H
+# include <string.h>
+#endif
+
+#if HAVE_CTYPE_H
+# include <ctype.h>
+#endif
+
+#if HAVE_INTTYPES_H
+# include <inttypes.h>
+#else
+# if HAVE_STDINT_H
+#  include <stdint.h>
+# endif
+#endif
+
+#if HAVE_SYS_RESOURCE_H
+# include <sys/resource.h>
+#endif
+
+#include <stdlib.h>
+"; then :
+
+else
+  fptools_cv_htype_sup_timer_t=no
+fi
+
+
+                if test "$HTYPE_IS_FLOAT" -eq 1
+                then
+                    fptools_cv_htype_timer_t=Float
+                elif test "$HTYPE_IS_DOUBLE" -eq 1
+                then
+                    fptools_cv_htype_timer_t=Double
+                elif test "$HTYPE_IS_LDOUBLE" -eq 1
+                then
+                    fptools_cv_htype_timer_t=LDouble
+                else
+                    fptools_cv_htype_sup_timer_t=no
+                fi
+            fi
+        else
+            if ac_fn_c_compute_int "$LINENO" "((timer_t)(-1)) < ((timer_t)0)" "HTYPE_IS_SIGNED"        "
+#include <stdbool.h>
+#include <stdio.h>
+#include <stddef.h>
+
+#if HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+
+#if HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+
+#if HAVE_SYS_STAT_H
+# include <sys/stat.h>
+#endif
+
+#if HAVE_FCNTL_H
+# include <fcntl.h>
+#endif
+
+#if HAVE_SIGNAL_H
+# include <signal.h>
+#endif
+
+#if HAVE_TIME_H
+# include <time.h>
+#endif
+
+#if HAVE_TERMIOS_H
+# include <termios.h>
+#endif
+
+#if HAVE_STRING_H
+# include <string.h>
+#endif
+
+#if HAVE_CTYPE_H
+# include <ctype.h>
+#endif
+
+#if HAVE_INTTYPES_H
+# include <inttypes.h>
+#else
+# if HAVE_STDINT_H
+#  include <stdint.h>
+# endif
+#endif
+
+#if HAVE_SYS_RESOURCE_H
+# include <sys/resource.h>
+#endif
+
+#include <stdlib.h>
+"; then :
+
+else
+  fptools_cv_htype_sup_timer_t=no
+fi
+
+
+            if ac_fn_c_compute_int "$LINENO" "sizeof(timer_t) * 8" "HTYPE_SIZE"        "
+#include <stdbool.h>
+#include <stdio.h>
+#include <stddef.h>
+
+#if HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+
+#if HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+
+#if HAVE_SYS_STAT_H
+# include <sys/stat.h>
+#endif
+
+#if HAVE_FCNTL_H
+# include <fcntl.h>
+#endif
+
+#if HAVE_SIGNAL_H
+# include <signal.h>
+#endif
+
+#if HAVE_TIME_H
+# include <time.h>
+#endif
+
+#if HAVE_TERMIOS_H
+# include <termios.h>
+#endif
+
+#if HAVE_STRING_H
+# include <string.h>
+#endif
+
+#if HAVE_CTYPE_H
+# include <ctype.h>
+#endif
+
+#if HAVE_INTTYPES_H
+# include <inttypes.h>
+#else
+# if HAVE_STDINT_H
+#  include <stdint.h>
+# endif
+#endif
+
+#if HAVE_SYS_RESOURCE_H
+# include <sys/resource.h>
+#endif
+
+#include <stdlib.h>
+"; then :
+
+else
+  fptools_cv_htype_sup_timer_t=no
+fi
+
+
+            if test "$HTYPE_IS_SIGNED" -eq 0
+            then
+                fptools_cv_htype_timer_t="Word$HTYPE_SIZE"
+            else
+                fptools_cv_htype_timer_t="Int$HTYPE_SIZE"
+            fi
+        fi
+
+fi
+
+    if test "$fptools_cv_htype_sup_timer_t" = no
+    then
+
+        fptools_cv_htype_timer_t=NotReallyAType
+        { $as_echo "$as_me:${as_lineno-$LINENO}: result: not supported" >&5
+$as_echo "not supported" >&6; }
+
+    fi
+
+            if test "$fptools_cv_htype_sup_timer_t" = yes; then
+        { $as_echo "$as_me:${as_lineno-$LINENO}: result: $fptools_cv_htype_timer_t" >&5
+$as_echo "$fptools_cv_htype_timer_t" >&6; }
+
+cat >>confdefs.h <<_ACEOF
+#define HTYPE_TIMER_T $fptools_cv_htype_timer_t
+_ACEOF
+
+    fi
+
+
+
+
+
+
+
+
+
+
+
+    { $as_echo "$as_me:${as_lineno-$LINENO}: checking Haskell type for intptr_t" >&5
+$as_echo_n "checking Haskell type for intptr_t... " >&6; }
+    if ${fptools_cv_htype_intptr_t+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+
+        fptools_cv_htype_sup_intptr_t=yes
+        if ac_fn_c_compute_int "$LINENO" "(intptr_t)0.2 - (intptr_t)0.4 < 0 ? 0 : 1" "HTYPE_IS_INTEGRAL"        "
+#include <stdbool.h>
+#include <stdio.h>
+#include <stddef.h>
+
+#if HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+
+#if HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+
+#if HAVE_SYS_STAT_H
+# include <sys/stat.h>
+#endif
+
+#if HAVE_FCNTL_H
+# include <fcntl.h>
+#endif
+
+#if HAVE_SIGNAL_H
+# include <signal.h>
+#endif
+
+#if HAVE_TIME_H
+# include <time.h>
+#endif
+
+#if HAVE_TERMIOS_H
+# include <termios.h>
+#endif
+
+#if HAVE_STRING_H
+# include <string.h>
+#endif
+
+#if HAVE_CTYPE_H
+# include <ctype.h>
+#endif
+
+#if HAVE_INTTYPES_H
+# include <inttypes.h>
+#else
+# if HAVE_STDINT_H
+#  include <stdint.h>
+# endif
+#endif
+
+#if HAVE_SYS_RESOURCE_H
+# include <sys/resource.h>
+#endif
+
+#include <stdlib.h>
+"; then :
+
+else
+  HTYPE_IS_INTEGRAL=0
+fi
+
+
+
+        if test "$HTYPE_IS_INTEGRAL" -eq 0
+        then
+                                                            cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+#include <stdbool.h>
+#include <stdio.h>
+#include <stddef.h>
+
+#if HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+
+#if HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+
+#if HAVE_SYS_STAT_H
+# include <sys/stat.h>
+#endif
+
+#if HAVE_FCNTL_H
+# include <fcntl.h>
+#endif
+
+#if HAVE_SIGNAL_H
+# include <signal.h>
+#endif
+
+#if HAVE_TIME_H
+# include <time.h>
+#endif
+
+#if HAVE_TERMIOS_H
+# include <termios.h>
+#endif
+
+#if HAVE_STRING_H
+# include <string.h>
+#endif
+
+#if HAVE_CTYPE_H
+# include <ctype.h>
+#endif
+
+#if HAVE_INTTYPES_H
+# include <inttypes.h>
+#else
+# if HAVE_STDINT_H
+#  include <stdint.h>
+# endif
+#endif
+
+#if HAVE_SYS_RESOURCE_H
+# include <sys/resource.h>
+#endif
+
+#include <stdlib.h>
+
+int
+main ()
+{
+intptr_t val; *val;
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  HTYPE_IS_POINTER=yes
+else
+  HTYPE_IS_POINTER=no
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+
+            if test "$HTYPE_IS_POINTER" = yes
+            then
+                fptools_cv_htype_intptr_t="Ptr ()"
+            else
+                if ac_fn_c_compute_int "$LINENO" "sizeof(intptr_t) == sizeof(float)" "HTYPE_IS_FLOAT"        "
+#include <stdbool.h>
+#include <stdio.h>
+#include <stddef.h>
+
+#if HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+
+#if HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+
+#if HAVE_SYS_STAT_H
+# include <sys/stat.h>
+#endif
+
+#if HAVE_FCNTL_H
+# include <fcntl.h>
+#endif
+
+#if HAVE_SIGNAL_H
+# include <signal.h>
+#endif
+
+#if HAVE_TIME_H
+# include <time.h>
+#endif
+
+#if HAVE_TERMIOS_H
+# include <termios.h>
+#endif
+
+#if HAVE_STRING_H
+# include <string.h>
+#endif
+
+#if HAVE_CTYPE_H
+# include <ctype.h>
+#endif
+
+#if HAVE_INTTYPES_H
+# include <inttypes.h>
+#else
+# if HAVE_STDINT_H
+#  include <stdint.h>
+# endif
+#endif
+
+#if HAVE_SYS_RESOURCE_H
+# include <sys/resource.h>
+#endif
+
+#include <stdlib.h>
+"; then :
+
+else
+  fptools_cv_htype_sup_intptr_t=no
+fi
+
+
+                if ac_fn_c_compute_int "$LINENO" "sizeof(intptr_t) == sizeof(double)" "HTYPE_IS_DOUBLE"        "
+#include <stdbool.h>
+#include <stdio.h>
+#include <stddef.h>
+
+#if HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+
+#if HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+
+#if HAVE_SYS_STAT_H
+# include <sys/stat.h>
+#endif
+
+#if HAVE_FCNTL_H
+# include <fcntl.h>
+#endif
+
+#if HAVE_SIGNAL_H
+# include <signal.h>
+#endif
+
+#if HAVE_TIME_H
+# include <time.h>
+#endif
+
+#if HAVE_TERMIOS_H
+# include <termios.h>
+#endif
+
+#if HAVE_STRING_H
+# include <string.h>
+#endif
+
+#if HAVE_CTYPE_H
+# include <ctype.h>
+#endif
+
+#if HAVE_INTTYPES_H
+# include <inttypes.h>
+#else
+# if HAVE_STDINT_H
+#  include <stdint.h>
+# endif
+#endif
+
+#if HAVE_SYS_RESOURCE_H
+# include <sys/resource.h>
+#endif
+
+#include <stdlib.h>
+"; then :
+
+else
+  fptools_cv_htype_sup_intptr_t=no
+fi
+
+
+                if ac_fn_c_compute_int "$LINENO" "sizeof(intptr_t) == sizeof(long double)" "HTYPE_IS_LDOUBLE"        "
+#include <stdbool.h>
+#include <stdio.h>
+#include <stddef.h>
+
+#if HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+
+#if HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+
+#if HAVE_SYS_STAT_H
+# include <sys/stat.h>
+#endif
+
+#if HAVE_FCNTL_H
+# include <fcntl.h>
+#endif
+
+#if HAVE_SIGNAL_H
+# include <signal.h>
+#endif
+
+#if HAVE_TIME_H
+# include <time.h>
+#endif
+
+#if HAVE_TERMIOS_H
+# include <termios.h>
+#endif
+
+#if HAVE_STRING_H
+# include <string.h>
+#endif
+
+#if HAVE_CTYPE_H
+# include <ctype.h>
+#endif
+
+#if HAVE_INTTYPES_H
+# include <inttypes.h>
+#else
+# if HAVE_STDINT_H
+#  include <stdint.h>
+# endif
+#endif
+
+#if HAVE_SYS_RESOURCE_H
+# include <sys/resource.h>
+#endif
+
+#include <stdlib.h>
+"; then :
+
+else
+  fptools_cv_htype_sup_intptr_t=no
+fi
+
+
+                if test "$HTYPE_IS_FLOAT" -eq 1
+                then
+                    fptools_cv_htype_intptr_t=Float
+                elif test "$HTYPE_IS_DOUBLE" -eq 1
+                then
+                    fptools_cv_htype_intptr_t=Double
+                elif test "$HTYPE_IS_LDOUBLE" -eq 1
+                then
+                    fptools_cv_htype_intptr_t=LDouble
+                else
+                    fptools_cv_htype_sup_intptr_t=no
+                fi
+            fi
+        else
+            if ac_fn_c_compute_int "$LINENO" "((intptr_t)(-1)) < ((intptr_t)0)" "HTYPE_IS_SIGNED"        "
+#include <stdbool.h>
+#include <stdio.h>
+#include <stddef.h>
+
+#if HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+
+#if HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+
+#if HAVE_SYS_STAT_H
+# include <sys/stat.h>
+#endif
+
+#if HAVE_FCNTL_H
+# include <fcntl.h>
+#endif
+
+#if HAVE_SIGNAL_H
+# include <signal.h>
+#endif
+
+#if HAVE_TIME_H
+# include <time.h>
+#endif
+
+#if HAVE_TERMIOS_H
+# include <termios.h>
+#endif
+
+#if HAVE_STRING_H
+# include <string.h>
+#endif
+
+#if HAVE_CTYPE_H
+# include <ctype.h>
+#endif
+
+#if HAVE_INTTYPES_H
+# include <inttypes.h>
+#else
+# if HAVE_STDINT_H
+#  include <stdint.h>
+# endif
+#endif
+
+#if HAVE_SYS_RESOURCE_H
+# include <sys/resource.h>
+#endif
+
+#include <stdlib.h>
+"; then :
+
+else
+  fptools_cv_htype_sup_intptr_t=no
+fi
+
+
+            if ac_fn_c_compute_int "$LINENO" "sizeof(intptr_t) * 8" "HTYPE_SIZE"        "
+#include <stdbool.h>
+#include <stdio.h>
+#include <stddef.h>
+
+#if HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+
+#if HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+
+#if HAVE_SYS_STAT_H
+# include <sys/stat.h>
+#endif
+
+#if HAVE_FCNTL_H
+# include <fcntl.h>
+#endif
+
+#if HAVE_SIGNAL_H
+# include <signal.h>
+#endif
+
+#if HAVE_TIME_H
+# include <time.h>
+#endif
+
+#if HAVE_TERMIOS_H
+# include <termios.h>
+#endif
+
+#if HAVE_STRING_H
+# include <string.h>
+#endif
+
+#if HAVE_CTYPE_H
+# include <ctype.h>
+#endif
+
+#if HAVE_INTTYPES_H
+# include <inttypes.h>
+#else
+# if HAVE_STDINT_H
+#  include <stdint.h>
+# endif
+#endif
+
+#if HAVE_SYS_RESOURCE_H
+# include <sys/resource.h>
+#endif
+
+#include <stdlib.h>
+"; then :
+
+else
+  fptools_cv_htype_sup_intptr_t=no
+fi
+
+
+            if test "$HTYPE_IS_SIGNED" -eq 0
+            then
+                fptools_cv_htype_intptr_t="Word$HTYPE_SIZE"
+            else
+                fptools_cv_htype_intptr_t="Int$HTYPE_SIZE"
+            fi
+        fi
+
+fi
+
+    if test "$fptools_cv_htype_sup_intptr_t" = no
+    then
+
+        fptools_cv_htype_intptr_t=NotReallyAType
+        { $as_echo "$as_me:${as_lineno-$LINENO}: result: not supported" >&5
+$as_echo "not supported" >&6; }
+
+    fi
+
+            if test "$fptools_cv_htype_sup_intptr_t" = yes; then
+        { $as_echo "$as_me:${as_lineno-$LINENO}: result: $fptools_cv_htype_intptr_t" >&5
+$as_echo "$fptools_cv_htype_intptr_t" >&6; }
+
+cat >>confdefs.h <<_ACEOF
+#define HTYPE_INTPTR_T $fptools_cv_htype_intptr_t
+_ACEOF
+
+    fi
+
+
+
+
+
+
+
+
+
+
+    { $as_echo "$as_me:${as_lineno-$LINENO}: checking Haskell type for uintptr_t" >&5
+$as_echo_n "checking Haskell type for uintptr_t... " >&6; }
+    if ${fptools_cv_htype_uintptr_t+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+
+        fptools_cv_htype_sup_uintptr_t=yes
+        if ac_fn_c_compute_int "$LINENO" "(uintptr_t)0.2 - (uintptr_t)0.4 < 0 ? 0 : 1" "HTYPE_IS_INTEGRAL"        "
+#include <stdbool.h>
+#include <stdio.h>
+#include <stddef.h>
+
+#if HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+
+#if HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+
+#if HAVE_SYS_STAT_H
+# include <sys/stat.h>
+#endif
+
+#if HAVE_FCNTL_H
+# include <fcntl.h>
+#endif
+
+#if HAVE_SIGNAL_H
+# include <signal.h>
+#endif
+
+#if HAVE_TIME_H
+# include <time.h>
+#endif
+
+#if HAVE_TERMIOS_H
+# include <termios.h>
+#endif
+
+#if HAVE_STRING_H
+# include <string.h>
+#endif
+
+#if HAVE_CTYPE_H
+# include <ctype.h>
+#endif
+
+#if HAVE_INTTYPES_H
+# include <inttypes.h>
+#else
+# if HAVE_STDINT_H
+#  include <stdint.h>
+# endif
+#endif
+
+#if HAVE_SYS_RESOURCE_H
+# include <sys/resource.h>
+#endif
+
+#include <stdlib.h>
+"; then :
+
+else
+  HTYPE_IS_INTEGRAL=0
+fi
+
+
+
+        if test "$HTYPE_IS_INTEGRAL" -eq 0
+        then
+                                                            cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+#include <stdbool.h>
+#include <stdio.h>
+#include <stddef.h>
+
+#if HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+
+#if HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+
+#if HAVE_SYS_STAT_H
+# include <sys/stat.h>
+#endif
+
+#if HAVE_FCNTL_H
+# include <fcntl.h>
+#endif
+
+#if HAVE_SIGNAL_H
+# include <signal.h>
+#endif
+
+#if HAVE_TIME_H
+# include <time.h>
+#endif
+
+#if HAVE_TERMIOS_H
+# include <termios.h>
+#endif
+
+#if HAVE_STRING_H
+# include <string.h>
+#endif
+
+#if HAVE_CTYPE_H
+# include <ctype.h>
+#endif
+
+#if HAVE_INTTYPES_H
+# include <inttypes.h>
+#else
+# if HAVE_STDINT_H
+#  include <stdint.h>
+# endif
+#endif
+
+#if HAVE_SYS_RESOURCE_H
+# include <sys/resource.h>
+#endif
+
+#include <stdlib.h>
+
+int
+main ()
+{
+uintptr_t val; *val;
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  HTYPE_IS_POINTER=yes
+else
+  HTYPE_IS_POINTER=no
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+
+            if test "$HTYPE_IS_POINTER" = yes
+            then
+                fptools_cv_htype_uintptr_t="Ptr ()"
+            else
+                if ac_fn_c_compute_int "$LINENO" "sizeof(uintptr_t) == sizeof(float)" "HTYPE_IS_FLOAT"        "
+#include <stdbool.h>
+#include <stdio.h>
+#include <stddef.h>
+
+#if HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+
+#if HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+
+#if HAVE_SYS_STAT_H
+# include <sys/stat.h>
+#endif
+
+#if HAVE_FCNTL_H
+# include <fcntl.h>
+#endif
+
+#if HAVE_SIGNAL_H
+# include <signal.h>
+#endif
+
+#if HAVE_TIME_H
+# include <time.h>
+#endif
+
+#if HAVE_TERMIOS_H
+# include <termios.h>
+#endif
+
+#if HAVE_STRING_H
+# include <string.h>
+#endif
+
+#if HAVE_CTYPE_H
+# include <ctype.h>
+#endif
+
+#if HAVE_INTTYPES_H
+# include <inttypes.h>
+#else
+# if HAVE_STDINT_H
+#  include <stdint.h>
+# endif
+#endif
+
+#if HAVE_SYS_RESOURCE_H
+# include <sys/resource.h>
+#endif
+
+#include <stdlib.h>
+"; then :
+
+else
+  fptools_cv_htype_sup_uintptr_t=no
+fi
+
+
+                if ac_fn_c_compute_int "$LINENO" "sizeof(uintptr_t) == sizeof(double)" "HTYPE_IS_DOUBLE"        "
+#include <stdbool.h>
+#include <stdio.h>
+#include <stddef.h>
+
+#if HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+
+#if HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+
+#if HAVE_SYS_STAT_H
+# include <sys/stat.h>
+#endif
+
+#if HAVE_FCNTL_H
+# include <fcntl.h>
+#endif
+
+#if HAVE_SIGNAL_H
+# include <signal.h>
+#endif
+
+#if HAVE_TIME_H
+# include <time.h>
+#endif
+
+#if HAVE_TERMIOS_H
+# include <termios.h>
+#endif
+
+#if HAVE_STRING_H
+# include <string.h>
+#endif
+
+#if HAVE_CTYPE_H
+# include <ctype.h>
+#endif
+
+#if HAVE_INTTYPES_H
+# include <inttypes.h>
+#else
+# if HAVE_STDINT_H
+#  include <stdint.h>
+# endif
+#endif
+
+#if HAVE_SYS_RESOURCE_H
+# include <sys/resource.h>
+#endif
+
+#include <stdlib.h>
+"; then :
+
+else
+  fptools_cv_htype_sup_uintptr_t=no
+fi
+
+
+                if ac_fn_c_compute_int "$LINENO" "sizeof(uintptr_t) == sizeof(long double)" "HTYPE_IS_LDOUBLE"        "
+#include <stdbool.h>
+#include <stdio.h>
+#include <stddef.h>
+
+#if HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+
+#if HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+
+#if HAVE_SYS_STAT_H
+# include <sys/stat.h>
+#endif
+
+#if HAVE_FCNTL_H
+# include <fcntl.h>
+#endif
+
+#if HAVE_SIGNAL_H
+# include <signal.h>
+#endif
+
+#if HAVE_TIME_H
+# include <time.h>
+#endif
+
+#if HAVE_TERMIOS_H
+# include <termios.h>
+#endif
+
+#if HAVE_STRING_H
+# include <string.h>
+#endif
+
+#if HAVE_CTYPE_H
+# include <ctype.h>
+#endif
+
+#if HAVE_INTTYPES_H
+# include <inttypes.h>
+#else
+# if HAVE_STDINT_H
+#  include <stdint.h>
+# endif
+#endif
+
+#if HAVE_SYS_RESOURCE_H
+# include <sys/resource.h>
+#endif
+
+#include <stdlib.h>
+"; then :
+
+else
+  fptools_cv_htype_sup_uintptr_t=no
+fi
+
+
+                if test "$HTYPE_IS_FLOAT" -eq 1
+                then
+                    fptools_cv_htype_uintptr_t=Float
+                elif test "$HTYPE_IS_DOUBLE" -eq 1
+                then
+                    fptools_cv_htype_uintptr_t=Double
+                elif test "$HTYPE_IS_LDOUBLE" -eq 1
+                then
+                    fptools_cv_htype_uintptr_t=LDouble
+                else
+                    fptools_cv_htype_sup_uintptr_t=no
+                fi
+            fi
+        else
+            if ac_fn_c_compute_int "$LINENO" "((uintptr_t)(-1)) < ((uintptr_t)0)" "HTYPE_IS_SIGNED"        "
+#include <stdbool.h>
+#include <stdio.h>
+#include <stddef.h>
+
+#if HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+
+#if HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+
+#if HAVE_SYS_STAT_H
+# include <sys/stat.h>
+#endif
+
+#if HAVE_FCNTL_H
+# include <fcntl.h>
+#endif
+
+#if HAVE_SIGNAL_H
+# include <signal.h>
+#endif
+
+#if HAVE_TIME_H
+# include <time.h>
+#endif
+
+#if HAVE_TERMIOS_H
+# include <termios.h>
+#endif
+
+#if HAVE_STRING_H
+# include <string.h>
+#endif
+
+#if HAVE_CTYPE_H
+# include <ctype.h>
+#endif
+
+#if HAVE_INTTYPES_H
+# include <inttypes.h>
+#else
+# if HAVE_STDINT_H
+#  include <stdint.h>
+# endif
+#endif
+
+#if HAVE_SYS_RESOURCE_H
+# include <sys/resource.h>
+#endif
+
+#include <stdlib.h>
+"; then :
+
+else
+  fptools_cv_htype_sup_uintptr_t=no
+fi
+
+
+            if ac_fn_c_compute_int "$LINENO" "sizeof(uintptr_t) * 8" "HTYPE_SIZE"        "
+#include <stdbool.h>
+#include <stdio.h>
+#include <stddef.h>
+
+#if HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+
+#if HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+
+#if HAVE_SYS_STAT_H
+# include <sys/stat.h>
+#endif
+
+#if HAVE_FCNTL_H
+# include <fcntl.h>
+#endif
+
+#if HAVE_SIGNAL_H
+# include <signal.h>
+#endif
+
+#if HAVE_TIME_H
+# include <time.h>
+#endif
+
+#if HAVE_TERMIOS_H
+# include <termios.h>
+#endif
+
+#if HAVE_STRING_H
+# include <string.h>
+#endif
+
+#if HAVE_CTYPE_H
+# include <ctype.h>
+#endif
+
+#if HAVE_INTTYPES_H
+# include <inttypes.h>
+#else
+# if HAVE_STDINT_H
+#  include <stdint.h>
+# endif
+#endif
+
+#if HAVE_SYS_RESOURCE_H
+# include <sys/resource.h>
+#endif
+
+#include <stdlib.h>
+"; then :
+
+else
+  fptools_cv_htype_sup_uintptr_t=no
+fi
+
+
+            if test "$HTYPE_IS_SIGNED" -eq 0
+            then
+                fptools_cv_htype_uintptr_t="Word$HTYPE_SIZE"
+            else
+                fptools_cv_htype_uintptr_t="Int$HTYPE_SIZE"
+            fi
+        fi
+
+fi
+
+    if test "$fptools_cv_htype_sup_uintptr_t" = no
+    then
+
+        fptools_cv_htype_uintptr_t=NotReallyAType
+        { $as_echo "$as_me:${as_lineno-$LINENO}: result: not supported" >&5
+$as_echo "not supported" >&6; }
+
+    fi
+
+            if test "$fptools_cv_htype_sup_uintptr_t" = yes; then
+        { $as_echo "$as_me:${as_lineno-$LINENO}: result: $fptools_cv_htype_uintptr_t" >&5
+$as_echo "$fptools_cv_htype_uintptr_t" >&6; }
+
+cat >>confdefs.h <<_ACEOF
+#define HTYPE_UINTPTR_T $fptools_cv_htype_uintptr_t
+_ACEOF
+
+    fi
+
+
+
+
+
+
+
+
+
+
+    { $as_echo "$as_me:${as_lineno-$LINENO}: checking Haskell type for intmax_t" >&5
+$as_echo_n "checking Haskell type for intmax_t... " >&6; }
+    if ${fptools_cv_htype_intmax_t+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+
+        fptools_cv_htype_sup_intmax_t=yes
+        if ac_fn_c_compute_int "$LINENO" "(intmax_t)0.2 - (intmax_t)0.4 < 0 ? 0 : 1" "HTYPE_IS_INTEGRAL"        "
+#include <stdbool.h>
+#include <stdio.h>
+#include <stddef.h>
+
+#if HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+
+#if HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+
+#if HAVE_SYS_STAT_H
+# include <sys/stat.h>
+#endif
+
+#if HAVE_FCNTL_H
+# include <fcntl.h>
+#endif
+
+#if HAVE_SIGNAL_H
+# include <signal.h>
+#endif
+
+#if HAVE_TIME_H
+# include <time.h>
+#endif
+
+#if HAVE_TERMIOS_H
+# include <termios.h>
+#endif
+
+#if HAVE_STRING_H
+# include <string.h>
+#endif
+
+#if HAVE_CTYPE_H
+# include <ctype.h>
+#endif
+
+#if HAVE_INTTYPES_H
+# include <inttypes.h>
+#else
+# if HAVE_STDINT_H
+#  include <stdint.h>
+# endif
+#endif
+
+#if HAVE_SYS_RESOURCE_H
+# include <sys/resource.h>
+#endif
+
+#include <stdlib.h>
+"; then :
+
+else
+  HTYPE_IS_INTEGRAL=0
+fi
+
+
+
+        if test "$HTYPE_IS_INTEGRAL" -eq 0
+        then
+                                                            cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+#include <stdbool.h>
+#include <stdio.h>
+#include <stddef.h>
+
+#if HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+
+#if HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+
+#if HAVE_SYS_STAT_H
+# include <sys/stat.h>
+#endif
+
+#if HAVE_FCNTL_H
+# include <fcntl.h>
+#endif
+
+#if HAVE_SIGNAL_H
+# include <signal.h>
+#endif
+
+#if HAVE_TIME_H
+# include <time.h>
+#endif
+
+#if HAVE_TERMIOS_H
+# include <termios.h>
+#endif
+
+#if HAVE_STRING_H
+# include <string.h>
+#endif
+
+#if HAVE_CTYPE_H
+# include <ctype.h>
+#endif
+
+#if HAVE_INTTYPES_H
+# include <inttypes.h>
+#else
+# if HAVE_STDINT_H
+#  include <stdint.h>
+# endif
+#endif
+
+#if HAVE_SYS_RESOURCE_H
+# include <sys/resource.h>
+#endif
+
+#include <stdlib.h>
+
+int
+main ()
+{
+intmax_t val; *val;
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  HTYPE_IS_POINTER=yes
+else
+  HTYPE_IS_POINTER=no
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+
+            if test "$HTYPE_IS_POINTER" = yes
+            then
+                fptools_cv_htype_intmax_t="Ptr ()"
+            else
+                if ac_fn_c_compute_int "$LINENO" "sizeof(intmax_t) == sizeof(float)" "HTYPE_IS_FLOAT"        "
+#include <stdbool.h>
+#include <stdio.h>
+#include <stddef.h>
+
+#if HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+
+#if HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+
+#if HAVE_SYS_STAT_H
+# include <sys/stat.h>
+#endif
+
+#if HAVE_FCNTL_H
+# include <fcntl.h>
+#endif
+
+#if HAVE_SIGNAL_H
+# include <signal.h>
+#endif
+
+#if HAVE_TIME_H
+# include <time.h>
+#endif
+
+#if HAVE_TERMIOS_H
+# include <termios.h>
+#endif
+
+#if HAVE_STRING_H
+# include <string.h>
+#endif
+
+#if HAVE_CTYPE_H
+# include <ctype.h>
+#endif
+
+#if HAVE_INTTYPES_H
+# include <inttypes.h>
+#else
+# if HAVE_STDINT_H
+#  include <stdint.h>
+# endif
+#endif
+
+#if HAVE_SYS_RESOURCE_H
+# include <sys/resource.h>
+#endif
+
+#include <stdlib.h>
+"; then :
+
+else
+  fptools_cv_htype_sup_intmax_t=no
+fi
+
+
+                if ac_fn_c_compute_int "$LINENO" "sizeof(intmax_t) == sizeof(double)" "HTYPE_IS_DOUBLE"        "
+#include <stdbool.h>
+#include <stdio.h>
+#include <stddef.h>
+
+#if HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+
+#if HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+
+#if HAVE_SYS_STAT_H
+# include <sys/stat.h>
+#endif
+
+#if HAVE_FCNTL_H
+# include <fcntl.h>
+#endif
+
+#if HAVE_SIGNAL_H
+# include <signal.h>
+#endif
+
+#if HAVE_TIME_H
+# include <time.h>
+#endif
+
+#if HAVE_TERMIOS_H
+# include <termios.h>
+#endif
+
+#if HAVE_STRING_H
+# include <string.h>
+#endif
+
+#if HAVE_CTYPE_H
+# include <ctype.h>
+#endif
+
+#if HAVE_INTTYPES_H
+# include <inttypes.h>
+#else
+# if HAVE_STDINT_H
+#  include <stdint.h>
+# endif
+#endif
+
+#if HAVE_SYS_RESOURCE_H
+# include <sys/resource.h>
+#endif
+
+#include <stdlib.h>
+"; then :
+
+else
+  fptools_cv_htype_sup_intmax_t=no
+fi
+
+
+                if ac_fn_c_compute_int "$LINENO" "sizeof(intmax_t) == sizeof(long double)" "HTYPE_IS_LDOUBLE"        "
+#include <stdbool.h>
+#include <stdio.h>
+#include <stddef.h>
+
+#if HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+
+#if HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+
+#if HAVE_SYS_STAT_H
+# include <sys/stat.h>
+#endif
+
+#if HAVE_FCNTL_H
+# include <fcntl.h>
+#endif
+
+#if HAVE_SIGNAL_H
+# include <signal.h>
+#endif
+
+#if HAVE_TIME_H
+# include <time.h>
+#endif
+
+#if HAVE_TERMIOS_H
+# include <termios.h>
+#endif
+
+#if HAVE_STRING_H
+# include <string.h>
+#endif
+
+#if HAVE_CTYPE_H
+# include <ctype.h>
+#endif
+
+#if HAVE_INTTYPES_H
+# include <inttypes.h>
+#else
+# if HAVE_STDINT_H
+#  include <stdint.h>
+# endif
+#endif
+
+#if HAVE_SYS_RESOURCE_H
+# include <sys/resource.h>
+#endif
+
+#include <stdlib.h>
+"; then :
+
+else
+  fptools_cv_htype_sup_intmax_t=no
+fi
+
+
+                if test "$HTYPE_IS_FLOAT" -eq 1
+                then
+                    fptools_cv_htype_intmax_t=Float
+                elif test "$HTYPE_IS_DOUBLE" -eq 1
+                then
+                    fptools_cv_htype_intmax_t=Double
+                elif test "$HTYPE_IS_LDOUBLE" -eq 1
+                then
+                    fptools_cv_htype_intmax_t=LDouble
+                else
+                    fptools_cv_htype_sup_intmax_t=no
+                fi
+            fi
+        else
+            if ac_fn_c_compute_int "$LINENO" "((intmax_t)(-1)) < ((intmax_t)0)" "HTYPE_IS_SIGNED"        "
+#include <stdbool.h>
+#include <stdio.h>
+#include <stddef.h>
+
+#if HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+
+#if HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+
+#if HAVE_SYS_STAT_H
+# include <sys/stat.h>
+#endif
+
+#if HAVE_FCNTL_H
+# include <fcntl.h>
+#endif
+
+#if HAVE_SIGNAL_H
+# include <signal.h>
+#endif
+
+#if HAVE_TIME_H
+# include <time.h>
+#endif
+
+#if HAVE_TERMIOS_H
+# include <termios.h>
+#endif
+
+#if HAVE_STRING_H
+# include <string.h>
+#endif
+
+#if HAVE_CTYPE_H
+# include <ctype.h>
+#endif
+
+#if HAVE_INTTYPES_H
+# include <inttypes.h>
+#else
+# if HAVE_STDINT_H
+#  include <stdint.h>
+# endif
+#endif
+
+#if HAVE_SYS_RESOURCE_H
+# include <sys/resource.h>
+#endif
+
+#include <stdlib.h>
+"; then :
+
+else
+  fptools_cv_htype_sup_intmax_t=no
+fi
+
+
+            if ac_fn_c_compute_int "$LINENO" "sizeof(intmax_t) * 8" "HTYPE_SIZE"        "
+#include <stdbool.h>
+#include <stdio.h>
+#include <stddef.h>
+
+#if HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+
+#if HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+
+#if HAVE_SYS_STAT_H
+# include <sys/stat.h>
+#endif
+
+#if HAVE_FCNTL_H
+# include <fcntl.h>
+#endif
+
+#if HAVE_SIGNAL_H
+# include <signal.h>
+#endif
+
+#if HAVE_TIME_H
+# include <time.h>
+#endif
+
+#if HAVE_TERMIOS_H
+# include <termios.h>
+#endif
+
+#if HAVE_STRING_H
+# include <string.h>
+#endif
+
+#if HAVE_CTYPE_H
+# include <ctype.h>
+#endif
+
+#if HAVE_INTTYPES_H
+# include <inttypes.h>
+#else
+# if HAVE_STDINT_H
+#  include <stdint.h>
+# endif
+#endif
+
+#if HAVE_SYS_RESOURCE_H
+# include <sys/resource.h>
+#endif
+
+#include <stdlib.h>
+"; then :
+
+else
+  fptools_cv_htype_sup_intmax_t=no
+fi
+
+
+            if test "$HTYPE_IS_SIGNED" -eq 0
+            then
+                fptools_cv_htype_intmax_t="Word$HTYPE_SIZE"
+            else
+                fptools_cv_htype_intmax_t="Int$HTYPE_SIZE"
+            fi
+        fi
+
+fi
+
+    if test "$fptools_cv_htype_sup_intmax_t" = no
+    then
+
+        fptools_cv_htype_intmax_t=NotReallyAType
+        { $as_echo "$as_me:${as_lineno-$LINENO}: result: not supported" >&5
+$as_echo "not supported" >&6; }
+
+    fi
+
+            if test "$fptools_cv_htype_sup_intmax_t" = yes; then
+        { $as_echo "$as_me:${as_lineno-$LINENO}: result: $fptools_cv_htype_intmax_t" >&5
+$as_echo "$fptools_cv_htype_intmax_t" >&6; }
+
+cat >>confdefs.h <<_ACEOF
+#define HTYPE_INTMAX_T $fptools_cv_htype_intmax_t
+_ACEOF
+
+    fi
+
+
+
+
+
+
+
+
+
+
+    { $as_echo "$as_me:${as_lineno-$LINENO}: checking Haskell type for uintmax_t" >&5
+$as_echo_n "checking Haskell type for uintmax_t... " >&6; }
+    if ${fptools_cv_htype_uintmax_t+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+
+        fptools_cv_htype_sup_uintmax_t=yes
+        if ac_fn_c_compute_int "$LINENO" "(uintmax_t)0.2 - (uintmax_t)0.4 < 0 ? 0 : 1" "HTYPE_IS_INTEGRAL"        "
+#include <stdbool.h>
+#include <stdio.h>
+#include <stddef.h>
+
+#if HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+
+#if HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+
+#if HAVE_SYS_STAT_H
+# include <sys/stat.h>
+#endif
+
+#if HAVE_FCNTL_H
+# include <fcntl.h>
+#endif
+
+#if HAVE_SIGNAL_H
+# include <signal.h>
+#endif
+
+#if HAVE_TIME_H
+# include <time.h>
+#endif
+
+#if HAVE_TERMIOS_H
+# include <termios.h>
+#endif
+
+#if HAVE_STRING_H
+# include <string.h>
+#endif
+
+#if HAVE_CTYPE_H
+# include <ctype.h>
+#endif
+
+#if HAVE_INTTYPES_H
+# include <inttypes.h>
+#else
+# if HAVE_STDINT_H
+#  include <stdint.h>
+# endif
+#endif
+
+#if HAVE_SYS_RESOURCE_H
+# include <sys/resource.h>
+#endif
+
+#include <stdlib.h>
+"; then :
+
+else
+  HTYPE_IS_INTEGRAL=0
+fi
+
+
+
+        if test "$HTYPE_IS_INTEGRAL" -eq 0
+        then
+                                                            cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+#include <stdbool.h>
+#include <stdio.h>
+#include <stddef.h>
+
+#if HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+
+#if HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+
+#if HAVE_SYS_STAT_H
+# include <sys/stat.h>
+#endif
+
+#if HAVE_FCNTL_H
+# include <fcntl.h>
+#endif
+
+#if HAVE_SIGNAL_H
+# include <signal.h>
+#endif
+
+#if HAVE_TIME_H
+# include <time.h>
+#endif
+
+#if HAVE_TERMIOS_H
+# include <termios.h>
+#endif
+
+#if HAVE_STRING_H
+# include <string.h>
+#endif
+
+#if HAVE_CTYPE_H
+# include <ctype.h>
+#endif
+
+#if HAVE_INTTYPES_H
+# include <inttypes.h>
+#else
+# if HAVE_STDINT_H
+#  include <stdint.h>
+# endif
+#endif
+
+#if HAVE_SYS_RESOURCE_H
+# include <sys/resource.h>
+#endif
+
+#include <stdlib.h>
+
+int
+main ()
+{
+uintmax_t val; *val;
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  HTYPE_IS_POINTER=yes
+else
+  HTYPE_IS_POINTER=no
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+
+            if test "$HTYPE_IS_POINTER" = yes
+            then
+                fptools_cv_htype_uintmax_t="Ptr ()"
+            else
+                if ac_fn_c_compute_int "$LINENO" "sizeof(uintmax_t) == sizeof(float)" "HTYPE_IS_FLOAT"        "
+#include <stdbool.h>
+#include <stdio.h>
+#include <stddef.h>
+
+#if HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+
+#if HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+
+#if HAVE_SYS_STAT_H
+# include <sys/stat.h>
+#endif
+
+#if HAVE_FCNTL_H
+# include <fcntl.h>
+#endif
+
+#if HAVE_SIGNAL_H
+# include <signal.h>
+#endif
+
+#if HAVE_TIME_H
+# include <time.h>
+#endif
+
+#if HAVE_TERMIOS_H
+# include <termios.h>
+#endif
+
+#if HAVE_STRING_H
+# include <string.h>
+#endif
+
+#if HAVE_CTYPE_H
+# include <ctype.h>
+#endif
+
+#if HAVE_INTTYPES_H
+# include <inttypes.h>
+#else
+# if HAVE_STDINT_H
+#  include <stdint.h>
+# endif
+#endif
+
+#if HAVE_SYS_RESOURCE_H
+# include <sys/resource.h>
+#endif
+
+#include <stdlib.h>
+"; then :
+
+else
+  fptools_cv_htype_sup_uintmax_t=no
+fi
+
+
+                if ac_fn_c_compute_int "$LINENO" "sizeof(uintmax_t) == sizeof(double)" "HTYPE_IS_DOUBLE"        "
+#include <stdbool.h>
+#include <stdio.h>
+#include <stddef.h>
+
+#if HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+
+#if HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+
+#if HAVE_SYS_STAT_H
+# include <sys/stat.h>
+#endif
+
+#if HAVE_FCNTL_H
+# include <fcntl.h>
+#endif
+
+#if HAVE_SIGNAL_H
+# include <signal.h>
+#endif
+
+#if HAVE_TIME_H
+# include <time.h>
+#endif
+
+#if HAVE_TERMIOS_H
+# include <termios.h>
+#endif
+
+#if HAVE_STRING_H
+# include <string.h>
+#endif
+
+#if HAVE_CTYPE_H
+# include <ctype.h>
+#endif
+
+#if HAVE_INTTYPES_H
+# include <inttypes.h>
+#else
+# if HAVE_STDINT_H
+#  include <stdint.h>
+# endif
+#endif
+
+#if HAVE_SYS_RESOURCE_H
+# include <sys/resource.h>
+#endif
+
+#include <stdlib.h>
+"; then :
+
+else
+  fptools_cv_htype_sup_uintmax_t=no
+fi
+
+
+                if ac_fn_c_compute_int "$LINENO" "sizeof(uintmax_t) == sizeof(long double)" "HTYPE_IS_LDOUBLE"        "
+#include <stdbool.h>
+#include <stdio.h>
+#include <stddef.h>
+
+#if HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+
+#if HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+
+#if HAVE_SYS_STAT_H
+# include <sys/stat.h>
+#endif
+
+#if HAVE_FCNTL_H
+# include <fcntl.h>
+#endif
+
+#if HAVE_SIGNAL_H
+# include <signal.h>
+#endif
+
+#if HAVE_TIME_H
+# include <time.h>
+#endif
+
+#if HAVE_TERMIOS_H
+# include <termios.h>
+#endif
+
+#if HAVE_STRING_H
+# include <string.h>
+#endif
+
+#if HAVE_CTYPE_H
+# include <ctype.h>
+#endif
+
+#if HAVE_INTTYPES_H
+# include <inttypes.h>
+#else
+# if HAVE_STDINT_H
+#  include <stdint.h>
+# endif
+#endif
+
+#if HAVE_SYS_RESOURCE_H
+# include <sys/resource.h>
+#endif
+
+#include <stdlib.h>
+"; then :
+
+else
+  fptools_cv_htype_sup_uintmax_t=no
+fi
+
+
+                if test "$HTYPE_IS_FLOAT" -eq 1
+                then
+                    fptools_cv_htype_uintmax_t=Float
+                elif test "$HTYPE_IS_DOUBLE" -eq 1
+                then
+                    fptools_cv_htype_uintmax_t=Double
+                elif test "$HTYPE_IS_LDOUBLE" -eq 1
+                then
+                    fptools_cv_htype_uintmax_t=LDouble
+                else
+                    fptools_cv_htype_sup_uintmax_t=no
+                fi
+            fi
+        else
+            if ac_fn_c_compute_int "$LINENO" "((uintmax_t)(-1)) < ((uintmax_t)0)" "HTYPE_IS_SIGNED"        "
+#include <stdbool.h>
+#include <stdio.h>
+#include <stddef.h>
+
+#if HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+
+#if HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+
+#if HAVE_SYS_STAT_H
+# include <sys/stat.h>
+#endif
+
+#if HAVE_FCNTL_H
+# include <fcntl.h>
+#endif
+
+#if HAVE_SIGNAL_H
+# include <signal.h>
+#endif
+
+#if HAVE_TIME_H
+# include <time.h>
+#endif
+
+#if HAVE_TERMIOS_H
+# include <termios.h>
+#endif
+
+#if HAVE_STRING_H
+# include <string.h>
+#endif
+
+#if HAVE_CTYPE_H
+# include <ctype.h>
+#endif
+
+#if HAVE_INTTYPES_H
+# include <inttypes.h>
+#else
+# if HAVE_STDINT_H
+#  include <stdint.h>
+# endif
+#endif
+
+#if HAVE_SYS_RESOURCE_H
+# include <sys/resource.h>
+#endif
+
+#include <stdlib.h>
+"; then :
+
+else
+  fptools_cv_htype_sup_uintmax_t=no
+fi
+
+
+            if ac_fn_c_compute_int "$LINENO" "sizeof(uintmax_t) * 8" "HTYPE_SIZE"        "
+#include <stdbool.h>
+#include <stdio.h>
+#include <stddef.h>
+
+#if HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+
+#if HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+
+#if HAVE_SYS_STAT_H
+# include <sys/stat.h>
+#endif
+
+#if HAVE_FCNTL_H
+# include <fcntl.h>
+#endif
+
+#if HAVE_SIGNAL_H
+# include <signal.h>
+#endif
+
+#if HAVE_TIME_H
+# include <time.h>
+#endif
+
+#if HAVE_TERMIOS_H
+# include <termios.h>
+#endif
+
+#if HAVE_STRING_H
+# include <string.h>
+#endif
+
+#if HAVE_CTYPE_H
+# include <ctype.h>
+#endif
+
+#if HAVE_INTTYPES_H
+# include <inttypes.h>
+#else
+# if HAVE_STDINT_H
+#  include <stdint.h>
+# endif
+#endif
+
+#if HAVE_SYS_RESOURCE_H
+# include <sys/resource.h>
+#endif
+
+#include <stdlib.h>
+"; then :
+
+else
+  fptools_cv_htype_sup_uintmax_t=no
+fi
+
+
+            if test "$HTYPE_IS_SIGNED" -eq 0
+            then
+                fptools_cv_htype_uintmax_t="Word$HTYPE_SIZE"
+            else
+                fptools_cv_htype_uintmax_t="Int$HTYPE_SIZE"
+            fi
+        fi
+
+fi
+
+    if test "$fptools_cv_htype_sup_uintmax_t" = no
+    then
+
+        fptools_cv_htype_uintmax_t=NotReallyAType
+        { $as_echo "$as_me:${as_lineno-$LINENO}: result: not supported" >&5
+$as_echo "not supported" >&6; }
+
+    fi
+
+            if test "$fptools_cv_htype_sup_uintmax_t" = yes; then
+        { $as_echo "$as_me:${as_lineno-$LINENO}: result: $fptools_cv_htype_uintmax_t" >&5
+$as_echo "$fptools_cv_htype_uintmax_t" >&6; }
+
+cat >>confdefs.h <<_ACEOF
+#define HTYPE_UINTMAX_T $fptools_cv_htype_uintmax_t
+_ACEOF
+
+    fi
+
+
+
+# test errno values
+for fp_const_name in E2BIG EACCES EADDRINUSE EADDRNOTAVAIL EADV EAFNOSUPPORT EAGAIN EALREADY EBADF EBADMSG EBADRPC EBUSY ECHILD ECOMM ECONNABORTED ECONNREFUSED ECONNRESET EDEADLK EDESTADDRREQ EDIRTY EDOM EDQUOT EEXIST EFAULT EFBIG EFTYPE EHOSTDOWN EHOSTUNREACH EIDRM EILSEQ EINPROGRESS EINTR EINVAL EIO EISCONN EISDIR ELOOP EMFILE EMLINK EMSGSIZE EMULTIHOP ENAMETOOLONG ENETDOWN ENETRESET ENETUNREACH ENFILE ENOBUFS ENODATA ENODEV ENOENT ENOEXEC ENOLCK ENOLINK ENOMEM ENOMSG ENONET ENOPROTOOPT ENOSPC ENOSR ENOSTR ENOSYS ENOTBLK ENOTCONN ENOTDIR ENOTEMPTY ENOTSOCK ENOTTY ENXIO EOPNOTSUPP EPERM EPFNOSUPPORT EPIPE EPROCLIM EPROCUNAVAIL EPROGMISMATCH EPROGUNAVAIL EPROTO EPROTONOSUPPORT EPROTOTYPE ERANGE EREMCHG EREMOTE EROFS ERPCMISMATCH ERREMOTE ESHUTDOWN ESOCKTNOSUPPORT ESPIPE ESRCH ESRMNT ESTALE ETIME ETIMEDOUT ETOOMANYREFS ETXTBSY EUSERS EWOULDBLOCK EXDEV ENOCIGAR ENOTSUP
+do
+as_fp_Cache=`$as_echo "fp_cv_const_$fp_const_name" | $as_tr_sh`
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking value of $fp_const_name" >&5
+$as_echo_n "checking value of $fp_const_name... " >&6; }
+if eval \${$as_fp_Cache+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if ac_fn_c_compute_int "$LINENO" "$fp_const_name" "fp_check_const_result"        "#include <stdio.h>
+#include <errno.h>
+"; then :
+
+else
+  fp_check_const_result='-1'
+fi
+
+
+eval "$as_fp_Cache=\$fp_check_const_result"
+fi
+eval ac_res=\$$as_fp_Cache
+	       { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+cat >>confdefs.h <<_ACEOF
+#define `$as_echo "CONST_$fp_const_name" | $as_tr_cpp` `eval 'as_val=${'$as_fp_Cache'};$as_echo "$as_val"'`
+_ACEOF
+
+done
+
+
+# we need SIGINT in TopHandler.lhs
+for fp_const_name in SIGINT
+do
+as_fp_Cache=`$as_echo "fp_cv_const_$fp_const_name" | $as_tr_sh`
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking value of $fp_const_name" >&5
+$as_echo_n "checking value of $fp_const_name... " >&6; }
+if eval \${$as_fp_Cache+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if ac_fn_c_compute_int "$LINENO" "$fp_const_name" "fp_check_const_result"        "
+#if HAVE_SIGNAL_H
+#include <signal.h>
+#endif
+"; then :
+
+else
+  fp_check_const_result='-1'
+fi
+
+
+eval "$as_fp_Cache=\$fp_check_const_result"
+fi
+eval ac_res=\$$as_fp_Cache
+	       { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+cat >>confdefs.h <<_ACEOF
+#define `$as_echo "CONST_$fp_const_name" | $as_tr_cpp` `eval 'as_val=${'$as_fp_Cache'};$as_echo "$as_val"'`
+_ACEOF
+
+done
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking value of O_BINARY" >&5
+$as_echo_n "checking value of O_BINARY... " >&6; }
+if ${fp_cv_const_O_BINARY+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if ac_fn_c_compute_int "$LINENO" "O_BINARY" "fp_check_const_result"        "#include <fcntl.h>
+"; then :
+
+else
+  fp_check_const_result=0
+fi
+
+
+fp_cv_const_O_BINARY=$fp_check_const_result
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $fp_cv_const_O_BINARY" >&5
+$as_echo "$fp_cv_const_O_BINARY" >&6; }
+cat >>confdefs.h <<_ACEOF
+#define CONST_O_BINARY $fp_cv_const_O_BINARY
+_ACEOF
+
+
+# We don't use iconv or libcharset on Windows, but if configure finds
+# them then it can cause problems. So we don't even try looking if
+# we are on Windows.
+# See http://www.haskell.org/pipermail/cvs-ghc/2011-September/065980.html
+if test "$WINDOWS" = "NO"
+then
+
+# We can't just use AC_SEARCH_LIBS for this, as on OpenBSD the iconv.h
+# header needs to be included as iconv_open is #define'd to something
+# else. We therefore use our own FP_SEARCH_LIBS_PROTO, which allows us
+# to give prototype text.
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing iconv" >&5
+$as_echo_n "checking for library containing iconv... " >&6; }
+if ${ac_cv_search_iconv+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  ac_func_search_save_LIBS=$LIBS
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+#include <stddef.h>
+#include <iconv.h>
+
+int
+main ()
+{
+iconv_t cd;
+                      cd = iconv_open("", "");
+                      iconv(cd,NULL,NULL,NULL,NULL);
+                      iconv_close(cd);
+  ;
+  return 0;
+}
+_ACEOF
+for ac_lib in '' iconv; do
+  if test -z "$ac_lib"; then
+    ac_res="none required"
+  else
+    ac_res=-l$ac_lib
+    LIBS="-l$ac_lib  $ac_func_search_save_LIBS"
+  fi
+  if ac_fn_c_try_link "$LINENO"; then :
+  ac_cv_search_iconv=$ac_res
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext
+  if ${ac_cv_search_iconv+:} false; then :
+  break
+fi
+done
+if ${ac_cv_search_iconv+:} false; then :
+
+else
+  ac_cv_search_iconv=no
+fi
+rm conftest.$ac_ext
+LIBS=$ac_func_search_save_LIBS
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_iconv" >&5
+$as_echo "$ac_cv_search_iconv" >&6; }
+ac_res=$ac_cv_search_iconv
+if test "$ac_res" != no; then :
+  test "$ac_res" = "none required" || LIBS="$ac_res $LIBS"
+  EXTRA_LIBS="$EXTRA_LIBS $ac_lib"
+else
+  as_fn_error $? "iconv is required on non-Windows platforms" "$LINENO" 5
+fi
+
+# If possible, we use libcharset instead of nl_langinfo(CODESET) to
+# determine the current locale's character encoding.  Allow the user
+# to disable this with --without-libcharset if they don't want a
+# dependency on libcharset.
+
+# Check whether --with-libcharset was given.
+if test "${with_libcharset+set}" = set; then :
+  withval=$with_libcharset;
+else
+  with_libcharset=check
+fi
+
+
+if test "x$with_libcharset" != xno; then :
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing locale_charset" >&5
+$as_echo_n "checking for library containing locale_charset... " >&6; }
+if ${ac_cv_search_locale_charset+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  ac_func_search_save_LIBS=$LIBS
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#include <libcharset.h>
+int
+main ()
+{
+const char* charset = locale_charset();
+  ;
+  return 0;
+}
+_ACEOF
+for ac_lib in '' charset; do
+  if test -z "$ac_lib"; then
+    ac_res="none required"
+  else
+    ac_res=-l$ac_lib
+    LIBS="-l$ac_lib  $ac_func_search_save_LIBS"
+  fi
+  if ac_fn_c_try_link "$LINENO"; then :
+  ac_cv_search_locale_charset=$ac_res
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext
+  if ${ac_cv_search_locale_charset+:} false; then :
+  break
+fi
+done
+if ${ac_cv_search_locale_charset+:} false; then :
+
+else
+  ac_cv_search_locale_charset=no
+fi
+rm conftest.$ac_ext
+LIBS=$ac_func_search_save_LIBS
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_locale_charset" >&5
+$as_echo "$ac_cv_search_locale_charset" >&6; }
+ac_res=$ac_cv_search_locale_charset
+if test "$ac_res" != no; then :
+  test "$ac_res" = "none required" || LIBS="$ac_res $LIBS"
+
+$as_echo "#define HAVE_LIBCHARSET 1" >>confdefs.h
+
+     EXTRA_LIBS="$EXTRA_LIBS $ac_lib"
+
+fi
 fi
 
 fi
diff --git a/configure.ac b/configure.ac
--- a/configure.ac
+++ b/configure.ac
@@ -30,7 +30,7 @@
 AC_HEADER_STDC
 
 # check for specific header (.h) files that we are interested in
-AC_CHECK_HEADERS([ctype.h errno.h fcntl.h inttypes.h limits.h signal.h sys/resource.h sys/select.h sys/stat.h sys/syscall.h sys/time.h sys/timeb.h sys/timers.h sys/times.h sys/types.h sys/utsname.h sys/wait.h termios.h time.h unistd.h utime.h windows.h winsock.h langinfo.h poll.h sys/epoll.h sys/event.h sys/eventfd.h])
+AC_CHECK_HEADERS([ctype.h errno.h fcntl.h inttypes.h limits.h signal.h sys/file.h sys/resource.h sys/select.h sys/stat.h sys/syscall.h sys/time.h sys/timeb.h sys/timers.h sys/times.h sys/types.h sys/utsname.h sys/wait.h termios.h time.h unistd.h utime.h windows.h winsock.h langinfo.h poll.h sys/epoll.h sys/event.h sys/eventfd.h])
 
 # Enable large file support. Do this before testing the types ino_t, off_t, and
 # rlim_t, because it will affect the result of that test.
@@ -51,11 +51,11 @@
 
 # event-related fun
 
-if test "$ac_cv_header_sys_epoll_h" = yes -a "$ac_cv_func_epoll_ctl" = yes; then
+if test "$ac_cv_header_sys_epoll_h" = yes && test "$ac_cv_func_epoll_ctl" = yes; then
   AC_DEFINE([HAVE_EPOLL], [1], [Define if you have epoll support.])
 fi
 
-if test "$ac_cv_header_sys_event_h" = yes -a "$ac_cv_func_kqueue" = yes; then
+if test "$ac_cv_header_sys_event_h" = yes && test "$ac_cv_func_kqueue" = yes; then
   AC_DEFINE([HAVE_KQUEUE], [1], [Define if you have kqueue support.])
 
   AC_CHECK_SIZEOF([kev.filter], [], [#include <sys/event.h>
@@ -65,10 +65,16 @@
 struct kevent kev;])
 fi
 
-if test "$ac_cv_header_poll_h" = yes -a "$ac_cv_func_poll" = yes; then
+if test "$ac_cv_header_poll_h" = yes && test "$ac_cv_func_poll" = yes; then
   AC_DEFINE([HAVE_POLL], [1], [Define if you have poll support.])
 fi
 
+#flock
+AC_CHECK_FUNCS([flock])
+if test "$ac_cv_header_sys_file_h" = yes && test "$ac_cv_func_flock" = yes; then
+  AC_DEFINE([HAVE_FLOCK], [1], [Define if you have flock support.])
+fi
+
 # unsetenv
 AC_CHECK_FUNCS([unsetenv])
 
@@ -118,6 +124,7 @@
 FPTOOLS_CHECK_HTYPE(long long)
 FPTOOLS_CHECK_HTYPE(unsigned long long)
 fi
+FPTOOLS_CHECK_HTYPE(bool)
 FPTOOLS_CHECK_HTYPE(float)
 FPTOOLS_CHECK_HTYPE(double)
 FPTOOLS_CHECK_HTYPE(ptrdiff_t)
@@ -148,6 +155,14 @@
 FPTOOLS_CHECK_HTYPE(nlink_t)
 FPTOOLS_CHECK_HTYPE(ssize_t)
 FPTOOLS_CHECK_HTYPE(rlim_t)
+FPTOOLS_CHECK_HTYPE(blksize_t)
+FPTOOLS_CHECK_HTYPE(blkcnt_t)
+FPTOOLS_CHECK_HTYPE(clockid_t)
+FPTOOLS_CHECK_HTYPE(fsblkcnt_t)
+FPTOOLS_CHECK_HTYPE(fsfilcnt_t)
+FPTOOLS_CHECK_HTYPE(id_t)
+FPTOOLS_CHECK_HTYPE(key_t)
+FPTOOLS_CHECK_HTYPE(timer_t)
 
 FPTOOLS_CHECK_HTYPE(intptr_t)
 FPTOOLS_CHECK_HTYPE(uintptr_t)
@@ -192,14 +207,24 @@
                      [AC_MSG_ERROR([iconv is required on non-Windows platforms])])
 
 # If possible, we use libcharset instead of nl_langinfo(CODESET) to
-# determine the current locale's character encoding.
-FP_SEARCH_LIBS_PROTO(
+# determine the current locale's character encoding.  Allow the user
+# to disable this with --without-libcharset if they don't want a
+# dependency on libcharset.
+AC_ARG_WITH([libcharset],
+  [AS_HELP_STRING([--with-libcharset],
+    [Use libcharset [default=only if available]])],
+  [],
+  [with_libcharset=check])
+
+AS_IF([test "x$with_libcharset" != xno],
+  FP_SEARCH_LIBS_PROTO(
     [locale_charset],
     [#include <libcharset.h>],
     [const char* charset = locale_charset();],
     [charset],
     [AC_DEFINE([HAVE_LIBCHARSET], [1], [Define to 1 if you have libcharset.])
-     EXTRA_LIBS="$EXTRA_LIBS $ac_lib"])
+     EXTRA_LIBS="$EXTRA_LIBS $ac_lib"]
+  ))
 
 fi
 
diff --git a/include/CTypes.h b/include/CTypes.h
--- a/include/CTypes.h
+++ b/include/CTypes.h
@@ -19,36 +19,33 @@
 #define ARITHMETIC_CLASSES  Eq,Ord,Num,Enum,Storable,Real
 #define INTEGRAL_CLASSES Bounded,Integral,Bits,FiniteBits
 #define FLOATING_CLASSES Fractional,Floating,RealFrac,RealFloat
+#define OPAQUE_CLASSES Eq,Ord,Storable
 
 #define ARITHMETIC_TYPE(T,B) \
-newtype T = T B deriving (ARITHMETIC_CLASSES); \
-INSTANCE_READ(T,B); \
-INSTANCE_SHOW(T,B);
+newtype T = T B deriving (ARITHMETIC_CLASSES) \
+                deriving newtype (Read, Show);
 
 #define INTEGRAL_TYPE(T,B) \
-newtype T = T B deriving (ARITHMETIC_CLASSES, INTEGRAL_CLASSES); \
-INSTANCE_READ(T,B); \
-INSTANCE_SHOW(T,B);
+newtype T = T B deriving (ARITHMETIC_CLASSES, INTEGRAL_CLASSES) \
+                deriving newtype (Read, Show);
 
 #define INTEGRAL_TYPE_WITH_CTYPE(T,THE_CTYPE,B) \
-newtype {-# CTYPE "THE_CTYPE" #-} T = T B deriving (ARITHMETIC_CLASSES, INTEGRAL_CLASSES); \
-INSTANCE_READ(T,B); \
-INSTANCE_SHOW(T,B);
+newtype {-# CTYPE "THE_CTYPE" #-} T = T B \
+    deriving (ARITHMETIC_CLASSES, INTEGRAL_CLASSES) \
+    deriving newtype (Read, Show);
 
 #define FLOATING_TYPE(T,B) \
-newtype T = T B deriving (ARITHMETIC_CLASSES, FLOATING_CLASSES); \
-INSTANCE_READ(T,B); \
-INSTANCE_SHOW(T,B);
+newtype T = T B deriving (ARITHMETIC_CLASSES, FLOATING_CLASSES) \
+                deriving newtype (Read, Show);
 
-#define INSTANCE_READ(T,B) \
-instance Read T where { \
-   readsPrec            = unsafeCoerce# (readsPrec :: Int -> ReadS B); \
-   readList             = unsafeCoerce# (readList  :: ReadS [B]); }
+#define FLOATING_TYPE_WITH_CTYPE(T,THE_CTYPE,B) \
+newtype {-# CTYPE "THE_CTYPE" #-} T = T B \
+    deriving (ARITHMETIC_CLASSES, FLOATING_CLASSES) \
+    deriving newtype (Read, Show);
 
-#define INSTANCE_SHOW(T,B) \
-instance Show T where { \
-   showsPrec            = unsafeCoerce# (showsPrec :: Int -> B -> ShowS); \
-   show                 = unsafeCoerce# (show :: B -> String); \
-   showList             = unsafeCoerce# (showList :: [B] -> ShowS); }
+#define OPAQUE_TYPE_WITH_CTYPE(T,THE_CTYPE,B) \
+newtype {-# CTYPE "THE_CTYPE" #-} T = T (B) \
+    deriving (OPAQUE_CLASSES) \
+    deriving newtype Show;
 
 #endif
diff --git a/include/HsBase.h b/include/HsBase.h
--- a/include/HsBase.h
+++ b/include/HsBase.h
@@ -111,7 +111,7 @@
 # include <mach/mach_time.h>
 #endif
 
-#if !defined(_WIN32) && !defined(irix_HOST_OS)
+#if !defined(_WIN32)
 # if HAVE_SYS_RESOURCE_H
 #  include <sys/resource.h>
 # endif
diff --git a/include/HsBaseConfig.h.in b/include/HsBaseConfig.h.in
--- a/include/HsBaseConfig.h.in
+++ b/include/HsBaseConfig.h.in
@@ -327,6 +327,9 @@
 /* Define to 1 if you have the <fcntl.h> header file. */
 #undef HAVE_FCNTL_H
 
+/* Define if you have flock support. */
+#undef HAVE_FLOCK
+
 /* Define to 1 if you have the `ftruncate' function. */
 #undef HAVE_FTRUNCATE
 
@@ -402,6 +405,9 @@
 /* Define to 1 if you have the <sys/event.h> header file. */
 #undef HAVE_SYS_EVENT_H
 
+/* Define to 1 if you have the <sys/file.h> header file. */
+#undef HAVE_SYS_FILE_H
+
 /* Define to 1 if you have the <sys/resource.h> header file. */
 #undef HAVE_SYS_RESOURCE_H
 
@@ -465,12 +471,24 @@
 /* Define to 1 if you have the `_chsize' function. */
 #undef HAVE__CHSIZE
 
+/* Define to Haskell type for blkcnt_t */
+#undef HTYPE_BLKCNT_T
+
+/* Define to Haskell type for blksize_t */
+#undef HTYPE_BLKSIZE_T
+
+/* Define to Haskell type for bool */
+#undef HTYPE_BOOL
+
 /* Define to Haskell type for cc_t */
 #undef HTYPE_CC_T
 
 /* Define to Haskell type for char */
 #undef HTYPE_CHAR
 
+/* Define to Haskell type for clockid_t */
+#undef HTYPE_CLOCKID_T
+
 /* Define to Haskell type for clock_t */
 #undef HTYPE_CLOCK_T
 
@@ -483,9 +501,18 @@
 /* Define to Haskell type for float */
 #undef HTYPE_FLOAT
 
+/* Define to Haskell type for fsblkcnt_t */
+#undef HTYPE_FSBLKCNT_T
+
+/* Define to Haskell type for fsfilcnt_t */
+#undef HTYPE_FSFILCNT_T
+
 /* Define to Haskell type for gid_t */
 #undef HTYPE_GID_T
 
+/* Define to Haskell type for id_t */
+#undef HTYPE_ID_T
+
 /* Define to Haskell type for ino_t */
 #undef HTYPE_INO_T
 
@@ -498,6 +525,9 @@
 /* Define to Haskell type for intptr_t */
 #undef HTYPE_INTPTR_T
 
+/* Define to Haskell type for key_t */
+#undef HTYPE_KEY_T
+
 /* Define to Haskell type for long */
 #undef HTYPE_LONG
 
@@ -545,6 +575,9 @@
 
 /* Define to Haskell type for tcflag_t */
 #undef HTYPE_TCFLAG_T
+
+/* Define to Haskell type for timer_t */
+#undef HTYPE_TIMER_T
 
 /* Define to Haskell type for time_t */
 #undef HTYPE_TIME_T
