diff --git a/COPYING b/COPYING
new file mode 100644
--- /dev/null
+++ b/COPYING
@@ -0,0 +1,29 @@
+<!-- -*- xml -*-
+
+HsHyperEstraier はパブリックドメインに在ります。
+HsHyperEstraier is in the public domain.
+
+See http://creativecommons.org/licenses/publicdomain/
+
+-->
+
+<rdf:RDF xmlns="http://web.resource.org/cc/"
+	     xmlns:dc="http://purl.org/dc/elements/1.1/"
+	     xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
+  <Work rdf:about="http://ccm.sherry.jp/HsHyperEstraier/">
+	<dc:title>HsHyperEstraier</dc:title>
+	<dc:rights>
+      <Agent>
+	    <dc:title>phonohawk</dc:title>
+	  </Agent>
+    </dc:rights>
+	<license rdf:resource="http://web.resource.org/cc/PublicDomain" />
+  </Work>
+      
+  <License rdf:about="http://web.resource.org/cc/PublicDomain">
+	<permits rdf:resource="http://web.resource.org/cc/Reproduction" />
+	<permits rdf:resource="http://web.resource.org/cc/Distribution" />
+	<permits rdf:resource="http://web.resource.org/cc/DerivativeWorks" />
+  </License>
+
+</rdf:RDF>
diff --git a/Database/QDBM/Cabin/List.hsc b/Database/QDBM/Cabin/List.hsc
new file mode 100644
--- /dev/null
+++ b/Database/QDBM/Cabin/List.hsc
@@ -0,0 +1,100 @@
+module Database.QDBM.Cabin.List
+    ( List
+    , CBLIST
+
+    , wrapList
+    , withListPtr
+
+    , newList
+    , push
+    , length
+    , (!!)
+
+    , toList
+    , fromList
+    )
+    where
+
+import qualified Data.ByteString as BS
+import           Data.ByteString.Base
+import           Data.Maybe
+import           Foreign.C.Types
+import           Foreign.ForeignPtr
+import           Foreign.Ptr
+import           Foreign.Storable
+import           Foreign.Marshal.Alloc
+import           Prelude hiding (length, (!!))
+
+
+infixl 9 !!
+
+
+newtype List = List (ForeignPtr CBLIST)
+data CBLIST
+
+
+foreign import ccall unsafe "cabin.h cblistopen"
+        _open :: IO (Ptr CBLIST)
+
+foreign import ccall unsafe "cabin.h &cblistclose"
+        _close :: FunPtr (Ptr CBLIST -> IO ())
+
+foreign import ccall unsafe "cabin.h cblistnum"
+        _num :: Ptr CBLIST -> IO CInt
+
+foreign import ccall unsafe "cabin.h cblistval"
+        _val :: Ptr CBLIST -> CInt -> Ptr CInt -> IO (Ptr CChar)
+
+foreign import ccall unsafe "cabin.h cblistpush"
+        _push :: Ptr CBLIST -> Ptr CChar -> CInt -> IO ()
+
+
+wrapList :: Ptr CBLIST -> IO List
+wrapList listPtr = newForeignPtr _close listPtr >>= return . List
+
+
+withListPtr :: List -> (Ptr CBLIST -> IO a) -> IO a
+withListPtr (List list) = withForeignPtr list
+
+
+newList :: IO List
+newList = _open >>= wrapList
+
+
+push :: List -> ByteString -> IO ()
+push list value
+    = withListPtr        list  $ \ listPtr              ->
+      BS.useAsCStringLen value $ \ (valuePtr, valueLen) ->
+      _push listPtr valuePtr (fromIntegral valueLen)
+
+
+length :: List -> IO Int
+length list
+    = withListPtr list $ \ listPtr ->
+      _num listPtr >>= return . fromIntegral
+
+
+(!!) :: List -> Int -> IO (Maybe ByteString)
+list !! index
+    = withListPtr list $ \ listPtr   ->
+      alloca           $ \ valLenPtr ->
+      do valPtr <- _val listPtr (fromIntegral index) valLenPtr
+         if valPtr == nullPtr then
+             return Nothing
+           else
+             do valLen <- peek valLenPtr
+                value  <- BS.copyCStringLen (valPtr, fromIntegral valLen)
+                return $ Just value
+
+
+toList :: List -> IO [ByteString]
+toList list
+    = do len <- length list
+         mapM (list !!) [0..len] >>= return . catMaybes
+
+
+fromList :: [ByteString] -> IO List
+fromList values
+    = do list <- newList
+         mapM_ (push list) values
+         return list
diff --git a/Database/QDBM/Cabin/Map.hsc b/Database/QDBM/Cabin/Map.hsc
new file mode 100644
--- /dev/null
+++ b/Database/QDBM/Cabin/Map.hsc
@@ -0,0 +1,141 @@
+module Database.QDBM.Cabin.Map
+    ( Map
+    , CBMAP
+
+    , wrapMap
+    , unsafePeekMap
+    , withMapPtr
+
+    , newMap
+    , put
+    , get
+
+    , toList
+    , fromList
+    )
+    where
+
+
+import qualified Data.ByteString as BS
+import           Data.ByteString.Base
+import           Foreign.C.Types
+import           Foreign.ForeignPtr
+import           Foreign.Ptr
+import           Foreign.Storable
+import           Foreign.Marshal.Alloc
+
+
+newtype Map = Map (ForeignPtr CBMAP)
+data CBMAP
+
+
+foreign import ccall unsafe "cabin.h cbmapopen"
+        _open :: IO (Ptr CBMAP)
+
+foreign import ccall unsafe "cabin.h &cbmapclose"
+        _close :: FunPtr (Ptr CBMAP -> IO ())
+
+foreign import ccall unsafe "cabin.h cbmapput"
+        _put :: Ptr CBMAP -> Ptr CChar -> CInt -> Ptr CChar -> CInt -> CInt -> IO CInt
+
+foreign import ccall unsafe "cabin.h cbmapget"
+        _get :: Ptr CBMAP -> Ptr CChar -> CInt -> Ptr CInt -> IO (Ptr CChar)
+
+foreign import ccall unsafe "cabin.h cbmapiterinit"
+        _iterinit :: Ptr CBMAP -> IO ()
+
+foreign import ccall unsafe "cabin.h cbmapiternext"
+        _iternext :: Ptr CBMAP -> Ptr CInt -> IO (Ptr CChar)
+
+foreign import ccall unsafe "cabin.h cbmapiterval"
+        _iterval :: Ptr CChar -> Ptr CInt -> IO (Ptr CChar)
+
+
+wrapMap :: Ptr CBMAP -> IO Map
+wrapMap mapPtr = newForeignPtr _close mapPtr >>= return . Map
+
+
+unsafePeekMap :: Ptr CBMAP -> IO Map
+unsafePeekMap mapPtr = newForeignPtr_ mapPtr >>= return . Map
+
+
+withMapPtr :: Map -> (Ptr CBMAP -> IO a) -> IO a
+withMapPtr (Map m) = withForeignPtr m
+
+
+newMap :: IO Map
+newMap = _open >>= wrapMap
+
+
+put :: Map -> ByteString -> ByteString -> Bool -> IO Bool
+put m key value overwrite
+    = withMapPtr         m     $ \ mapPtr               ->
+      BS.useAsCStringLen key   $ \ (keyPtr  , keyLen  ) ->
+      BS.useAsCStringLen value $ \ (valuePtr, valueLen) ->
+      _put mapPtr
+           keyPtr   (fromIntegral keyLen  )
+           valuePtr (fromIntegral valueLen)
+           (fromIntegral $ fromEnum overwrite)
+           >>= return . (/= 0)
+
+
+get :: Map -> ByteString -> IO (Maybe ByteString)
+get m key
+    = withMapPtr         m   $ \ mapPtr           ->
+      BS.useAsCStringLen key $ \ (keyPtr, keyLen) ->
+      alloca                 $ \ valLenPtr        ->
+      do valPtr <- _get mapPtr keyPtr (fromIntegral keyLen) valLenPtr
+         if valPtr == nullPtr then
+             return Nothing
+           else
+             do valLen <- peek valLenPtr
+                value  <- BS.copyCStringLen (valPtr, fromIntegral valLen)
+                return $ Just value
+
+
+initIterator :: Map -> IO ()
+initIterator m
+    = withMapPtr m $ \ mapPtr ->
+      _iterinit mapPtr
+
+
+iterateNext :: Map -> IO (Maybe (ByteString, ByteString))
+iterateNext m
+    = withMapPtr m $ \ mapPtr    ->
+      alloca       $ \ keyLenPtr ->
+      alloca       $ \ valLenPtr ->
+      do keyPtr <- _iternext mapPtr keyLenPtr
+         if keyPtr == nullPtr then
+             return Nothing
+           else
+             do keyLen <- peek keyLenPtr
+                key    <- BS.copyCStringLen (keyPtr, fromIntegral keyLen)
+                -- QDBM のソースを見たら、keyPtr そのものの値からアドレ
+                -- スを計算してゐた…。良くそんな無茶をやるなあと思ふ。
+                valPtr <- _iterval keyPtr valLenPtr
+                valLen <- peek valLenPtr
+                value  <- BS.copyCStringLen (valPtr, fromIntegral valLen)
+                return $ Just (key, value)
+
+
+-- iterator の状態は Map 内部に格納されるので、thread-safe でない。だか
+-- ら list にするなら正格にしなければならない。
+toList :: Map -> IO [(ByteString, ByteString)]
+toList m = initIterator m >> loop
+    where
+      loop :: IO [(ByteString, ByteString)]
+      loop = do next <- iterateNext m
+                case next of
+                  Nothing   -> return []
+                  Just pair -> do rest <- loop -- ここで unsafeInterleaveIO したいが出來ない。
+                                  return $ pair : rest
+
+
+fromList :: [(ByteString, ByteString)] -> IO Map
+fromList pairs
+    = do m <- newMap
+         mapM_ (putPair m) pairs
+         return m
+    where
+      putPair :: Map -> (ByteString, ByteString) -> IO ()
+      putPair m (key, value) = put m key value True >> return ()
diff --git a/HsHyperEstraier.buildinfo.in b/HsHyperEstraier.buildinfo.in
new file mode 100644
--- /dev/null
+++ b/HsHyperEstraier.buildinfo.in
@@ -0,0 +1,2 @@
+cc-options: @HyperEstraier_CFLAGS@
+ld-options: @HyperEstraier_LIBS@
diff --git a/HsHyperEstraier.cabal b/HsHyperEstraier.cabal
new file mode 100644
--- /dev/null
+++ b/HsHyperEstraier.cabal
@@ -0,0 +1,48 @@
+Name:
+    HsHyperEstraier
+Synopsis:
+    HyperEstraier binding for Haskell
+Description:
+    HsHyperEstraier is a HyperEstraier binding for
+    Haskell. HyperEstraier is an embeddable full text search engine
+    which is supposed to be independent to any particular natural
+    languages.
+Version:
+    0.1
+License:
+    PublicDomain
+License-File:
+    COPYING
+Author: 
+    PHO <phonohawk at ps dot sakura dot ne dot jp>
+Maintainer: 
+    PHO <phonohawk at ps dot sakura dot ne dot jp>
+Stability:
+    experimental
+Homepage: 
+    http://ccm.sherry.jp/HsHyperEstraier/
+Category: 
+    Text
+Tested-With: 
+    GHC == 6.6.1
+Build-Depends:
+    base, encoding, network
+Exposed-Modules:
+    Text.HyperEstraier
+    Text.HyperEstraier.Condition
+    Text.HyperEstraier.Database
+    Text.HyperEstraier.Document
+Other-Modules:
+    Database.QDBM.Cabin.List
+    Database.QDBM.Cabin.Map
+    Text.HyperEstraier.Utils
+Extensions:
+    ForeignFunctionInterface, EmptyDataDecls
+GHC-Options: 
+    -fwarn-unused-imports -O3
+Extra-Source-Files:
+    HsHyperEstraier.buildinfo.in
+    configure
+    configure.ac
+    examples/Makefile
+    examples/HelloWorld.hs
diff --git a/Setup.hs b/Setup.hs
new file mode 100644
--- /dev/null
+++ b/Setup.hs
@@ -0,0 +1,4 @@
+#!/usr/bin/env runghc
+
+import Distribution.Simple
+main = defaultMainWithHooks defaultUserHooks
diff --git a/Text/HyperEstraier.hs b/Text/HyperEstraier.hs
new file mode 100644
--- /dev/null
+++ b/Text/HyperEstraier.hs
@@ -0,0 +1,20 @@
+-- |HsHyperEstraier is a HyperEstraier binding for
+-- Haskell. HyperEstraier is an embeddable full text search engine
+-- which is supposed to be independent to any particular natural
+-- languages.
+--
+-- Before reading this documentation, you should see the manual of the
+-- HyperEstraier to understand how it works and what terms it uses.
+--
+-- <http://hyperestraier.sourceforge.net/>
+
+module Text.HyperEstraier
+    ( module Text.HyperEstraier.Document
+    , module Text.HyperEstraier.Condition
+    , module Text.HyperEstraier.Database
+    )
+    where
+
+import Text.HyperEstraier.Document
+import Text.HyperEstraier.Condition
+import Text.HyperEstraier.Database
diff --git a/Text/HyperEstraier/Condition.hsc b/Text/HyperEstraier/Condition.hsc
new file mode 100644
--- /dev/null
+++ b/Text/HyperEstraier/Condition.hsc
@@ -0,0 +1,258 @@
+#include "estraier.h"
+
+-- #prune
+
+-- |An interface to functions to manipulate search conditions.
+
+module Text.HyperEstraier.Condition
+    ( -- * Types
+      Condition
+    , ESTCOND -- private
+    , CondOption(..)
+    , SearchSpeed(..)
+    , SyntaxType(..)
+    , Eclipse(..)
+
+    , withCondPtr -- private
+
+      -- * Manipulating conditions
+    , newCondition
+    , setPhrase
+    , addAttrCond
+    , setOrder
+    , setMax
+    , setSkip
+    , setOptions
+    , setAuxiliary
+    , setEclipse
+    , setDistinct
+    , setMetaSearchMask
+    )
+    where
+
+import           Control.Exception
+import           Data.Bits
+import           Foreign.C.String
+import           Foreign.ForeignPtr
+import           Foreign.Ptr
+import           Text.HyperEstraier.Utils
+
+-- |'Condition' is an opaque object representing a search condition.
+newtype Condition = Condition (ForeignPtr ESTCOND)
+data ESTCOND
+
+-- |'CondOption' is an option to the search condition.
+data CondOption
+    = Speed SearchSpeed -- ^ Choose a @'SearchSpeed'@.
+    | OmitTFIDF         -- ^ Omit calculating TF-IDF weight.
+    | Syntax SyntaxType -- ^ Choose a @'SyntaxType'@.
+    deriving (Eq, Show)
+
+-- |'SearchSpeed' is an option to the search condition.
+data SearchSpeed
+    = Slow       -- ^ Search for all N-gram keys.
+    | Normal     -- ^ Search for N-gram keys alternately.
+    | Fast       -- ^ Search for N-gram keys by skipping 2\/3 of them.
+    | EvenFaster -- ^ Search for N-gram keys by skipping 3\/4 of them.
+    deriving (Eq, Show)
+
+-- |'SyntaxType' is an option to the search condition.
+data SyntaxType
+    = Simplified   -- ^ Interpret the condition phrase as the
+                   --   simplified syntax. See the user's guide of the
+                   --   HyperEstraier for explanation about the
+                   --   simplified syntax.
+    | Rough        -- ^ Interpret the condition phrase as the rough
+                   --   syntax. See the user's guide for details.
+    | Union        -- ^ Interpret the condition phrase as the union
+                   --   syntax. See the user's guide for details.
+    | Intersection -- ^ Interpret the condition phrase as the
+                   --   intersection syntax. See the user's guide for
+                   --   details.
+    deriving (Eq, Show)
+
+marshalCondOption :: CondOption -> Int
+marshalCondOption (Speed Slow         ) = (#const ESTCONDSURE  )
+marshalCondOption (Speed Normal       ) = (#const ESTCONDUSUAL )
+marshalCondOption (Speed Fast         ) = (#const ESTCONDFAST  )
+marshalCondOption (Speed EvenFaster   ) = (#const ESTCONDAGITO )
+marshalCondOption OmitTFIDF             = (#const ESTCONDNOIDF )
+marshalCondOption (Syntax Simplified  ) = (#const ESTCONDSIMPLE)
+marshalCondOption (Syntax Rough       ) = (#const ESTCONDROUGH )
+marshalCondOption (Syntax Union       ) = (#const ESTCONDUNION )
+marshalCondOption (Syntax Intersection) = (#const ESTCONDISECT )
+
+-- |'Eclipse' represents how to hide documents from the search
+-- result by their similarity.
+data Eclipse
+    = Threshold Double -- ^ Threshold to cause eclipse to
+                       --   documents. @'Threshold' x@ must satisfy
+                       --   @0.0 <= x <= 1.0@.
+    | ThresholdWithURL Double -- ^ This is similar to @'Threshold'@
+                              -- but this specifies that the document
+                              -- URI is also used to calculate the
+                              -- similarity.
+    | SameServer       -- ^ Cause eclipse to the documents on the same
+                       --   server.
+    | SameDirectory    -- ^ Cause eclipse to the documents in the same
+                       --   directory.
+    | SameFile         -- ^ Cause eclipse to the documents whose file
+                       --   name is the same.
+    deriving (Eq, Show)
+
+
+marshalEclipse :: Eclipse -> Double
+marshalEclipse (Threshold thr)        = assertThreshold thr
+marshalEclipse (ThresholdWithURL thr) = assertThreshold thr + (#const ESTECLSIMURL)
+marshalEclipse SameServer             = (#const ESTECLSERV)
+marshalEclipse SameDirectory          = (#const ESTECLDIR )
+marshalEclipse SameFile               = (#const ESTECLFILE)
+
+assertThreshold :: Double -> Double
+assertThreshold thr = assert (thr >= 0.0 && thr <= 1.0) thr
+
+
+foreign import ccall unsafe "estraier.h est_cond_new"
+        _new :: IO (Ptr ESTCOND)
+
+foreign import ccall unsafe "estraier.h &est_cond_delete"
+        _delete :: FunPtr (Ptr ESTCOND -> IO ())
+
+foreign import ccall unsafe "estraier.h est_cond_set_phrase"
+        _set_phrase :: Ptr ESTCOND -> CString -> IO ()
+
+foreign import ccall unsafe "estraier.h est_cond_add_attr"
+        _add_attr :: Ptr ESTCOND -> CString -> IO ()
+
+foreign import ccall unsafe "estraier.h est_cond_set_order"
+        _set_order :: Ptr ESTCOND -> CString -> IO ()
+
+foreign import ccall unsafe "estraier.h est_cond_set_max"
+        _set_max :: Ptr ESTCOND -> Int -> IO ()
+
+foreign import ccall unsafe "estraier.h est_cond_set_skip"
+        _set_skip :: Ptr ESTCOND -> Int -> IO ()
+
+foreign import ccall unsafe "estraier.h est_cond_set_options"
+        _set_options :: Ptr ESTCOND -> Int -> IO ()
+
+foreign import ccall unsafe "estraier.h est_cond_set_auxiliary"
+        _set_auxiliary :: Ptr ESTCOND -> Int -> IO ()
+
+foreign import ccall unsafe "estraier.h est_cond_set_eclipse"
+        _set_eclipse :: Ptr ESTCOND -> Double -> IO ()
+
+foreign import ccall unsafe "estraier.h est_cond_set_distinct"
+        _set_distinct :: Ptr ESTCOND -> CString -> IO ()
+
+foreign import ccall unsafe "estraier.h est_cond_set_mask"
+        _set_mask :: Ptr ESTCOND -> Int -> IO ()
+
+
+wrapCond :: Ptr ESTCOND -> IO Condition
+wrapCond condPtr = newForeignPtr _delete condPtr >>= return . Condition
+
+
+withCondPtr :: Condition -> (Ptr ESTCOND -> IO a) -> IO a
+withCondPtr (Condition cond) = withForeignPtr cond
+
+-- |'newCondition' creates an empty search condition.
+newCondition :: IO Condition
+newCondition = _new >>= wrapCond
+
+-- |@'setPhrase' cond phrase@ stores a condition phrase into
+-- @cond@. The syntax of the phrase is assumed to be the normal
+-- syntax, unless you specify a 'SyntaxType' explicitly with
+-- 'setOptions'.
+setPhrase :: Condition -> String -> IO ()
+setPhrase cond phrase
+    = withCondPtr     cond   $ \ condPtr   ->
+      withUTF8CString phrase $ \ phrasePtr ->
+      _set_phrase condPtr phrasePtr
+
+-- |@'addAttrCond' cond expr@ appends an attribute search condition to
+-- @cond@. See the user's guide for explanation about the attribute
+-- search condition.
+addAttrCond :: Condition -> String -> IO ()
+addAttrCond cond attr
+    = withCondPtr     cond $ \ condPtr ->
+      withUTF8CString attr $ \ attrPtr ->
+      _add_attr condPtr attrPtr
+
+-- |@'setOrder' cond expr@ stores an ordering expression into
+-- @cond@. See the user's guide for explanation about the ordering
+-- expression. By default, the result is sorted in descending order of
+-- score.
+setOrder :: Condition -> String -> IO ()
+setOrder cond order
+    = withCondPtr     cond  $ \ condPtr  ->
+      withUTF8CString order $ \ orderPtr ->
+      _set_order condPtr orderPtr
+
+-- |@'setMax' cond n@ specifies the maximum number of results. By
+-- default, the number of results is unlimited.
+setMax :: Condition -> Int -> IO ()
+setMax cond n
+    = withCondPtr cond $ \ condPtr ->
+      _set_max condPtr n
+
+-- |@'setSkip' cond n@ specifies how many documents should be skipped
+-- from the beginning of result.
+setSkip :: Condition -> Int -> IO ()
+setSkip cond n
+    = withCondPtr cond $ \ condPtr ->
+      _set_skip condPtr n
+
+-- |@'setOptions' cond opts@ specifies options to the search
+-- condition.
+setOptions :: Condition -> [CondOption] -> IO ()
+setOptions cond options
+    = withCondPtr cond $ \ condPtr ->
+      _set_options condPtr (marshalOpts marshalCondOption options)
+
+-- |@'setAuxiliary' cond min@ specifies how many documents should be
+-- in the result to avoid using the auxiliary index to pad the result.
+setAuxiliary :: Condition -> Int -> IO ()
+setAuxiliary cond n
+    = withCondPtr cond $ \ condPtr ->
+      _set_auxiliary condPtr n
+
+-- |@'setEclipse' cond ecl@ specifies how to hide documents from the
+-- search result by their similarity.
+setEclipse :: Condition -> Eclipse -> IO ()
+setEclipse cond ecl
+    = withCondPtr cond $ \ condPtr ->
+      _set_eclipse condPtr (marshalEclipse ecl)
+
+-- |@'setDistinct' cond attr@ specifies an attribute which must be
+-- unique to the search result.
+setDistinct :: Condition -> String -> IO ()
+setDistinct cond attr
+    = withCondPtr     cond $ \ condPtr ->
+      withUTF8CString attr $ \ attrPtr ->
+      _set_distinct condPtr attrPtr
+
+-- |@'setMetaSearchMask' cond xs@ specifies that, in
+-- 'Text.HyperEstraier.Database.metaSearch', some databases must be
+-- excluded from the search result. e.g.
+--
+-- > main = withDatabase "db1" (Reader []) $ \ db1 ->
+-- >        withDatabase "db2" (Reader []) $ \ db2 ->
+-- >        withDatabase "db3" (Reader []) $ \ db3 ->
+-- >        do cond <- newCondition
+-- >           setPhrase cond "hello AND world"
+-- >           setMetaSearchMask cond [0, 2] -- zero-origin
+-- >
+-- >           -- In this case, "db1" and "db3" are excluded from the meta search.
+-- >           result <- metaSearch [db1, db2, db3] 
+-- >           print result
+--
+setMetaSearchMask :: Condition -> [Int] -> IO ()
+setMetaSearchMask cond xs
+    = withCondPtr cond $ \ condPtr ->
+      _set_max condPtr (calculateMask xs)
+    where
+      calculateMask :: [Int] -> Int
+      calculateMask []     = 0
+      calculateMask (x:xs) = assert (x >= 0 && x <= 28)
+                             $ (1 `shiftL` x) .|. calculateMask xs
diff --git a/Text/HyperEstraier/Database.hsc b/Text/HyperEstraier/Database.hsc
new file mode 100644
--- /dev/null
+++ b/Text/HyperEstraier/Database.hsc
@@ -0,0 +1,682 @@
+#include "estraier.h"
+
+-- |An interface to functions to manipulate databases.
+
+module Text.HyperEstraier.Database
+    ( -- * Types
+      Database
+    , EstError(..)
+
+    , AttrIndexType(..)
+    , OptimizeOption(..)
+    , RemoveOption(..)
+    , PutOption(..)
+    , GetOption(..)
+
+    , OpenMode(..)
+    , ReaderOption(..)
+    , WriterOption(..)
+    , LockingMode(..)
+    , CreateOption(..)
+    , AnalysisOption(..)
+    , IndexTuning(..)
+    , ScoreOption(..)
+
+      -- * Opening and closing databases
+    , withDatabase
+    , openDatabase
+    , closeDatabase
+
+      -- * Manipulating database
+    , addAttrIndex
+    , flushDatabase
+    , syncDatabase
+    , optimizeDatabase
+    , mergeDatabase
+    , setCacheSize
+
+      -- * Getting documents in and out
+    , putDocument
+    , removeDocument
+    , updateDocAttrs
+    , getDocument
+    , getDocAttr
+    , getDocIdByURI
+
+      -- * Statistics of databases
+    , getDatabaseName
+    , getNumOfDocs
+    , getNumOfWords
+    , getDatabaseSize
+    , hasFatalError
+
+      -- * Searching for documents
+    , searchDatabase
+    , searchDatabase'
+    , metaSearch
+    , metaSearch'
+    , scanDocument
+    )
+    where
+
+import           Control.Exception
+import           Control.Monad
+import           Data.Bits
+import qualified Data.ByteString.Char8 as BS
+import           Data.ByteString.Base
+import           Data.Encoding
+import           Data.Encoding.UTF8
+import           Data.Dynamic
+import           Data.IORef
+import           Data.Typeable
+import qualified Database.QDBM.Cabin.Map as CM
+import           Foreign.C.String
+import           Foreign.C.Types
+import           Foreign.Marshal.Alloc
+import           Foreign.Marshal.Array
+import           Foreign.Ptr
+import           Foreign.Storable
+import           Network.URI
+import           Text.HyperEstraier.Condition
+import           Text.HyperEstraier.Document
+import           Text.HyperEstraier.Utils
+
+-- |'EstError' represents an error occured on various operations. It
+-- is usually thrown as a 'Control.Exception.DynException'.
+data EstError
+    = InvalidArgument -- ^ An argument passed to the function was invalid.
+    | AccessForbidden -- ^ The operation is forbidden.
+    | LockFailure     -- ^ Failed to lock the database.
+    | DatabaseProblem -- ^ The database has a problem.
+    | IOProblem       -- ^ An I\/O operation failed.
+    | NoSuchItem      -- ^ An object you specified does not exist.
+    | MiscError       -- ^ Errors for other reasons.
+    deriving (Eq, Show, Typeable)
+
+
+unmarshalError :: Int -> EstError
+unmarshalError (#const ESTEINVAL ) = InvalidArgument
+unmarshalError (#const ESTEACCES ) = AccessForbidden
+unmarshalError (#const ESTELOCK  ) = LockFailure
+unmarshalError (#const ESTEDB    ) = DatabaseProblem
+unmarshalError (#const ESTEIO    ) = IOProblem
+unmarshalError (#const ESTENOITEM) = NoSuchItem
+unmarshalError (#const ESTEMISC  ) = MiscError
+
+-- |'OpenMode' represents how to open a database.
+data OpenMode
+    = Reader [ReaderOption] -- ^ Open the database with read-only
+                            --   mode. You can specify 'ReaderOption'
+                            --   to modify the behavior of the
+                            --   database.
+    | Writer [WriterOption] -- ^ Open the database with writable
+                            --   mode. You can specify 'WriterOption'
+                            --   to modify the behavior of the
+                            --   database.
+    deriving (Eq, Show)
+
+-- |'ReaderOption' is an option for the 'Reader' constructor.
+data ReaderOption
+    = ReadLock LockingMode -- ^ Specify how to lock the database.
+    deriving (Eq, Show)
+
+-- |'WriterOption' is an option for the 'Writer' constructor.
+data WriterOption
+    = Create [CreateOption]   -- ^ Create a database if an old one
+                              --   doesn't exist. You can specify
+                              --   'CreateOption' to modify the
+                              --   behavior of the database.
+    | Truncate [CreateOption] -- ^ Always create a new database even
+                              --   if an old one already exists. You
+                              --   can specify 'CreateOption' to
+                              --   modify the behavior of the
+                              --   database.
+    | WriteLock LockingMode   -- ^ Specify how to lock the database.
+    deriving (Eq, Show)
+
+-- |'LockingMode' represents how to lock the database.
+data LockingMode
+    = NoLock          -- ^ Do no exclusive access control at all. This
+                      --   option is very unsafe.
+    | NonblockingLock -- ^ Do non-blocking lock. (The author of this
+                      --   module doesn't know what happens if this
+                      --   option is in effect. See the manual and the
+                      --   source code of HyperEstraier and QDBM.)
+    deriving (Eq, Show)
+
+-- |'CreateOption' is an option for the 'Create' constructor.
+data CreateOption
+    = Analysis AnalysisOption -- ^ Specify the word analysis method.
+    | Index IndexTuning       -- ^ Specify the prospective size of the
+                              --   database.
+    | Score [ScoreOption]     -- ^ Specify how to handle scores of the
+                              --   documents.
+    deriving (Eq, Show)
+
+-- |'AnalysisOption' is an option for the 'Analysis' constructor.
+data AnalysisOption
+    = PerfectNGram -- ^ Use the perfect N-gram analyzer.
+    | CharCategory -- ^ Use the character category analyzer.
+    deriving (Eq, Show)
+
+-- |'IndexTuning' is an option for the 'Index' constructor.
+data IndexTuning
+    = Small -- ^ Predict the database will have less than 50,000
+            --   documents.
+    | Large -- ^ Predict the database will have less than 300,000
+            --   documents.
+    | Huge  -- ^ Predict the database will have less than 1,000,000
+            --   documents.
+    | Huge2 -- ^ Predict the database will have less than 5,000,000
+            --   documents.
+    | Huge3 -- ^ Predict the database will have more than 10,000,000
+            --   documents.
+    deriving (Eq, Show)
+
+-- |'ScoreOption' is an option for the 'Score' constructor.
+data ScoreOption
+    = Nullified      -- ^ Nullify anything about the score of
+                     --   documents.
+    | StoredAsInt    -- ^ Store the scores for documents into the
+                     --   database as 32-bit integer.
+    | OnlyToBeStored -- ^ Store the scores for documents into the
+                     --   database but don't use them during the
+                     --   search operation.
+    deriving (Eq, Show)
+
+
+marshalOpenMode :: OpenMode -> Int
+marshalOpenMode (Reader opts) = (#const ESTDBREADER) .|. marshalOpts marshalReaderOption opts
+marshalOpenMode (Writer opts) = (#const ESTDBWRITER) .|. marshalOpts marshalWriterOption opts
+
+marshalReaderOption :: ReaderOption -> Int
+marshalReaderOption (ReadLock mode) = marshalLockingMode mode
+
+marshalWriterOption :: WriterOption -> Int
+marshalWriterOption (Create    opts) = (#const ESTDBCREAT) .|. marshalOpts marshalCreateOption opts
+marshalWriterOption (Truncate  opts) = (#const ESTDBTRUNC) .|. marshalOpts marshalCreateOption opts
+marshalWriterOption (WriteLock mode) = marshalLockingMode mode
+
+marshalLockingMode :: LockingMode -> Int
+marshalLockingMode NoLock          = (#const ESTDBNOLCK)
+marshalLockingMode NonblockingLock = (#const ESTDBLCKNB)
+
+marshalCreateOption :: CreateOption -> Int
+marshalCreateOption (Analysis opt   ) = marshalAnalysisOption opt
+marshalCreateOption (Index    tuning) = marshalIndexTuning tuning
+marshalCreateOption (Score    opts  ) = marshalOpts marshalScoreOption opts
+
+marshalAnalysisOption :: AnalysisOption -> Int
+marshalAnalysisOption PerfectNGram = (#const ESTDBPERFNG)
+marshalAnalysisOption CharCategory = (#const ESTDBCHRCAT)
+
+marshalIndexTuning :: IndexTuning -> Int
+marshalIndexTuning Small = (#const ESTDBSMALL)
+marshalIndexTuning Large = (#const ESTDBLARGE)
+marshalIndexTuning Huge  = (#const ESTDBHUGE )
+marshalIndexTuning Huge2 = (#const ESTDBHUGE2)
+marshalIndexTuning Huge3 = (#const ESTDBHUGE3)
+
+marshalScoreOption :: ScoreOption -> Int
+marshalScoreOption Nullified      = (#const ESTDBSCVOID)
+marshalScoreOption StoredAsInt    = (#const ESTDBSCINT )
+marshalScoreOption OnlyToBeStored = (#const ESTDBSCASIS)
+
+-- |'AttrIndexType' represents an index type for an attribute.
+data AttrIndexType
+    = SeqIndex -- ^ Map from a document ID to an attribute value. This
+               --   type of index increses the efficiency of, say,
+               --   'getDocAttr'.
+    | StrIndex -- ^ Map from an attribute value to a document ID. This
+               --   increases the search speed when you search for
+               --   documents by an attribute value.
+    | NumIndex -- ^ This is similar to 'StrIndex' but for attributes
+               --   whose value is a number.
+    deriving (Eq, Show)
+
+
+marshalAttrIndexType :: AttrIndexType -> Int
+marshalAttrIndexType SeqIndex = (#const ESTIDXATTRSEQ)
+marshalAttrIndexType StrIndex = (#const ESTIDXATTRSTR)
+marshalAttrIndexType NumIndex = (#const ESTIDXATTRNUM)
+
+-- |'OptimizeOption' is an option for the 'optimizeDatabase' action.
+data OptimizeOption
+    = NoPurge      -- ^ Omit the process which purges garbages of
+                   --   removed documents.
+    | NoDBOptimize -- ^ Omit the process which optimizes the database
+                   --   file.
+    deriving (Eq, Show)
+
+
+marshalOptimizeOption :: OptimizeOption -> Int
+marshalOptimizeOption NoPurge      = (#const ESTOPTNOPURGE)
+marshalOptimizeOption NoDBOptimize = (#const ESTOPTNODBOPT)
+
+-- |'RemoveOption' is an option for the 'mergeDatabase' action and the
+-- 'removeDocument' action.
+data RemoveOption
+    = CleaningRemove -- ^ Clean up the region in the database where
+                     --   the removed documents were placed.
+    deriving (Eq, Show)
+
+
+marshalRemoveOption :: RemoveOption -> Int
+marshalRemoveOption CleaningRemove = (#const ESTODCLEAN)
+
+-- |'PutOption' is an option for the 'putDocument' action.
+data PutOption
+    = CleaningPut      -- ^ If the new document overwrites an old one,
+                       --   clean up the region in the database where
+                       --   the old document were placed.
+    | WeightStatically -- ^ Statically apply the \"\@weight\"
+                       --   attribute of the document.
+    deriving (Eq, Show)
+
+
+marshalPutOption :: PutOption -> Int
+marshalPutOption CleaningPut      = (#const ESTPDCLEAN)
+marshalPutOption WeightStatically = (#const ESTPDWEIGHT)
+
+-- |'GetOption' is an option for the 'getDocument' action.
+data GetOption
+    = NoAttributes -- ^ Don't retrieve the attributes of the document.
+    | NoText       -- ^ Don't retrieve the body of the document.
+    | NoKeywords   -- ^ Don't retrieve the keywords of the document.
+    deriving (Eq, Show)
+
+marshalGetOption :: GetOption -> Int
+marshalGetOption NoAttributes = (#const ESTGDNOATTR)
+marshalGetOption NoText       = (#const ESTGDNOTEXT)
+marshalGetOption NoKeywords   = (#const ESTGDNOKWD)
+
+-- |@'Database'@ is an opaque object representing a HyperEstraier
+-- database.
+newtype Database = Database (IORef (Ptr ESTMTDB))
+data ESTMTDB
+
+
+foreign import ccall unsafe "estmtdb.h est_mtdb_open"
+        _open :: CString -> Int -> Ptr Int -> IO (Ptr ESTMTDB)
+
+foreign import ccall unsafe "estmtdb.h est_mtdb_close"
+        _close :: Ptr ESTMTDB -> Ptr Int -> IO Int
+
+foreign import ccall unsafe "estmtdb.h est_mtdb_error"
+        _error :: Ptr ESTMTDB -> IO Int
+
+foreign import ccall unsafe "estmtdb.h est_mtdb_fatal"
+        _fatal :: Ptr ESTMTDB -> IO Int
+
+foreign import ccall unsafe "estmtdb.h est_mtdb_add_attr_index"
+        _add_attr_index :: Ptr ESTMTDB -> CString -> Int -> IO Int
+
+foreign import ccall unsafe "estmtdb.h est_mtdb_flush"
+        _flush :: Ptr ESTMTDB -> Int -> IO Int
+
+foreign import ccall unsafe "estmtdb.h est_mtdb_sync"
+        _sync :: Ptr ESTMTDB -> IO Int
+
+foreign import ccall unsafe "estmtdb.h est_mtdb_optimize"
+        _optimize :: Ptr ESTMTDB -> Int -> IO Int
+
+foreign import ccall unsafe "estmtdb.h est_mtdb_merge"
+        _merge :: Ptr ESTMTDB -> CString -> Int -> IO Int
+
+foreign import ccall unsafe "estmtdb.h est_mtdb_put_doc"
+        _put_doc :: Ptr ESTMTDB -> Ptr ESTDOC -> Int -> IO Int
+
+foreign import ccall unsafe "estmtdb.h est_mtdb_out_doc"
+        _out_doc :: Ptr ESTMTDB -> Int -> Int -> IO Int
+
+foreign import ccall unsafe "estmtdb.h est_mtdb_edit_doc"
+        _edit_doc :: Ptr ESTMTDB -> Ptr ESTDOC -> IO Int
+
+foreign import ccall unsafe "estmtdb.h est_mtdb_get_doc"
+        _get_doc :: Ptr ESTMTDB -> Int -> Int -> IO (Ptr ESTDOC)
+
+foreign import ccall unsafe "estmtdb.h est_mtdb_get_doc_attr"
+        _get_doc_attr :: Ptr ESTMTDB -> Int -> CString -> IO CString
+
+foreign import ccall unsafe "estmtdb.h est_mtdb_uri_to_id"
+        _uri_to_id :: Ptr ESTMTDB -> CString -> IO Int
+
+foreign import ccall unsafe "estmtdb.h est_mtdb_name"
+        _name :: Ptr ESTMTDB -> IO CString
+
+foreign import ccall unsafe "estmtdb.h est_mtdb_doc_num"
+        _doc_num :: Ptr ESTMTDB -> IO Int
+
+foreign import ccall unsafe "estmtdb.h est_mtdb_word_num"
+        _word_num :: Ptr ESTMTDB -> IO Int
+
+foreign import ccall unsafe "estmtdb.h est_mtdb_size"
+        _size :: Ptr ESTMTDB -> IO Double
+
+foreign import ccall unsafe "estmtdb.h est_mtdb_search"
+        _search :: Ptr ESTMTDB -> Ptr ESTCOND -> Ptr Int -> Ptr CM.CBMAP -> IO (Ptr Int)
+
+foreign import ccall unsafe "estmtdb.h est_mtdb_search_meta"
+        _search_meta :: Ptr (Ptr ESTMTDB) -> Int -> Ptr ESTCOND -> Ptr Int -> Ptr CM.CBMAP -> IO (Ptr Int)
+
+foreign import ccall unsafe "estmtdb.h est_mtdb_scan_doc"
+        _scan_doc :: Ptr ESTMTDB -> Ptr ESTDOC -> Ptr ESTCOND -> IO Int
+
+foreign import ccall unsafe "estmtdb.h est_mtdb_set_cache_size"
+        _set_cache_size :: Ptr ESTMTDB -> CSize -> Int -> Int -> Int -> IO ()
+
+
+wrapDB :: Ptr ESTMTDB -> IO Database
+wrapDB dbPtr = newIORef dbPtr >>= return . Database
+
+
+throwEstError :: EstError -> IO a
+throwEstError = throwIO . DynException . toDyn
+
+
+withDBPtr :: Database -> (Ptr ESTMTDB -> IO a) -> IO a
+withDBPtr (Database ref) f
+    = do dbPtr <- readIORef ref
+         if dbPtr == nullPtr then
+             fail "The HyperEstraier DB has already been closed."
+           else
+             f dbPtr
+
+-- |@'withDatabase' fpath mode f@ opens a database at @fpath@ and
+-- compute @f@. When the action @f@ finishes or throws an exception,
+-- the database will be closed automatically. If 'withDatabase' fails
+-- to open the database, it throws an 'EstError'. See 'openDatabase'.
+withDatabase :: FilePath -> OpenMode -> (Database -> IO a) -> IO a
+withDatabase fpath opts f = bracket openDB' closeDatabase f
+    where
+      openDB' :: IO Database
+      openDB' = do ret <- openDatabase fpath opts
+                   case ret of
+                     Left  err -> throwEstError err
+                     Right db  -> return db
+
+-- |@'openDatabase' fpath mode@ opens a database at @fpath@. If it
+-- succeeds it returns @'Prelude.Right' 'Database'@, otherwise it
+-- returns @'Prelude.Left' 'EstError'@.
+--
+-- The 'Database' can be shared by multiple threads, but there is one
+-- important limitation in the current implementation of the
+-- HyperEstraier itself. /A single process can NOT open the same
+-- database twice simultaneously./ Such attempt results in
+-- 'AccessForbidden'.
+openDatabase :: FilePath -> OpenMode -> IO (Either EstError Database)
+openDatabase fpath opts
+    = withUTF8CString fpath $ \ fpathPtr ->
+      alloca                $ \ errPtr   ->
+      do dbPtr <- _open fpathPtr (marshalOpenMode opts) errPtr
+         if dbPtr == nullPtr then
+             peek errPtr >>= return . Left . unmarshalError
+           else
+             wrapDB dbPtr >>= return . Right
+
+-- |@'closeDatabase' db@ closes the database @db@. If the @db@ has
+-- already been closed, this operation causes nothing.
+closeDatabase :: Database -> IO ()
+closeDatabase (Database ref)
+    = do dbPtr <- readIORef ref
+         when (dbPtr /= nullPtr) (close' dbPtr)
+    where
+      close' :: Ptr ESTMTDB -> IO ()
+      close' dbPtr
+          = alloca $ \ errPtr ->
+            do ret <- _close dbPtr errPtr
+               case ret of
+                 0 -> peek errPtr >>= throwEstError . unmarshalError
+                 _ -> writeIORef ref nullPtr
+
+
+throwLastError :: Database -> IO a
+throwLastError db
+    = withDBPtr db $ \ dbPtr ->
+      _error dbPtr >>= throwEstError . unmarshalError
+
+
+throwLastErrorIf :: Database -> Bool -> IO ()
+throwLastErrorIf _  False = return ()
+throwLastErrorIf db True  = throwLastError db
+
+-- |Return 'Prelude.True' iff the document has a fatal error.
+hasFatalError :: Database -> IO Bool
+hasFatalError db
+    = withDBPtr db $ \ dbPtr ->
+      _fatal dbPtr >>= return . (/= 0)
+
+-- |@'addAttrIndex' db attr idxType@ creates an index of type
+-- @idxType@ for attribute @attr@ into the database @db@.
+addAttrIndex :: Database -> String -> AttrIndexType -> IO ()
+addAttrIndex db attr idxType
+    = withDBPtr       db   $ \ dbPtr   ->
+      withUTF8CString attr $ \ attrPtr ->
+      _add_attr_index dbPtr attrPtr (marshalAttrIndexType idxType)
+           >>= throwLastErrorIf db . (== 0)
+
+-- |@'flushDatabase' db numWords@ flushes at most @numWords@ index
+-- words in the cache of the database @db@. If @numWords <= 0@ all the
+-- index words will be flushed.
+flushDatabase :: Database -> Int -> IO ()
+flushDatabase db maxWords
+    = withDBPtr db $ \ dbPtr ->
+      _flush dbPtr maxWords
+           >>= throwLastErrorIf db . (== 0)
+
+-- |Synchronize a database to the disk.
+syncDatabase :: Database -> IO ()
+syncDatabase db
+    = withDBPtr db $ \ dbPtr ->
+      _sync dbPtr
+           >>= throwLastErrorIf db . (== 0)
+
+-- |Optimize a database.
+optimizeDatabase :: Database -> [OptimizeOption] -> IO ()
+optimizeDatabase db opts
+    = withDBPtr db $ \ dbPtr ->
+      _optimize dbPtr (marshalOpts marshalOptimizeOption opts)
+           >>= throwLastErrorIf db . (== 0)
+
+-- |@'mergeDatabase' db fpath opts@ merges another database at @fpath@
+-- (source) to the @db@ (destination). The flags of the two databases
+-- must be the same. If any documents in the source database have the
+-- same URI as the documents in the destination, those documents in
+-- the destination will be overwritten.
+mergeDatabase :: Database -> FilePath -> [RemoveOption] -> IO ()
+mergeDatabase db fpath opts
+    = withDBPtr       db    $ \ dbPtr    ->
+      withUTF8CString fpath $ \ fpathPtr ->
+      _merge dbPtr fpathPtr (marshalOpts marshalRemoveOption opts)
+           >>= throwLastErrorIf db . (== 0)
+
+-- |Put a document into a database. The document must have an
+-- @\"\@uri\"@ attribute. If the database already has a document whose
+-- URI is the same as of the new document, the old one will be
+-- overwritten. See 'Text.HyperEstraier.Document.setURI' and
+-- 'updateDocAttrs'.
+putDocument :: Database -> Document -> [PutOption] -> IO ()
+putDocument db doc opts
+    = withDBPtr  db  $ \ dbPtr  ->
+      withDocPtr doc $ \ docPtr ->
+      _put_doc dbPtr docPtr (marshalOpts marshalPutOption opts)
+           >>= throwLastErrorIf db . (== 0)
+
+-- |Remove a document from a database.
+removeDocument :: Database -> DocumentID -> [RemoveOption] -> IO ()
+removeDocument db docId opts
+    = withDBPtr db $ \ dbPtr ->
+      _out_doc dbPtr docId (marshalOpts marshalRemoveOption opts)
+           >>= throwLastErrorIf db . (== 0)
+
+-- |Update attributes of a document in a database. The document to be
+-- updated is determined by the document ID. It is an error to change
+-- the URI of the document to be the same as of one of existing
+-- documents. Note that the document body will not be updated. See
+-- 'putDocument'.
+updateDocAttrs :: Database -> Document -> IO ()
+updateDocAttrs db doc
+    = withDBPtr  db  $ \ dbPtr  ->
+      withDocPtr doc $ \ docPtr ->
+      _edit_doc dbPtr docPtr
+           >>= throwLastErrorIf db . (== 0)
+
+-- |Find a document in a database by an ID.
+getDocument :: Database -> DocumentID -> [GetOption] -> IO Document
+getDocument db docId opts
+    = withDBPtr db $ \ dbPtr ->
+      do docPtr <- _get_doc dbPtr docId (marshalOpts marshalGetOption opts)
+         throwLastErrorIf db (docPtr == nullPtr)
+         wrapDoc docPtr
+
+-- |Get an attribute of a document in a database.
+getDocAttr :: Database -> DocumentID -> String -> IO (Maybe String)
+getDocAttr db docId name
+    = withDBPtr       db   $ \ dbPtr   ->
+      withUTF8CString name $ \ namePtr ->
+      do valuePtr <- _get_doc_attr dbPtr docId namePtr
+         if valuePtr == nullPtr then
+             return Nothing
+           else
+             packMallocUTF8CString valuePtr >>= return . Just
+
+-- |Find a document in a database by an URI and return its ID.
+getDocIdByURI :: Database -> URI -> IO DocumentID
+getDocIdByURI db uri
+    = withDBPtr db $ \ dbPtr ->
+      withUTF8CString (uriToString id uri "") $ \ uriPtr ->
+      do ret <- _uri_to_id dbPtr uriPtr
+         case ret of
+           -1 -> throwLastError db
+           _  -> return ret
+
+-- |Get the name of a database.
+getDatabaseName :: Database -> IO String
+getDatabaseName db
+    = withDBPtr db $ \ dbPtr ->
+      _name dbPtr 
+           >>= copyUTF8CString
+
+-- |Get the number of documents in a database.
+getNumOfDocs :: Database -> IO Int
+getNumOfDocs db
+    = withDBPtr db $ \ dbPtr ->
+      _doc_num dbPtr
+
+-- |Get the number of words in a database.
+getNumOfWords :: Database -> IO Int
+getNumOfWords db
+    = withDBPtr db $ \ dbPtr ->
+      _word_num dbPtr
+
+-- |Get the size of a database.
+getDatabaseSize :: Database -> IO Integer
+getDatabaseSize db
+    = withDBPtr db $ \ dbPtr ->
+      -- なんで est_db_size() の戻り値が double なの。なんで size_t と
+      -- か long long int とかぢゃないの。H.E. のやってる事は大雜把には
+      -- 凄いのに、細かい部分が實に好い加減だなあ…
+      _size dbPtr >>= return . floor
+
+-- |Search for documents in a database by a condition.
+searchDatabase :: Database -> Condition -> IO [DocumentID]
+searchDatabase db cond
+    = withDBPtr   db   $ \ dbPtr     ->
+      withCondPtr cond $ \ condPtr   ->
+      alloca           $ \ retLenPtr ->
+      do retPtr <- _search dbPtr condPtr retLenPtr nullPtr
+         retLen <- peek retLenPtr
+         ret    <- peekArray retLen retPtr
+         free retPtr
+         return ret
+
+-- |Search for documents in a database by a condition. The second item
+-- of the resulting tuple is a map from each search words to the
+-- number of documents which are matched to the word.
+searchDatabase' :: Database -> Condition -> IO ([DocumentID], [(String, Int)])
+searchDatabase' db cond
+    = do hints <- CM.newMap
+         withDBPtr db $ \ dbPtr ->
+             withCondPtr cond    $ \ condPtr   ->
+             alloca              $ \ retLenPtr ->
+             CM.withMapPtr hints $ \ hintsPtr  ->
+             do retPtr <- _search dbPtr condPtr retLenPtr hintsPtr
+                retLen <- peek retLenPtr
+                ret    <- peekArray retLen retPtr
+                free retPtr
+                hints' <- liftM (map decodeHint) (CM.toList hints)
+                return (ret, hints')
+
+
+decodeHint :: (ByteString, ByteString) -> (String, Int)
+decodeHint (word, count)
+    = let word'  = decode UTF8 word
+          count' = read $ BS.unpack count
+      in
+        (word', count')
+
+-- |Search for documents in many databases at once.
+metaSearch :: [Database] -> Condition -> IO [(Database, DocumentID)]
+metaSearch dbs cond
+    = withArrayOfPtrs withDBPtr dbs $ \ dbPtrArray ->
+      withCondPtr cond              $ \ condPtr    ->
+      alloca                        $ \ retLenPtr  ->
+      do retPtr <- _search_meta dbPtrArray (length dbs) condPtr retLenPtr nullPtr
+         retLen <- peek retLenPtr
+         ret    <- liftM (decodeMetaSearchRec dbs) $ peekArray retLen retPtr
+         free retPtr
+         return ret
+
+-- |Search for documents in many databases at once. The second item of
+-- the resulting tuple is a map from each search words to the number
+-- of documents which are matched to the word.
+metaSearch' :: [Database]
+            -> Condition
+            -> IO ([(Database, DocumentID)], [(String, Int)])
+metaSearch' dbs cond
+    = do hints <- CM.newMap
+         withArrayOfPtrs withDBPtr dbs $ \ dbPtrArray ->
+             withCondPtr cond          $ \ condPtr    ->
+             alloca                    $ \ retLenPtr  ->
+             CM.withMapPtr hints       $ \ hintsPtr   ->
+             do retPtr <- _search_meta dbPtrArray (length dbs) condPtr retLenPtr hintsPtr
+                retLen <- peek retLenPtr
+                ret    <- liftM (decodeMetaSearchRec dbs) $ peekArray retLen retPtr
+                free retPtr
+                hints' <- liftM (map decodeHint) (CM.toList hints)
+                return (ret, hints')
+
+
+decodeMetaSearchRec :: [Database] -> [Int] -> [(Database, DocumentID)]
+decodeMetaSearchRec _   []               = []
+decodeMetaSearchRec dbs (dbIdx:docId:xs) = (dbs !! dbIdx, docId) : decodeMetaSearchRec dbs xs
+
+-- |Check if a document matches to every phrases in a condition.
+--
+-- To be honest with you, the author of this binding doesn't really
+-- know what @est_db_scan_doc()@ does. Its documentation is way too
+-- ambiguous across the board. Moreover, the names of symbols of the
+-- HyperEstraier are very badly named. Can you imagine what, say
+-- @est_db_out_doc()@ does? How about the constant named
+-- @ESTCONDSURE@? The author got tired of examining the commentless
+-- source code over and over again to write this binding. Its
+-- functionality is awesome though...
+scanDocument :: Database -> Document -> Condition -> IO Bool
+scanDocument db doc cond
+    = withDBPtr   db   $ \ dbPtr   ->
+      withDocPtr  doc  $ \ docPtr  ->
+      withCondPtr cond $ \ condPtr ->
+      _scan_doc dbPtr docPtr condPtr
+           >>= return . (/= 0)
+
+-- |Change the size of various caches of a database. Passing negative
+-- values leaves the old values unchanged.
+setCacheSize :: Database -- ^ The database.
+             -> Int      -- ^ Maximum size of the index cache. (default: 64 MiB)
+             -> Int      -- ^ Maximum records of cached attributes. (default: 8192 records)
+             -> Int      -- ^ Maximum number of cached document text. (default: 1024 documents)
+             -> Int      -- ^ Maximum number of the cached search results. (default: 256 records)
+             -> IO ()
+setCacheSize db size anum tnum rnum
+    = withDBPtr db $ \ dbPtr ->
+      _set_cache_size dbPtr (fromIntegral size) anum tnum rnum
diff --git a/Text/HyperEstraier/Document.hsc b/Text/HyperEstraier/Document.hsc
new file mode 100644
--- /dev/null
+++ b/Text/HyperEstraier/Document.hsc
@@ -0,0 +1,280 @@
+-- #prune
+
+-- |An interface to manipulate documents of the HyperEstraier.
+
+module Text.HyperEstraier.Document
+    ( -- * Types
+      Document
+    , DocumentID
+
+    , ESTDOC -- private
+    , wrapDoc -- private
+    , withDocPtr -- private
+
+      -- * Creating and parsing document
+    , newDocument
+    , parseDraft
+
+      -- * Setting contents and attributes of document
+    , addText
+    , addHiddenText
+    , setAttribute
+    , setURI
+    , setKeywords
+    , setScore
+
+      -- * Getting contents and attributes of document
+    , getId
+    , getAttrNames
+    , getAttribute
+    , getText
+    , getURI
+    , getKeywords
+    , getScore
+
+      -- * Dumping document
+    , dumpDraft
+
+      -- * Making snippet of document
+    , makeSnippet
+    )
+    where
+
+import qualified Data.ByteString.Char8    as B8
+import           Data.Encoding
+import           Data.Encoding.UTF8
+import           Data.Maybe
+import qualified Database.QDBM.Cabin.List as CL
+import qualified Database.QDBM.Cabin.Map  as CM
+import           Foreign.C.String
+import           Foreign.ForeignPtr
+import           Foreign.Ptr
+import           Text.HyperEstraier.Utils
+import           Network.URI
+
+-- |'Document' is an opaque object representing a document of
+-- HyperEstraier.
+newtype Document = Document (ForeignPtr ESTDOC)
+data ESTDOC
+
+-- |'DocumentID' is just an alias to 'Prelude.Int'. It represents a
+-- document ID.
+type DocumentID = Int
+
+
+foreign import ccall unsafe "estraier.h est_doc_new"
+        _new :: IO (Ptr ESTDOC)
+
+foreign import ccall unsafe "estraier.h est_doc_new_from_draft"
+        _new_from_draft :: CString -> IO (Ptr ESTDOC)
+
+foreign import ccall unsafe "estraier.h &est_doc_delete"
+        _delete :: FunPtr (Ptr ESTDOC -> IO ())
+
+foreign import ccall unsafe "estraier.h est_doc_add_attr"
+        _add_attr :: Ptr ESTDOC -> CString -> CString -> IO ()
+
+foreign import ccall unsafe "estraier.h est_doc_add_text"
+        _add_text :: Ptr ESTDOC -> CString -> IO ()
+
+foreign import ccall unsafe "estraier.h est_doc_add_hidden_text"
+        _add_hidden_text :: Ptr ESTDOC -> CString -> IO ()
+
+foreign import ccall unsafe "estraier.h est_doc_set_keywords"
+        _set_keywords :: Ptr ESTDOC -> Ptr CM.CBMAP -> IO ()
+
+foreign import ccall unsafe "estraier.h est_doc_set_score"
+        _set_score :: Ptr ESTDOC -> Int -> IO ()
+
+foreign import ccall unsafe "estraier.h est_doc_id"
+        _id :: Ptr ESTDOC -> IO Int
+
+foreign import ccall unsafe "estraier.h est_doc_attr_names"
+        _attr_names :: Ptr ESTDOC -> IO (Ptr CL.CBLIST)
+
+foreign import ccall unsafe "estraier.h est_doc_attr"
+        _attr :: Ptr ESTDOC -> CString -> IO CString
+
+foreign import ccall unsafe "estraier.h est_doc_cat_texts"
+        _cat_texts :: Ptr ESTDOC -> IO CString
+
+foreign import ccall unsafe "estraier.h est_doc_keywords"
+        _keywords :: Ptr ESTDOC -> IO (Ptr CM.CBMAP)
+
+foreign import ccall unsafe "estraier.h est_doc_score"
+        _score :: Ptr ESTDOC -> IO Int
+
+foreign import ccall unsafe "estraier.h est_doc_dump_draft"
+        _dump_draft :: Ptr ESTDOC -> IO CString
+
+foreign import ccall unsafe "estraier.h est_doc_make_snippet"
+        _make_snippet :: Ptr ESTDOC -> Ptr CL.CBLIST -> Int -> Int -> Int -> IO CString
+
+
+wrapDoc :: Ptr ESTDOC -> IO Document
+wrapDoc docPtr = newForeignPtr _delete docPtr >>= return . Document
+
+
+withDocPtr :: Document -> (Ptr ESTDOC -> IO a) -> IO a
+withDocPtr (Document doc) = withForeignPtr doc
+
+-- |'newDocument' creates an empty document.
+newDocument :: IO Document
+newDocument = _new >>= wrapDoc
+
+-- |'parseDraft' parses a document in the \"draft\" format.
+parseDraft :: String -> IO Document
+parseDraft draft
+    = withUTF8CString draft $ \ draftPtr ->
+      _new_from_draft draftPtr >>= wrapDoc
+
+-- |Set an attribute value of a document.
+setAttribute :: Document     -- ^ The document.
+             -> String       -- ^ An attribute name.
+             -> Maybe String -- ^ An attribute value. If this is
+                             --   'Prelude.Nothing', the attribute
+                             --   will be deleted.
+             -> IO ()
+setAttribute doc name value
+    = withDocPtr       doc   $ \ docPtr   ->
+      withUTF8CString  name  $ \ namePtr  ->
+      withUTF8CString' value $ \ valuePtr ->
+      _add_attr docPtr namePtr valuePtr
+
+-- |Add a block of text to a document.
+addText :: Document -> String -> IO ()
+addText doc text
+    = withDocPtr      doc  $ \ docPtr  ->
+      withUTF8CString text $ \ textPtr ->
+      _add_text docPtr textPtr
+
+-- |Add a block of hidden text to a document.
+addHiddenText :: Document -> String -> IO ()
+addHiddenText doc text
+    = withDocPtr      doc  $ \ docPtr  ->
+      withUTF8CString text $ \ textPtr ->
+      _add_hidden_text docPtr textPtr
+
+-- |Set an URI of a document. This is a special case of
+-- 'setAttribute'.
+setURI :: Document -> Maybe URI -> IO ()
+setURI doc uri = setAttribute doc "@uri" (fmap uri2str uri)
+    where
+      uri2str uri = uriToString id uri ""
+
+-- |Set keywords of a document.
+setKeywords :: Document            -- ^ The document.
+            -> [(String, Integer)] -- ^ A list of @(keyword, score)@.
+            -> IO ()
+setKeywords doc keywords
+    = withDocPtr doc    $ \ docPtr ->
+      withKeywordMapPtr $ \ mapPtr ->
+      _set_keywords docPtr mapPtr
+    where
+      withKeywordMapPtr :: (Ptr CM.CBMAP -> IO a) -> IO a
+      withKeywordMapPtr f = do m <- CM.fromList $ map encodeKeyword keywords
+                               CM.withMapPtr m f
+
+      encodeKeyword (word, score) = (encode UTF8 word, B8.pack $ show score)
+
+-- |Set an alternative score of a document.
+setScore :: Document -> Maybe Int -> IO ()
+setScore doc score
+    = withDocPtr doc $ \ docPtr ->
+      _set_score docPtr (fromMaybe (-1) score)
+
+-- |Get the ID of document.
+getId :: Document -> IO DocumentID
+getId doc
+    = withDocPtr doc $ \ docPtr ->
+      _id docPtr
+
+-- |Get a list of all attribute names in a document.
+getAttrNames :: Document -> IO [String]
+getAttrNames doc
+    = withDocPtr doc $ \ docPtr ->
+      _attr_names docPtr
+           >>= CL.wrapList
+           >>= CL.toList
+           >>= return . map (decode UTF8)
+
+-- |Get an attribute value of a document.
+getAttribute :: Document -> String -> IO (Maybe String)
+getAttribute doc name
+    = withDocPtr doc $ \ docPtr ->
+      withUTF8CString name $ \ namePtr ->
+      do valuePtr <- _attr docPtr namePtr
+         if valuePtr == nullPtr then
+             return Nothing
+           else
+             copyUTF8CString valuePtr >>= return . Just
+
+-- |Get the text in a document.
+getText :: Document -> IO String
+getText doc
+    = withDocPtr doc $ \ docPtr ->
+      _cat_texts docPtr
+           >>= packMallocUTF8CString
+
+-- |Get the URI of a document.
+getURI :: Document -> IO (Maybe URI)
+getURI doc = getAttribute doc "@uri" >>= return . fmap parse
+    where
+      parse :: String -> URI
+      parse = fromJust . parseURIReference
+
+-- |Get the keywords of a document.
+getKeywords :: Document -> IO [(String, Integer)]
+getKeywords doc
+    = withDocPtr doc $ \ docPtr ->
+      _keywords docPtr
+           >>= CM.unsafePeekMap
+           >>= CM.toList
+           -- ここまで正格。次の行は遲延される。
+           >>= return . map decodeKeyword
+    where
+      decodeKeyword (word, score) = (decode UTF8 word, read $ B8.unpack score)
+
+-- |Get an alternative score of a document.
+getScore :: Document -> IO (Maybe Int)
+getScore doc
+    = withDocPtr doc $ \ docPtr ->
+      _score docPtr >>= \ n ->
+          case n of
+            -1 -> return Nothing
+            _  -> return (Just n)
+            
+-- |Dump a document in the \"draft\" format.
+dumpDraft :: Document -> IO String
+dumpDraft doc
+    = withDocPtr doc $ \ docPtr ->
+      _dump_draft docPtr >>= packMallocUTF8CString
+
+-- |Make a snippet from a document.
+makeSnippet
+    :: Document -- ^ The document.
+    -> [String] -- ^ Words to be highlighted.
+    -> Int      -- ^ Maximum width of the whole result.
+    -> Int      -- ^ Width of the heading text to be shown.
+    -> Int      -- ^ Width of the text surrounding each highlighted words.
+    -> IO [Either String (String, String)] -- ^ A list of either
+                                           -- @('Prelude.Left'
+                                           -- non-highlighted text)@
+                                           -- or @('Prelude.Right'
+                                           -- (highlighted word, its
+                                           -- normalized form))@.
+makeSnippet doc words wwidth hwidth awidth
+    = do wordsList <- CL.fromList $ map (encode UTF8) words
+         withDocPtr doc $ \ docPtr ->
+             CL.withListPtr wordsList $ \ wordsPtr ->
+             _make_snippet docPtr wordsPtr wwidth hwidth awidth
+                  >>= packMallocUTF8CString
+                  >>= return . parseSnippet
+    where
+      parseSnippet :: String -> [Either String (String, String)]
+      parseSnippet = map parseLine . lines
+
+      parseLine :: String -> Either String (String, String)
+      parseLine line = case break (== '\t') line of
+                         (x, ""    ) -> Left   x
+                         (x, '\t':y) -> Right (x, y)
diff --git a/Text/HyperEstraier/Utils.hsc b/Text/HyperEstraier/Utils.hsc
new file mode 100644
--- /dev/null
+++ b/Text/HyperEstraier/Utils.hsc
@@ -0,0 +1,66 @@
+module Text.HyperEstraier.Utils
+    ( withUTF8CString
+    , withUTF8CString'
+    , packMallocUTF8CString
+    , copyUTF8CString
+
+    , marshalOpts
+
+    , withArrayOfPtrs
+    )
+    where
+
+import           Data.Bits
+import qualified Data.ByteString as BS
+import           Data.Encoding
+import           Data.Encoding.UTF8
+import           Foreign.C.String
+import           Foreign.Marshal.Array
+import           Foreign.Ptr
+
+
+-- Yet another withUTF8CString. Hope GHC officially supports this!
+withUTF8CString :: String -> (CString -> IO a) -> IO a
+withUTF8CString = BS.useAsCString . encode UTF8
+
+
+withUTF8CString' :: Maybe String -> (CString -> IO a) -> IO a
+withUTF8CString' (Just str) f = BS.useAsCString (encode UTF8 str) f
+withUTF8CString' Nothing f    = f nullPtr
+
+
+packMallocUTF8CString :: CString -> IO String
+packMallocUTF8CString = return . decode UTF8 . BS.packMallocCString
+
+
+copyUTF8CString :: CString -> IO String
+copyUTF8CString cstr = BS.copyCString cstr >>= return . decode UTF8
+
+-- (.) の型は (b -> c) -> (a -> b) -> a -> c である。(.) は同じ arity
+-- の函數を繋げる。map は二引數函數なので、それと繋げる方も二引數にしな
+-- ければならない。所で foldl (.|.) 0 の型は Bits a => [a] -> a で一引
+-- 數である。これを (foldl (.|.) 0 .) にすると、その型は Bits b => (a
+-- -> [b]) -> a -> b になり、單純に Bits a のリストを取ってゐた函數が
+-- 「何かの値を取って Bits b のリストを返す函數」と「その何かの値」を取
+-- る函數に變化する。それを (.) の左邊に置くと、((foldl (.|.) 0 .) .)
+-- の型は Bits c => (a -> b -> [c]) -> a -> b -> c になる。この函數に
+-- map を適用すると、map の型は (a -> b) -> [a] -> [b] なので、結果は
+-- Bits b => (a -> b) -> [a] -> b になる。
+--
+-- point-free って難しいね。
+marshalOpts :: Bits b => (a -> b) -> [a] -> b
+marshalOpts = (foldl (.|.) 0 .) . map
+
+
+withArrayOfPtrs :: (a -> (Ptr b -> IO c) -> IO c)
+                -> [a]
+                -> (Ptr (Ptr b) -> IO c)
+                -> IO c
+withArrayOfPtrs withXPtr xs f
+    = withXPtrList xs [] $ \ xPtrs ->
+      withArray xPtrs f
+    where
+      -- withXPtrList :: [a] -> [Ptr b] -> ([Ptr b] -> IO c) -> IO c
+      withXPtrList []     acc f = f acc
+      withXPtrList (x:xs) acc f = withXPtr x $ \ xPtr ->
+                                  withXPtrList xs (acc ++ [xPtr]) f
diff --git a/configure b/configure
new file mode 100644
--- /dev/null
+++ b/configure
@@ -0,0 +1,2833 @@
+#! /bin/sh
+# Guess values for system-dependent variables and create Makefiles.
+# Generated by GNU Autoconf 2.60.
+#
+# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001,
+# 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
+# This configure script is free software; the Free Software Foundation
+# gives unlimited permission to copy, distribute and modify it.
+## --------------------- ##
+## M4sh Initialization.  ##
+## --------------------- ##
+
+# Be Bourne compatible
+if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
+  emulate sh
+  NULLCMD=:
+  # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which
+  # is contrary to our usage.  Disable this feature.
+  alias -g '${1+"$@"}'='"$@"'
+  setopt NO_GLOB_SUBST
+else
+  case `(set -o) 2>/dev/null` in *posix*) set -o posix;; esac
+fi
+BIN_SH=xpg4; export BIN_SH # for Tru64
+DUALCASE=1; export DUALCASE # for MKS sh
+
+
+# PATH needs CR
+# Avoid depending upon Character Ranges.
+as_cr_letters='abcdefghijklmnopqrstuvwxyz'
+as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ'
+as_cr_Letters=$as_cr_letters$as_cr_LETTERS
+as_cr_digits='0123456789'
+as_cr_alnum=$as_cr_Letters$as_cr_digits
+
+# The user is always right.
+if test "${PATH_SEPARATOR+set}" != set; then
+  echo "#! /bin/sh" >conf$$.sh
+  echo  "exit 0"   >>conf$$.sh
+  chmod +x conf$$.sh
+  if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then
+    PATH_SEPARATOR=';'
+  else
+    PATH_SEPARATOR=:
+  fi
+  rm -f conf$$.sh
+fi
+
+# Support unset when possible.
+if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then
+  as_unset=unset
+else
+  as_unset=false
+fi
+
+
+# IFS
+# We need space, tab and new line, in precisely that order.  Quoting is
+# there to prevent editors from complaining about space-tab.
+# (If _AS_PATH_WALK were called with IFS unset, it would disable word
+# splitting by setting IFS to empty value.)
+as_nl='
+'
+IFS=" ""	$as_nl"
+
+# Find who we are.  Look in the path if we contain no directory separator.
+case $0 in
+  *[\\/]* ) as_myself=$0 ;;
+  *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break
+done
+IFS=$as_save_IFS
+
+     ;;
+esac
+# We did not find ourselves, most probably we were run as `sh COMMAND'
+# in which case we are not to be found in the path.
+if test "x$as_myself" = x; then
+  as_myself=$0
+fi
+if test ! -f "$as_myself"; then
+  echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2
+  { (exit 1); exit 1; }
+fi
+
+# Work around bugs in pre-3.0 UWIN ksh.
+for as_var in ENV MAIL MAILPATH
+do ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var
+done
+PS1='$ '
+PS2='> '
+PS4='+ '
+
+# NLS nuisances.
+for as_var in \
+  LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \
+  LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \
+  LC_TELEPHONE LC_TIME
+do
+  if (set +x; test -z "`(eval $as_var=C; export $as_var) 2>&1`"); then
+    eval $as_var=C; export $as_var
+  else
+    ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var
+  fi
+done
+
+# Required to use basename.
+if expr a : '\(a\)' >/dev/null 2>&1 &&
+   test "X`expr 00001 : '.*\(...\)'`" = X001; then
+  as_expr=expr
+else
+  as_expr=false
+fi
+
+if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then
+  as_basename=basename
+else
+  as_basename=false
+fi
+
+
+# Name of the executable.
+as_me=`$as_basename -- "$0" ||
+$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \
+	 X"$0" : 'X\(//\)$' \| \
+	 X"$0" : 'X\(/\)' \| . 2>/dev/null ||
+echo X/"$0" |
+    sed '/^.*\/\([^/][^/]*\)\/*$/{
+	    s//\1/
+	    q
+	  }
+	  /^X\/\(\/\/\)$/{
+	    s//\1/
+	    q
+	  }
+	  /^X\/\(\/\).*/{
+	    s//\1/
+	    q
+	  }
+	  s/.*/./; q'`
+
+# CDPATH.
+$as_unset CDPATH
+
+
+if test "x$CONFIG_SHELL" = x; then
+  if (eval ":") 2>/dev/null; then
+  as_have_required=yes
+else
+  as_have_required=no
+fi
+
+  if test $as_have_required = yes && 	 (eval ":
+(as_func_return () {
+  (exit \$1)
+}
+as_func_success () {
+  as_func_return 0
+}
+as_func_failure () {
+  as_func_return 1
+}
+as_func_ret_success () {
+  return 0
+}
+as_func_ret_failure () {
+  return 1
+}
+
+exitcode=0
+if as_func_success; then
+  :
+else
+  exitcode=1
+  echo as_func_success failed.
+fi
+
+if as_func_failure; then
+  exitcode=1
+  echo as_func_failure succeeded.
+fi
+
+if as_func_ret_success; then
+  :
+else
+  exitcode=1
+  echo as_func_ret_success failed.
+fi
+
+if as_func_ret_failure; then
+  exitcode=1
+  echo as_func_ret_failure succeeded.
+fi
+
+if ( set x; as_func_ret_success y && test x = \"\$1\" ); then
+  :
+else
+  exitcode=1
+  echo positional parameters were not saved.
+fi
+
+test \$exitcode = 0) || { (exit 1); exit 1; }
+
+(
+  as_lineno_1=\$LINENO
+  as_lineno_2=\$LINENO
+  test \"x\$as_lineno_1\" != \"x\$as_lineno_2\" &&
+  test \"x\`expr \$as_lineno_1 + 1\`\" = \"x\$as_lineno_2\") || { (exit 1); exit 1; }
+") 2> /dev/null; then
+  :
+else
+  as_candidate_shells=
+    as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in /usr/bin/posix$PATH_SEPARATOR/bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  case $as_dir in
+	 /*)
+	   for as_base in sh bash ksh sh5; do
+	     as_candidate_shells="$as_candidate_shells $as_dir/$as_base"
+	   done;;
+       esac
+done
+IFS=$as_save_IFS
+
+
+      for as_shell in $as_candidate_shells $SHELL; do
+	 # Try only shells that exist, to save several forks.
+	 if { test -f "$as_shell" || test -f "$as_shell.exe"; } &&
+		{ ("$as_shell") 2> /dev/null <<\_ASEOF
+# Be Bourne compatible
+if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
+  emulate sh
+  NULLCMD=:
+  # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which
+  # is contrary to our usage.  Disable this feature.
+  alias -g '${1+"$@"}'='"$@"'
+  setopt NO_GLOB_SUBST
+else
+  case `(set -o) 2>/dev/null` in *posix*) set -o posix;; esac
+fi
+BIN_SH=xpg4; export BIN_SH # for Tru64
+DUALCASE=1; export DUALCASE # for MKS sh
+
+:
+_ASEOF
+}; then
+  CONFIG_SHELL=$as_shell
+	       as_have_required=yes
+	       if { "$as_shell" 2> /dev/null <<\_ASEOF
+# Be Bourne compatible
+if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
+  emulate sh
+  NULLCMD=:
+  # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which
+  # is contrary to our usage.  Disable this feature.
+  alias -g '${1+"$@"}'='"$@"'
+  setopt NO_GLOB_SUBST
+else
+  case `(set -o) 2>/dev/null` in *posix*) set -o posix;; esac
+fi
+BIN_SH=xpg4; export BIN_SH # for Tru64
+DUALCASE=1; export DUALCASE # for MKS sh
+
+:
+(as_func_return () {
+  (exit $1)
+}
+as_func_success () {
+  as_func_return 0
+}
+as_func_failure () {
+  as_func_return 1
+}
+as_func_ret_success () {
+  return 0
+}
+as_func_ret_failure () {
+  return 1
+}
+
+exitcode=0
+if as_func_success; then
+  :
+else
+  exitcode=1
+  echo as_func_success failed.
+fi
+
+if as_func_failure; then
+  exitcode=1
+  echo as_func_failure succeeded.
+fi
+
+if as_func_ret_success; then
+  :
+else
+  exitcode=1
+  echo as_func_ret_success failed.
+fi
+
+if as_func_ret_failure; then
+  exitcode=1
+  echo as_func_ret_failure succeeded.
+fi
+
+if ( set x; as_func_ret_success y && test x = "$1" ); then
+  :
+else
+  exitcode=1
+  echo positional parameters were not saved.
+fi
+
+test $exitcode = 0) || { (exit 1); exit 1; }
+
+(
+  as_lineno_1=$LINENO
+  as_lineno_2=$LINENO
+  test "x$as_lineno_1" != "x$as_lineno_2" &&
+  test "x`expr $as_lineno_1 + 1`" = "x$as_lineno_2") || { (exit 1); exit 1; }
+
+_ASEOF
+}; then
+  break
+fi
+
+fi
+
+      done
+
+      if test "x$CONFIG_SHELL" != x; then
+  for as_var in BASH_ENV ENV
+        do ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var
+        done
+        export CONFIG_SHELL
+        exec "$CONFIG_SHELL" "$as_myself" ${1+"$@"}
+fi
+
+
+    if test $as_have_required = no; then
+  echo This script requires a shell more modern than all the
+      echo shells that I found on your system.  Please install a
+      echo modern shell, or manually run the script under such a
+      echo shell if you do have one.
+      { (exit 1); exit 1; }
+fi
+
+
+fi
+
+fi
+
+
+
+(eval "as_func_return () {
+  (exit \$1)
+}
+as_func_success () {
+  as_func_return 0
+}
+as_func_failure () {
+  as_func_return 1
+}
+as_func_ret_success () {
+  return 0
+}
+as_func_ret_failure () {
+  return 1
+}
+
+exitcode=0
+if as_func_success; then
+  :
+else
+  exitcode=1
+  echo as_func_success failed.
+fi
+
+if as_func_failure; then
+  exitcode=1
+  echo as_func_failure succeeded.
+fi
+
+if as_func_ret_success; then
+  :
+else
+  exitcode=1
+  echo as_func_ret_success failed.
+fi
+
+if as_func_ret_failure; then
+  exitcode=1
+  echo as_func_ret_failure succeeded.
+fi
+
+if ( set x; as_func_ret_success y && test x = \"\$1\" ); then
+  :
+else
+  exitcode=1
+  echo positional parameters were not saved.
+fi
+
+test \$exitcode = 0") || {
+  echo No shell found that supports shell functions.
+  echo Please tell autoconf@gnu.org about your system,
+  echo including any error possibly output before this
+  echo message
+}
+
+
+
+  as_lineno_1=$LINENO
+  as_lineno_2=$LINENO
+  test "x$as_lineno_1" != "x$as_lineno_2" &&
+  test "x`expr $as_lineno_1 + 1`" = "x$as_lineno_2" || {
+
+  # Create $as_me.lineno as a copy of $as_myself, but with $LINENO
+  # uniformly replaced by the line number.  The first 'sed' inserts a
+  # line-number line after each line using $LINENO; the second 'sed'
+  # does the real work.  The second script uses 'N' to pair each
+  # line-number line with the line containing $LINENO, and appends
+  # trailing '-' during substitution so that $LINENO is not a special
+  # case at line end.
+  # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the
+  # scripts with optimization help from Paolo Bonzini.  Blame Lee
+  # E. McMahon (1931-1989) for sed's syntax.  :-)
+  sed -n '
+    p
+    /[$]LINENO/=
+  ' <$as_myself |
+    sed '
+      s/[$]LINENO.*/&-/
+      t lineno
+      b
+      :lineno
+      N
+      :loop
+      s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/
+      t loop
+      s/-\n.*//
+    ' >$as_me.lineno &&
+  chmod +x "$as_me.lineno" ||
+    { echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2
+   { (exit 1); exit 1; }; }
+
+  # Don't try to exec as it changes $[0], causing all sort of problems
+  # (the dirname of $[0] is not the place where we might find the
+  # original and so on.  Autoconf is especially sensitive to this).
+  . "./$as_me.lineno"
+  # Exit status is that of the last command.
+  exit
+}
+
+
+if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then
+  as_dirname=dirname
+else
+  as_dirname=false
+fi
+
+ECHO_C= ECHO_N= ECHO_T=
+case `echo -n x` in
+-n*)
+  case `echo 'x\c'` in
+  *c*) ECHO_T='	';;	# ECHO_T is single tab character.
+  *)   ECHO_C='\c';;
+  esac;;
+*)
+  ECHO_N='-n';;
+esac
+
+if expr a : '\(a\)' >/dev/null 2>&1 &&
+   test "X`expr 00001 : '.*\(...\)'`" = X001; then
+  as_expr=expr
+else
+  as_expr=false
+fi
+
+rm -f conf$$ conf$$.exe conf$$.file
+if test -d conf$$.dir; then
+  rm -f conf$$.dir/conf$$.file
+else
+  rm -f conf$$.dir
+  mkdir conf$$.dir
+fi
+echo >conf$$.file
+if ln -s conf$$.file conf$$ 2>/dev/null; then
+  as_ln_s='ln -s'
+  # ... but there are two gotchas:
+  # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail.
+  # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable.
+  # In both cases, we have to default to `cp -p'.
+  ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe ||
+    as_ln_s='cp -p'
+elif ln conf$$.file conf$$ 2>/dev/null; then
+  as_ln_s=ln
+else
+  as_ln_s='cp -p'
+fi
+rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file
+rmdir conf$$.dir 2>/dev/null
+
+if mkdir -p . 2>/dev/null; then
+  as_mkdir_p=:
+else
+  test -d ./-p && rmdir ./-p
+  as_mkdir_p=false
+fi
+
+# Find out whether ``test -x'' works.  Don't use a zero-byte file, as
+# systems may use methods other than mode bits to determine executability.
+cat >conf$$.file <<_ASEOF
+#! /bin/sh
+exit 0
+_ASEOF
+chmod +x conf$$.file
+if test -x conf$$.file >/dev/null 2>&1; then
+  as_executable_p="test -x"
+else
+  as_executable_p=:
+fi
+rm -f conf$$.file
+
+# Sed expression to map a string onto a valid CPP name.
+as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'"
+
+# Sed expression to map a string onto a valid variable name.
+as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'"
+
+
+
+exec 7<&0 </dev/null 6>&1
+
+# Name of the host.
+# hostname on some systems (SVR3.2, Linux) returns a bogus exit status,
+# so uname gets run too.
+ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q`
+
+#
+# Initializations.
+#
+ac_default_prefix=/usr/local
+ac_clean_files=
+ac_config_libobj_dir=.
+LIBOBJS=
+cross_compiling=no
+subdirs=
+MFLAGS=
+MAKEFLAGS=
+SHELL=${CONFIG_SHELL-/bin/sh}
+
+# Identity of this package.
+PACKAGE_NAME=
+PACKAGE_TARNAME=
+PACKAGE_VERSION=
+PACKAGE_STRING=
+PACKAGE_BUGREPORT=
+
+ac_unique_file="HsHyperEstraier"
+ac_unique_file="HsHyperEstraier.cabal"
+ac_subst_vars='SHELL
+PATH_SEPARATOR
+PACKAGE_NAME
+PACKAGE_TARNAME
+PACKAGE_VERSION
+PACKAGE_STRING
+PACKAGE_BUGREPORT
+exec_prefix
+prefix
+program_transform_name
+bindir
+sbindir
+libexecdir
+datarootdir
+datadir
+sysconfdir
+sharedstatedir
+localstatedir
+includedir
+oldincludedir
+docdir
+infodir
+htmldir
+dvidir
+pdfdir
+psdir
+libdir
+localedir
+mandir
+DEFS
+ECHO_C
+ECHO_N
+ECHO_T
+LIBS
+build_alias
+host_alias
+target_alias
+PKG_CONFIG
+HyperEstraier_CFLAGS
+HyperEstraier_LIBS
+LIBOBJS
+LTLIBOBJS'
+ac_subst_files=''
+      ac_precious_vars='build_alias
+host_alias
+target_alias
+PKG_CONFIG
+HyperEstraier_CFLAGS
+HyperEstraier_LIBS'
+
+
+# Initialize some variables set by options.
+ac_init_help=
+ac_init_version=false
+# 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'
+includedir='${prefix}/include'
+oldincludedir='/usr/include'
+docdir='${datarootdir}/doc/${PACKAGE}'
+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=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_feature=`expr "x$ac_option" : 'x-*disable-\(.*\)'`
+    # Reject names that are not valid shell variable names.
+    expr "x$ac_feature" : ".*[^-_$as_cr_alnum]" >/dev/null &&
+      { echo "$as_me: error: invalid feature name: $ac_feature" >&2
+   { (exit 1); exit 1; }; }
+    ac_feature=`echo $ac_feature | sed 's/-/_/g'`
+    eval enable_$ac_feature=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_feature=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'`
+    # Reject names that are not valid shell variable names.
+    expr "x$ac_feature" : ".*[^-_$as_cr_alnum]" >/dev/null &&
+      { echo "$as_me: error: invalid feature name: $ac_feature" >&2
+   { (exit 1); exit 1; }; }
+    ac_feature=`echo $ac_feature | sed 's/-/_/g'`
+    eval enable_$ac_feature=\$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 ;;
+
+  -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_package=`expr "x$ac_option" : 'x-*with-\([^=]*\)'`
+    # Reject names that are not valid shell variable names.
+    expr "x$ac_package" : ".*[^-_$as_cr_alnum]" >/dev/null &&
+      { echo "$as_me: error: invalid package name: $ac_package" >&2
+   { (exit 1); exit 1; }; }
+    ac_package=`echo $ac_package| sed 's/-/_/g'`
+    eval with_$ac_package=\$ac_optarg ;;
+
+  -without-* | --without-*)
+    ac_package=`expr "x$ac_option" : 'x-*without-\(.*\)'`
+    # Reject names that are not valid shell variable names.
+    expr "x$ac_package" : ".*[^-_$as_cr_alnum]" >/dev/null &&
+      { echo "$as_me: error: invalid package name: $ac_package" >&2
+   { (exit 1); exit 1; }; }
+    ac_package=`echo $ac_package | sed 's/-/_/g'`
+    eval with_$ac_package=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 ;;
+
+  -*) { echo "$as_me: error: unrecognized option: $ac_option
+Try \`$0 --help' for more information." >&2
+   { (exit 1); exit 1; }; }
+    ;;
+
+  *=*)
+    ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='`
+    # Reject names that are not valid shell variable names.
+    expr "x$ac_envvar" : ".*[^_$as_cr_alnum]" >/dev/null &&
+      { echo "$as_me: error: invalid variable name: $ac_envvar" >&2
+   { (exit 1); exit 1; }; }
+    eval $ac_envvar=\$ac_optarg
+    export $ac_envvar ;;
+
+  *)
+    # FIXME: should be removed in autoconf 3.0.
+    echo "$as_me: WARNING: you should use --build, --host, --target" >&2
+    expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null &&
+      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'`
+  { echo "$as_me: error: missing argument to $ac_option" >&2
+   { (exit 1); exit 1; }; }
+fi
+
+# Be sure to have absolute directory names.
+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
+do
+  eval ac_val=\$$ac_var
+  case $ac_val in
+    [\\/$]* | ?:[\\/]* )  continue;;
+    NONE | '' ) case $ac_var in *prefix ) continue;; esac;;
+  esac
+  { echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2
+   { (exit 1); exit 1; }; }
+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
+    echo "$as_me: WARNING: If you wanted to set the --build type, don't use --host.
+    If a cross compiler is detected then cross compile mode will be used." >&2
+  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 .` ||
+  { echo "$as_me: error: Working directory cannot be determined" >&2
+   { (exit 1); exit 1; }; }
+test "X$ac_ls_di" = "X$ac_pwd_ls_di" ||
+  { echo "$as_me: error: pwd does not report name of working directory" >&2
+   { (exit 1); exit 1; }; }
+
+
+# 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 -- "$0" ||
+$as_expr X"$0" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+	 X"$0" : 'X\(//\)[^/]' \| \
+	 X"$0" : 'X\(//\)$' \| \
+	 X"$0" : 'X\(/\)' \| . 2>/dev/null ||
+echo X"$0" |
+    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 .."
+  { echo "$as_me: error: cannot find sources ($ac_unique_file) in $srcdir" >&2
+   { (exit 1); exit 1; }; }
+fi
+ac_msg="sources are in $srcdir, but \`cd $srcdir' does not work"
+ac_abs_confdir=`(
+	cd "$srcdir" && test -r "./$ac_unique_file" || { echo "$as_me: error: $ac_msg" >&2
+   { (exit 1); exit 1; }; }
+	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 this package 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]
+  --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/PACKAGE]
+  --htmldir=DIR          html documentation [DOCDIR]
+  --dvidir=DIR           dvi documentation [DOCDIR]
+  --pdfdir=DIR           pdf documentation [DOCDIR]
+  --psdir=DIR            ps documentation [DOCDIR]
+_ACEOF
+
+  cat <<\_ACEOF
+_ACEOF
+fi
+
+if test -n "$ac_init_help"; then
+
+  cat <<\_ACEOF
+
+Some influential environment variables:
+  PKG_CONFIG  path to pkg-config utility
+  HyperEstraier_CFLAGS
+              C compiler flags for HyperEstraier, overriding pkg-config
+  HyperEstraier_LIBS
+              linker flags for HyperEstraier, overriding pkg-config
+
+Use these variables to override the choices made by `configure' or to help
+it to find libraries and programs with nonstandard names/locations.
+
+_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" || continue
+    ac_builddir=.
+
+case "$ac_dir" in
+.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;;
+*)
+  ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'`
+  # A ".." for each directory in $ac_dir_suffix.
+  ac_top_builddir_sub=`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
+      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
+configure
+generated by GNU Autoconf 2.60
+
+Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001,
+2002, 2003, 2004, 2005, 2006 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
+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 $as_me, which was
+generated by GNU Autoconf 2.60.  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=.
+  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=`echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;;
+    esac
+    case $ac_pass in
+    1) ac_configure_args0="$ac_configure_args0 '$ac_arg'" ;;
+    2)
+      ac_configure_args1="$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
+      ac_configure_args="$ac_configure_args '$ac_arg'"
+      ;;
+    esac
+  done
+done
+$as_unset ac_configure_args0 || test "${ac_configure_args0+set}" != set || { ac_configure_args0=; export ac_configure_args0; }
+$as_unset ac_configure_args1 || test "${ac_configure_args1+set}" != set || { ac_configure_args1=; export 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
+
+    cat <<\_ASBOX
+## ---------------- ##
+## Cache variables. ##
+## ---------------- ##
+_ASBOX
+    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_*) { echo "$as_me:$LINENO: WARNING: Cache variable $ac_var contains a newline." >&5
+echo "$as_me: WARNING: Cache variable $ac_var contains a newline." >&2;} ;;
+      esac
+      case $ac_var in #(
+      _ | IFS | as_nl) ;; #(
+      *) $as_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
+
+    cat <<\_ASBOX
+## ----------------- ##
+## Output variables. ##
+## ----------------- ##
+_ASBOX
+    echo
+    for ac_var in $ac_subst_vars
+    do
+      eval ac_val=\$$ac_var
+      case $ac_val in
+      *\'\''*) ac_val=`echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;;
+      esac
+      echo "$ac_var='\''$ac_val'\''"
+    done | sort
+    echo
+
+    if test -n "$ac_subst_files"; then
+      cat <<\_ASBOX
+## ------------------- ##
+## File substitutions. ##
+## ------------------- ##
+_ASBOX
+      echo
+      for ac_var in $ac_subst_files
+      do
+	eval ac_val=\$$ac_var
+	case $ac_val in
+	*\'\''*) ac_val=`echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;;
+	esac
+	echo "$ac_var='\''$ac_val'\''"
+      done | sort
+      echo
+    fi
+
+    if test -s confdefs.h; then
+      cat <<\_ASBOX
+## ----------- ##
+## confdefs.h. ##
+## ----------- ##
+_ASBOX
+      echo
+      cat confdefs.h
+      echo
+    fi
+    test "$ac_signal" != 0 &&
+      echo "$as_me: caught signal $ac_signal"
+    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'; { (exit 1); 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
+
+# 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
+
+
+# Let the site file select an alternate cache file if it wants to.
+# Prefer explicitly selected file to automatically selected ones.
+if test -n "$CONFIG_SITE"; then
+  set x "$CONFIG_SITE"
+elif test "x$prefix" != xNONE; then
+  set x "$prefix/share/config.site" "$prefix/etc/config.site"
+else
+  set x "$ac_default_prefix/share/config.site" \
+	"$ac_default_prefix/etc/config.site"
+fi
+shift
+for ac_site_file
+do
+  if test -r "$ac_site_file"; then
+    { echo "$as_me:$LINENO: loading site script $ac_site_file" >&5
+echo "$as_me: loading site script $ac_site_file" >&6;}
+    sed 's/^/| /' "$ac_site_file" >&5
+    . "$ac_site_file"
+  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.
+  if test -f "$cache_file"; then
+    { echo "$as_me:$LINENO: loading cache $cache_file" >&5
+echo "$as_me: loading cache $cache_file" >&6;}
+    case $cache_file in
+      [\\/]* | ?:[\\/]* ) . "$cache_file";;
+      *)                      . "./$cache_file";;
+    esac
+  fi
+else
+  { echo "$as_me:$LINENO: creating cache $cache_file" >&5
+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,)
+      { echo "$as_me:$LINENO: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5
+echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;}
+      ac_cache_corrupted=: ;;
+    ,set)
+      { echo "$as_me:$LINENO: error: \`$ac_var' was not set in the previous run" >&5
+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
+	{ echo "$as_me:$LINENO: error: \`$ac_var' has changed since the previous run:" >&5
+echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;}
+	{ echo "$as_me:$LINENO:   former value:  $ac_old_val" >&5
+echo "$as_me:   former value:  $ac_old_val" >&2;}
+	{ echo "$as_me:$LINENO:   current value: $ac_new_val" >&5
+echo "$as_me:   current value: $ac_new_val" >&2;}
+	ac_cache_corrupted=:
+      fi;;
+  esac
+  # Pass precious variables to config.status.
+  if test "$ac_new_set" = set; then
+    case $ac_new_val in
+    *\'*) ac_arg=$ac_var=`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.
+      *) ac_configure_args="$ac_configure_args '$ac_arg'" ;;
+    esac
+  fi
+done
+if $ac_cache_corrupted; then
+  { echo "$as_me:$LINENO: error: changes in the environment can compromise the build" >&5
+echo "$as_me: error: changes in the environment can compromise the build" >&2;}
+  { { echo "$as_me:$LINENO: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&5
+echo "$as_me: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&2;}
+   { (exit 1); exit 1; }; }
+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
+
+
+
+
+
+# checks for HyperEstraier
+
+
+if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then
+	if test -n "$ac_tool_prefix"; then
+  # Extract the first word of "${ac_tool_prefix}pkg-config", so it can be a program name with args.
+set dummy ${ac_tool_prefix}pkg-config; ac_word=$2
+{ echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+if test "${ac_cv_path_PKG_CONFIG+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  case $PKG_CONFIG in
+  [\\/]* | ?:[\\/]*)
+  ac_cv_path_PKG_CONFIG="$PKG_CONFIG" # Let the user override the test with a path.
+  ;;
+  *)
+  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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_path_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext"
+    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+done
+IFS=$as_save_IFS
+
+  ;;
+esac
+fi
+PKG_CONFIG=$ac_cv_path_PKG_CONFIG
+if test -n "$PKG_CONFIG"; then
+  { echo "$as_me:$LINENO: result: $PKG_CONFIG" >&5
+echo "${ECHO_T}$PKG_CONFIG" >&6; }
+else
+  { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
+fi
+
+
+fi
+if test -z "$ac_cv_path_PKG_CONFIG"; then
+  ac_pt_PKG_CONFIG=$PKG_CONFIG
+  # Extract the first word of "pkg-config", so it can be a program name with args.
+set dummy pkg-config; ac_word=$2
+{ echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+if test "${ac_cv_path_ac_pt_PKG_CONFIG+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  case $ac_pt_PKG_CONFIG in
+  [\\/]* | ?:[\\/]*)
+  ac_cv_path_ac_pt_PKG_CONFIG="$ac_pt_PKG_CONFIG" # Let the user override the test with a path.
+  ;;
+  *)
+  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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_path_ac_pt_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext"
+    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+done
+IFS=$as_save_IFS
+
+  ;;
+esac
+fi
+ac_pt_PKG_CONFIG=$ac_cv_path_ac_pt_PKG_CONFIG
+if test -n "$ac_pt_PKG_CONFIG"; then
+  { echo "$as_me:$LINENO: result: $ac_pt_PKG_CONFIG" >&5
+echo "${ECHO_T}$ac_pt_PKG_CONFIG" >&6; }
+else
+  { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
+fi
+
+  if test "x$ac_pt_PKG_CONFIG" = x; then
+    PKG_CONFIG=""
+  else
+    case $cross_compiling:$ac_tool_warned in
+yes:)
+{ echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools
+whose name does not start with the host triplet.  If you think this
+configuration is useful to you, please write to autoconf@gnu.org." >&5
+echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools
+whose name does not start with the host triplet.  If you think this
+configuration is useful to you, please write to autoconf@gnu.org." >&2;}
+ac_tool_warned=yes ;;
+esac
+    PKG_CONFIG=$ac_pt_PKG_CONFIG
+  fi
+else
+  PKG_CONFIG="$ac_cv_path_PKG_CONFIG"
+fi
+
+fi
+if test -n "$PKG_CONFIG"; then
+	_pkg_min_version=0.9.0
+	{ echo "$as_me:$LINENO: checking pkg-config is at least version $_pkg_min_version" >&5
+echo $ECHO_N "checking pkg-config is at least version $_pkg_min_version... $ECHO_C" >&6; }
+	if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then
+		{ echo "$as_me:$LINENO: result: yes" >&5
+echo "${ECHO_T}yes" >&6; }
+	else
+		{ echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
+		PKG_CONFIG=""
+	fi
+
+fi
+
+pkg_failed=no
+{ echo "$as_me:$LINENO: checking for HyperEstraier" >&5
+echo $ECHO_N "checking for HyperEstraier... $ECHO_C" >&6; }
+
+if test -n "$PKG_CONFIG"; then
+    if test -n "$HyperEstraier_CFLAGS"; then
+        pkg_cv_HyperEstraier_CFLAGS="$HyperEstraier_CFLAGS"
+    else
+        if test -n "$PKG_CONFIG" && \
+    { (echo "$as_me:$LINENO: \$PKG_CONFIG --exists --print-errors \"hyperestraier >= 1.4.9 qdbm >= 1.8.74\"") >&5
+  ($PKG_CONFIG --exists --print-errors "hyperestraier >= 1.4.9 qdbm >= 1.8.74") 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; then
+  pkg_cv_HyperEstraier_CFLAGS=`$PKG_CONFIG --cflags "hyperestraier >= 1.4.9 qdbm >= 1.8.74" 2>/dev/null`
+else
+  pkg_failed=yes
+fi
+    fi
+else
+	pkg_failed=untried
+fi
+if test -n "$PKG_CONFIG"; then
+    if test -n "$HyperEstraier_LIBS"; then
+        pkg_cv_HyperEstraier_LIBS="$HyperEstraier_LIBS"
+    else
+        if test -n "$PKG_CONFIG" && \
+    { (echo "$as_me:$LINENO: \$PKG_CONFIG --exists --print-errors \"hyperestraier >= 1.4.9 qdbm >= 1.8.74\"") >&5
+  ($PKG_CONFIG --exists --print-errors "hyperestraier >= 1.4.9 qdbm >= 1.8.74") 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; then
+  pkg_cv_HyperEstraier_LIBS=`$PKG_CONFIG --libs "hyperestraier >= 1.4.9 qdbm >= 1.8.74" 2>/dev/null`
+else
+  pkg_failed=yes
+fi
+    fi
+else
+	pkg_failed=untried
+fi
+
+
+
+if test $pkg_failed = yes; then
+
+if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
+        _pkg_short_errors_supported=yes
+else
+        _pkg_short_errors_supported=no
+fi
+        if test $_pkg_short_errors_supported = yes; then
+	        HyperEstraier_PKG_ERRORS=`$PKG_CONFIG --short-errors --errors-to-stdout --print-errors "hyperestraier >= 1.4.9 qdbm >= 1.8.74"`
+        else
+	        HyperEstraier_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "hyperestraier >= 1.4.9 qdbm >= 1.8.74"`
+        fi
+	# Put the nasty error message in config.log where it belongs
+	echo "$HyperEstraier_PKG_ERRORS" >&5
+
+	{ { echo "$as_me:$LINENO: error: Package requirements (hyperestraier >= 1.4.9 qdbm >= 1.8.74) were not met:
+
+$HyperEstraier_PKG_ERRORS
+
+Consider adjusting the PKG_CONFIG_PATH environment variable if you
+installed software in a non-standard prefix.
+
+Alternatively, you may set the environment variables HyperEstraier_CFLAGS
+and HyperEstraier_LIBS to avoid the need to call pkg-config.
+See the pkg-config man page for more details.
+" >&5
+echo "$as_me: error: Package requirements (hyperestraier >= 1.4.9 qdbm >= 1.8.74) were not met:
+
+$HyperEstraier_PKG_ERRORS
+
+Consider adjusting the PKG_CONFIG_PATH environment variable if you
+installed software in a non-standard prefix.
+
+Alternatively, you may set the environment variables HyperEstraier_CFLAGS
+and HyperEstraier_LIBS to avoid the need to call pkg-config.
+See the pkg-config man page for more details.
+" >&2;}
+   { (exit 1); exit 1; }; }
+elif test $pkg_failed = untried; then
+	{ { echo "$as_me:$LINENO: error: The pkg-config script could not be found or is too old.  Make sure it
+is in your PATH or set the PKG_CONFIG environment variable to the full
+path to pkg-config.
+
+Alternatively, you may set the environment variables HyperEstraier_CFLAGS
+and HyperEstraier_LIBS to avoid the need to call pkg-config.
+See the pkg-config man page for more details.
+
+To get pkg-config, see <http://pkg-config.freedesktop.org/>.
+See \`config.log' for more details." >&5
+echo "$as_me: error: The pkg-config script could not be found or is too old.  Make sure it
+is in your PATH or set the PKG_CONFIG environment variable to the full
+path to pkg-config.
+
+Alternatively, you may set the environment variables HyperEstraier_CFLAGS
+and HyperEstraier_LIBS to avoid the need to call pkg-config.
+See the pkg-config man page for more details.
+
+To get pkg-config, see <http://pkg-config.freedesktop.org/>.
+See \`config.log' for more details." >&2;}
+   { (exit 1); exit 1; }; }
+else
+	HyperEstraier_CFLAGS=$pkg_cv_HyperEstraier_CFLAGS
+	HyperEstraier_LIBS=$pkg_cv_HyperEstraier_LIBS
+        { echo "$as_me:$LINENO: result: yes" >&5
+echo "${ECHO_T}yes" >&6; }
+	:
+fi
+
+# output
+ac_config_files="$ac_config_files HsHyperEstraier.buildinfo"
+
+cat >confcache <<\_ACEOF
+# This file is a shell script that caches the results of configure
+# tests run on this system so they can be shared between configure
+# scripts and configure runs, see configure's option --config-cache.
+# It is not useful on other systems.  If it contains results you don't
+# want to keep, you may remove or edit it.
+#
+# config.status only pays attention to the cache file if you give it
+# the --recheck option to rerun configure.
+#
+# `ac_cv_env_foo' variables (set or unset) will be overridden when
+# loading this file, other *unset* `ac_cv_foo' will be assigned the
+# following values.
+
+_ACEOF
+
+# The following way of writing the cache mishandles newlines in values,
+# but we know of no workaround that is simple, portable, and efficient.
+# So, we kill variables containing newlines.
+# Ultrix sh set writes to stderr and can't be redirected directly,
+# and sets the high bit in the cache file unless we assign to the vars.
+(
+  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_*) { echo "$as_me:$LINENO: WARNING: Cache variable $ac_var contains a newline." >&5
+echo "$as_me: WARNING: Cache variable $ac_var contains a newline." >&2;} ;;
+      esac
+      case $ac_var in #(
+      _ | IFS | as_nl) ;; #(
+      *) $as_unset $ac_var ;;
+      esac ;;
+    esac
+  done
+
+  (set) 2>&1 |
+    case $as_nl`(ac_space=' '; set) 2>&1` in #(
+    *${as_nl}ac_space=\ *)
+      # `set' does not quote correctly, so add quotes (double-quote
+      # substitution turns \\\\ into \\, and sed turns \\ into \).
+      sed -n \
+	"s/'/'\\\\''/g;
+	  s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p"
+      ;; #(
+    *)
+      # `set' quotes correctly as required by POSIX, so do not add quotes.
+      sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p"
+      ;;
+    esac |
+    sort
+) |
+  sed '
+     /^ac_cv_env_/b end
+     t clear
+     :clear
+     s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/
+     t end
+     s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/
+     :end' >>confcache
+if diff "$cache_file" confcache >/dev/null 2>&1; then :; else
+  if test -w "$cache_file"; then
+    test "x$cache_file" != "x/dev/null" &&
+      { echo "$as_me:$LINENO: updating cache $cache_file" >&5
+echo "$as_me: updating cache $cache_file" >&6;}
+    cat confcache >$cache_file
+  else
+    { echo "$as_me:$LINENO: not updating unwritable cache $cache_file" >&5
+echo "$as_me: not updating unwritable cache $cache_file" >&6;}
+  fi
+fi
+rm -f confcache
+
+test "x$prefix" = xNONE && prefix=$ac_default_prefix
+# Let make expand exec_prefix.
+test "x$exec_prefix" = xNONE && exec_prefix='${prefix}'
+
+# Transform confdefs.h into DEFS.
+# Protect against shell expansion while executing Makefile rules.
+# Protect against Makefile macro expansion.
+#
+# If the first sed substitution is executed (which looks for macros that
+# take arguments), then branch to the quote section.  Otherwise,
+# look for a macro that doesn't take arguments.
+ac_script='
+t clear
+:clear
+s/^[	 ]*#[	 ]*define[	 ][	 ]*\([^	 (][^	 (]*([^)]*)\)[	 ]*\(.*\)/-D\1=\2/g
+t quote
+s/^[	 ]*#[	 ]*define[	 ][	 ]*\([^	 ][^	 ]*\)[	 ]*\(.*\)/-D\1=\2/g
+t quote
+b any
+:quote
+s/[	 `~#$^&*(){}\\|;'\''"<>?]/\\&/g
+s/\[/\\&/g
+s/\]/\\&/g
+s/\$/$$/g
+H
+:any
+${
+	g
+	s/^\n//
+	s/\n/ /g
+	p
+}
+'
+DEFS=`sed -n "$ac_script" confdefs.h`
+
+
+ac_libobjs=
+ac_ltlibobjs=
+for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue
+  # 1. Remove the extension, and $U if already installed.
+  ac_script='s/\$U\././;s/\.o$//;s/\.obj$//'
+  ac_i=`echo "$ac_i" | sed "$ac_script"`
+  # 2. Prepend LIBOBJDIR.  When used with automake>=1.10 LIBOBJDIR
+  #    will be set to the directory where LIBOBJS objects are built.
+  ac_libobjs="$ac_libobjs \${LIBOBJDIR}$ac_i\$U.$ac_objext"
+  ac_ltlibobjs="$ac_ltlibobjs \${LIBOBJDIR}$ac_i"'$U.lo'
+done
+LIBOBJS=$ac_libobjs
+
+LTLIBOBJS=$ac_ltlibobjs
+
+
+
+: ${CONFIG_STATUS=./config.status}
+ac_clean_files_save=$ac_clean_files
+ac_clean_files="$ac_clean_files $CONFIG_STATUS"
+{ echo "$as_me:$LINENO: creating $CONFIG_STATUS" >&5
+echo "$as_me: creating $CONFIG_STATUS" >&6;}
+cat >$CONFIG_STATUS <<_ACEOF
+#! $SHELL
+# Generated by $as_me.
+# Run this file to recreate the current configuration.
+# Compiler output produced by configure, useful for debugging
+# configure, is in config.log if it exists.
+
+debug=false
+ac_cs_recheck=false
+ac_cs_silent=false
+SHELL=\${CONFIG_SHELL-$SHELL}
+_ACEOF
+
+cat >>$CONFIG_STATUS <<\_ACEOF
+## --------------------- ##
+## M4sh Initialization.  ##
+## --------------------- ##
+
+# Be Bourne compatible
+if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
+  emulate sh
+  NULLCMD=:
+  # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which
+  # is contrary to our usage.  Disable this feature.
+  alias -g '${1+"$@"}'='"$@"'
+  setopt NO_GLOB_SUBST
+else
+  case `(set -o) 2>/dev/null` in *posix*) set -o posix;; esac
+fi
+BIN_SH=xpg4; export BIN_SH # for Tru64
+DUALCASE=1; export DUALCASE # for MKS sh
+
+
+# PATH needs CR
+# Avoid depending upon Character Ranges.
+as_cr_letters='abcdefghijklmnopqrstuvwxyz'
+as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ'
+as_cr_Letters=$as_cr_letters$as_cr_LETTERS
+as_cr_digits='0123456789'
+as_cr_alnum=$as_cr_Letters$as_cr_digits
+
+# The user is always right.
+if test "${PATH_SEPARATOR+set}" != set; then
+  echo "#! /bin/sh" >conf$$.sh
+  echo  "exit 0"   >>conf$$.sh
+  chmod +x conf$$.sh
+  if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then
+    PATH_SEPARATOR=';'
+  else
+    PATH_SEPARATOR=:
+  fi
+  rm -f conf$$.sh
+fi
+
+# Support unset when possible.
+if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then
+  as_unset=unset
+else
+  as_unset=false
+fi
+
+
+# IFS
+# We need space, tab and new line, in precisely that order.  Quoting is
+# there to prevent editors from complaining about space-tab.
+# (If _AS_PATH_WALK were called with IFS unset, it would disable word
+# splitting by setting IFS to empty value.)
+as_nl='
+'
+IFS=" ""	$as_nl"
+
+# Find who we are.  Look in the path if we contain no directory separator.
+case $0 in
+  *[\\/]* ) as_myself=$0 ;;
+  *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break
+done
+IFS=$as_save_IFS
+
+     ;;
+esac
+# We did not find ourselves, most probably we were run as `sh COMMAND'
+# in which case we are not to be found in the path.
+if test "x$as_myself" = x; then
+  as_myself=$0
+fi
+if test ! -f "$as_myself"; then
+  echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2
+  { (exit 1); exit 1; }
+fi
+
+# Work around bugs in pre-3.0 UWIN ksh.
+for as_var in ENV MAIL MAILPATH
+do ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var
+done
+PS1='$ '
+PS2='> '
+PS4='+ '
+
+# NLS nuisances.
+for as_var in \
+  LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \
+  LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \
+  LC_TELEPHONE LC_TIME
+do
+  if (set +x; test -z "`(eval $as_var=C; export $as_var) 2>&1`"); then
+    eval $as_var=C; export $as_var
+  else
+    ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var
+  fi
+done
+
+# Required to use basename.
+if expr a : '\(a\)' >/dev/null 2>&1 &&
+   test "X`expr 00001 : '.*\(...\)'`" = X001; then
+  as_expr=expr
+else
+  as_expr=false
+fi
+
+if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then
+  as_basename=basename
+else
+  as_basename=false
+fi
+
+
+# Name of the executable.
+as_me=`$as_basename -- "$0" ||
+$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \
+	 X"$0" : 'X\(//\)$' \| \
+	 X"$0" : 'X\(/\)' \| . 2>/dev/null ||
+echo X/"$0" |
+    sed '/^.*\/\([^/][^/]*\)\/*$/{
+	    s//\1/
+	    q
+	  }
+	  /^X\/\(\/\/\)$/{
+	    s//\1/
+	    q
+	  }
+	  /^X\/\(\/\).*/{
+	    s//\1/
+	    q
+	  }
+	  s/.*/./; q'`
+
+# CDPATH.
+$as_unset CDPATH
+
+
+
+  as_lineno_1=$LINENO
+  as_lineno_2=$LINENO
+  test "x$as_lineno_1" != "x$as_lineno_2" &&
+  test "x`expr $as_lineno_1 + 1`" = "x$as_lineno_2" || {
+
+  # Create $as_me.lineno as a copy of $as_myself, but with $LINENO
+  # uniformly replaced by the line number.  The first 'sed' inserts a
+  # line-number line after each line using $LINENO; the second 'sed'
+  # does the real work.  The second script uses 'N' to pair each
+  # line-number line with the line containing $LINENO, and appends
+  # trailing '-' during substitution so that $LINENO is not a special
+  # case at line end.
+  # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the
+  # scripts with optimization help from Paolo Bonzini.  Blame Lee
+  # E. McMahon (1931-1989) for sed's syntax.  :-)
+  sed -n '
+    p
+    /[$]LINENO/=
+  ' <$as_myself |
+    sed '
+      s/[$]LINENO.*/&-/
+      t lineno
+      b
+      :lineno
+      N
+      :loop
+      s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/
+      t loop
+      s/-\n.*//
+    ' >$as_me.lineno &&
+  chmod +x "$as_me.lineno" ||
+    { echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2
+   { (exit 1); exit 1; }; }
+
+  # Don't try to exec as it changes $[0], causing all sort of problems
+  # (the dirname of $[0] is not the place where we might find the
+  # original and so on.  Autoconf is especially sensitive to this).
+  . "./$as_me.lineno"
+  # Exit status is that of the last command.
+  exit
+}
+
+
+if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then
+  as_dirname=dirname
+else
+  as_dirname=false
+fi
+
+ECHO_C= ECHO_N= ECHO_T=
+case `echo -n x` in
+-n*)
+  case `echo 'x\c'` in
+  *c*) ECHO_T='	';;	# ECHO_T is single tab character.
+  *)   ECHO_C='\c';;
+  esac;;
+*)
+  ECHO_N='-n';;
+esac
+
+if expr a : '\(a\)' >/dev/null 2>&1 &&
+   test "X`expr 00001 : '.*\(...\)'`" = X001; then
+  as_expr=expr
+else
+  as_expr=false
+fi
+
+rm -f conf$$ conf$$.exe conf$$.file
+if test -d conf$$.dir; then
+  rm -f conf$$.dir/conf$$.file
+else
+  rm -f conf$$.dir
+  mkdir conf$$.dir
+fi
+echo >conf$$.file
+if ln -s conf$$.file conf$$ 2>/dev/null; then
+  as_ln_s='ln -s'
+  # ... but there are two gotchas:
+  # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail.
+  # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable.
+  # In both cases, we have to default to `cp -p'.
+  ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe ||
+    as_ln_s='cp -p'
+elif ln conf$$.file conf$$ 2>/dev/null; then
+  as_ln_s=ln
+else
+  as_ln_s='cp -p'
+fi
+rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file
+rmdir conf$$.dir 2>/dev/null
+
+if mkdir -p . 2>/dev/null; then
+  as_mkdir_p=:
+else
+  test -d ./-p && rmdir ./-p
+  as_mkdir_p=false
+fi
+
+# Find out whether ``test -x'' works.  Don't use a zero-byte file, as
+# systems may use methods other than mode bits to determine executability.
+cat >conf$$.file <<_ASEOF
+#! /bin/sh
+exit 0
+_ASEOF
+chmod +x conf$$.file
+if test -x conf$$.file >/dev/null 2>&1; then
+  as_executable_p="test -x"
+else
+  as_executable_p=:
+fi
+rm -f conf$$.file
+
+# Sed expression to map a string onto a valid CPP name.
+as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'"
+
+# Sed expression to map a string onto a valid variable name.
+as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'"
+
+
+exec 6>&1
+
+# Save the log message, to keep $[0] and so on meaningful, and to
+# report actual input values of CONFIG_FILES etc. instead of their
+# values after options handling.
+ac_log="
+This file was extended by $as_me, which was
+generated by GNU Autoconf 2.60.  Invocation command line was
+
+  CONFIG_FILES    = $CONFIG_FILES
+  CONFIG_HEADERS  = $CONFIG_HEADERS
+  CONFIG_LINKS    = $CONFIG_LINKS
+  CONFIG_COMMANDS = $CONFIG_COMMANDS
+  $ $0 $@
+
+on `(hostname || uname -n) 2>/dev/null | sed 1q`
+"
+
+_ACEOF
+
+cat >>$CONFIG_STATUS <<_ACEOF
+# Files that config.status was made for.
+config_files="$ac_config_files"
+
+_ACEOF
+
+cat >>$CONFIG_STATUS <<\_ACEOF
+ac_cs_usage="\
+\`$as_me' instantiates files from templates according to the
+current configuration.
+
+Usage: $0 [OPTIONS] [FILE]...
+
+  -h, --help       print this help, then exit
+  -V, --version    print version number, then exit
+  -q, --quiet      do not print progress messages
+  -d, --debug      don't remove temporary files
+      --recheck    update $as_me by reconfiguring in the same conditions
+  --file=FILE[:TEMPLATE]
+		   instantiate the configuration file FILE
+
+Configuration files:
+$config_files
+
+Report bugs to <bug-autoconf@gnu.org>."
+
+_ACEOF
+cat >>$CONFIG_STATUS <<_ACEOF
+ac_cs_version="\\
+config.status
+configured by $0, generated by GNU Autoconf 2.60,
+  with options \\"`echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`\\"
+
+Copyright (C) 2006 Free Software Foundation, Inc.
+This config.status script is free software; the Free Software Foundation
+gives unlimited permission to copy, distribute and modify it."
+
+ac_pwd='$ac_pwd'
+srcdir='$srcdir'
+_ACEOF
+
+cat >>$CONFIG_STATUS <<\_ACEOF
+# If no file are specified by the user, then we need to provide default
+# value.  By we need to know if files were specified by the user.
+ac_need_defaults=:
+while test $# != 0
+do
+  case $1 in
+  --*=*)
+    ac_option=`expr "X$1" : 'X\([^=]*\)='`
+    ac_optarg=`expr "X$1" : 'X[^=]*=\(.*\)'`
+    ac_shift=:
+    ;;
+  *)
+    ac_option=$1
+    ac_optarg=$2
+    ac_shift=shift
+    ;;
+  esac
+
+  case $ac_option in
+  # Handling of the options.
+  -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r)
+    ac_cs_recheck=: ;;
+  --version | --versio | --versi | --vers | --ver | --ve | --v | -V )
+    echo "$ac_cs_version"; exit ;;
+  --debug | --debu | --deb | --de | --d | -d )
+    debug=: ;;
+  --file | --fil | --fi | --f )
+    $ac_shift
+    CONFIG_FILES="$CONFIG_FILES $ac_optarg"
+    ac_need_defaults=false;;
+  --he | --h |  --help | --hel | -h )
+    echo "$ac_cs_usage"; exit ;;
+  -q | -quiet | --quiet | --quie | --qui | --qu | --q \
+  | -silent | --silent | --silen | --sile | --sil | --si | --s)
+    ac_cs_silent=: ;;
+
+  # This is an error.
+  -*) { echo "$as_me: error: unrecognized option: $1
+Try \`$0 --help' for more information." >&2
+   { (exit 1); exit 1; }; } ;;
+
+  *) ac_config_targets="$ac_config_targets $1"
+     ac_need_defaults=false ;;
+
+  esac
+  shift
+done
+
+ac_configure_extra_args=
+
+if $ac_cs_silent; then
+  exec 6>/dev/null
+  ac_configure_extra_args="$ac_configure_extra_args --silent"
+fi
+
+_ACEOF
+cat >>$CONFIG_STATUS <<_ACEOF
+if \$ac_cs_recheck; then
+  echo "running CONFIG_SHELL=$SHELL $SHELL $0 "$ac_configure_args \$ac_configure_extra_args " --no-create --no-recursion" >&6
+  CONFIG_SHELL=$SHELL
+  export CONFIG_SHELL
+  exec $SHELL "$0"$ac_configure_args \$ac_configure_extra_args --no-create --no-recursion
+fi
+
+_ACEOF
+cat >>$CONFIG_STATUS <<\_ACEOF
+exec 5>>config.log
+{
+  echo
+  sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX
+## Running $as_me. ##
+_ASBOX
+  echo "$ac_log"
+} >&5
+
+_ACEOF
+cat >>$CONFIG_STATUS <<_ACEOF
+_ACEOF
+
+cat >>$CONFIG_STATUS <<\_ACEOF
+
+# Handling of arguments.
+for ac_config_target in $ac_config_targets
+do
+  case $ac_config_target in
+    "HsHyperEstraier.buildinfo") CONFIG_FILES="$CONFIG_FILES HsHyperEstraier.buildinfo" ;;
+
+  *) { { echo "$as_me:$LINENO: error: invalid argument: $ac_config_target" >&5
+echo "$as_me: error: invalid argument: $ac_config_target" >&2;}
+   { (exit 1); exit 1; }; };;
+  esac
+done
+
+
+# If the user did not use the arguments to specify the items to instantiate,
+# then the envvar interface is used.  Set only those that are not.
+# We use the long form for the default assignment because of an extremely
+# bizarre bug on SunOS 4.1.3.
+if $ac_need_defaults; then
+  test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files
+fi
+
+# Have a temporary directory for convenience.  Make it in the build tree
+# simply because there is no reason against having it here, and in addition,
+# creating and moving files from /tmp can sometimes cause problems.
+# Hook for its removal unless debugging.
+# Note that there is a small window in which the directory will not be cleaned:
+# after its creation but before its name has been assigned to `$tmp'.
+$debug ||
+{
+  tmp=
+  trap 'exit_status=$?
+  { test -z "$tmp" || test ! -d "$tmp" || rm -fr "$tmp"; } && exit $exit_status
+' 0
+  trap '{ (exit 1); exit 1; }' 1 2 13 15
+}
+# Create a (secure) tmp directory for tmp files.
+
+{
+  tmp=`(umask 077 && mktemp -d "./confXXXXXX") 2>/dev/null` &&
+  test -n "$tmp" && test -d "$tmp"
+}  ||
+{
+  tmp=./conf$$-$RANDOM
+  (umask 077 && mkdir "$tmp")
+} ||
+{
+   echo "$me: cannot create a temporary directory in ." >&2
+   { (exit 1); exit 1; }
+}
+
+#
+# Set up the sed scripts for CONFIG_FILES section.
+#
+
+# No need to generate the scripts if there are no CONFIG_FILES.
+# This happens for instance when ./config.status config.h
+if test -n "$CONFIG_FILES"; then
+
+_ACEOF
+
+
+
+ac_delim='%!_!# '
+for ac_last_try in false false false false false :; do
+  cat >conf$$subs.sed <<_ACEOF
+SHELL!$SHELL$ac_delim
+PATH_SEPARATOR!$PATH_SEPARATOR$ac_delim
+PACKAGE_NAME!$PACKAGE_NAME$ac_delim
+PACKAGE_TARNAME!$PACKAGE_TARNAME$ac_delim
+PACKAGE_VERSION!$PACKAGE_VERSION$ac_delim
+PACKAGE_STRING!$PACKAGE_STRING$ac_delim
+PACKAGE_BUGREPORT!$PACKAGE_BUGREPORT$ac_delim
+exec_prefix!$exec_prefix$ac_delim
+prefix!$prefix$ac_delim
+program_transform_name!$program_transform_name$ac_delim
+bindir!$bindir$ac_delim
+sbindir!$sbindir$ac_delim
+libexecdir!$libexecdir$ac_delim
+datarootdir!$datarootdir$ac_delim
+datadir!$datadir$ac_delim
+sysconfdir!$sysconfdir$ac_delim
+sharedstatedir!$sharedstatedir$ac_delim
+localstatedir!$localstatedir$ac_delim
+includedir!$includedir$ac_delim
+oldincludedir!$oldincludedir$ac_delim
+docdir!$docdir$ac_delim
+infodir!$infodir$ac_delim
+htmldir!$htmldir$ac_delim
+dvidir!$dvidir$ac_delim
+pdfdir!$pdfdir$ac_delim
+psdir!$psdir$ac_delim
+libdir!$libdir$ac_delim
+localedir!$localedir$ac_delim
+mandir!$mandir$ac_delim
+DEFS!$DEFS$ac_delim
+ECHO_C!$ECHO_C$ac_delim
+ECHO_N!$ECHO_N$ac_delim
+ECHO_T!$ECHO_T$ac_delim
+LIBS!$LIBS$ac_delim
+build_alias!$build_alias$ac_delim
+host_alias!$host_alias$ac_delim
+target_alias!$target_alias$ac_delim
+PKG_CONFIG!$PKG_CONFIG$ac_delim
+HyperEstraier_CFLAGS!$HyperEstraier_CFLAGS$ac_delim
+HyperEstraier_LIBS!$HyperEstraier_LIBS$ac_delim
+LIBOBJS!$LIBOBJS$ac_delim
+LTLIBOBJS!$LTLIBOBJS$ac_delim
+_ACEOF
+
+  if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 42; then
+    break
+  elif $ac_last_try; then
+    { { echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5
+echo "$as_me: error: could not make $CONFIG_STATUS" >&2;}
+   { (exit 1); exit 1; }; }
+  else
+    ac_delim="$ac_delim!$ac_delim _$ac_delim!! "
+  fi
+done
+
+ac_eof=`sed -n '/^CEOF[0-9]*$/s/CEOF/0/p' conf$$subs.sed`
+if test -n "$ac_eof"; then
+  ac_eof=`echo "$ac_eof" | sort -nru | sed 1q`
+  ac_eof=`expr $ac_eof + 1`
+fi
+
+cat >>$CONFIG_STATUS <<_ACEOF
+cat >"\$tmp/subs-1.sed" <<\CEOF$ac_eof
+/@[a-zA-Z_][a-zA-Z_0-9]*@/!b end
+_ACEOF
+sed '
+s/[,\\&]/\\&/g; s/@/@|#_!!_#|/g
+s/^/s,@/; s/!/@,|#_!!_#|/
+:n
+t n
+s/'"$ac_delim"'$/,g/; t
+s/$/\\/; p
+N; s/^.*\n//; s/[,\\&]/\\&/g; s/@/@|#_!!_#|/g; b n
+' >>$CONFIG_STATUS <conf$$subs.sed
+rm -f conf$$subs.sed
+cat >>$CONFIG_STATUS <<_ACEOF
+:end
+s/|#_!!_#|//g
+CEOF$ac_eof
+_ACEOF
+
+
+# VPATH may cause trouble with some makes, so we remove $(srcdir),
+# ${srcdir} and @srcdir@ from VPATH if srcdir is ".", strip leading and
+# trailing colons and then remove the whole line if VPATH becomes empty
+# (actually we leave an empty line to preserve line numbers).
+if test "x$srcdir" = x.; then
+  ac_vpsub='/^[	 ]*VPATH[	 ]*=/{
+s/:*\$(srcdir):*/:/
+s/:*\${srcdir}:*/:/
+s/:*@srcdir@:*/:/
+s/^\([^=]*=[	 ]*\):*/\1/
+s/:*$//
+s/^[^=]*=[	 ]*$//
+}'
+fi
+
+cat >>$CONFIG_STATUS <<\_ACEOF
+fi # test -n "$CONFIG_FILES"
+
+
+for ac_tag in  :F $CONFIG_FILES
+do
+  case $ac_tag in
+  :[FHLC]) ac_mode=$ac_tag; continue;;
+  esac
+  case $ac_mode$ac_tag in
+  :[FHL]*:*);;
+  :L* | :C*:*) { { echo "$as_me:$LINENO: error: Invalid tag $ac_tag." >&5
+echo "$as_me: error: Invalid tag $ac_tag." >&2;}
+   { (exit 1); exit 1; }; };;
+  :[FH]-) ac_tag=-:-;;
+  :[FH]*) ac_tag=$ac_tag:$ac_tag.in;;
+  esac
+  ac_save_IFS=$IFS
+  IFS=:
+  set x $ac_tag
+  IFS=$ac_save_IFS
+  shift
+  ac_file=$1
+  shift
+
+  case $ac_mode in
+  :L) ac_source=$1;;
+  :[FH])
+    ac_file_inputs=
+    for ac_f
+    do
+      case $ac_f in
+      -) ac_f="$tmp/stdin";;
+      *) # Look for the file first in the build tree, then in the source tree
+	 # (if the path is not absolute).  The absolute path cannot be DOS-style,
+	 # because $ac_f cannot contain `:'.
+	 test -f "$ac_f" ||
+	   case $ac_f in
+	   [\\/$]*) false;;
+	   *) test -f "$srcdir/$ac_f" && ac_f="$srcdir/$ac_f";;
+	   esac ||
+	   { { echo "$as_me:$LINENO: error: cannot find input file: $ac_f" >&5
+echo "$as_me: error: cannot find input file: $ac_f" >&2;}
+   { (exit 1); exit 1; }; };;
+      esac
+      ac_file_inputs="$ac_file_inputs $ac_f"
+    done
+
+    # Let's still pretend it is `configure' which instantiates (i.e., don't
+    # use $as_me), people would be surprised to read:
+    #    /* config.h.  Generated by config.status.  */
+    configure_input="Generated from "`IFS=:
+	  echo $* | sed 's|^[^:]*/||;s|:[^:]*/|, |g'`" by configure."
+    if test x"$ac_file" != x-; then
+      configure_input="$ac_file.  $configure_input"
+      { echo "$as_me:$LINENO: creating $ac_file" >&5
+echo "$as_me: creating $ac_file" >&6;}
+    fi
+
+    case $ac_tag in
+    *:-:* | *:-) cat >"$tmp/stdin";;
+    esac
+    ;;
+  esac
+
+  ac_dir=`$as_dirname -- "$ac_file" ||
+$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+	 X"$ac_file" : 'X\(//\)[^/]' \| \
+	 X"$ac_file" : 'X\(//\)$' \| \
+	 X"$ac_file" : 'X\(/\)' \| . 2>/dev/null ||
+echo X"$ac_file" |
+    sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
+	    s//\1/
+	    q
+	  }
+	  /^X\(\/\/\)[^/].*/{
+	    s//\1/
+	    q
+	  }
+	  /^X\(\/\/\)$/{
+	    s//\1/
+	    q
+	  }
+	  /^X\(\/\).*/{
+	    s//\1/
+	    q
+	  }
+	  s/.*/./; q'`
+  { as_dir="$ac_dir"
+  case $as_dir in #(
+  -*) as_dir=./$as_dir;;
+  esac
+  test -d "$as_dir" || { $as_mkdir_p && mkdir -p "$as_dir"; } || {
+    as_dirs=
+    while :; do
+      case $as_dir in #(
+      *\'*) as_qdir=`echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #(
+      *) as_qdir=$as_dir;;
+      esac
+      as_dirs="'$as_qdir' $as_dirs"
+      as_dir=`$as_dirname -- "$as_dir" ||
+$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+	 X"$as_dir" : 'X\(//\)[^/]' \| \
+	 X"$as_dir" : 'X\(//\)$' \| \
+	 X"$as_dir" : 'X\(/\)' \| . 2>/dev/null ||
+echo X"$as_dir" |
+    sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
+	    s//\1/
+	    q
+	  }
+	  /^X\(\/\/\)[^/].*/{
+	    s//\1/
+	    q
+	  }
+	  /^X\(\/\/\)$/{
+	    s//\1/
+	    q
+	  }
+	  /^X\(\/\).*/{
+	    s//\1/
+	    q
+	  }
+	  s/.*/./; q'`
+      test -d "$as_dir" && break
+    done
+    test -z "$as_dirs" || eval "mkdir $as_dirs"
+  } || test -d "$as_dir" || { { echo "$as_me:$LINENO: error: cannot create directory $as_dir" >&5
+echo "$as_me: error: cannot create directory $as_dir" >&2;}
+   { (exit 1); exit 1; }; }; }
+  ac_builddir=.
+
+case "$ac_dir" in
+.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;;
+*)
+  ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'`
+  # A ".." for each directory in $ac_dir_suffix.
+  ac_top_builddir_sub=`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
+
+
+  case $ac_mode in
+  :F)
+  #
+  # CONFIG_FILE
+  #
+
+_ACEOF
+
+cat >>$CONFIG_STATUS <<\_ACEOF
+# If the template does not know about datarootdir, expand it.
+# FIXME: This hack should be removed a few years after 2.60.
+ac_datarootdir_hack=; ac_datarootdir_seen=
+
+case `sed -n '/datarootdir/ {
+  p
+  q
+}
+/@datadir@/p
+/@docdir@/p
+/@infodir@/p
+/@localedir@/p
+/@mandir@/p
+' $ac_file_inputs` in
+*datarootdir*) ac_datarootdir_seen=yes;;
+*@datadir@*|*@docdir@*|*@infodir@*|*@localedir@*|*@mandir@*)
+  { echo "$as_me:$LINENO: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&5
+echo "$as_me: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&2;}
+_ACEOF
+cat >>$CONFIG_STATUS <<_ACEOF
+  ac_datarootdir_hack='
+  s&@datadir@&$datadir&g
+  s&@docdir@&$docdir&g
+  s&@infodir@&$infodir&g
+  s&@localedir@&$localedir&g
+  s&@mandir@&$mandir&g
+    s&\\\${datarootdir}&$datarootdir&g' ;;
+esac
+_ACEOF
+
+# Neutralize VPATH when `$srcdir' = `.'.
+# Shell code in configure.ac might set extrasub.
+# FIXME: do we really want to maintain this feature?
+cat >>$CONFIG_STATUS <<_ACEOF
+  sed "$ac_vpsub
+$extrasub
+_ACEOF
+cat >>$CONFIG_STATUS <<\_ACEOF
+:t
+/@[a-zA-Z_][a-zA-Z_0-9]*@/!b
+s&@configure_input@&$configure_input&;t t
+s&@top_builddir@&$ac_top_builddir_sub&;t t
+s&@srcdir@&$ac_srcdir&;t t
+s&@abs_srcdir@&$ac_abs_srcdir&;t t
+s&@top_srcdir@&$ac_top_srcdir&;t t
+s&@abs_top_srcdir@&$ac_abs_top_srcdir&;t t
+s&@builddir@&$ac_builddir&;t t
+s&@abs_builddir@&$ac_abs_builddir&;t t
+s&@abs_top_builddir@&$ac_abs_top_builddir&;t t
+$ac_datarootdir_hack
+" $ac_file_inputs | sed -f "$tmp/subs-1.sed" >$tmp/out
+
+test -z "$ac_datarootdir_hack$ac_datarootdir_seen" &&
+  { ac_out=`sed -n '/\${datarootdir}/p' "$tmp/out"`; test -n "$ac_out"; } &&
+  { ac_out=`sed -n '/^[	 ]*datarootdir[	 ]*:*=/p' "$tmp/out"`; test -z "$ac_out"; } &&
+  { echo "$as_me:$LINENO: WARNING: $ac_file contains a reference to the variable \`datarootdir'
+which seems to be undefined.  Please make sure it is defined." >&5
+echo "$as_me: WARNING: $ac_file contains a reference to the variable \`datarootdir'
+which seems to be undefined.  Please make sure it is defined." >&2;}
+
+  rm -f "$tmp/stdin"
+  case $ac_file in
+  -) cat "$tmp/out"; rm -f "$tmp/out";;
+  *) rm -f "$ac_file"; mv "$tmp/out" $ac_file;;
+  esac
+ ;;
+
+
+
+  esac
+
+done # for ac_tag
+
+
+{ (exit 0); exit 0; }
+_ACEOF
+chmod +x $CONFIG_STATUS
+ac_clean_files=$ac_clean_files_save
+
+
+# configure is writing to config.log, and then calls config.status.
+# config.status does its own redirection, appending to config.log.
+# Unfortunately, on DOS this fails, as config.log is still kept open
+# by configure, so config.status won't be able to write to it; its
+# output is simply discarded.  So we exec the FD to /dev/null,
+# effectively closing config.log, so it can be properly (re)opened and
+# appended to by config.status.  When coming back to configure, we
+# need to make the FD available again.
+if test "$no_create" != yes; then
+  ac_cs_success=:
+  ac_config_status_args=
+  test "$silent" = yes &&
+    ac_config_status_args="$ac_config_status_args --quiet"
+  exec 5>/dev/null
+  $SHELL $CONFIG_STATUS $ac_config_status_args || ac_cs_success=false
+  exec 5>>config.log
+  # Use ||, not &&, to avoid exiting from the if with $? = 1, which
+  # would make configure fail if this is the last instruction.
+  $ac_cs_success || { (exit 1); exit 1; }
+fi
+
diff --git a/configure.ac b/configure.ac
new file mode 100644
--- /dev/null
+++ b/configure.ac
@@ -0,0 +1,14 @@
+AC_INIT([HsHyperEstraier], [], [phonohawk@ps.sakura.ne.jp])
+
+AC_CONFIG_SRCDIR([HsHyperEstraier.cabal])
+
+# checks for HyperEstraier
+PKG_CHECK_MODULES(
+        [HyperEstraier],
+        [hyperestraier >= 1.4.9 qdbm >= 1.8.74])
+
+# output
+AC_CONFIG_FILES([
+        HsHyperEstraier.buildinfo
+])
+AC_OUTPUT
diff --git a/examples/HelloWorld.hs b/examples/HelloWorld.hs
new file mode 100644
--- /dev/null
+++ b/examples/HelloWorld.hs
@@ -0,0 +1,46 @@
+{- -*- Coding: utf-8 -*- -}
+
+import qualified Data.ByteString as BS
+import           Data.Encoding
+import           Data.Encoding.UTF8
+import           Network.URI
+import           System.Directory
+import           Text.HyperEstraier
+
+
+main = do withDatabase "casket" (Writer [Create []]) $ \ db ->
+              do doc <- newDocument Nothing
+
+                 let Just uri = parseURI "http://example.net/hello"
+
+                 setURI doc (Just uri)
+                 addText doc "Hello, world!"
+
+                 putStrLn ">> Registering the following document:"
+                 dumpDraft doc >>= putStr
+                 putDocument db doc []
+
+                 docID <- getId doc
+                 putStrLn (">> Done. The document got ID " ++ show docID ++ ".")
+
+                 putStrLn ">> Trying to search for \"World OR dlroW\"..."
+                 cond <- newCondition
+                 setPhrase cond "World OR dlroW"
+                 result <- searchDatabase db cond
+                 putStrLn (">> Found: " ++ show result)
+                 
+                 BS.putStrLn (encode UTF8 ">> Trying to search for \"hêllö\"...")
+                 cond' <- newCondition
+                 setPhrase cond "hêllö"
+                 result' <- searchDatabase db cond
+                 putStrLn (">> Found: " ++ show result')
+
+                 if null result' then
+                     BS.putStrLn (encode UTF8 ">> Okay, hêllö doesn't match to hello.")
+                   else
+                     BS.putStrLn (encode UTF8 
+                                  (">> hêllö matches to hello... This seems to be indeed a desired behavior, " ++
+                                   "but this may cause problems on languages where diacritical marks are " ++
+                                   "significant to distinguish completely different words..."))
+          
+          removeDirectoryRecursive "casket"
diff --git a/examples/Makefile b/examples/Makefile
new file mode 100644
--- /dev/null
+++ b/examples/Makefile
@@ -0,0 +1,12 @@
+GHCFLAGS = -fglasgow-exts
+
+build:
+	ghc $(GHCFLAGS) --make HelloWorld
+
+run: build
+	./HelloWorld
+
+clean:
+	rm -f HelloWorld *.hi *.o
+
+.PHONY: build run clean
