diff --git a/INSTALL.txt b/INSTALL.txt
new file mode 100644
--- /dev/null
+++ b/INSTALL.txt
@@ -0,0 +1,77 @@
+Build and installation instructions
+-----------------------------------
+
+Please don't think of these as canonical build instructions yet, as
+this work is rather early along.  Let me tell you what's working for
+*me*, and hopefully this information will be enough to get you going.
+
+
+Prerequisites
+-------------
+
+I'm using GHC 6.8.2 for development.  6.8.1 will probably work.  I'll
+be happy to accept patches to get things working with 6.6.x, provided
+they don't pervert the code much :-)
+
+(My development environment is Fedora 8 x86_64, in case you're
+curious.)
+
+Firstly, you'll need the SVN version of LLVM:
+
+  svn co http://llvm.org/svn/llvm-project/llvm/trunk llvm-trunk
+
+Build this and install it somewhere.  Here's what I do:
+
+  cd llvn-trunk
+  ./configure --prefix=$HOME
+  make
+  make install
+
+If you're building the Haskell bindings from the darcs repo (strongly
+recommended from now), you'll also need a copy of GNU autoconf.
+
+
+Using GNU Make
+--------------
+
+There's a GNU Make Makefile in the top-level directory that builds the
+LLVM bindings the way I want them built.  In principle, you ought to
+be able to simply run something like this:
+
+  make llvm_prefix=/my/llvm/path prefix=/my/preferred/path
+
+These both default to $HOME.
+
+
+Building by hand
+----------------
+
+If you want to avoid GNU Make, here's a recipe you can follow.  Run
+these in the root of your darcs repo or unpacked source tarball.
+
+If you're building from darcs, run this once (this is why you need
+autoconf installed):
+
+  autoreconf
+
+Configure the package.  I'm assuming that LLVM is installed in $HOME,
+and that you want the bindings installed in $HOME, too.
+
+  runhaskell Setup configure --prefix=$HOME \
+    --configure-option --with-llvm-prefix=$HOME --user
+
+Build.
+
+  runhaskell Setup build
+
+Install.
+
+  runhaskell Setup install
+
+
+Building examples
+-----------------
+
+In the examples directory are a few example programs.  There's a GNU
+Make Makefile in there, so running "make" in that directory will build
+the examples, as will "make examples" in the top-level directory.
diff --git a/LICENSE b/LICENSE
new file mode 100644
--- /dev/null
+++ b/LICENSE
@@ -0,0 +1,67 @@
+======================================================================
+Haskell LLVM Bindings Release License
+======================================================================
+University of Illinois/NCSA
+Open Source License
+
+Copyright (c) 2007 Bryan O'Sullivan
+All rights reserved.
+
+Developed by:
+
+    Bryan O'Sullivan <bos@serpentine.com>
+    http://www.serpentine.com/blog/
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal with the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+    * Redistributions of source code must retain the above copyright
+      notice, this list of conditions and the following disclaimers.
+
+    * Redistributions in binary form must reproduce the above
+      copyright notice, this list of conditions and the following
+      disclaimers in the documentation and/or other materials provided
+      with the distribution.
+
+    * Neither the names of Bryan O'Sullivan, University of Illinois at
+      Urbana-Champaign, nor the names of its contributors may be used
+      to endorse or promote products derived from this Software
+      without specific prior written permission.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+IN NO EVENT SHALL THE CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR
+ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
+CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS WITH THE SOFTWARE.
+
+======================================================================
+Copyrights and Licenses for Third Party Software Distributed with
+Haskell LLVM Bindings:
+======================================================================
+
+The Haskell LLVM Bindings software may contain code written by third
+parties.  Any such software will have its own individual license file
+in the directory in which it appears.  This file will describe the
+copyrights, license, and restrictions which apply to that code.
+
+The disclaimer of warranty in the University of Illinois Open Source
+License applies to all code in the Haskell LLVM Bindings Distribution,
+and nothing in any of the other licenses gives permission to use the
+name of Bryan O'Sullivan or the University of Illinois to endorse or
+promote products derived from this Software.
+
+The following pieces of software have additional or alternate
+copyrights, licenses, and/or restrictions:
+
+Program             Directory
+-------             ---------
+configure           .
+
+
diff --git a/LLVM/Core.hs b/LLVM/Core.hs
new file mode 100644
--- /dev/null
+++ b/LLVM/Core.hs
@@ -0,0 +1,117 @@
+{-# LANGUAGE FunctionalDependencies, MultiParamTypeClasses #-}
+
+module LLVM.Core
+    (
+    -- * Modules
+      createModule
+
+    -- * Module providers
+    , createModuleProviderForExistingModule
+
+    -- * Types
+    , addTypeName
+    , deleteTypeName
+
+    -- * Values
+    , addGlobal
+    , setInitializer
+
+    -- ** Operations on functions
+    , addFunction
+    , deleteFunction
+    , getNamedFunction
+
+    -- * Basic blocks
+    , appendBasicBlock
+    , insertBasicBlock
+    , deleteBasicBlock
+    ) where
+
+import Control.Applicative ((<$>))
+import Foreign.C.String (withCString)
+import Foreign.Marshal.Utils (toBool)
+import Foreign.ForeignPtr (FinalizerPtr, newForeignPtr)
+import Foreign.Ptr (Ptr, nullPtr)
+import Prelude hiding (mod)
+
+import qualified LLVM.Core.FFI as FFI
+import qualified LLVM.Core.Builder as B
+import qualified LLVM.Core.Type as T
+import qualified LLVM.Core.Value as V
+
+
+createModule :: String -> IO T.Module
+createModule name =
+    withCString name $ \namePtr -> do
+      ptr <- FFI.moduleCreateWithName namePtr
+      final <- h2c_module FFI.disposeModule
+      T.Module <$> newForeignPtr final ptr
+
+foreign import ccall "wrapper" h2c_module
+    :: (FFI.ModuleRef -> IO ()) -> IO (FinalizerPtr a)
+
+
+createModuleProviderForExistingModule :: T.Module -> IO T.ModuleProvider
+createModuleProviderForExistingModule mod =
+    T.withModule mod $ \modPtr -> do
+        ptr <- FFI.createModuleProviderForExistingModule modPtr
+        final <- h2c_moduleProvider FFI.disposeModuleProvider
+        T.ModuleProvider <$> newForeignPtr final ptr
+
+foreign import ccall "wrapper" h2c_moduleProvider
+    :: (FFI.ModuleProviderRef -> IO ()) -> IO (FinalizerPtr a)
+
+
+addTypeName :: (T.Type t) => T.Module -> t -> String -> IO Bool
+addTypeName mod typ name =
+    T.withModule mod $ \modPtr ->
+      withCString name $ \namePtr ->
+        toBool <$> FFI.addTypeName modPtr namePtr (T.typeRef typ)
+                 
+deleteTypeName :: T.Module -> String -> IO ()
+deleteTypeName mod name =
+    T.withModule mod $ \modPtr ->
+      withCString name $ FFI.deleteTypeName modPtr
+
+addGlobal :: (T.Type t) => T.Module -> t -> String -> IO (V.GlobalVar t)
+addGlobal mod typ name =
+    T.withModule mod $ \modPtr ->
+      withCString name $ \namePtr ->
+        V.GlobalVar . V.mkAnyValue <$> FFI.addGlobal modPtr (T.typeRef typ) namePtr
+
+setInitializer :: V.ConstValue t => V.GlobalVar a -> t -> IO ()
+setInitializer global cnst =
+    FFI.setInitializer (V.valueRef global) (V.valueRef cnst)
+
+addFunction :: (T.Params p) => T.Module -> String -> T.Function r p
+            -> IO (V.Function r p)
+addFunction mod name typ =
+    T.withModule mod $ \modPtr ->
+      withCString name $ \namePtr ->
+        V.Function . V.mkAnyValue <$> FFI.addFunction modPtr namePtr (T.typeRef typ)
+
+deleteFunction :: V.Function r p -> IO ()
+deleteFunction = FFI.deleteFunction . V.valueRef
+
+maybePtr :: (Ptr a -> b) -> Ptr a -> Maybe b
+maybePtr f ptr | ptr /= nullPtr = Just (f ptr)
+               | otherwise = Nothing
+
+getNamedFunction :: T.Module -> String -> IO (Maybe (V.Function r p))
+getNamedFunction mod name =
+    T.withModule mod $ \modPtr ->
+      withCString name $ \namePtr ->
+        maybePtr (V.Function . V.mkAnyValue) <$> FFI.getNamedFunction modPtr namePtr
+
+appendBasicBlock :: V.Function r p -> String -> IO B.BasicBlock
+appendBasicBlock func name =
+    withCString name $ \namePtr ->
+      B.BasicBlock . V.mkAnyValue <$> FFI.appendBasicBlock (V.valueRef func) namePtr
+
+insertBasicBlock :: B.BasicBlock -> String -> IO B.BasicBlock
+insertBasicBlock before name =
+    withCString name $ \namePtr ->
+      B.BasicBlock . V.mkAnyValue <$> FFI.insertBasicBlock (V.valueRef before) namePtr
+
+deleteBasicBlock :: B.BasicBlock -> IO ()
+deleteBasicBlock = FFI.deleteBasicBlock . V.valueRef
diff --git a/LLVM/Core/Builder.hs b/LLVM/Core/Builder.hs
new file mode 100644
--- /dev/null
+++ b/LLVM/Core/Builder.hs
@@ -0,0 +1,498 @@
+{-# LANGUAGE
+    DeriveDataTypeable
+  , FlexibleContexts
+  , FunctionalDependencies
+  , MultiParamTypeClasses
+  , UndecidableInstances
+  #-}
+
+module LLVM.Core.Builder
+    (
+      Instruction(..)
+    , BasicBlock(..)
+
+    -- * Instruction building
+    , createBuilder
+
+    , positionBefore
+    , positionAtEnd
+
+    -- * Terminators
+    , retVoid
+    , ret
+    , br
+    , condBr
+    , switch
+    , invoke
+    , unwind
+    , unreachable
+
+    -- * Arithmetic
+    , add
+    , sub
+    , mul
+    , uDiv
+    , sDiv
+    , fDiv
+    , uRem
+    , sRem
+    , fRem
+    , shl
+    , lShr
+    , aShr
+    , and
+    , or
+    , xor
+    , neg
+    , not
+
+    -- * Memory
+    , malloc
+    , arrayMalloc
+    , alloca
+    , arrayAlloca
+    , free
+    , load
+    , store
+    , getElementPtr
+
+    -- * Casts
+    , trunc
+    , zExt
+    , sExt
+    , fpToUI
+    , fpToSI
+    , uiToFP
+    , siToFP
+    , fpTrunc
+    , fpExt
+    , ptrToInt
+    , intToPtr
+    , bitCast
+
+    -- * Comparisons
+    , icmp
+    , fcmp
+
+    -- * Miscellaneous instructions
+    , call
+    , call_
+    , extractElement
+    , insertElement
+    , phi
+    , select
+    , vaArg
+    , shuffleVector
+    ) where
+
+import Control.Applicative ((<$>))
+import Control.Arrow ((***))
+import Control.Monad (forM_)
+import Data.Typeable (Typeable)
+import Foreign.C.String (CString, withCString)
+import Foreign.ForeignPtr (FinalizerPtr, ForeignPtr, newForeignPtr,
+                           withForeignPtr)
+import Foreign.Marshal.Array (withArray, withArrayLen)
+import Prelude hiding (and, not, or)
+
+import qualified LLVM.Core.FFI as FFI
+import qualified LLVM.Core.Instruction as I
+import qualified LLVM.Core.Type as T
+import qualified LLVM.Core.Value as V
+import LLVM.Core.Type ((:->)(..))
+import LLVM.Core.Value (Instruction(..))
+
+
+newtype Builder = Builder {
+      fromBuilder :: ForeignPtr FFI.Builder
+    }
+    deriving (Typeable)
+
+newtype BasicBlock = BasicBlock V.AnyValue
+    deriving (V.DynamicValue, Typeable, V.Value)
+
+withBuilder :: Builder -> (FFI.BuilderRef -> IO a) -> IO a
+withBuilder = withForeignPtr . fromBuilder
+
+createBuilder :: IO Builder
+createBuilder = do
+  final <- h2c_builder FFI.disposeBuilder
+  ptr <- FFI.createBuilder
+  Builder <$> newForeignPtr final ptr
+
+foreign import ccall "wrapper" h2c_builder
+    :: (FFI.BuilderRef -> IO ()) -> IO (FinalizerPtr a)
+
+positionBefore :: Builder -> Instruction a -> IO ()
+positionBefore bld insn =
+    withBuilder bld $ \bldPtr ->
+      FFI.positionBefore bldPtr (V.valueRef insn)
+
+positionAtEnd :: Builder -> BasicBlock -> IO ()
+positionAtEnd bld bblk =
+    withBuilder bld $ \bldPtr ->
+      FFI.positionAtEnd bldPtr (V.valueRef bblk)
+
+instruction :: IO FFI.ValueRef -> IO (Instruction t)
+instruction = fmap (Instruction . V.mkAnyValue)
+
+unary :: (V.Value a)
+         => (FFI.BuilderRef -> FFI.ValueRef -> CString -> IO FFI.ValueRef)
+      -> Builder -> String -> a -> IO (Instruction t)
+unary ffi bld name a =
+    withBuilder bld $ \bldPtr ->
+      withCString name $ \namePtr ->
+        Instruction . V.mkAnyValue <$>
+        ffi bldPtr (V.valueRef a) namePtr
+
+binary :: (V.Value a, V.Value b)
+          => (FFI.BuilderRef -> FFI.ValueRef -> FFI.ValueRef -> CString
+              -> IO FFI.ValueRef)
+          -> Builder -> String -> a -> b -> IO (Instruction t)
+binary ffi bld name a b =
+    withBuilder bld $ \bldPtr ->
+      withCString name $ instruction . ffi bldPtr (V.valueRef a) (V.valueRef b) 
+
+add :: (T.Arithmetic t,
+        V.Value a, V.TypedValue a t,
+        V.Value b, V.TypedValue b t)
+       => Builder -> String -> a -> b -> IO (Instruction t)
+add = binary FFI.buildAdd
+
+sub :: (T.Arithmetic t, V.TypedValue a t, V.TypedValue b t)
+       => Builder -> String -> a -> b -> IO (Instruction t)
+sub = binary FFI.buildSub
+
+mul :: (T.Arithmetic t, V.TypedValue a t, V.TypedValue b t)
+       => Builder -> String -> a -> b -> IO (Instruction t)
+mul = binary FFI.buildSub
+
+uDiv :: (T.Integer t, V.TypedValue a t, V.TypedValue b t)
+       => Builder -> String -> a -> b -> IO (Instruction t)
+uDiv = binary FFI.buildUDiv
+
+sDiv :: (T.Integer t, V.TypedValue a t, V.TypedValue b t)
+       => Builder -> String -> a -> b -> IO (Instruction t)
+sDiv = binary FFI.buildSDiv
+
+fDiv :: (T.Real t, V.TypedValue a t, V.TypedValue b t)
+       => Builder -> String -> a -> b -> IO (Instruction t)
+fDiv = binary FFI.buildFDiv
+
+uRem :: (T.Integer t, V.TypedValue a t, V.TypedValue b t)
+       => Builder -> String -> a -> b -> IO (Instruction t)
+uRem = binary FFI.buildURem
+
+sRem :: (T.Integer t, V.TypedValue a t, V.TypedValue b t)
+       => Builder -> String -> a -> b -> IO (Instruction t)
+sRem = binary FFI.buildSRem
+
+fRem :: (T.Real t, V.TypedValue a t, V.TypedValue b t)
+       => Builder -> String -> a -> b -> IO (Instruction t)
+fRem = binary FFI.buildFRem
+
+shl :: (T.Integer t, V.TypedValue a t, V.TypedValue b t)
+       => Builder -> String -> a -> b -> IO (Instruction t)
+shl = binary FFI.buildShl
+
+lShr :: (T.Integer t, V.TypedValue a t, V.TypedValue b t)
+        => Builder -> String -> a -> b -> IO (Instruction t)
+lShr = binary FFI.buildLShr
+
+aShr :: (T.Integer t, V.TypedValue a t, V.TypedValue b t)
+        => Builder -> String -> a -> b -> IO (Instruction t)
+aShr = binary FFI.buildAShr
+
+and :: (T.Integer t, V.TypedValue a t, V.TypedValue b t)
+       => Builder -> String -> a -> b -> IO (Instruction t)
+and = binary FFI.buildAnd
+
+or :: (T.Integer t, V.TypedValue a t, V.TypedValue b t)
+      => Builder -> String -> a -> b -> IO (Instruction t)
+or = binary FFI.buildOr
+
+xor :: (T.Integer t, V.TypedValue a t, V.TypedValue b t)
+       => Builder -> String -> a -> b -> IO (Instruction t)
+xor = binary FFI.buildAnd
+
+neg :: (T.Arithmetic t, V.TypedValue v t)
+       => Builder -> String -> v -> IO (Instruction t)
+neg = unary FFI.buildNeg
+
+not :: (T.Arithmetic t, V.TypedValue v t)
+       => Builder -> String -> v -> IO (Instruction t)
+not = unary FFI.buildNot
+
+typed :: (V.Value v, T.Type s, T.Type t)
+         => (FFI.BuilderRef -> FFI.ValueRef -> FFI.TypeRef -> CString
+             -> IO FFI.ValueRef)
+         -> Builder -> String -> v -> s -> IO (Instruction t)
+typed ffi bld name a t =
+    withBuilder bld $ \bldPtr ->
+      withCString name $ \namePtr ->
+        Instruction . V.mkAnyValue <$> ffi bldPtr (V.valueRef a) (T.typeRef t) namePtr
+
+trunc :: (T.Integer s, V.TypedValue v s, T.Integer t)
+         => Builder -> String -> v -> s -> IO (Instruction t)
+trunc = typed FFI.buildTrunc
+
+zExt :: (T.Integer s, V.TypedValue v s, T.Integer t)
+         => Builder -> String -> v -> s -> IO (Instruction t)
+zExt = typed FFI.buildZExt
+
+sExt :: (T.Integer s, V.TypedValue v s, T.Integer t)
+         => Builder -> String -> v -> s -> IO (Instruction t)
+sExt = typed FFI.buildSExt
+
+fpToUI :: (T.Integer s, V.TypedValue v s, T.Real t)
+         => Builder -> String -> v -> s -> IO (Instruction t)
+fpToUI = typed FFI.buildFPToUI
+
+fpToSI :: (T.Integer s, V.TypedValue v s, T.Real t)
+         => Builder -> String -> v -> s -> IO (Instruction t)
+fpToSI = typed FFI.buildFPToSI
+
+uiToFP :: (T.Real s, V.TypedValue v s, T.Integer t)
+         => Builder -> String -> v -> s -> IO (Instruction t)
+uiToFP = typed FFI.buildUIToFP
+
+siToFP :: (T.Real s, V.TypedValue v s, T.Integer t)
+         => Builder -> String -> v -> s -> IO (Instruction t)
+siToFP = typed FFI.buildSIToFP
+
+fpTrunc :: (T.Real s, V.TypedValue v s, T.Real t)
+         => Builder -> String -> v -> s -> IO (Instruction t)
+fpTrunc = typed FFI.buildFPTrunc
+
+fpExt :: (T.Real s, V.TypedValue v s, T.Real t)
+         => Builder -> String -> v -> s -> IO (Instruction t)
+fpExt = typed FFI.buildFPExt
+
+ptrToInt :: (V.TypedValue (T.Pointer s) s, T.Integer t)
+            => Builder -> String -> T.Pointer s -> s -> IO (Instruction t)
+ptrToInt = typed FFI.buildPtrToInt
+
+intToPtr :: (T.Integer s, V.TypedValue v s, T.Type t)
+            => Builder -> String -> v -> t -> IO (Instruction (T.Pointer t))
+intToPtr = typed FFI.buildIntToPtr
+
+bitCast :: (V.TypedValue v s, T.Type t)
+           => Builder -> String -> v -> s -> IO (Instruction t)
+bitCast = typed FFI.buildBitCast
+
+fcmp :: (T.Real t, V.TypedValue a t, V.TypedValue b t)
+        => Builder -> String -> I.RealPredicate -> a -> b
+        -> IO (Instruction T.Int1)
+fcmp bld name p = binary (flip FFI.buildFCmp (I.fromRP p)) bld name
+
+icmp :: (T.Integer t, V.TypedValue a t, V.TypedValue b t)
+        => Builder -> String -> I.IntPredicate -> a -> b
+        -> IO (Instruction T.Int1)
+icmp bld name p = binary (flip FFI.buildICmp (I.fromIP p)) bld name
+
+retVoid :: Builder -> IO (Instruction T.Void)
+retVoid bld = withBuilder bld $ instruction . FFI.buildRetVoid
+
+ret :: (T.FirstClass t, V.TypedValue v t) => Builder -> v -> IO (Instruction t)
+ret bld v =
+    withBuilder bld $ \bldPtr ->
+      instruction $ FFI.buildRet bldPtr (V.valueRef v)
+
+br :: Builder -> BasicBlock -> IO (Instruction T.Void)
+br bld bblk =
+    withBuilder bld $ \bldPtr ->
+      instruction $ FFI.buildBr bldPtr (V.valueRef bblk)
+
+condBr :: (V.TypedValue v T.Int1)
+          => Builder -> v -> BasicBlock -> BasicBlock
+          -> IO (Instruction T.Void)
+condBr bld bit true false =
+    withBuilder bld $ \bldPtr ->
+      instruction $ FFI.buildCondBr bldPtr (V.valueRef bit)
+                      (V.valueRef true) (V.valueRef false)
+
+unwrap :: (V.Value a, V.Value b) => (a, b) -> (FFI.ValueRef, FFI.ValueRef)
+unwrap = V.valueRef *** V.valueRef
+
+switch :: (T.Integer t, V.TypedValue v t)
+          => Builder -> v -> BasicBlock -> [(v, BasicBlock)]
+          -> IO (Instruction T.Void)
+switch bld val noMatch cases =
+    withBuilder bld $ \bldPtr -> do
+        inst <- FFI.buildSwitch bldPtr (V.valueRef val)
+                        (V.valueRef noMatch) (fromIntegral $ length cases)
+        forM_ (map unwrap cases) $ uncurry (FFI.addCase inst)
+        instruction $ return inst
+
+invoke :: (T.DynamicType r, T.Params p, Params p v, T.FirstClass r)
+          => Builder -> String -> V.Function r p -> v
+          -> BasicBlock -> BasicBlock -> IO (Instruction r)
+invoke bld name func args thenBlk catchBlk =
+  withBuilder bld $ \bldPtr ->
+    withCString name $ \namePtr ->
+      withArrayLen (argList func args) $ \argLen argPtr ->
+        instruction $ FFI.buildInvoke bldPtr (V.valueRef func) argPtr
+                        (fromIntegral argLen) (V.valueRef thenBlk)
+                        (V.valueRef catchBlk) namePtr
+
+unwind :: Builder -> IO (Instruction T.Void)
+unwind bld = withBuilder bld $ instruction . FFI.buildUnwind
+
+unreachable :: Builder -> IO (Instruction T.Void)
+unreachable bld = withBuilder bld $ instruction . FFI.buildUnreachable
+
+allocWith :: (T.Type t)
+             => (FFI.BuilderRef -> FFI.TypeRef -> CString -> IO FFI.ValueRef)
+             -> Builder -> String -> t -> IO FFI.ValueRef
+allocWith ffi bld name typ =
+    withBuilder bld $ \bldPtr ->
+      withCString name $ ffi bldPtr (T.typeRef typ)
+
+arrayAllocWith :: (T.Type t, T.Integer n, V.TypedValue v n)
+               => (FFI.BuilderRef -> FFI.TypeRef -> FFI.ValueRef -> CString
+                   -> IO FFI.ValueRef)
+               -> Builder -> String -> t -> v -> IO FFI.ValueRef
+arrayAllocWith ffi bld name typ count =
+    withBuilder bld $ \bldPtr ->
+      withCString name $ ffi bldPtr (T.typeRef typ) (V.valueRef count)
+
+malloc :: (T.Type t) => Builder -> String -> t -> IO (Instruction (T.Array t))
+malloc bld name typ = instruction $ allocWith FFI.buildMalloc bld name typ
+
+arrayMalloc :: (T.Type t, V.TypedValue v T.Int32)
+               => Builder -> String -> t -> v -> IO (Instruction (T.Array t))
+arrayMalloc bld name typ count =
+    instruction $ arrayAllocWith FFI.buildArrayMalloc bld name typ count
+
+alloca :: (T.Type t)
+          => Builder -> String -> t -> IO (Instruction (T.Pointer t))
+alloca bld name typ = instruction $ allocWith FFI.buildAlloca bld name typ
+
+arrayAlloca :: (T.Type t, V.TypedValue v T.Int32)
+               => Builder -> String -> t -> v -> IO (Instruction (T.Pointer t))
+arrayAlloca bld name typ count =
+    instruction $ arrayAllocWith FFI.buildArrayAlloca bld name typ count
+
+free :: (V.TypedValue v (T.Pointer t))
+        => Builder -> v -> IO (Instruction T.Void)
+free bld ary =
+    withBuilder bld $ \bldPtr ->
+      instruction $ FFI.buildFree bldPtr (V.valueRef ary)
+
+load :: (V.TypedValue v (T.Pointer t))
+        => Builder -> String -> v -> IO (Instruction t)
+load bld name ptr =
+    withBuilder bld $ \bldPtr ->
+        instruction $ withCString name $ FFI.buildLoad bldPtr (V.valueRef ptr)
+
+store :: (V.TypedValue v t, V.TypedValue p (T.Pointer t))
+        => Builder -> v -> p -> IO (Instruction T.Void)
+store bld val ptr =
+    withBuilder bld $ \bldPtr ->
+      instruction $ FFI.buildStore bldPtr (V.valueRef val) (V.valueRef ptr) 
+
+getElementPtr :: (T.Sequence s e, V.TypedValue p s,
+                  T.Integer t, V.TypedValue i t)
+                 => Builder -> String -> p -> [i]
+                 -> IO (Instruction (T.Pointer e))
+getElementPtr bld name ptr idxs =
+    withBuilder bld $ \bldPtr ->
+        withCString name $ \namePtr ->
+          withArrayLen (map V.valueRef idxs) $ \idxLen idxPtr ->
+            instruction $ FFI.buildGEP bldPtr (V.valueRef ptr) idxPtr
+                            (fromIntegral idxLen) namePtr
+
+argList :: (Params p a, T.Params p, V.TypedValue v (T.Function r p))
+           => v -> a -> [FFI.ValueRef]
+argList func = map V.valueRef . toAnyList (T.params (V.typeOf func))
+
+callRef :: (T.DynamicType r, T.Params p, Params p v)
+           => Builder -> String -> V.Function r p -> v -> IO FFI.ValueRef
+callRef bld name func args = do
+    withBuilder bld $ \bldPtr ->
+      withArrayLen (argList func args) $ \argLen argPtr ->
+        withCString name $ \namePtr ->
+          FFI.buildCall bldPtr (V.valueRef func) argPtr
+                 (fromIntegral argLen) namePtr
+
+class Params t v | t -> v where
+    toAnyList :: t -> v -> [V.AnyValue]
+
+listValue :: (V.TypedValue v t) => t -> v -> [V.AnyValue]
+listValue _ v = [V.anyValue v]
+
+instance (V.TypedValue v a, Params b c) => Params (a :-> b) (v :-> c) where
+    toAnyList t (a :-> b) = V.anyValue a : toAnyList (T.cdr t) b
+
+instance (V.TypedValue v T.Int32) => Params T.Int32 v where
+    toAnyList = listValue
+
+instance (T.Type t, V.TypedValue v (T.Pointer t)) => Params (T.Pointer t) v where
+    toAnyList = listValue
+
+call :: (T.DynamicType r, T.Params p, Params p v, T.FirstClass r)
+        => Builder -> String -> V.Function r p -> v
+     -> IO (Instruction r)
+call bld name func args = instruction $ callRef bld name func args
+
+call_ :: (T.DynamicType r, T.Params p, Params p v)
+         => Builder -> String -> V.Function r p -> v -> IO ()
+call_ bld name func args = callRef bld name func args >> return ()
+
+extractElement :: (V.TypedValue v (T.Vector t),
+                   V.TypedValue i T.Int32)
+                  => Builder -> String -> v -> i -> IO (Instruction t)
+extractElement bld name vec idx =
+    withBuilder bld $ \bldPtr ->
+        withCString name $ \namePtr ->
+            instruction $ FFI.buildExtractElement bldPtr (V.valueRef vec)
+                            (V.valueRef idx) namePtr
+
+insertElement :: (V.TypedValue v (T.Vector t),
+                  V.TypedValue e t,
+                  V.TypedValue i T.Int32)
+                  => Builder -> String -> v -> e -> i -> IO (Instruction t)
+insertElement bld name vec elt idx =
+    withBuilder bld $ \bldPtr ->
+        withCString name $ \namePtr ->
+            instruction $ FFI.buildInsertElement bldPtr (V.valueRef vec)
+                            (V.valueRef elt) (V.valueRef idx) namePtr
+
+phi :: (V.TypedValue v t)
+       => Builder -> String -> t -> [(v, BasicBlock)] -> IO (Instruction t)
+phi bld name typ incoming =
+    withBuilder bld $ \bldPtr ->
+      withCString name $ \namePtr -> do
+        inst <- FFI.buildPhi bldPtr (T.typeRef typ) namePtr
+        let (vals, bblks) = unzip . map unwrap $ incoming
+        withArrayLen vals $ \count valPtr ->
+          withArray bblks $ \bblkPtr ->
+            FFI.addIncoming inst valPtr bblkPtr (fromIntegral count)
+        instruction $ return inst
+
+select :: (V.TypedValue p T.Int1, V.TypedValue a t, V.TypedValue b t)
+          => Builder -> String -> p -> a -> b -> IO (Instruction t)
+select bld name bit true false =
+    withBuilder bld $ \bldPtr ->
+      withCString name $ \namePtr -> do
+        instruction $ FFI.buildSelect bldPtr (V.valueRef bit)
+                        (V.valueRef true) (V.valueRef false) namePtr
+
+vaArg :: (V.Value v, T.Type t)
+         => Builder -> String -> v -> t -> IO (Instruction t)
+vaArg bld name valist typ =
+    withBuilder bld $ \bldPtr ->
+      withCString name $ \namePtr ->
+        instruction $ FFI.buildVAArg bldPtr (V.valueRef valist)
+                        (T.typeRef typ) namePtr
+
+shuffleVector :: (V.TypedValue a (T.Vector t),
+                  V.TypedValue b (T.Vector t),
+                  V.TypedValue m (T.Vector T.Int32))
+                 => Builder -> String -> a -> b -> m
+                 -> IO (Instruction (T.Vector t))
+shuffleVector bld name a b mask =
+    withBuilder bld $ \bldPtr ->
+      withCString name $ \namePtr ->
+        instruction $ FFI.buildShuffleVector bldPtr (V.valueRef a)
+                        (V.valueRef b) (V.valueRef mask) namePtr
diff --git a/LLVM/Core/Constant.hs b/LLVM/Core/Constant.hs
new file mode 100644
--- /dev/null
+++ b/LLVM/Core/Constant.hs
@@ -0,0 +1,338 @@
+{-# LANGUAGE
+    DeriveDataTypeable
+  , FlexibleContexts
+  , FunctionalDependencies
+  , MultiParamTypeClasses
+  #-}
+
+module LLVM.Core.Constant
+    (
+    -- * Constant expressions
+      ConstExpr(..)
+
+    -- ** Arithmetic
+    , neg
+    , not
+    , add
+    , sub
+    , mul
+    , udiv
+    , sdiv
+    , fdiv
+    , urem
+    , srem
+    , frem
+    , and
+    , or
+    , xor
+    , shl
+    , lshr
+    , ashr
+
+    -- ** Memory
+    , gep
+
+    -- ** Conversions
+    , trunc
+    , sExt
+    , zExt
+    , fpTrunc
+    , fpExt
+    , uiToFP
+    , siToFP
+    , fpToUI
+    , fpToSI
+    , ptrToInt
+    , intToPtr
+    , bitCast
+
+    -- ** Comparisons
+    , icmp
+    , fcmp
+
+    -- ** Miscellaneous operations
+    , select
+    , extractElement
+    , insertElement
+    , shuffleVector
+
+    -- * Constant values
+    , Const(..)
+
+    -- ** Scalar constants
+    , constInt
+    , constWord
+    , constReal
+
+    -- ** Composite constants
+    , constString
+    , constStringNul
+    ) where
+
+import Data.Int (Int8, Int16, Int32, Int64)
+import Data.Typeable (Typeable)
+import Data.Word (Word8, Word16, Word32, Word64)
+import Foreign.C.String (withCStringLen)
+import Foreign.Marshal.Utils (fromBool)
+import Prelude hiding (and, const, not, or)
+import qualified Prelude as Prelude
+import System.IO.Unsafe (unsafePerformIO)
+
+import qualified LLVM.Core.FFI as FFI
+import qualified LLVM.Core.Instruction as I
+import qualified LLVM.Core.Type as T
+import qualified LLVM.Core.Value as V
+
+
+newtype ConstExpr t = ConstExpr V.AnyValue
+    deriving (V.ConstValue, V.DynamicValue, Typeable, V.Value)
+
+unary :: (V.ConstValue v) =>
+         (FFI.ValueRef -> FFI.ValueRef) -> v -> ConstExpr t
+unary ffi = ConstExpr . V.mkAnyValue . ffi . V.valueRef
+
+neg :: (V.ConstValue v, V.Arithmetic v, T.Arithmetic t) => v -> ConstExpr t
+neg = unary FFI.constNeg
+
+not :: (V.ConstValue v, T.Integer t, V.TypedValue v t) => v -> ConstExpr t
+not = unary FFI.constNot
+
+binary :: (V.ConstValue a, V.ConstValue b)
+          => (FFI.ValueRef -> FFI.ValueRef -> FFI.ValueRef) -> a -> b
+          -> ConstExpr t
+binary ffi a b = ConstExpr . V.mkAnyValue $ ffi (V.valueRef a) (V.valueRef b)
+
+add :: (T.Arithmetic t, V.ConstValue a, V.TypedValue a t,
+        V.ConstValue b, V.TypedValue b t)
+       => a -> b -> ConstExpr t
+add = binary FFI.constAdd
+
+sub :: (T.Arithmetic t, V.ConstValue a, V.TypedValue a t,
+        V.ConstValue b, V.TypedValue b t)
+       => a -> b -> ConstExpr t
+sub = binary FFI.constSub
+
+mul :: (T.Arithmetic t, V.ConstValue a, V.TypedValue a t,
+        V.ConstValue b, V.TypedValue b t)
+       => a -> b -> ConstExpr t
+mul = binary FFI.constMul
+
+udiv :: (T.Integer t, V.ConstValue a, V.TypedValue a t,
+         V.ConstValue b, V.TypedValue b t)
+       => a -> b -> ConstExpr t
+udiv = binary FFI.constUDiv
+
+sdiv :: (T.Integer t, V.ConstValue a, V.TypedValue a t,
+         V.ConstValue b, V.TypedValue b t)
+       => a -> b -> ConstExpr t
+sdiv = binary FFI.constSDiv
+
+fdiv :: (T.Real t, V.ConstValue a, V.TypedValue a t,
+         V.ConstValue b, V.TypedValue b t)
+       => a -> b -> ConstExpr t
+fdiv = binary FFI.constFDiv
+
+urem :: (T.Integer t, V.ConstValue a, V.TypedValue a t,
+         V.ConstValue b, V.TypedValue b t)
+       => a -> b -> ConstExpr t
+urem = binary FFI.constURem
+
+srem :: (T.Integer t, V.ConstValue a, V.TypedValue a t,
+         V.ConstValue b, V.TypedValue b t)
+       => a -> b -> ConstExpr t
+srem = binary FFI.constURem
+
+frem :: (T.Real t, V.ConstValue a, V.TypedValue a t,
+         V.ConstValue b, V.TypedValue b t)
+       => a -> b -> ConstExpr t
+frem = binary FFI.constFRem
+
+and :: (T.Integer t, V.ConstValue a, V.TypedValue a t,
+        V.ConstValue b, V.TypedValue b t)
+       => a -> b -> ConstExpr t
+and = binary FFI.constAnd
+
+or :: (T.Integer t, V.ConstValue a, V.TypedValue a t,
+       V.ConstValue b, V.TypedValue b t)
+      => a -> b -> ConstExpr t
+or = binary FFI.constOr
+
+xor :: (T.Integer t, V.ConstValue a, V.TypedValue a t,
+        V.ConstValue b, V.TypedValue b t)
+       => a -> b -> ConstExpr t
+xor = binary FFI.constXor
+
+icmp :: (T.Integer t, V.ConstValue a, V.TypedValue a t,
+         V.ConstValue b, V.TypedValue b t)
+        => I.IntPredicate -> a -> b -> ConstExpr T.Int1
+icmp p = binary (FFI.constICmp (I.fromIP p))
+
+fcmp :: (T.Real t, V.ConstValue a, V.TypedValue a t,
+         V.ConstValue b, V.TypedValue b t)
+        => I.RealPredicate -> a -> b -> ConstExpr T.Int1
+fcmp p = binary (FFI.constFCmp (I.fromRP p))
+
+shl :: (T.Integer t, V.ConstValue a, V.TypedValue a t,
+         V.ConstValue b, V.TypedValue b t)
+       => a -> b -> ConstExpr t
+shl = binary FFI.constShl
+
+lshr :: (T.Integer t, V.ConstValue a, V.TypedValue a t,
+         V.ConstValue b, V.TypedValue b t)
+       => a -> b -> ConstExpr t
+lshr = binary FFI.constLShr
+
+ashr :: (T.Integer t, V.ConstValue a, V.TypedValue a t,
+         V.ConstValue b, V.TypedValue b t)
+       => a -> b -> ConstExpr t
+ashr = binary FFI.constAShr
+
+gep :: (V.ConstValue v, T.Integer t, V.TypedValue v t)
+       => a -> b -> ConstExpr t
+gep = undefined
+
+typed :: (V.ConstValue v, T.Type s, V.ConstValue w, V.DynamicValue w)
+         => (FFI.ValueRef -> FFI.TypeRef -> FFI.ValueRef) -> v -> s -> w
+typed ffi a b = V.fromAnyValue . V.mkAnyValue $ ffi (V.valueRef a) (T.typeRef b)
+
+trunc :: (V.ConstValue v, T.Integer s, V.TypedValue v s,
+          V.ConstValue w, V.DynamicValue w, T.Integer t, V.TypedValue w t)
+         => v -> t -> w
+trunc = typed FFI.constTrunc
+
+sExt :: (V.ConstValue v, T.Integer t, V.TypedValue v t)
+        => v -> t -> ConstExpr t
+sExt = typed FFI.constSExt
+
+zExt :: (V.ConstValue v, T.Integer t, V.TypedValue v t)
+        => v -> t -> ConstExpr t
+zExt = typed FFI.constZExt
+
+fpTrunc :: (V.ConstValue v, V.Real v, T.Real t)
+         => v -> t -> ConstExpr t
+fpTrunc = typed FFI.constFPTrunc
+
+fpExt :: (V.ConstValue v, V.Real v, T.Real t)
+         => v -> t -> ConstExpr t
+fpExt = typed FFI.constFPExt
+
+-- XXX How to express the inability to cast from scalar to vector?
+
+uiToFP :: (V.ConstValue v, T.Integer s, V.TypedValue v s, T.Real t)
+          => v -> s -> ConstExpr t
+uiToFP = typed FFI.constUIToFP
+
+siToFP :: (V.ConstValue v, V.Integer v, T.Integer s, T.Real t)
+          => v -> s -> ConstExpr t
+siToFP = typed FFI.constSIToFP
+
+fpToUI :: (V.ConstValue v, V.Real v, T.Real s, T.Integer t)
+          => v -> s -> ConstExpr t
+fpToUI = typed FFI.constFPToUI
+
+fpToSI :: (V.ConstValue v, V.Real v, T.Real s, T.Integer t)
+          => v -> s -> ConstExpr t
+fpToSI = typed FFI.constFPToSI
+
+ptrToInt :: (V.ConstValue v, T.Integer t)
+            => v -> T.Pointer a -> ConstExpr t
+ptrToInt = typed FFI.constPtrToInt
+
+intToPtr :: (V.ConstValue v, T.Integer t)
+            => v -> t -> ConstExpr (T.Pointer a)
+intToPtr = typed FFI.constIntToPtr
+
+-- XXX How to express pointer/non-pointer and bit-width constraints?
+bitCast :: (V.ConstValue v, T.Type t,
+            V.ConstValue w, V.DynamicValue w)
+           => v -> t -> w
+bitCast = typed FFI.constBitCast
+
+select :: (V.TypedValue k T.Int1,
+           V.ConstValue a, V.TypedValue a t, V.ConstValue b, V.TypedValue b t)
+          => k -> a -> b -> ConstExpr t
+select k = binary (FFI.constSelect (V.valueRef k))
+
+extractElement :: (V.ConstValue v, V.TypedValue v (T.Vector a),
+                   V.ConstValue i, V.Integer i) => v -> i -> ConstExpr a
+extractElement = binary FFI.constExtractElement
+
+ternary :: (V.ConstValue a, V.ConstValue b, V.ConstValue c)
+           => (FFI.ValueRef -> FFI.ValueRef -> FFI.ValueRef -> FFI.ValueRef)
+           -> a -> b -> c -> ConstExpr t
+ternary ffi a b c = ConstExpr . V.mkAnyValue $
+                    ffi (V.valueRef a) (V.valueRef b) (V.valueRef c)
+
+insertElement :: (V.ConstValue v, V.TypedValue v (T.Vector a),
+                  V.ConstValue e, V.TypedValue e a,
+                  V.ConstValue i, V.Integer i)
+                 => v -> e -> i -> ConstExpr (T.Vector a)
+insertElement = ternary FFI.constInsertElement
+
+shuffleVector :: (V.ConstValue v1, V.TypedValue v1 (T.Vector a),
+                  V.ConstValue v2, V.TypedValue v2 (T.Vector a),
+                  V.ConstValue m, V.TypedValue m (T.Vector T.Int32))
+                 => v1 -> v2 -> m -> ConstExpr (T.Vector a)
+shuffleVector = ternary FFI.constShuffleVector
+
+constWord :: (T.Integer t, Integral a) => (b -> t) -> a -> V.ConstInt t
+constWord typ val =
+    V.ConstInt . V.mkAnyValue $ FFI.constInt (T.typeRef (typ undefined))
+         (fromIntegral val) 0
+
+constInt :: (T.Integer t, Integral a) => (b -> t) -> a -> V.ConstInt t
+constInt typ val =
+    V.ConstInt . V.mkAnyValue $ FFI.constInt (T.typeRef (typ undefined))
+                 (fromIntegral val) 1
+
+constReal :: (T.Real t, RealFloat a) => (b -> t) -> a -> V.ConstReal t
+constReal typ val = V.ConstReal . V.mkAnyValue $ FFI.constReal
+                    (T.typeRef (typ undefined)) (realToFrac val)
+
+constStringInternal :: Bool -> String -> V.ConstArray T.Int8
+constStringInternal nulTerm s = unsafePerformIO $
+    withCStringLen s $ \(sPtr, sLen) ->
+      return . V.ConstArray . V.mkAnyValue $
+      FFI.constString sPtr (fromIntegral sLen) (fromBool (Prelude.not nulTerm))
+
+constString :: String -> V.ConstArray T.Int8
+constString = constStringInternal False
+
+constStringNul :: String -> V.ConstArray T.Int8
+constStringNul = constStringInternal True
+
+class V.ConstValue t => Const a t | a -> t where
+    const :: a -> t
+
+instance Const String (V.ConstArray T.Int8) where
+    const = constStringNul
+
+instance Const Float (V.ConstReal T.Float) where
+    const = constReal T.float . fromRational . toRational
+
+instance Const Double (V.ConstReal T.Double) where
+    const = constReal T.double
+
+instance Const Int8 (V.ConstInt T.Int8) where
+    const = constInt T.int8 . fromIntegral
+
+instance Const Int16 (V.ConstInt T.Int16) where
+    const = constInt T.int16 . fromIntegral
+
+instance Const Int32 (V.ConstInt T.Int32) where
+    const = constInt T.int32 . fromIntegral
+
+instance Const Int64 (V.ConstInt T.Int64) where
+    const = constInt T.int64
+
+instance Const Word8 (V.ConstInt T.Int8) where
+    const = constWord T.int8 . fromIntegral
+
+instance Const Word16 (V.ConstInt T.Int16) where
+    const = constWord T.int16 . fromIntegral
+
+instance Const Word32 (V.ConstInt T.Int32) where
+    const = constWord T.int32 . fromIntegral
+
+instance Const Word64 (V.ConstInt T.Int64) where
+    const = constWord T.int64 . fromIntegral
diff --git a/LLVM/Core/FFI.hsc b/LLVM/Core/FFI.hsc
new file mode 100644
--- /dev/null
+++ b/LLVM/Core/FFI.hsc
@@ -0,0 +1,628 @@
+{-# LANGUAGE EmptyDataDecls #-}
+
+module LLVM.Core.FFI
+    (
+      -- * Modules
+      Module
+    , ModuleRef
+    , moduleCreateWithName
+    , disposeModule
+
+    -- * Module providers
+    , ModuleProvider
+    , ModuleProviderRef
+    , createModuleProviderForExistingModule
+    , disposeModuleProvider
+
+    -- * Types
+    , Type
+    , TypeRef
+    , addTypeName
+    , deleteTypeName
+    , getElementType
+
+    -- ** Integer types
+    , int1Type
+    , int8Type
+    , int16Type
+    , int32Type
+    , int64Type
+    , integerType
+
+    -- ** Real types
+    , floatType
+    , doubleType
+    , x86FP80Type
+    , fp128Type
+    , ppcFP128Type
+
+    -- ** Function types
+    , functionType
+    , isFunctionVarArg
+    , getReturnType
+    , countParamTypes
+    , getParamTypes
+
+    -- ** Other types
+    , voidType
+
+    -- ** Array, pointer, and vector types
+    , arrayType
+    , pointerType
+    , vectorType
+
+    -- * Values
+    , Value
+    , ValueRef
+    , addGlobal
+    , deleteGlobal
+    , setInitializer
+    , typeOf
+    , getValueName
+    , setValueName
+    , dumpValue
+
+    -- ** Functions
+    , addFunction
+    , deleteFunction
+    , getNamedFunction
+    , countParams
+    , getParam
+    , getParams
+      
+    -- * Constants
+
+    -- ** Scalar constants
+    , constInt
+    , constReal
+
+    -- ** Composite constants
+    , constString
+
+    -- ** Constant expressions
+    , constNeg
+    , constNot
+    , constAdd
+    , constSub
+    , constMul
+    , constUDiv
+    , constSDiv
+    , constFDiv
+    , constURem
+    , constSRem
+    , constFRem
+    , constAnd
+    , constOr
+    , constXor
+    , constICmp
+    , constFCmp
+    , constShl
+    , constLShr
+    , constAShr
+    , constGEP
+    , constTrunc
+    , constSExt
+    , constZExt
+    , constFPTrunc
+    , constFPExt
+    , constUIToFP
+    , constSIToFP
+    , constFPToUI
+    , constFPToSI
+    , constPtrToInt
+    , constIntToPtr
+    , constBitCast
+    , constSelect
+    , constExtractElement
+    , constInsertElement
+    , constShuffleVector
+
+    -- * Basic blocks
+    , BasicBlock
+    , BasicBlockRef
+    , appendBasicBlock
+    , insertBasicBlock
+    , deleteBasicBlock
+    , getEntryBasicBlock
+
+    -- * Instruction building
+    , Builder
+    , BuilderRef
+    , createBuilder
+    , disposeBuilder
+    , positionBefore
+    , positionAtEnd
+
+    -- ** Terminators
+    , buildRetVoid
+    , buildRet
+    , buildBr
+    , buildCondBr
+    , buildSwitch
+    , buildInvoke
+    , buildUnwind
+    , buildUnreachable
+
+    -- ** Arithmetic
+    , buildAdd
+    , buildSub
+    , buildMul
+    , buildUDiv
+    , buildSDiv
+    , buildFDiv
+    , buildURem
+    , buildSRem
+    , buildFRem
+    , buildShl
+    , buildLShr
+    , buildAShr
+    , buildAnd
+    , buildOr
+    , buildXor
+    , buildNeg
+    , buildNot
+
+    -- ** Memory
+    , buildMalloc
+    , buildArrayMalloc
+    , buildAlloca
+    , buildArrayAlloca
+    , buildFree
+    , buildLoad
+    , buildStore
+    , buildGEP
+
+    -- ** Casts
+    , buildTrunc
+    , buildZExt
+    , buildSExt
+    , buildFPToUI
+    , buildFPToSI
+    , buildUIToFP
+    , buildSIToFP
+    , buildFPTrunc
+    , buildFPExt
+    , buildPtrToInt
+    , buildIntToPtr
+    , buildBitCast
+
+    -- ** Comparisons
+    , buildICmp
+    , buildFCmp
+
+    -- ** Miscellaneous instructions
+    , buildPhi
+    , buildCall
+    , buildSelect
+    , buildVAArg
+    , buildExtractElement
+    , buildInsertElement
+    , buildShuffleVector
+
+    -- ** Other helpers
+    , addCase
+    , addIncoming
+    ) where
+
+import Foreign.C.String (CString)
+import Foreign.C.Types (CDouble, CInt, CUInt, CULLong)
+import Foreign.Ptr (Ptr)
+
+#include <llvm-c/Core.h>
+
+data Module
+type ModuleRef = Ptr Module
+
+foreign import ccall unsafe "LLVMModuleCreateWithName" moduleCreateWithName
+    :: CString -> IO ModuleRef
+
+foreign import ccall unsafe "LLVMDisposeModule" disposeModule
+    :: ModuleRef -> IO ()
+
+
+data ModuleProvider
+type ModuleProviderRef = Ptr ModuleProvider
+
+foreign import ccall unsafe "LLVMCreateModuleProviderForExistingModule"
+    createModuleProviderForExistingModule
+    :: ModuleRef -> IO ModuleProviderRef
+
+foreign import ccall unsafe "LLVMDisposeModuleProvider" disposeModuleProvider
+    :: ModuleProviderRef -> IO ()
+
+
+data Type
+type TypeRef = Ptr Type
+
+foreign import ccall unsafe "LLVMInt1Type" int1Type :: TypeRef
+
+foreign import ccall unsafe "LLVMInt8Type" int8Type :: TypeRef
+
+foreign import ccall unsafe "LLVMInt16Type" int16Type :: TypeRef
+
+foreign import ccall unsafe "LLVMInt32Type" int32Type :: TypeRef
+
+foreign import ccall unsafe "LLVMInt64Type" int64Type :: TypeRef
+
+-- | An integer type of the given width.
+foreign import ccall unsafe "LLVMIntType" integerType
+    :: CUInt                    -- ^ width in bits
+    -> TypeRef
+
+foreign import ccall unsafe "LLVMFloatType" floatType :: TypeRef
+
+foreign import ccall unsafe "LLVMDoubleType" doubleType :: TypeRef
+
+foreign import ccall unsafe "LLVMX86FP80Type" x86FP80Type :: TypeRef
+
+foreign import ccall unsafe "LLVMFP128Type" fp128Type :: TypeRef
+
+foreign import ccall unsafe "LLVMPPCFP128Type" ppcFP128Type :: TypeRef
+
+foreign import ccall unsafe "LLVMVoidType" voidType :: TypeRef
+
+-- | Create a function type.
+foreign import ccall unsafe "LLVMFunctionType" functionType
+        :: TypeRef              -- ^ return type
+        -> Ptr TypeRef          -- ^ array of argument types
+        -> CUInt                -- ^ number of elements in array
+        -> CInt                 -- ^ non-zero if function is varargs
+        -> TypeRef
+
+-- | Indicate whether a function takes varargs.
+foreign import ccall unsafe "LLVMIsFunctionVarArg" isFunctionVarArg
+        :: TypeRef -> CInt
+
+-- | Give a function's return type.
+foreign import ccall unsafe "LLVMGetReturnType" getReturnType
+        :: TypeRef -> TypeRef
+
+-- | Give the number of fixed parameters that a function takes.
+foreign import ccall unsafe "LLVMCountParamTypes" countParamTypes
+        :: TypeRef -> CUInt
+
+-- | Fill out an array with the types of a function's fixed
+-- parameters.
+foreign import ccall unsafe "LLVMGetParamTypes" getParamTypes
+        :: TypeRef -> Ptr TypeRef -> IO ()
+
+foreign import ccall unsafe "LLVMArrayType" arrayType
+    :: TypeRef                  -- ^ element type
+    -> CUInt                    -- ^ element count
+    -> TypeRef
+
+foreign import ccall unsafe "LLVMPointerType" pointerType
+    :: TypeRef                  -- ^ pointed-to type
+    -> CUInt                    -- ^ address space
+    -> TypeRef
+
+foreign import ccall unsafe "LLVMVectorType" vectorType
+    :: TypeRef                  -- ^ element type
+    -> CUInt                    -- ^ element count
+    -> TypeRef
+
+foreign import ccall unsafe "LLVMAddTypeName" addTypeName
+    :: ModuleRef -> CString -> TypeRef -> IO CInt
+
+foreign import ccall unsafe "LLVMDeleteTypeName" deleteTypeName
+    :: ModuleRef -> CString -> IO ()
+
+-- | Give the type of a sequential type's elements.
+foreign import ccall unsafe "LLVMGetElementType" getElementType
+    :: TypeRef -> TypeRef
+
+
+data Value
+type ValueRef = Ptr Value
+
+foreign import ccall unsafe "LLVMAddGlobal" addGlobal
+    :: ModuleRef -> TypeRef -> CString -> IO ValueRef
+
+foreign import ccall unsafe "LLVMDeleteGlobal" deleteGlobal
+    :: ValueRef -> IO ()
+
+foreign import ccall unsafe "LLVMSetInitializer" setInitializer
+    :: ValueRef -> ValueRef -> IO ()
+
+foreign import ccall unsafe "LLVMTypeOf" typeOf
+    :: ValueRef -> IO TypeRef
+
+foreign import ccall unsafe "LLVMGetValueName" getValueName
+    :: ValueRef -> IO CString
+
+foreign import ccall unsafe "LLVMSetValueName" setValueName
+    :: ValueRef -> CString -> IO ()
+
+foreign import ccall unsafe "LLVMDumpValue" dumpValue
+    :: ValueRef -> IO ()
+
+foreign import ccall unsafe "LLVMGetNamedFunction" getNamedFunction
+    :: ModuleRef -> CString -> IO ValueRef
+
+foreign import ccall unsafe "LLVMAddFunction" addFunction
+    :: ModuleRef -> CString -> TypeRef -> IO ValueRef
+
+foreign import ccall unsafe "LLVMDeleteFunction" deleteFunction
+    :: ValueRef -> IO ()
+
+foreign import ccall unsafe "LLVMCountParams" countParams
+    :: ValueRef -> CUInt
+
+foreign import ccall unsafe "LLVMGetParam" getParam
+    :: ValueRef -> CUInt -> ValueRef
+
+foreign import ccall unsafe "LLVMGetParams" getParams
+    :: ValueRef -> Ptr ValueRef -> IO ()
+
+foreign import ccall unsafe "LLVMConstInt" constInt
+    :: TypeRef -> CULLong -> CInt -> ValueRef
+
+foreign import ccall unsafe "LLVMConstReal" constReal
+    :: TypeRef -> CDouble -> ValueRef
+
+foreign import ccall unsafe "LLVMConstString" constString
+    :: CString -> CUInt -> CInt -> ValueRef
+
+foreign import ccall unsafe "LLVMConstNeg" constNeg
+    :: ValueRef -> ValueRef
+
+foreign import ccall unsafe "LLVMConstNot" constNot
+    :: ValueRef -> ValueRef
+
+foreign import ccall unsafe "LLVMConstAdd" constAdd
+    :: ValueRef -> ValueRef -> ValueRef
+
+foreign import ccall unsafe "LLVMConstSub" constSub
+    :: ValueRef -> ValueRef -> ValueRef
+
+foreign import ccall unsafe "LLVMConstMul" constMul
+    :: ValueRef -> ValueRef -> ValueRef
+
+foreign import ccall unsafe "LLVMConstUDiv" constUDiv
+    :: ValueRef -> ValueRef -> ValueRef
+
+foreign import ccall unsafe "LLVMConstSDiv" constSDiv
+    :: ValueRef -> ValueRef -> ValueRef
+
+foreign import ccall unsafe "LLVMConstFDiv" constFDiv
+    :: ValueRef -> ValueRef -> ValueRef
+
+foreign import ccall unsafe "LLVMConstURem" constURem
+    :: ValueRef -> ValueRef -> ValueRef
+
+foreign import ccall unsafe "LLVMConstSRem" constSRem
+    :: ValueRef -> ValueRef -> ValueRef
+
+foreign import ccall unsafe "LLVMConstFRem" constFRem
+    :: ValueRef -> ValueRef -> ValueRef
+
+foreign import ccall unsafe "LLVMConstAnd" constAnd
+    :: ValueRef -> ValueRef -> ValueRef
+
+foreign import ccall unsafe "LLVMConstOr" constOr
+    :: ValueRef -> ValueRef -> ValueRef
+
+foreign import ccall unsafe "LLVMConstXor" constXor
+    :: ValueRef -> ValueRef -> ValueRef
+
+foreign import ccall unsafe "LLVMConstICmp" constICmp
+    :: CInt -> ValueRef -> ValueRef -> ValueRef
+
+foreign import ccall unsafe "LLVMConstFCmp" constFCmp
+    :: CInt -> ValueRef -> ValueRef -> ValueRef
+
+foreign import ccall unsafe "LLVMConstShl" constShl
+    :: ValueRef -> ValueRef -> ValueRef
+
+foreign import ccall unsafe "LLVMConstLShr" constLShr
+    :: ValueRef -> ValueRef -> ValueRef
+
+foreign import ccall unsafe "LLVMConstAShr" constAShr
+    :: ValueRef -> ValueRef -> ValueRef
+
+foreign import ccall unsafe "LLVMConstGEP" constGEP
+    :: ValueRef -> Ptr ValueRef -> CUInt -> ValueRef
+
+foreign import ccall unsafe "LLVMConstTrunc" constTrunc
+    :: ValueRef -> TypeRef -> ValueRef
+
+foreign import ccall unsafe "LLVMConstSExt" constSExt
+    :: ValueRef -> TypeRef -> ValueRef
+
+foreign import ccall unsafe "LLVMConstZExt" constZExt
+    :: ValueRef -> TypeRef -> ValueRef
+
+foreign import ccall unsafe "LLVMConstFPTrunc" constFPTrunc
+    :: ValueRef -> TypeRef -> ValueRef
+
+foreign import ccall unsafe "LLVMConstFPExt" constFPExt
+    :: ValueRef -> TypeRef -> ValueRef
+
+foreign import ccall unsafe "LLVMConstUIToFP" constUIToFP
+    :: ValueRef -> TypeRef -> ValueRef
+
+foreign import ccall unsafe "LLVMConstSIToFP" constSIToFP
+    :: ValueRef -> TypeRef -> ValueRef
+
+foreign import ccall unsafe "LLVMConstFPToUI" constFPToUI
+    :: ValueRef -> TypeRef -> ValueRef
+
+foreign import ccall unsafe "LLVMConstFPToSI" constFPToSI
+    :: ValueRef -> TypeRef -> ValueRef
+
+foreign import ccall unsafe "LLVMConstPtrToInt" constPtrToInt
+    :: ValueRef -> TypeRef -> ValueRef
+
+foreign import ccall unsafe "LLVMConstIntToPtr" constIntToPtr
+    :: ValueRef -> TypeRef -> ValueRef
+
+foreign import ccall unsafe "LLVMConstBitCast" constBitCast
+    :: ValueRef -> TypeRef -> ValueRef
+
+foreign import ccall unsafe "LLVMConstSelect" constSelect
+    :: ValueRef -> ValueRef -> ValueRef -> ValueRef
+
+foreign import ccall unsafe "LLVMConstExtractElement" constExtractElement
+    :: ValueRef -> ValueRef -> ValueRef
+
+foreign import ccall unsafe "LLVMConstInsertElement" constInsertElement
+    :: ValueRef -> ValueRef -> ValueRef -> ValueRef
+
+foreign import ccall unsafe "LLVMConstShuffleVector" constShuffleVector
+    :: ValueRef -> ValueRef -> ValueRef -> ValueRef
+
+type BasicBlock = Value
+type BasicBlockRef = Ptr BasicBlock
+
+foreign import ccall unsafe "LLVMAppendBasicBlock" appendBasicBlock
+    :: ValueRef -> CString -> IO BasicBlockRef
+
+foreign import ccall unsafe "LLVMInsertBasicBlock" insertBasicBlock
+    :: BasicBlockRef -> CString -> IO BasicBlockRef
+
+foreign import ccall unsafe "LLVMDeleteBasicBlock" deleteBasicBlock
+    :: BasicBlockRef -> IO ()
+
+foreign import ccall unsafe "LLVMGetEntryBasicBlock" getEntryBasicBlock
+    :: ValueRef -> IO BasicBlockRef
+
+data Builder
+type BuilderRef = Ptr Builder
+
+foreign import ccall unsafe "LLVMCreateBuilder" createBuilder
+    :: IO BuilderRef
+
+foreign import ccall unsafe "LLVMDisposeBuilder" disposeBuilder
+    :: BuilderRef -> IO ()
+
+foreign import ccall unsafe "LLVMPositionBuilderBefore" positionBefore
+    :: BuilderRef -> ValueRef -> IO ()
+
+foreign import ccall unsafe "LLVMPositionBuilderAtEnd" positionAtEnd
+    :: BuilderRef -> BasicBlockRef -> IO ()
+
+foreign import ccall unsafe "LLVMBuildRetVoid" buildRetVoid
+    :: BuilderRef -> IO ValueRef
+foreign import ccall unsafe "LLVMBuildRet" buildRet
+    :: BuilderRef -> ValueRef -> IO ValueRef
+foreign import ccall unsafe "LLVMBuildBr" buildBr
+    :: BuilderRef -> BasicBlockRef -> IO ValueRef
+foreign import ccall unsafe "LLVMBuildCondBr" buildCondBr
+    :: BuilderRef -> ValueRef -> BasicBlockRef -> BasicBlockRef -> IO ValueRef
+foreign import ccall unsafe "LLVMBuildSwitch" buildSwitch
+    :: BuilderRef -> ValueRef -> BasicBlockRef -> CUInt -> IO ValueRef
+foreign import ccall unsafe "LLVMBuildInvoke" buildInvoke
+    :: BuilderRef -> ValueRef -> Ptr ValueRef -> CUInt
+    -> BasicBlockRef -> BasicBlockRef -> CString -> IO ValueRef
+foreign import ccall unsafe "LLVMBuildUnwind" buildUnwind
+    :: BuilderRef -> IO ValueRef
+foreign import ccall unsafe "LLVMBuildUnreachable" buildUnreachable
+    :: BuilderRef -> IO ValueRef
+
+foreign import ccall unsafe "LLVMBuildAdd" buildAdd
+    :: BuilderRef -> ValueRef -> ValueRef -> CString -> IO ValueRef
+foreign import ccall unsafe "LLVMBuildSub" buildSub
+    :: BuilderRef -> ValueRef -> ValueRef -> CString -> IO ValueRef
+foreign import ccall unsafe "LLVMBuildMul" buildMul
+    :: BuilderRef -> ValueRef -> ValueRef -> CString -> IO ValueRef
+foreign import ccall unsafe "LLVMBuildUDiv" buildUDiv
+    :: BuilderRef -> ValueRef -> ValueRef -> CString -> IO ValueRef
+foreign import ccall unsafe "LLVMBuildSDiv" buildSDiv
+    :: BuilderRef -> ValueRef -> ValueRef -> CString -> IO ValueRef
+foreign import ccall unsafe "LLVMBuildFDiv" buildFDiv
+    :: BuilderRef -> ValueRef -> ValueRef -> CString -> IO ValueRef
+foreign import ccall unsafe "LLVMBuildURem" buildURem
+    :: BuilderRef -> ValueRef -> ValueRef -> CString -> IO ValueRef
+foreign import ccall unsafe "LLVMBuildSRem" buildSRem
+    :: BuilderRef -> ValueRef -> ValueRef -> CString -> IO ValueRef
+foreign import ccall unsafe "LLVMBuildFRem" buildFRem
+    :: BuilderRef -> ValueRef -> ValueRef -> CString -> IO ValueRef
+foreign import ccall unsafe "LLVMBuildShl" buildShl
+    :: BuilderRef -> ValueRef -> ValueRef -> CString -> IO ValueRef
+foreign import ccall unsafe "LLVMBuildLShr" buildLShr
+    :: BuilderRef -> ValueRef -> ValueRef -> CString -> IO ValueRef
+foreign import ccall unsafe "LLVMBuildAShr" buildAShr
+    :: BuilderRef -> ValueRef -> ValueRef -> CString -> IO ValueRef
+foreign import ccall unsafe "LLVMBuildAnd" buildAnd
+    :: BuilderRef -> ValueRef -> ValueRef -> CString -> IO ValueRef
+foreign import ccall unsafe "LLVMBuildOr" buildOr
+    :: BuilderRef -> ValueRef -> ValueRef -> CString -> IO ValueRef
+foreign import ccall unsafe "LLVMBuildXor" buildXor
+    :: BuilderRef -> ValueRef -> ValueRef -> CString -> IO ValueRef
+foreign import ccall unsafe "LLVMBuildNeg" buildNeg
+    :: BuilderRef -> ValueRef -> CString -> IO ValueRef
+foreign import ccall unsafe "LLVMBuildNot" buildNot
+    :: BuilderRef -> ValueRef -> CString -> IO ValueRef
+
+-- Memory
+foreign import ccall unsafe "LLVMBuildMalloc" buildMalloc
+    :: BuilderRef -> TypeRef -> CString -> IO ValueRef
+foreign import ccall unsafe "LLVMBuildArrayMalloc" buildArrayMalloc
+    :: BuilderRef -> TypeRef -> ValueRef -> CString -> IO ValueRef
+foreign import ccall unsafe "LLVMBuildAlloca" buildAlloca
+    :: BuilderRef -> TypeRef -> CString -> IO ValueRef
+foreign import ccall unsafe "LLVMBuildArrayAlloca" buildArrayAlloca
+    :: BuilderRef -> TypeRef -> ValueRef -> CString -> IO ValueRef
+foreign import ccall unsafe "LLVMBuildFree" buildFree
+    :: BuilderRef -> ValueRef -> IO ValueRef
+foreign import ccall unsafe "LLVMBuildLoad" buildLoad
+    :: BuilderRef -> ValueRef -> CString -> IO ValueRef
+foreign import ccall unsafe "LLVMBuildStore" buildStore
+    :: BuilderRef -> ValueRef -> ValueRef -> IO ValueRef
+foreign import ccall unsafe "LLVMBuildGEP" buildGEP
+    :: BuilderRef -> ValueRef -> Ptr ValueRef -> CUInt -> CString
+    -> IO ValueRef
+
+-- Casts
+foreign import ccall unsafe "LLVMBuildTrunc" buildTrunc
+    :: BuilderRef -> ValueRef -> TypeRef -> CString -> IO ValueRef
+foreign import ccall unsafe "LLVMBuildZExt" buildZExt
+    :: BuilderRef -> ValueRef -> TypeRef -> CString -> IO ValueRef
+foreign import ccall unsafe "LLVMBuildSExt" buildSExt
+    :: BuilderRef -> ValueRef -> TypeRef -> CString -> IO ValueRef
+foreign import ccall unsafe "LLVMBuildFPToUI" buildFPToUI
+    :: BuilderRef -> ValueRef -> TypeRef -> CString -> IO ValueRef
+foreign import ccall unsafe "LLVMBuildFPToSI" buildFPToSI
+    :: BuilderRef -> ValueRef -> TypeRef -> CString -> IO ValueRef
+foreign import ccall unsafe "LLVMBuildUIToFP" buildUIToFP
+    :: BuilderRef -> ValueRef -> TypeRef -> CString -> IO ValueRef
+foreign import ccall unsafe "LLVMBuildSIToFP" buildSIToFP
+    :: BuilderRef -> ValueRef -> TypeRef -> CString -> IO ValueRef
+foreign import ccall unsafe "LLVMBuildFPTrunc" buildFPTrunc
+    :: BuilderRef -> ValueRef -> TypeRef -> CString -> IO ValueRef
+foreign import ccall unsafe "LLVMBuildFPExt" buildFPExt
+    :: BuilderRef -> ValueRef -> TypeRef -> CString -> IO ValueRef
+foreign import ccall unsafe "LLVMBuildPtrToInt" buildPtrToInt
+    :: BuilderRef -> ValueRef -> TypeRef -> CString -> IO ValueRef
+foreign import ccall unsafe "LLVMBuildIntToPtr" buildIntToPtr
+    :: BuilderRef -> ValueRef -> TypeRef -> CString -> IO ValueRef
+foreign import ccall unsafe "LLVMBuildBitCast" buildBitCast
+    :: BuilderRef -> ValueRef -> TypeRef -> CString -> IO ValueRef
+
+-- Comparisons
+foreign import ccall unsafe "LLVMBuildICmp" buildICmp
+    :: BuilderRef -> CInt -> ValueRef -> ValueRef -> CString -> IO ValueRef
+foreign import ccall unsafe "LLVMBuildFCmp" buildFCmp
+    :: BuilderRef -> CInt -> ValueRef -> ValueRef -> CString -> IO ValueRef
+
+-- Miscellaneous instructions
+foreign import ccall unsafe "LLVMBuildPhi" buildPhi
+    :: BuilderRef -> TypeRef -> CString -> IO ValueRef
+foreign import ccall unsafe "LLVMBuildCall" buildCall
+    :: BuilderRef -> ValueRef -> Ptr ValueRef -> CUInt -> CString -> IO ValueRef
+foreign import ccall unsafe "LLVMBuildSelect" buildSelect
+    :: BuilderRef -> ValueRef -> ValueRef -> ValueRef -> CString -> IO ValueRef
+foreign import ccall unsafe "LLVMBuildVAArg" buildVAArg
+    :: BuilderRef -> ValueRef -> TypeRef -> CString -> IO ValueRef
+foreign import ccall unsafe "LLVMBuildExtractElement" buildExtractElement
+    :: BuilderRef -> ValueRef -> ValueRef -> CString -> IO ValueRef
+foreign import ccall unsafe "LLVMBuildInsertElement" buildInsertElement
+    :: BuilderRef -> ValueRef -> ValueRef -> ValueRef -> CString -> IO ValueRef
+foreign import ccall unsafe "LLVMBuildShuffleVector" buildShuffleVector
+    :: BuilderRef -> ValueRef -> ValueRef -> ValueRef -> CString -> IO ValueRef
+
+foreign import ccall unsafe "LLVMAddCase" addCase
+    :: ValueRef -> ValueRef -> BasicBlockRef -> IO ()
+
+foreign import ccall unsafe "LLVMAddIncoming" addIncoming
+    :: ValueRef -> Ptr ValueRef -> Ptr ValueRef -> CUInt -> IO ()
diff --git a/LLVM/Core/Instruction.hs b/LLVM/Core/Instruction.hs
new file mode 100644
--- /dev/null
+++ b/LLVM/Core/Instruction.hs
@@ -0,0 +1,47 @@
+module LLVM.Core.Instruction
+    (
+      IntPredicate(..)
+    , RealPredicate(..)
+    , fromIP
+    , fromRP
+    ) where
+
+import Foreign.C.Types (CInt)
+
+data IntPredicate =
+    IntEQ                       -- ^ equal
+  | IntNE                       -- ^ not equal
+  | IntUGT                      -- ^ unsigned greater than
+  | IntUGE                      -- ^ unsigned greater or equal
+  | IntULT                      -- ^ unsigned less than
+  | IntULE                      -- ^ unsigned less or equal
+  | IntSGT                      -- ^ signed greater than
+  | IntSGE                      -- ^ signed greater or equal
+  | IntSLT                      -- ^ signed less than
+  | IntSLE                      -- ^ signed less or equal
+    deriving (Eq, Ord, Enum, Show)
+
+fromIP :: IntPredicate -> CInt
+fromIP ip = fromIntegral (fromEnum ip + 32)
+
+data RealPredicate =
+    RealFalse           -- ^ Always false (always folded)
+  | RealOEQ             -- ^ True if ordered and equal
+  | RealOGT             -- ^ True if ordered and greater than
+  | RealOGE             -- ^ True if ordered and greater than or equal
+  | RealOLT             -- ^ True if ordered and less than
+  | RealOLE             -- ^ True if ordered and less than or equal
+  | RealONE             -- ^ True if ordered and operands are unequal
+  | RealORD             -- ^ True if ordered (no nans)
+  | RealUNO             -- ^ True if unordered: isnan(X) | isnan(Y)
+  | RealUEQ             -- ^ True if unordered or equal
+  | RealUGT             -- ^ True if unordered or greater than
+  | RealUGE             -- ^ True if unordered, greater than, or equal
+  | RealULT             -- ^ True if unordered or less than
+  | RealULE             -- ^ True if unordered, less than, or equal
+  | RealUNE             -- ^ True if unordered or not equal
+  | RealT               -- ^ Always true (always folded)
+    deriving (Eq, Ord, Enum, Show)
+
+fromRP :: RealPredicate -> CInt
+fromRP = fromIntegral . fromEnum
diff --git a/LLVM/Core/Type.hs b/LLVM/Core/Type.hs
new file mode 100644
--- /dev/null
+++ b/LLVM/Core/Type.hs
@@ -0,0 +1,547 @@
+{-# LANGUAGE
+    DeriveDataTypeable
+  , ExistentialQuantification
+  , FunctionalDependencies
+  , MultiParamTypeClasses
+  #-}
+
+module LLVM.Core.Type
+    (
+      Module(..)
+    , withModule
+    , ModuleProvider(..)
+    , withModuleProvider
+
+    -- * Types
+    , Type(..)
+    , TypeValue(..)
+    , AnyType
+    , HasAnyType(..)
+    , DynamicType(..)
+    , mkAnyType
+
+    -- ** Integer types
+    , Arithmetic
+    , FirstClass
+    , Integer
+    , integer
+    , Int1(..)
+    , int1
+    , Int8(..)
+    , int8
+    , Int16(..)
+    , int16
+    , Int32(..)
+    , int32
+    , Int64(..)
+    , int64
+    , IntWidth(..)
+
+    -- ** Real types
+    , Real
+    , Float(..)
+    , float
+    , Double(..)
+    , double
+
+    -- *** Machine-specific real types
+    , X86Float80(..)
+    , x86Float80
+    , Float128(..)
+    , float128
+    , PPCFloat128(..)
+    , ppcFloat128
+
+    -- ** Array, pointer, and vector types
+    , Sequence(..)
+    , elementTypeDyn
+    , Array(..)
+    , array
+    , arrayElementType
+    , Pointer(..)
+    , AddressSpace
+    , addressSpace
+    , fromAddressSpace
+    , genericAddressSpace
+    , pointerIn
+    , pointer
+    , pointerElementType
+    , Vector(..)
+    , vector
+    , vectorElementType
+
+    -- ** Function-related types
+    , Function(..)
+    , function
+    , params
+    , functionVarArg
+    , isFunctionVarArg
+    , getReturnType
+    , getParamTypes
+
+    -- *** Type hackery
+    , functionParams
+    , Params(..)
+    , (:->)(..)
+    , car
+    , cdr
+
+    -- ** Other types
+    , Void(..)
+    ) where
+
+import Control.Applicative ((<$>))
+import Data.Typeable (Typeable)
+import Foreign.ForeignPtr (ForeignPtr, withForeignPtr)
+import Foreign.Marshal.Array (allocaArray, peekArray, withArrayLen)
+import Foreign.Marshal.Utils (fromBool, toBool)
+import Prelude hiding (Double, Float, Integer, Real, mod)
+import System.IO.Unsafe (unsafePerformIO)
+
+import qualified LLVM.Core.FFI as FFI
+
+import Debug.Trace
+
+
+newtype Module = Module {
+      fromModule :: ForeignPtr FFI.Module
+    }
+    deriving (Typeable)
+
+withModule :: Module -> (FFI.ModuleRef -> IO a) -> IO a
+withModule mod = withForeignPtr (fromModule mod)
+
+newtype ModuleProvider = ModuleProvider {
+      fromModuleProvider :: ForeignPtr FFI.ModuleProvider
+    }
+    deriving (Typeable)
+
+withModuleProvider :: ModuleProvider -> (FFI.ModuleProviderRef -> IO a)
+                   -> IO a
+withModuleProvider prov = withForeignPtr (fromModuleProvider prov)
+
+class Type a where
+    typeRef :: a -> FFI.TypeRef
+    anyType :: a -> AnyType
+
+class Type t => TypeValue t where
+    typeValue :: a -> t
+
+class Type a => Arithmetic a
+class Arithmetic a => Integer a
+class Arithmetic a => Real a
+
+class FirstClass a
+instance FirstClass AnyType
+
+class HasAnyType a where
+    fromAnyType :: AnyType -> a
+
+instance Type FFI.TypeRef where
+    anyType = AnyType
+    typeRef = id
+
+data AnyType = forall a. Type a => AnyType a
+               deriving (Typeable)
+
+instance Eq AnyType where
+    a == b = typeRef a == typeRef b
+
+instance Show AnyType where
+    show a = "AnyType " ++ show (typeRef a)
+
+mkAnyType :: Type a => a -> AnyType
+mkAnyType = AnyType
+
+instance Type AnyType where
+    typeRef (AnyType a) = typeRef a
+    anyType = id
+
+instance HasAnyType AnyType where
+    fromAnyType = id
+
+class Params a where
+    toAnyList :: a -> [AnyType]
+    fromAnyList :: [AnyType] -> (a, [AnyType])
+
+instance Integer AnyType
+
+newtype Int1 = Int1 AnyType
+    deriving (Arithmetic, FirstClass, HasAnyType, Integer, Type, Typeable)
+
+instance Show Int1 where
+    show _ = "Int1"
+
+newtype Int8 = Int8 AnyType
+    deriving (Arithmetic, FirstClass, HasAnyType, Integer, Type, Typeable)
+
+instance Show Int8 where
+    show _ = "Int8"
+
+newtype Int16 = Int16 AnyType
+    deriving (Arithmetic, FirstClass, HasAnyType, Integer, Type, Typeable)
+
+instance Show Int16 where
+    show _ = "Int16"
+
+newtype Int32 = Int32 AnyType
+    deriving (Arithmetic, FirstClass, HasAnyType, Integer, Type, Typeable)
+
+instance Show Int32 where
+    show _ = "Int32"
+
+newtype Int64 = Int64 AnyType
+    deriving (Arithmetic, FirstClass, HasAnyType, Integer, Type, Typeable)
+
+instance Show Int64 where
+    show _ = "Int64"
+
+newtype IntWidth a = IntWidth AnyType
+    deriving (Arithmetic, FirstClass, HasAnyType, Integer, Type, Typeable)
+
+instance Show (IntWidth a) where
+    show _ = "IntWidth"
+
+instance Real AnyType
+instance Arithmetic AnyType
+
+newtype Float = Float AnyType
+    deriving (Arithmetic, FirstClass, HasAnyType, Real, Type, Typeable)
+
+instance Show Float where
+    show _ = "Float"
+
+newtype Double = Double AnyType
+    deriving (Arithmetic, FirstClass, HasAnyType, Real, Type, Typeable)
+
+instance Show Double where
+    show _ = "Double"
+
+newtype X86Float80 = X86Float80 AnyType
+    deriving (Arithmetic, FirstClass, HasAnyType, Real, Type, Typeable)
+
+instance Show X86Float80 where
+    show _ = "X86Float80"
+
+newtype Float128 = Float128 AnyType
+    deriving (Arithmetic, FirstClass, HasAnyType, Real, Type, Typeable)
+
+instance Show Float128 where
+    show _ = "Float128"
+
+newtype PPCFloat128 = PPCFloat128 AnyType
+    deriving (Arithmetic, FirstClass, HasAnyType, Real, Type, Typeable)
+
+instance Show PPCFloat128 where
+    show _ = "PPCFloat128"
+
+class (Type a, Type t) => Sequence a t | a -> t where
+    elementType :: a -> t
+
+instance Sequence AnyType AnyType where
+    elementType = elementTypeDyn
+
+newtype Array a = Array AnyType
+    deriving (HasAnyType, Type, Typeable)
+
+arrayElementType :: Array a -> a
+arrayElementType _ = undefined
+
+instance Type a => Sequence (Array a) a where
+    elementType = arrayElementType
+
+instance (Show a) => Show (Array a) where
+    show a = "Array " ++ show (arrayElementType a)
+
+newtype Pointer a = Pointer AnyType
+    deriving (FirstClass, HasAnyType, Type, Typeable)
+
+pointerElementType :: Pointer a -> a
+pointerElementType _ = undefined
+
+instance Type a => Sequence (Pointer a) a where
+    elementType = pointerElementType
+
+instance (Show a) => Show (Pointer a) where
+    show a = "Pointer " ++ show (pointerElementType a)
+
+newtype Vector a = Vector AnyType
+    deriving (Arithmetic, FirstClass, HasAnyType, Type, Typeable)
+
+vectorElementType :: Vector a -> a
+vectorElementType _ = undefined
+
+instance Type a => Sequence (Vector a) a where
+    elementType = vectorElementType
+
+instance (Show a) => Show (Vector a) where
+    show a = "Vector " ++ show (vectorElementType a)
+
+newtype Void = Void AnyType
+    deriving (HasAnyType, Type, Typeable)
+
+instance Show Void where
+    show _ = "Void"
+
+class Type a => DynamicType a where
+    toAnyType :: a              -- ^ not inspected
+              -> AnyType
+
+data Function r p = Function {
+      fromNewFunction :: AnyType
+    }
+    deriving (Typeable)
+
+instance HasAnyType (Function r p) where
+    fromAnyType = Function
+
+instance Type (Function r p) where
+    typeRef = typeRef . fromNewFunction
+    anyType = fromNewFunction
+
+instance (Show r, Show p, Params p) => Show (Function r p) where
+    show a = "Function " ++ show (functionResult a) ++ " " ++ show (params a)
+
+functionParams :: Function r p -> p
+functionParams _ = undefined
+
+functionResult :: Function r p -> r
+functionResult _ = undefined
+
+instance (DynamicType r, Params p) => DynamicType (Function r p) where
+    toAnyType f = let parms = toAnyList . functionParams $ f
+                      ret = toAnyType . functionResult $ f
+                  in functionType False ret parms
+
+instance DynamicType AnyType where
+    toAnyType = id
+
+data a :-> b = a :-> b
+infixr 6 :->
+
+car :: (a :-> b) -> a
+car _ = undefined
+
+cdr :: (a :-> b) -> b
+cdr _ = undefined
+
+instance (Show a, Show b) => Show (a :-> b) where
+    show a = show (car a) ++ " :-> " ++ show (cdr a)
+
+int1 :: a -> Int1
+int1 _ = Int1 $ mkAnyType FFI.int1Type
+
+fromAny :: HasAnyType a => [AnyType] -> (a, [AnyType])
+fromAny e | trace ("eee " ++ show (length e) ) False = undefined
+fromAny (x:xs) = (fromAnyType x,xs)
+fromAny _ = error "LLVM.Core.Type.fromAny: empty list"
+
+instance Params () where
+    toAnyList _ = []
+    fromAnyList _ = error "fromAnyList ()"
+
+instance Params Int1 where
+    toAnyList a = [toAnyType a]
+    fromAnyList = fromAny
+
+instance TypeValue Int1 where
+    typeValue = int1
+
+instance DynamicType Int1 where
+    toAnyType = mkAnyType . int1
+
+int8 :: a -> Int8
+int8 _ = Int8 $ mkAnyType FFI.int8Type
+
+instance Params Int8 where
+    toAnyList a = [toAnyType a]
+    fromAnyList = fromAny
+
+instance Params AnyType where
+    toAnyList a = [toAnyType a]
+    fromAnyList = fromAny
+
+instance DynamicType Int8 where
+    toAnyType = mkAnyType . int8
+
+int16 :: a -> Int16
+int16 _ = Int16 $ mkAnyType FFI.int16Type
+
+instance Params Int16 where
+    toAnyList a = [toAnyType a]
+    fromAnyList = fromAny
+
+instance DynamicType Int16 where
+    toAnyType = mkAnyType . int16
+
+int32 :: a -> Int32
+int32 _ = Int32 $ mkAnyType FFI.int32Type
+
+instance Params Int32 where
+    toAnyList a = [toAnyType a]
+    fromAnyList = fromAny
+
+instance DynamicType Int32 where
+    toAnyType = mkAnyType . int32
+
+int64 :: a -> Int64
+int64 _ = Int64 $ mkAnyType FFI.int64Type
+
+instance Params Int64 where
+    toAnyList a = [toAnyType a]
+    fromAnyList = fromAny
+
+instance DynamicType Int64 where
+    toAnyType = mkAnyType . int64
+
+integer :: Int -> b -> IntWidth a
+integer width _ = IntWidth . mkAnyType . FFI.integerType $ fromIntegral width
+
+-- Not possible:
+--
+-- instance Params (IntWidth a) where
+--     toAnyList a = [toAnyType a]
+--
+-- instance DynamicType (IntWidth a) where
+--     toAnyType _ = mkAnyType integerType
+
+float :: a -> Float
+float _ = Float $ mkAnyType FFI.floatType
+
+instance Params Float where
+    toAnyList a = [toAnyType a]
+    fromAnyList = fromAny
+
+instance DynamicType Float where
+    toAnyType = mkAnyType . float
+
+double :: a -> Double
+double _ = Double $ mkAnyType FFI.doubleType
+
+instance Params Double where
+    toAnyList a = [toAnyType a]
+    fromAnyList = fromAny
+
+instance DynamicType Double where
+    toAnyType = mkAnyType . double
+
+x86Float80 :: a -> X86Float80
+x86Float80 _ = X86Float80 $ mkAnyType FFI.x86FP80Type
+
+instance Params X86Float80 where
+    toAnyList a = [toAnyType a]
+    fromAnyList = fromAny
+
+instance DynamicType X86Float80 where
+    toAnyType = mkAnyType . x86Float80
+
+float128 :: a -> Float128
+float128 _ = Float128 $ mkAnyType FFI.fp128Type
+
+instance Params Float128 where
+    toAnyList a = [toAnyType a]
+    fromAnyList = fromAny
+
+instance DynamicType Float128 where
+    toAnyType = mkAnyType . float128
+
+ppcFloat128 :: a -> PPCFloat128
+ppcFloat128 _ = PPCFloat128 $ mkAnyType FFI.ppcFP128Type
+
+instance Params PPCFloat128 where
+    toAnyList a = [toAnyType a]
+    fromAnyList  = fromAny
+
+instance DynamicType PPCFloat128 where
+    toAnyType = mkAnyType . ppcFloat128
+
+void :: a -> Void
+void _ = Void $ mkAnyType FFI.voidType
+
+instance Params Void where
+    toAnyList a = [toAnyType a]
+    fromAnyList = fromAny
+
+instance DynamicType Void where
+    toAnyType = mkAnyType . void
+
+instance (DynamicType a, HasAnyType a, Params b) => Params (a :-> b) where
+    toAnyList a = toAnyType (car a) : toAnyList (cdr a)
+    fromAnyList (x:xs) = let (y,ys) = fromAnyList xs
+                         in (fromAnyType x :-> y,ys)
+    fromAnyList _ = error "LLVM.Core.Type.fromAnyList(:->): empty list"
+
+functionType :: Bool -> AnyType -> [AnyType] -> AnyType
+functionType varargs retType paramTypes = unsafePerformIO $
+    withArrayLen (map typeRef paramTypes) $ \len ptr ->
+        return . mkAnyType $ FFI.functionType (typeRef retType) ptr
+                                        (fromIntegral len) (fromBool varargs)
+
+params :: Params p => Function r p -> p
+params f = case fromAnyList . toAnyList . functionParams $ f of
+             (p, []) -> p
+             _ -> error "LLVM.Core.Type.newParams: incompletely consumed params"
+
+function :: (DynamicType r, Params p) => r -> p -> Function r p
+function r p = Function . functionType False (toAnyType r) $ toAnyList p
+
+instance DynamicType p => Params (Function r p) where
+    toAnyList a = [toAnyType (functionParams a)]
+    fromAnyList = fromAny
+    
+functionVarArg :: (DynamicType r, Params p) => r -> p -> Function r p
+functionVarArg r p = Function . functionType True (toAnyType r) $ toAnyList p
+    
+isFunctionVarArg :: Function r p -> Bool
+isFunctionVarArg = toBool . FFI.isFunctionVarArg . typeRef
+
+getReturnType :: (Params p) => Function r p -> AnyType
+getReturnType = mkAnyType . FFI.getReturnType . typeRef
+
+getParamTypes :: (Params p) => Function r p -> [AnyType]
+getParamTypes typ = unsafePerformIO $ do
+    let typ' = typeRef typ
+        count = FFI.countParamTypes typ'
+        len = fromIntegral count
+    allocaArray len $ \ptr -> do
+      FFI.getParamTypes typ' ptr
+      map mkAnyType <$> peekArray len ptr
+
+array :: (DynamicType t) => t -> Int -> Array t
+array typ len = Array . mkAnyType $ FFI.arrayType (typeRef (toAnyType typ)) (fromIntegral len)
+
+instance (DynamicType t) => DynamicType (Array t) where
+    toAnyType = mkAnyType . flip array 0 . toAnyType . arrayElementType
+
+newtype AddressSpace = AddressSpace {
+      fromAddressSpace :: Int
+    }
+    deriving (Eq, Ord, Show, Read)
+
+addressSpace :: Int -> AddressSpace
+addressSpace = AddressSpace
+
+genericAddressSpace :: AddressSpace
+genericAddressSpace = addressSpace 0
+
+pointerIn :: (DynamicType t) => t -> AddressSpace -> Pointer t
+pointerIn typ space = Pointer . mkAnyType $ FFI.pointerType (typeRef (toAnyType typ)) (fromIntegral . fromAddressSpace $ space)
+
+pointer :: (DynamicType t) => t -> Pointer t
+pointer typ = pointerIn typ genericAddressSpace
+
+instance (DynamicType t) => DynamicType (Pointer t) where
+    toAnyType = mkAnyType . pointer . toAnyType . pointerElementType
+
+instance (DynamicType t) => Params (Pointer t) where
+    toAnyList a = [toAnyType a]
+    fromAnyList = fromAny
+
+vector :: (DynamicType t) => t -> Int -> Vector t
+vector typ len = Vector . mkAnyType $ FFI.vectorType (typeRef (toAnyType typ)) (fromIntegral len)
+
+instance (DynamicType t) => DynamicType (Vector t) where
+    toAnyType = mkAnyType . flip vector 0 . toAnyType . vectorElementType
+
+elementTypeDyn :: Type a => a -> AnyType
+elementTypeDyn = mkAnyType . FFI.getElementType . typeRef
diff --git a/LLVM/Core/Utils.hs b/LLVM/Core/Utils.hs
new file mode 100644
--- /dev/null
+++ b/LLVM/Core/Utils.hs
@@ -0,0 +1,41 @@
+module LLVM.Core.Utils
+    (
+      defineGlobal
+    , declareFunction
+    , defineFunction
+    ) where
+
+import Prelude hiding (mod)
+
+import qualified LLVM.Core as Core
+import qualified LLVM.Core.Builder as B
+import qualified LLVM.Core.Constant as C
+import qualified LLVM.Core.Type as T
+import qualified LLVM.Core.Value as V
+
+
+defineGlobal :: (V.ConstValue a, V.TypedValue a t) => T.Module -> String -> a
+             -> IO (V.GlobalVar t)
+defineGlobal mod name val = do
+  global <- Core.addGlobal mod (V.typeOf val) name
+  Core.setInitializer global val
+  return global
+
+declareFunction :: (T.DynamicType r, T.Params p)
+                   => T.Module -> String -> T.Function r p
+                   -> IO (V.Function r p)
+declareFunction mod name typ = do
+  maybeFunc <- Core.getNamedFunction mod name
+  case maybeFunc of
+    Nothing -> Core.addFunction mod name typ
+    Just func -> return $ let t = V.typeOf func
+                          in if T.elementTypeDyn t /= T.toAnyType typ
+                             then C.bitCast func (T.pointer typ)
+                             else func
+
+defineFunction :: T.Params p => T.Module -> String -> T.Function r p
+               -> IO (V.Function r p, B.BasicBlock)
+defineFunction mod name typ = do
+  func <- Core.addFunction mod name typ
+  bblk <- Core.appendBasicBlock func "entry"
+  return (func, bblk)
diff --git a/LLVM/Core/Value.hs b/LLVM/Core/Value.hs
new file mode 100644
--- /dev/null
+++ b/LLVM/Core/Value.hs
@@ -0,0 +1,312 @@
+{-# LANGUAGE
+    DeriveDataTypeable
+  , ExistentialQuantification
+  , FunctionalDependencies
+  , MultiParamTypeClasses
+  , UndecidableInstances
+  #-}
+
+module LLVM.Core.Value
+    (
+    -- * Values
+
+    -- * Opaque wrapper for LLVM's basic value type
+      AnyValue
+    , DynamicValue(..)
+    , mkAnyValue
+    , typeOfDyn
+
+    -- ** Type classes
+    , Value(..)
+    , Params(..)
+    , ConstValue
+    , GlobalValue
+    , GlobalVariable
+    , Arithmetic
+    , Integer
+    , Real
+    , Vector
+
+    , Global(..)
+    , GlobalVar(..)
+    , Function(..)
+    , TypedValue(..)
+    , Argument(..)
+
+    , Instruction(..)
+
+    -- * Constants
+    , ConstInt(..)
+    , ConstReal(..)
+    , ConstArray(..)
+
+    -- ** Useful functions
+    , params
+    , getName
+    , setName
+    , dumpValue
+    ) where
+
+import Control.Applicative ((<$>))
+import Data.Typeable (Typeable)
+import Foreign.C.String (peekCString, withCString)
+import Foreign.Marshal.Array (allocaArray, peekArray)
+import Foreign.Ptr (nullPtr)
+import Prelude hiding (Integer, Real)
+import System.IO.Unsafe (unsafePerformIO)
+
+import qualified LLVM.Core.FFI as FFI
+import LLVM.Core.Type ((:->)(..))
+import qualified LLVM.Core.Type as T
+
+-- import Debug.Trace
+
+
+class Value a where
+    valueRef :: a -> FFI.ValueRef
+    anyValue :: a -> AnyValue
+
+class DynamicValue a where
+    fromAnyValue :: AnyValue -> a
+
+class Params t v | t -> v where
+    fromAnyList :: t -> [AnyValue] -> (v, [AnyValue])
+
+-- | Recover the type of a value in a manner that preserves static
+-- type safety.
+class (T.Type t, Value v) => TypedValue v t | v -> t where
+    typeOf :: v                 -- ^ value is not inspected
+           -> t
+
+data AnyValue = forall a. Value a => AnyValue a
+                deriving (Typeable)
+
+instance DynamicValue AnyValue where
+    fromAnyValue = id
+
+instance Value FFI.ValueRef where
+    valueRef = id
+    anyValue = AnyValue
+
+mkAnyValue :: Value a => a -> AnyValue
+mkAnyValue = AnyValue
+
+class Value a => ConstValue a
+class Value a => Arithmetic a
+class Arithmetic a => Integer a
+class Arithmetic a => Real a
+class Arithmetic a => Vector a
+class ConstValue a => GlobalValue a
+class GlobalValue a => GlobalVariable a
+
+instance Value AnyValue where
+    valueRef (AnyValue a) = valueRef a
+    anyValue = id
+
+instance ConstValue AnyValue
+instance GlobalValue AnyValue
+instance GlobalVariable AnyValue
+instance Arithmetic AnyValue
+instance Integer AnyValue
+instance Real AnyValue
+
+getName :: Value v => v -> IO String
+getName v = do
+  namePtr <- FFI.getValueName (valueRef v)
+  if namePtr == nullPtr
+    then return []
+    else peekCString namePtr
+
+setName :: Value v => v -> String -> IO ()
+setName v name = withCString name (FFI.setValueName (valueRef v))
+
+dumpValue :: Value v => v -> IO ()
+dumpValue = FFI.dumpValue . valueRef
+
+newtype Instruction a = Instruction AnyValue
+    deriving (DynamicValue, Typeable, Value)
+
+newtype Global t = Global AnyValue
+    deriving (ConstValue, DynamicValue, GlobalValue, Typeable, Value)
+
+newtype GlobalVar t = GlobalVar AnyValue
+    deriving (ConstValue, DynamicValue, GlobalValue, GlobalVariable,
+              Typeable, Value)
+
+fromAny :: (DynamicValue v, TypedValue v t, T.Type t) => t -> [AnyValue] -> (v, [AnyValue])
+fromAny _ (x:xs) = (fromAnyValue x,xs)
+fromAny _ _ = error "LLVM.Core.Value.fromAny: empty list"
+
+globalVarType :: GlobalVar t -> t
+globalVarType _ = undefined
+
+instance T.Type t => TypedValue (GlobalVar t) t where
+    typeOf = globalVarType
+
+data Function r p = Function {
+      fromFunction :: AnyValue
+    }
+    deriving (Typeable)
+
+instance ConstValue (Function r p)
+instance GlobalValue (Function r p)
+instance GlobalVariable (Function r p)
+
+instance DynamicValue (Function r p) where
+    fromAnyValue = Function
+
+instance Value (Function r p) where
+    valueRef = valueRef . anyValue
+    anyValue = fromFunction
+
+newtype Argument t = Argument AnyValue
+    deriving (DynamicValue, Typeable, Value)
+
+instance (T.DynamicType r, T.Params p) => TypedValue (Function r p) (T.Function r p) where
+    typeOf _ = T.function undefined undefined
+
+instance (Params b c) => Params (a :-> b) (Argument a :-> c) where
+    fromAnyList t (x:xs) = let (y,ys) = fromAnyList (T.cdr t) xs
+                           in (Argument x :-> y,ys)
+    fromAnyList _ _ = error "LLVM.Core.Value.fromAnyList(:->): empty list"
+
+newtype ConstInt t = ConstInt AnyValue
+    deriving (Arithmetic, ConstValue, DynamicValue, Integer, Typeable, Value)
+
+instance TypedValue (ConstInt T.Int1) T.Int1 where
+    typeOf = T.int1
+
+instance TypedValue (Argument T.Int1) T.Int1 where
+    typeOf = T.int1
+
+instance TypedValue (Instruction T.Int1) T.Int1 where
+    typeOf = T.int1
+
+instance Params T.Int1 (Argument T.Int1) where
+    fromAnyList = fromAny
+
+instance TypedValue (ConstInt T.Int8) T.Int8 where
+    typeOf = T.int8
+
+instance TypedValue (Argument T.Int8) T.Int8 where
+    typeOf = T.int8
+
+instance TypedValue (Instruction T.Int8) T.Int8 where
+    typeOf = T.int8
+
+instance Params T.Int8 (Argument T.Int8) where
+    fromAnyList = fromAny
+
+instance TypedValue (ConstInt T.Int16) T.Int16 where
+    typeOf = T.int16
+
+instance TypedValue (Argument T.Int16) T.Int16 where
+    typeOf = T.int16
+
+instance Params T.Int16 (Argument T.Int16) where
+    fromAnyList = fromAny
+
+instance TypedValue (ConstInt T.Int32) T.Int32 where
+    typeOf = T.int32
+
+instance TypedValue (Argument T.Int32) T.Int32 where
+    typeOf = T.int32
+
+instance TypedValue (Instruction T.Int32) T.Int32 where
+    typeOf = T.int32
+
+instance Params T.Int32 (Argument T.Int32) where
+    fromAnyList = fromAny
+
+instance TypedValue (ConstInt T.Int64) T.Int64 where
+    typeOf = T.int64
+
+instance TypedValue (Argument T.Int64) T.Int64 where
+    typeOf = T.int64
+
+instance TypedValue (Instruction T.Int64) T.Int64 where
+    typeOf = T.int64
+
+instance Params T.Int64 (Argument T.Int64) where
+    fromAnyList = fromAny
+
+newtype ConstArray t = ConstArray AnyValue
+    deriving (ConstValue, DynamicValue, Typeable, Value)
+
+instance (T.DynamicType a) => TypedValue (ConstArray a) (T.Array a) where
+    typeOf _ = T.array undefined 0
+
+instance (T.DynamicType t) => TypedValue (Instruction (T.Array t)) (T.Array t) where
+    typeOf _ = T.array undefined 0
+
+instance (T.DynamicType t) => TypedValue (Instruction (T.Pointer t)) (T.Pointer t) where
+    typeOf _ = T.pointer undefined
+
+instance (T.DynamicType t) => Params (T.Pointer t) (Instruction (T.Pointer t)) where
+    fromAnyList = fromAny
+
+newtype ConstReal t = ConstReal AnyValue
+    deriving (Arithmetic, ConstValue, DynamicValue, Real, Typeable, Value)
+
+instance TypedValue (ConstReal T.Float) T.Float where
+    typeOf = T.float
+
+instance TypedValue (Argument T.Float) T.Float where
+    typeOf = T.float
+
+instance Params T.Float (Argument T.Float) where
+    fromAnyList = fromAny
+
+instance TypedValue (ConstReal T.Double) T.Double where
+    typeOf = T.double
+
+instance TypedValue (Argument T.Double) T.Double where
+    typeOf = T.double
+
+instance Params T.Double (Argument T.Double) where
+    fromAnyList = fromAny
+
+instance TypedValue (ConstReal T.X86Float80) T.X86Float80 where
+    typeOf = T.x86Float80
+
+instance TypedValue (Argument T.X86Float80) T.X86Float80 where
+    typeOf = T.x86Float80
+
+instance Params T.X86Float80 (Argument T.X86Float80) where
+    fromAnyList = fromAny
+
+instance TypedValue (ConstReal T.Float128) T.Float128 where
+    typeOf = T.float128
+
+instance TypedValue (Argument T.Float128) T.Float128 where
+    typeOf = T.float128
+
+instance Params T.Float128 (Argument T.Float128) where
+    fromAnyList = fromAny
+
+instance TypedValue (ConstReal T.PPCFloat128) T.PPCFloat128 where
+    typeOf = T.ppcFloat128
+
+instance TypedValue (Argument T.PPCFloat128) T.PPCFloat128 where
+    typeOf = T.ppcFloat128
+
+instance Params T.PPCFloat128 (Argument T.PPCFloat128) where
+    fromAnyList = fromAny
+
+countParams :: Function r p -> Int
+countParams = fromIntegral . FFI.countParams . valueRef
+
+listParams :: Function r p -> [AnyValue]
+listParams f = unsafePerformIO $ do
+  let len = countParams f
+  allocaArray len $ \ptr -> do
+    FFI.getParams (valueRef f) ptr
+    map mkAnyValue <$> peekArray len ptr
+
+params :: (T.DynamicType r, T.Params p, Params p v) => Function r p -> v
+params f = case fromAnyList (T.params (typeOf f)) (listParams f) of
+             (p, []) -> p
+             _ -> error "LLVM.Core.Value.params: incompletely consumed params"
+
+typeOfDyn :: Value a => a -> T.AnyType
+typeOfDyn val = unsafePerformIO $ T.mkAnyType <$> FFI.typeOf (valueRef val)
diff --git a/LLVM/ExecutionEngine.hs b/LLVM/ExecutionEngine.hs
new file mode 100644
--- /dev/null
+++ b/LLVM/ExecutionEngine.hs
@@ -0,0 +1,173 @@
+{-# LANGUAGE
+   DeriveDataTypeable
+  , FunctionalDependencies
+  , MultiParamTypeClasses
+  #-}
+
+module LLVM.ExecutionEngine
+    (
+    -- * Execution engines
+      ExecutionEngine
+    , createExecutionEngine
+    , runStaticConstructors
+    , runStaticDestructors
+    , runFunction
+
+    -- * Generic values
+    , GenericValue
+    , Generic(..)
+    ) where
+
+import Control.Applicative ((<$>))
+import Control.Exception (ioError)
+import Data.Int (Int8, Int16, Int32, Int64)
+import Data.Typeable (Typeable)
+import Data.Word (Word8, Word16, Word32, Word64)
+import Foreign.ForeignPtr (FinalizerPtr, ForeignPtr, newForeignPtr,
+                           withForeignPtr)
+import Foreign.C.String (peekCString)
+import Foreign.Marshal.Alloc (alloca, free)
+import Foreign.Marshal.Array (withArrayLen)
+import Foreign.Marshal.Utils (fromBool, toBool)
+import Foreign.Ptr (Ptr)
+import Foreign.Storable (peek)
+import System.IO.Error (userError)
+import System.IO.Unsafe (unsafePerformIO)
+
+import qualified LLVM.ExecutionEngine.FFI as FFI
+import qualified LLVM.Core.Type as T
+import qualified LLVM.Core.Value as V
+
+newtype ExecutionEngine = ExecutionEngine {
+      fromExecutionEngine :: ForeignPtr FFI.ExecutionEngine
+    }
+
+withExecutionEngine :: ExecutionEngine -> (Ptr FFI.ExecutionEngine -> IO a)
+                    -> IO a
+withExecutionEngine ee = withForeignPtr (fromExecutionEngine ee)
+
+createExecutionEngine :: T.ModuleProvider -> IO ExecutionEngine
+createExecutionEngine prov =
+    T.withModuleProvider prov $ \provPtr ->
+      alloca $ \eePtr ->
+        alloca $ \errPtr -> do
+          ret <- FFI.createExecutionEngine eePtr provPtr errPtr
+          if ret == 1
+            then do err <- peek errPtr
+                    errStr <- peekCString err
+                    free err
+                    ioError . userError $ errStr
+            else do ptr <- peek eePtr
+                    final <- h2c_ee FFI.disposeExecutionEngine
+                    ExecutionEngine <$> newForeignPtr final ptr
+
+foreign import ccall "wrapper" h2c_ee
+    :: (Ptr FFI.ExecutionEngine -> IO ()) -> IO (FinalizerPtr a)
+
+runStaticConstructors :: ExecutionEngine -> IO ()
+runStaticConstructors ee = withExecutionEngine ee FFI.runStaticConstructors
+
+runStaticDestructors :: ExecutionEngine -> IO ()
+runStaticDestructors ee = withExecutionEngine ee FFI.runStaticDestructors
+
+
+newtype GenericValue t = GenericValue {
+      fromGenericValue :: ForeignPtr FFI.GenericValue
+    }
+    deriving (Typeable)
+
+withGenericValue :: GenericValue t -> (FFI.GenericValueRef -> IO a) -> IO a
+withGenericValue = withForeignPtr . fromGenericValue
+
+createGenericValueWith :: IO FFI.GenericValueRef -> IO (GenericValue t)
+createGenericValueWith f = do
+  final <- h2c_genericValue FFI.disposeGenericValue
+  ptr <- f
+  GenericValue <$> newForeignPtr final ptr
+
+foreign import ccall "wrapper" h2c_genericValue
+    :: (FFI.GenericValueRef -> IO ()) -> IO (FinalizerPtr a)
+
+withAll :: [GenericValue t] -> (Int -> Ptr FFI.GenericValueRef -> IO a) -> IO a
+withAll ps a = go [] ps
+    where go ptrs (x:xs) = withGenericValue x $ \ptr -> go (ptr:ptrs) xs
+          go ptrs _ = withArrayLen (reverse ptrs) a
+                   
+runFunction :: ExecutionEngine -> V.Function r p -> [GenericValue t]
+            -> IO (GenericValue r)
+runFunction ee func args =
+    withExecutionEngine ee $ \eePtr ->
+      withAll args $ \argLen argPtr ->
+        createGenericValueWith $ FFI.runFunction eePtr (V.valueRef func)
+                                        (fromIntegral argLen) argPtr
+
+class Generic a t | a -> t where
+    createGeneric :: a -> IO (GenericValue t)
+    fromGeneric :: GenericValue t -> a
+
+toGenericInt :: (Integral a, T.Type t) => (b -> t) -> Bool -> a -> IO (GenericValue t)
+toGenericInt typf signed val = createGenericValueWith $
+    FFI.createGenericValueOfInt (T.typeRef (typf undefined))
+           (fromIntegral val) (fromBool signed)
+
+fromGenericInt :: (Integral a, T.Type t) => Bool -> GenericValue t -> a
+fromGenericInt signed val = unsafePerformIO $
+    withGenericValue val $ \ref ->
+      return . fromIntegral $ FFI.genericValueToInt ref (fromBool signed)
+
+instance Generic Bool T.Int1 where
+    createGeneric = toGenericInt T.int1 False . fromBool
+    fromGeneric = toBool . fromGenericInt False
+
+instance Generic Int8 T.Int8 where
+    createGeneric = toGenericInt T.int8 True . fromIntegral
+    fromGeneric = fromIntegral . fromGenericInt True
+
+instance Generic Int16 T.Int16 where
+    createGeneric = toGenericInt T.int16 True . fromIntegral
+    fromGeneric = fromIntegral . fromGenericInt True
+
+instance Generic Int32 T.Int32 where
+    createGeneric = toGenericInt T.int32 True . fromIntegral
+    fromGeneric = fromIntegral . fromGenericInt True
+
+instance Generic Int T.Int32 where
+    createGeneric = toGenericInt T.int32 True . fromIntegral
+    fromGeneric = fromIntegral . fromGenericInt True
+
+instance Generic Int64 T.Int64 where
+    createGeneric = toGenericInt T.int64 True . fromIntegral
+    fromGeneric = fromIntegral . fromGenericInt True
+
+instance Generic Word8 T.Int8 where
+    createGeneric = toGenericInt T.int8 False . fromIntegral
+    fromGeneric = fromIntegral . fromGenericInt False
+
+instance Generic Word16 T.Int16 where
+    createGeneric = toGenericInt T.int16 False . fromIntegral
+    fromGeneric = fromIntegral . fromGenericInt False
+
+instance Generic Word32 T.Int32 where
+    createGeneric = toGenericInt T.int32 False . fromIntegral
+    fromGeneric = fromIntegral . fromGenericInt False
+
+instance Generic Word64 T.Int64 where
+    createGeneric = toGenericInt T.int64 False . fromIntegral
+    fromGeneric = fromIntegral . fromGenericInt False
+
+toGenericReal :: (Real a, T.Type t) => t -> a -> IO (GenericValue t)
+toGenericReal typ val = createGenericValueWith $
+    FFI.createGenericValueOfFloat (T.typeRef typ) (realToFrac val)
+
+fromGenericReal :: (Fractional a, T.Type t) => GenericValue t -> a
+fromGenericReal val = unsafePerformIO $
+    withGenericValue val $ \ref ->
+      return . realToFrac $ FFI.genericValueToFloat ref
+
+instance Generic Float T.Float where
+    createGeneric = toGenericReal undefined
+    fromGeneric = fromGenericReal
+
+instance Generic Double T.Double where
+    createGeneric = toGenericReal undefined
+    fromGeneric = fromGenericReal
diff --git a/LLVM/ExecutionEngine/FFI.hsc b/LLVM/ExecutionEngine/FFI.hsc
new file mode 100644
--- /dev/null
+++ b/LLVM/ExecutionEngine/FFI.hsc
@@ -0,0 +1,69 @@
+{-# LANGUAGE EmptyDataDecls #-}
+
+module LLVM.ExecutionEngine.FFI
+    (
+    -- * Execution engines
+      ExecutionEngine
+    , createExecutionEngine
+    , disposeExecutionEngine
+    , runStaticConstructors
+    , runStaticDestructors
+    , runFunction
+
+    -- * Generic values
+    , GenericValue
+    , GenericValueRef
+    , createGenericValueOfInt
+    , genericValueToInt
+    , createGenericValueOfFloat
+    , genericValueToFloat
+    , disposeGenericValue
+    ) where
+
+import Foreign.C.String (CString)
+import Foreign.C.Types (CDouble, CInt, CUInt, CULLong)
+import Foreign.Ptr (Ptr)
+
+import LLVM.Core.FFI (ModuleProviderRef, TypeRef, ValueRef)
+
+#include <llvm-c/ExecutionEngine.h>
+
+data ExecutionEngine
+type ExecutionEngineRef = Ptr ExecutionEngine
+
+foreign import ccall unsafe "LLVMCreateExecutionEngine" createExecutionEngine
+    :: Ptr ExecutionEngineRef -> ModuleProviderRef -> Ptr CString
+    -> IO CInt
+
+foreign import ccall unsafe "LLVMDisposeExecutionEngine" disposeExecutionEngine
+    :: ExecutionEngineRef -> IO ()
+
+foreign import ccall unsafe "LLVMRunStaticConstructors" runStaticConstructors
+    :: ExecutionEngineRef -> IO ()
+
+foreign import ccall unsafe "LLVMRunStaticDestructors" runStaticDestructors
+    :: ExecutionEngineRef -> IO ()
+
+
+data GenericValue
+type GenericValueRef = Ptr GenericValue
+
+foreign import ccall unsafe "LLVMCreateGenericValueOfInt"
+    createGenericValueOfInt :: TypeRef -> CULLong -> CInt
+                            -> IO GenericValueRef
+
+foreign import ccall unsafe "LLVMGenericValueToInt" genericValueToInt
+    :: GenericValueRef -> CInt -> CULLong
+
+foreign import ccall unsafe "LLVMCreateGenericValueOfFloat"
+    createGenericValueOfFloat :: TypeRef -> CDouble -> IO GenericValueRef
+
+foreign import ccall unsafe "LLVMGenericValueToFloat" genericValueToFloat
+    :: GenericValueRef -> CDouble
+
+foreign import ccall unsafe "LLVMDisposeGenericValue" disposeGenericValue
+    :: GenericValueRef -> IO ()
+
+foreign import ccall unsafe "LLVMRunFunction" runFunction
+    :: ExecutionEngineRef -> ValueRef -> CUInt
+    -> Ptr GenericValueRef -> IO GenericValueRef
diff --git a/Makefile b/Makefile
new file mode 100644
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,44 @@
+ghc := ghc
+ghcflags := -Wall -Werror
+
+llvm_prefix ?= $(HOME)
+prefix ?= $(HOME)
+_lib := $(shell test -d /usr/lib64 && echo lib64 || echo lib)
+
+ifeq ($(prefix),$(HOME))
+user_flag := --user
+endif
+
+all: build
+
+.PHONY: build
+build: dist/setup-config
+	./setup build
+
+dist/setup-config: setup configure llvm.cabal llvm.buildinfo.in
+	./setup configure --prefix=$(prefix) --libdir=$(prefix)/$(_lib) \
+	    --configure-option --with-llvm-prefix=$(llvm_prefix) $(user_flag)
+
+setup: Setup.lhs
+	$(ghc) --make -O -o $@ $<
+
+configure: configure.ac
+	autoreconf
+
+.PHONY: examples
+examples:
+	$(MAKE) -C examples
+
+sdist: dist/setup-config
+	./setup sdist
+
+.PHONY: install
+install: setup
+	./setup install
+
+clean:
+	-rm -f Setup.hi Setup.hi
+	-./setup clean
+
+distclean: clean
+	-rm -f setup configure
diff --git a/PROBLEMS.txt b/PROBLEMS.txt
new file mode 100644
--- /dev/null
+++ b/PROBLEMS.txt
@@ -0,0 +1,20 @@
+Known problems
+--------------
+
+If you have solutions to any of the problems listed below, please let
+me know, or better yet, send a patch.  Thanks!
+
+
+Can't use LLVM bindings from ghci
+---------------------------------
+
+When I try to use the LLVM bindings in ghci, on Linux, loading the
+bindings succeeds, but trying to do anything fails:
+
+  $ ghci
+  Prelude> :m +LLVM.Core
+  Prelude LLVM.Core> m <- createModule "foo"
+  can't load .so/.DLL for: stdc++ (libstdc++.so: cannot open shared
+    object file: No such file or directory)
+
+I don't know why this happens, but it looks like a ghci bug.
diff --git a/README.txt b/README.txt
new file mode 100644
--- /dev/null
+++ b/README.txt
@@ -0,0 +1,40 @@
+Haskell LLVM bindings
+---------------------
+
+This package provides Haskell bindings for the popular LLVM compiler
+infrastructure project.  If you don't know what LLVM is, the main LLVM
+home page is here:
+
+  http://llvm.org/
+
+
+Package status - what to expect
+-------------------------------
+
+This package is under heavy development.  I've released it quite early
+in order to solicit comments and help from interested parties.
+
+The bindings are currently incomplete, so there are some severe limits
+on what you can do.  Adding new functions is generally easy, though,
+so don't be afraid to get your hands dirty.
+
+Also, the type safety of various functions is a bit dubious.  The
+underlying C bindings to LLVM throw away almost all type information,
+so we have to reconstruct types in Haskell.  I'm still working on
+straightening things out.
+
+Please expect the sands to shift under your feet quite rapidly for a
+little while as I add functionality, improve the interfaces, and
+generally flesh the bindings out to be thoroughly useful.
+
+
+Jump in and help!
+-----------------
+
+I welcome your comments and contributions.  You can send email to me
+at <bos@serpentine.com>.  If you want to send patches, please get a
+copy of the darcs repository:
+
+  darcs get http://darcs.serpentine.com/llvm
+
+Thanks!
diff --git a/Setup.lhs b/Setup.lhs
new file mode 100644
--- /dev/null
+++ b/Setup.lhs
@@ -0,0 +1,3 @@
+#!/usr/bin/env runhaskell
+> import Distribution.Simple
+> main = defaultMainWithHooks defaultUserHooks
diff --git a/configure b/configure
new file mode 100644
--- /dev/null
+++ b/configure
@@ -0,0 +1,4943 @@
+#! /bin/sh
+# Guess values for system-dependent variables and create Makefiles.
+# Generated by GNU Autoconf 2.61 for Haskell LLVM bindings 0.0.2.
+#
+# Report bugs to <bos@serpentine.com>.
+#
+# 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 more Bourne compatible
+DUALCASE=1; export DUALCASE # for MKS sh
+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
+
+
+
+
+# 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 /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
+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
+
+
+:
+_ASEOF
+}; then
+  CONFIG_SHELL=$as_shell
+	       as_have_required=yes
+	       if { "$as_shell" 2> /dev/null <<\_ASEOF
+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
+
+
+:
+(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
+
+if test -x / >/dev/null 2>&1; then
+  as_test_x='test -x'
+else
+  if ls -dL / >/dev/null 2>&1; then
+    as_ls_L_option=L
+  else
+    as_ls_L_option=
+  fi
+  as_test_x='
+    eval sh -c '\''
+      if test -d "$1"; then
+        test -d "$1/.";
+      else
+	case $1 in
+        -*)set "./$1";;
+	esac;
+	case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in
+	???[sx]*):;;*)false;;esac;fi
+    '\'' sh
+  '
+fi
+as_executable_p=$as_test_x
+
+# 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='Haskell LLVM bindings'
+PACKAGE_TARNAME='llvm'
+PACKAGE_VERSION='0.0.2'
+PACKAGE_STRING='Haskell LLVM bindings 0.0.2'
+PACKAGE_BUGREPORT='bos@serpentine.com'
+
+ac_unique_file="LLVM/ExecutionEngine.hs"
+# Factoring default headers for most tests.
+ac_includes_default="\
+#include <stdio.h>
+#ifdef HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+#ifdef HAVE_SYS_STAT_H
+# include <sys/stat.h>
+#endif
+#ifdef STDC_HEADERS
+# include <stdlib.h>
+# include <stddef.h>
+#else
+# ifdef HAVE_STDLIB_H
+#  include <stdlib.h>
+# endif
+#endif
+#ifdef HAVE_STRING_H
+# if !defined STDC_HEADERS && defined HAVE_MEMORY_H
+#  include <memory.h>
+# endif
+# include <string.h>
+#endif
+#ifdef HAVE_STRINGS_H
+# include <strings.h>
+#endif
+#ifdef HAVE_INTTYPES_H
+# include <inttypes.h>
+#endif
+#ifdef HAVE_STDINT_H
+# include <stdint.h>
+#endif
+#ifdef HAVE_UNISTD_H
+# include <unistd.h>
+#endif"
+
+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
+CXX
+CXXFLAGS
+LDFLAGS
+CPPFLAGS
+ac_ct_CXX
+EXEEXT
+OBJEXT
+llvm_config
+CC
+CFLAGS
+ac_ct_CC
+CPP
+GREP
+EGREP
+llvm_cppflags llvm_engine_libs llvm_includedir llvm_ldflags
+LIBOBJS
+LTLIBOBJS'
+ac_subst_files=''
+      ac_precious_vars='build_alias
+host_alias
+target_alias
+CXX
+CXXFLAGS
+LDFLAGS
+LIBS
+CPPFLAGS
+CCC
+CC
+CFLAGS
+CPP'
+
+
+# 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_TARNAME}'
+infodir='${datarootdir}/info'
+htmldir='${docdir}'
+dvidir='${docdir}'
+pdfdir='${docdir}'
+psdir='${docdir}'
+libdir='${exec_prefix}/lib'
+localedir='${datarootdir}/locale'
+mandir='${datarootdir}/man'
+
+ac_prev=
+ac_dashdash=
+for ac_option
+do
+  # If the previous option needs an argument, assign it.
+  if test -n "$ac_prev"; then
+    eval $ac_prev=\$ac_option
+    ac_prev=
+    continue
+  fi
+
+  case $ac_option in
+  *=*)	ac_optarg=`expr "X$ac_option" : '[^=]*=\(.*\)'` ;;
+  *)	ac_optarg=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 Haskell LLVM bindings 0.0.2 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/llvm]
+  --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
+  case $ac_init_help in
+     short | recursive ) echo "Configuration of Haskell LLVM bindings 0.0.2:";;
+   esac
+  cat <<\_ACEOF
+
+Optional Packages:
+  --with-PACKAGE[=ARG]    use PACKAGE [ARG=yes]
+  --without-PACKAGE       do not use PACKAGE (same as --with-PACKAGE=no)
+  --with-llvm-prefix      use the version of LLVM at the given location
+  --with-llvm-bindir      use LLVM binaries at the given location
+
+Some influential environment variables:
+  CXX         C++ compiler command
+  CXXFLAGS    C++ compiler flags
+  LDFLAGS     linker flags, e.g. -L<lib dir> if you have libraries in a
+              nonstandard directory <lib dir>
+  LIBS        libraries to pass to the linker, e.g. -l<library>
+  CPPFLAGS    C/C++/Objective C preprocessor flags, e.g. -I<include dir> if
+              you have headers in a nonstandard directory <include dir>
+  CC          C compiler command
+  CFLAGS      C compiler flags
+  CPP         C preprocessor
+
+Use these variables to override the choices made by `configure' or to help
+it to find libraries and programs with nonstandard names/locations.
+
+Report bugs to <bos@serpentine.com>.
+_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
+Haskell LLVM bindings configure 0.0.2
+generated by GNU Autoconf 2.61
+
+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 Haskell LLVM bindings $as_me 0.0.2, which was
+generated by GNU Autoconf 2.61.  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
+
+
+
+
+
+ac_config_files="$ac_config_files llvm.buildinfo"
+
+
+ac_ext=cpp
+ac_cpp='$CXXCPP $CPPFLAGS'
+ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
+if test -z "$CXX"; then
+  if test -n "$CCC"; then
+    CXX=$CCC
+  else
+    if test -n "$ac_tool_prefix"; then
+  for ac_prog in g++ c++ gpp aCC CC cxx cc++ cl.exe FCC KCC RCC xlC_r xlC
+  do
+    # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args.
+set dummy $ac_tool_prefix$ac_prog; ac_word=$2
+{ echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+if test "${ac_cv_prog_CXX+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test -n "$CXX"; then
+  ac_cv_prog_CXX="$CXX" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_prog_CXX="$ac_tool_prefix$ac_prog"
+    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+done
+IFS=$as_save_IFS
+
+fi
+fi
+CXX=$ac_cv_prog_CXX
+if test -n "$CXX"; then
+  { echo "$as_me:$LINENO: result: $CXX" >&5
+echo "${ECHO_T}$CXX" >&6; }
+else
+  { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
+fi
+
+
+    test -n "$CXX" && break
+  done
+fi
+if test -z "$CXX"; then
+  ac_ct_CXX=$CXX
+  for ac_prog in g++ c++ gpp aCC CC cxx cc++ cl.exe FCC KCC RCC xlC_r xlC
+do
+  # Extract the first word of "$ac_prog", so it can be a program name with args.
+set dummy $ac_prog; 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_prog_ac_ct_CXX+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test -n "$ac_ct_CXX"; then
+  ac_cv_prog_ac_ct_CXX="$ac_ct_CXX" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_prog_ac_ct_CXX="$ac_prog"
+    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_CXX=$ac_cv_prog_ac_ct_CXX
+if test -n "$ac_ct_CXX"; then
+  { echo "$as_me:$LINENO: result: $ac_ct_CXX" >&5
+echo "${ECHO_T}$ac_ct_CXX" >&6; }
+else
+  { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
+fi
+
+
+  test -n "$ac_ct_CXX" && break
+done
+
+  if test "x$ac_ct_CXX" = x; then
+    CXX="g++"
+  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
+    CXX=$ac_ct_CXX
+  fi
+fi
+
+  fi
+fi
+# Provide some information about the compiler.
+echo "$as_me:$LINENO: checking for C++ compiler version" >&5
+ac_compiler=`set X $ac_compile; echo $2`
+{ (ac_try="$ac_compiler --version >&5"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_compiler --version >&5") 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }
+{ (ac_try="$ac_compiler -v >&5"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_compiler -v >&5") 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }
+{ (ac_try="$ac_compiler -V >&5"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_compiler -V >&5") 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }
+
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+ac_clean_files_save=$ac_clean_files
+ac_clean_files="$ac_clean_files a.out a.exe b.out"
+# Try to create an executable without -o first, disregard a.out.
+# It will help us diagnose broken compilers, and finding out an intuition
+# of exeext.
+{ echo "$as_me:$LINENO: checking for C++ compiler default output file name" >&5
+echo $ECHO_N "checking for C++ compiler default output file name... $ECHO_C" >&6; }
+ac_link_default=`echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'`
+#
+# List of possible output files, starting from the most likely.
+# The algorithm is not robust to junk in `.', hence go to wildcards (a.*)
+# only as a last resort.  b.out is created by i960 compilers.
+ac_files='a_out.exe a.exe conftest.exe a.out conftest a.* conftest.* b.out'
+#
+# The IRIX 6 linker writes into existing files which may not be
+# executable, retaining their permissions.  Remove them first so a
+# subsequent execution test works.
+ac_rmfiles=
+for ac_file in $ac_files
+do
+  case $ac_file in
+    *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.o | *.obj ) ;;
+    * ) ac_rmfiles="$ac_rmfiles $ac_file";;
+  esac
+done
+rm -f $ac_rmfiles
+
+if { (ac_try="$ac_link_default"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_link_default") 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; then
+  # Autoconf-2.13 could set the ac_cv_exeext variable to `no'.
+# So ignore a value of `no', otherwise this would lead to `EXEEXT = no'
+# in a Makefile.  We should not override ac_cv_exeext if it was cached,
+# so that the user can short-circuit this test for compilers unknown to
+# Autoconf.
+for ac_file in $ac_files ''
+do
+  test -f "$ac_file" || continue
+  case $ac_file in
+    *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.o | *.obj )
+	;;
+    [ab].out )
+	# We found the default executable, but exeext='' is most
+	# certainly right.
+	break;;
+    *.* )
+        if test "${ac_cv_exeext+set}" = set && test "$ac_cv_exeext" != no;
+	then :; else
+	   ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'`
+	fi
+	# We set ac_cv_exeext here because the later test for it is not
+	# safe: cross compilers may not add the suffix if given an `-o'
+	# argument, so we may need to know it at that point already.
+	# Even if this section looks crufty: it has the advantage of
+	# actually working.
+	break;;
+    * )
+	break;;
+  esac
+done
+test "$ac_cv_exeext" = no && ac_cv_exeext=
+
+else
+  ac_file=''
+fi
+
+{ echo "$as_me:$LINENO: result: $ac_file" >&5
+echo "${ECHO_T}$ac_file" >&6; }
+if test -z "$ac_file"; then
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+{ { echo "$as_me:$LINENO: error: C++ compiler cannot create executables
+See \`config.log' for more details." >&5
+echo "$as_me: error: C++ compiler cannot create executables
+See \`config.log' for more details." >&2;}
+   { (exit 77); exit 77; }; }
+fi
+
+ac_exeext=$ac_cv_exeext
+
+# Check that the compiler produces executables we can run.  If not, either
+# the compiler is broken, or we cross compile.
+{ echo "$as_me:$LINENO: checking whether the C++ compiler works" >&5
+echo $ECHO_N "checking whether the C++ compiler works... $ECHO_C" >&6; }
+# FIXME: These cross compiler hacks should be removed for Autoconf 3.0
+# If not cross compiling, check that we can run a simple program.
+if test "$cross_compiling" != yes; then
+  if { ac_try='./$ac_file'
+  { (case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_try") 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+    cross_compiling=no
+  else
+    if test "$cross_compiling" = maybe; then
+	cross_compiling=yes
+    else
+	{ { echo "$as_me:$LINENO: error: cannot run C++ compiled programs.
+If you meant to cross compile, use \`--host'.
+See \`config.log' for more details." >&5
+echo "$as_me: error: cannot run C++ compiled programs.
+If you meant to cross compile, use \`--host'.
+See \`config.log' for more details." >&2;}
+   { (exit 1); exit 1; }; }
+    fi
+  fi
+fi
+{ echo "$as_me:$LINENO: result: yes" >&5
+echo "${ECHO_T}yes" >&6; }
+
+rm -f a.out a.exe conftest$ac_cv_exeext b.out
+ac_clean_files=$ac_clean_files_save
+# Check that the compiler produces executables we can run.  If not, either
+# the compiler is broken, or we cross compile.
+{ echo "$as_me:$LINENO: checking whether we are cross compiling" >&5
+echo $ECHO_N "checking whether we are cross compiling... $ECHO_C" >&6; }
+{ echo "$as_me:$LINENO: result: $cross_compiling" >&5
+echo "${ECHO_T}$cross_compiling" >&6; }
+
+{ echo "$as_me:$LINENO: checking for suffix of executables" >&5
+echo $ECHO_N "checking for suffix of executables... $ECHO_C" >&6; }
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_link") 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; then
+  # If both `conftest.exe' and `conftest' are `present' (well, observable)
+# catch `conftest.exe'.  For instance with Cygwin, `ls conftest' will
+# work properly (i.e., refer to `conftest.exe'), while it won't with
+# `rm'.
+for ac_file in conftest.exe conftest conftest.*; do
+  test -f "$ac_file" || continue
+  case $ac_file in
+    *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.o | *.obj ) ;;
+    *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'`
+	  break;;
+    * ) break;;
+  esac
+done
+else
+  { { echo "$as_me:$LINENO: error: cannot compute suffix of executables: cannot compile and link
+See \`config.log' for more details." >&5
+echo "$as_me: error: cannot compute suffix of executables: cannot compile and link
+See \`config.log' for more details." >&2;}
+   { (exit 1); exit 1; }; }
+fi
+
+rm -f conftest$ac_cv_exeext
+{ echo "$as_me:$LINENO: result: $ac_cv_exeext" >&5
+echo "${ECHO_T}$ac_cv_exeext" >&6; }
+
+rm -f conftest.$ac_ext
+EXEEXT=$ac_cv_exeext
+ac_exeext=$EXEEXT
+{ echo "$as_me:$LINENO: checking for suffix of object files" >&5
+echo $ECHO_N "checking for suffix of object files... $ECHO_C" >&6; }
+if test "${ac_cv_objext+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.o conftest.obj
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_compile") 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; then
+  for ac_file in conftest.o conftest.obj conftest.*; do
+  test -f "$ac_file" || continue;
+  case $ac_file in
+    *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf ) ;;
+    *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'`
+       break;;
+  esac
+done
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+{ { echo "$as_me:$LINENO: error: cannot compute suffix of object files: cannot compile
+See \`config.log' for more details." >&5
+echo "$as_me: error: cannot compute suffix of object files: cannot compile
+See \`config.log' for more details." >&2;}
+   { (exit 1); exit 1; }; }
+fi
+
+rm -f conftest.$ac_cv_objext conftest.$ac_ext
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_objext" >&5
+echo "${ECHO_T}$ac_cv_objext" >&6; }
+OBJEXT=$ac_cv_objext
+ac_objext=$OBJEXT
+{ echo "$as_me:$LINENO: checking whether we are using the GNU C++ compiler" >&5
+echo $ECHO_N "checking whether we are using the GNU C++ compiler... $ECHO_C" >&6; }
+if test "${ac_cv_cxx_compiler_gnu+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+int
+main ()
+{
+#ifndef __GNUC__
+       choke me
+#endif
+
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_compile") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+	 test -z "$ac_cxx_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
+  ac_compiler_gnu=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	ac_compiler_gnu=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+ac_cv_cxx_compiler_gnu=$ac_compiler_gnu
+
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_cxx_compiler_gnu" >&5
+echo "${ECHO_T}$ac_cv_cxx_compiler_gnu" >&6; }
+GXX=`test $ac_compiler_gnu = yes && echo yes`
+ac_test_CXXFLAGS=${CXXFLAGS+set}
+ac_save_CXXFLAGS=$CXXFLAGS
+{ echo "$as_me:$LINENO: checking whether $CXX accepts -g" >&5
+echo $ECHO_N "checking whether $CXX accepts -g... $ECHO_C" >&6; }
+if test "${ac_cv_prog_cxx_g+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  ac_save_cxx_werror_flag=$ac_cxx_werror_flag
+   ac_cxx_werror_flag=yes
+   ac_cv_prog_cxx_g=no
+   CXXFLAGS="-g"
+   cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_compile") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+	 test -z "$ac_cxx_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
+  ac_cv_prog_cxx_g=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	CXXFLAGS=""
+      cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_compile") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+	 test -z "$ac_cxx_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
+  :
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	ac_cxx_werror_flag=$ac_save_cxx_werror_flag
+	 CXXFLAGS="-g"
+	 cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_compile") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+	 test -z "$ac_cxx_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
+  ac_cv_prog_cxx_g=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+   ac_cxx_werror_flag=$ac_save_cxx_werror_flag
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_prog_cxx_g" >&5
+echo "${ECHO_T}$ac_cv_prog_cxx_g" >&6; }
+if test "$ac_test_CXXFLAGS" = set; then
+  CXXFLAGS=$ac_save_CXXFLAGS
+elif test $ac_cv_prog_cxx_g = yes; then
+  if test "$GXX" = yes; then
+    CXXFLAGS="-g -O2"
+  else
+    CXXFLAGS="-g"
+  fi
+else
+  if test "$GXX" = yes; then
+    CXXFLAGS="-O2"
+  else
+    CXXFLAGS=
+  fi
+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
+
+
+
+# Check whether --with-llvm_prefix was given.
+if test "${with_llvm_prefix+set}" = set; then
+  withval=$with_llvm_prefix; llvm_prefix="$withval"
+else
+  llvm_prefix=/usr/local
+fi
+
+
+# Check whether --with-llvm_bindir was given.
+if test "${with_llvm_bindir+set}" = set; then
+  withval=$with_llvm_bindir; llvm_bindir="$withval"
+else
+  llvm_bindir="$llvm_prefix/bin"
+fi
+
+# Extract the first word of "llvm-config", so it can be a program name with args.
+set dummy llvm-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_llvm_config+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  case $llvm_config in
+  [\\/]* | ?:[\\/]*)
+  ac_cv_path_llvm_config="$llvm_config" # Let the user override the test with a path.
+  ;;
+  *)
+  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $llvm_bindir
+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_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_path_llvm_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
+
+  test -z "$ac_cv_path_llvm_config" && ac_cv_path_llvm_config="{ { echo "$as_me:$LINENO: error: could not find llvm-config in $llvm_bindir" >&5
+echo "$as_me: error: could not find llvm-config in $llvm_bindir" >&2;}
+   { (exit 1); exit 1; }; }"
+  ;;
+esac
+fi
+llvm_config=$ac_cv_path_llvm_config
+if test -n "$llvm_config"; then
+  { echo "$as_me:$LINENO: result: $llvm_config" >&5
+echo "${ECHO_T}$llvm_config" >&6; }
+else
+  { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
+fi
+
+
+
+llvm_cppflags="`$llvm_config --cppflags`"
+llvm_includedir="`$llvm_config --includedir`"
+llvm_ldflags="`$llvm_config --ldflags`"
+
+llvm_engine_libs="`$llvm_config --libs engine`"
+
+CPPFLAGS="$llvm_cppflags $CPPFLAGS"
+LDFLAGS="$llvm_ldflags $LDFLAGS"
+
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+if test -n "$ac_tool_prefix"; then
+  # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args.
+set dummy ${ac_tool_prefix}gcc; ac_word=$2
+{ echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+if test "${ac_cv_prog_CC+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test -n "$CC"; then
+  ac_cv_prog_CC="$CC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_prog_CC="${ac_tool_prefix}gcc"
+    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+done
+IFS=$as_save_IFS
+
+fi
+fi
+CC=$ac_cv_prog_CC
+if test -n "$CC"; then
+  { echo "$as_me:$LINENO: result: $CC" >&5
+echo "${ECHO_T}$CC" >&6; }
+else
+  { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
+fi
+
+
+fi
+if test -z "$ac_cv_prog_CC"; then
+  ac_ct_CC=$CC
+  # Extract the first word of "gcc", so it can be a program name with args.
+set dummy gcc; ac_word=$2
+{ echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+if test "${ac_cv_prog_ac_ct_CC+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test -n "$ac_ct_CC"; then
+  ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_prog_ac_ct_CC="gcc"
+    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_CC=$ac_cv_prog_ac_ct_CC
+if test -n "$ac_ct_CC"; then
+  { echo "$as_me:$LINENO: result: $ac_ct_CC" >&5
+echo "${ECHO_T}$ac_ct_CC" >&6; }
+else
+  { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
+fi
+
+  if test "x$ac_ct_CC" = x; then
+    CC=""
+  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
+    CC=$ac_ct_CC
+  fi
+else
+  CC="$ac_cv_prog_CC"
+fi
+
+if test -z "$CC"; then
+          if test -n "$ac_tool_prefix"; then
+    # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args.
+set dummy ${ac_tool_prefix}cc; ac_word=$2
+{ echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+if test "${ac_cv_prog_CC+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test -n "$CC"; then
+  ac_cv_prog_CC="$CC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_prog_CC="${ac_tool_prefix}cc"
+    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+done
+IFS=$as_save_IFS
+
+fi
+fi
+CC=$ac_cv_prog_CC
+if test -n "$CC"; then
+  { echo "$as_me:$LINENO: result: $CC" >&5
+echo "${ECHO_T}$CC" >&6; }
+else
+  { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
+fi
+
+
+  fi
+fi
+if test -z "$CC"; then
+  # Extract the first word of "cc", so it can be a program name with args.
+set dummy cc; ac_word=$2
+{ echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+if test "${ac_cv_prog_CC+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test -n "$CC"; then
+  ac_cv_prog_CC="$CC" # Let the user override the test.
+else
+  ac_prog_rejected=no
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then
+       ac_prog_rejected=yes
+       continue
+     fi
+    ac_cv_prog_CC="cc"
+    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+done
+IFS=$as_save_IFS
+
+if test $ac_prog_rejected = yes; then
+  # We found a bogon in the path, so make sure we never use it.
+  set dummy $ac_cv_prog_CC
+  shift
+  if test $# != 0; then
+    # We chose a different compiler from the bogus one.
+    # However, it has the same basename, so the bogon will be chosen
+    # first if we set CC to just the basename; use the full file name.
+    shift
+    ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@"
+  fi
+fi
+fi
+fi
+CC=$ac_cv_prog_CC
+if test -n "$CC"; then
+  { echo "$as_me:$LINENO: result: $CC" >&5
+echo "${ECHO_T}$CC" >&6; }
+else
+  { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
+fi
+
+
+fi
+if test -z "$CC"; then
+  if test -n "$ac_tool_prefix"; then
+  for ac_prog in cl.exe
+  do
+    # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args.
+set dummy $ac_tool_prefix$ac_prog; ac_word=$2
+{ echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+if test "${ac_cv_prog_CC+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test -n "$CC"; then
+  ac_cv_prog_CC="$CC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_prog_CC="$ac_tool_prefix$ac_prog"
+    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+done
+IFS=$as_save_IFS
+
+fi
+fi
+CC=$ac_cv_prog_CC
+if test -n "$CC"; then
+  { echo "$as_me:$LINENO: result: $CC" >&5
+echo "${ECHO_T}$CC" >&6; }
+else
+  { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
+fi
+
+
+    test -n "$CC" && break
+  done
+fi
+if test -z "$CC"; then
+  ac_ct_CC=$CC
+  for ac_prog in cl.exe
+do
+  # Extract the first word of "$ac_prog", so it can be a program name with args.
+set dummy $ac_prog; ac_word=$2
+{ echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+if test "${ac_cv_prog_ac_ct_CC+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test -n "$ac_ct_CC"; then
+  ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_prog_ac_ct_CC="$ac_prog"
+    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_CC=$ac_cv_prog_ac_ct_CC
+if test -n "$ac_ct_CC"; then
+  { echo "$as_me:$LINENO: result: $ac_ct_CC" >&5
+echo "${ECHO_T}$ac_ct_CC" >&6; }
+else
+  { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
+fi
+
+
+  test -n "$ac_ct_CC" && break
+done
+
+  if test "x$ac_ct_CC" = x; then
+    CC=""
+  else
+    case $cross_compiling:$ac_tool_warned in
+yes:)
+{ 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
+    CC=$ac_ct_CC
+  fi
+fi
+
+fi
+
+
+test -z "$CC" && { { echo "$as_me:$LINENO: error: no acceptable C compiler found in \$PATH
+See \`config.log' for more details." >&5
+echo "$as_me: error: no acceptable C compiler found in \$PATH
+See \`config.log' for more details." >&2;}
+   { (exit 1); exit 1; }; }
+
+# Provide some information about the compiler.
+echo "$as_me:$LINENO: checking for C compiler version" >&5
+ac_compiler=`set X $ac_compile; echo $2`
+{ (ac_try="$ac_compiler --version >&5"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_compiler --version >&5") 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }
+{ (ac_try="$ac_compiler -v >&5"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_compiler -v >&5") 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }
+{ (ac_try="$ac_compiler -V >&5"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_compiler -V >&5") 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }
+
+{ echo "$as_me:$LINENO: checking whether we are using the GNU C compiler" >&5
+echo $ECHO_N "checking whether we are using the GNU C compiler... $ECHO_C" >&6; }
+if test "${ac_cv_c_compiler_gnu+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+int
+main ()
+{
+#ifndef __GNUC__
+       choke me
+#endif
+
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_compile") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
+  ac_compiler_gnu=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	ac_compiler_gnu=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+ac_cv_c_compiler_gnu=$ac_compiler_gnu
+
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_c_compiler_gnu" >&5
+echo "${ECHO_T}$ac_cv_c_compiler_gnu" >&6; }
+GCC=`test $ac_compiler_gnu = yes && echo yes`
+ac_test_CFLAGS=${CFLAGS+set}
+ac_save_CFLAGS=$CFLAGS
+{ echo "$as_me:$LINENO: checking whether $CC accepts -g" >&5
+echo $ECHO_N "checking whether $CC accepts -g... $ECHO_C" >&6; }
+if test "${ac_cv_prog_cc_g+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  ac_save_c_werror_flag=$ac_c_werror_flag
+   ac_c_werror_flag=yes
+   ac_cv_prog_cc_g=no
+   CFLAGS="-g"
+   cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_compile") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
+  ac_cv_prog_cc_g=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	CFLAGS=""
+      cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_compile") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
+  :
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	ac_c_werror_flag=$ac_save_c_werror_flag
+	 CFLAGS="-g"
+	 cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_compile") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
+  ac_cv_prog_cc_g=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+   ac_c_werror_flag=$ac_save_c_werror_flag
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_prog_cc_g" >&5
+echo "${ECHO_T}$ac_cv_prog_cc_g" >&6; }
+if test "$ac_test_CFLAGS" = set; then
+  CFLAGS=$ac_save_CFLAGS
+elif test $ac_cv_prog_cc_g = yes; then
+  if test "$GCC" = yes; then
+    CFLAGS="-g -O2"
+  else
+    CFLAGS="-g"
+  fi
+else
+  if test "$GCC" = yes; then
+    CFLAGS="-O2"
+  else
+    CFLAGS=
+  fi
+fi
+{ echo "$as_me:$LINENO: checking for $CC option to accept ISO C89" >&5
+echo $ECHO_N "checking for $CC option to accept ISO C89... $ECHO_C" >&6; }
+if test "${ac_cv_prog_cc_c89+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  ac_cv_prog_cc_c89=no
+ac_save_CC=$CC
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#include <stdarg.h>
+#include <stdio.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+/* Most of the following tests are stolen from RCS 5.7's src/conf.sh.  */
+struct buf { int x; };
+FILE * (*rcsopen) (struct buf *, struct stat *, int);
+static char *e (p, i)
+     char **p;
+     int i;
+{
+  return p[i];
+}
+static char *f (char * (*g) (char **, int), char **p, ...)
+{
+  char *s;
+  va_list v;
+  va_start (v,p);
+  s = g (p, va_arg (v,int));
+  va_end (v);
+  return s;
+}
+
+/* OSF 4.0 Compaq cc is some sort of almost-ANSI by default.  It has
+   function prototypes and stuff, but not '\xHH' hex character constants.
+   These don't provoke an error unfortunately, instead are silently treated
+   as 'x'.  The following induces an error, until -std is added to get
+   proper ANSI mode.  Curiously '\x00'!='x' always comes out true, for an
+   array size at least.  It's necessary to write '\x00'==0 to get something
+   that's true only with -std.  */
+int osf4_cc_array ['\x00' == 0 ? 1 : -1];
+
+/* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters
+   inside strings and character constants.  */
+#define FOO(x) 'x'
+int xlc6_cc_array[FOO(a) == 'x' ? 1 : -1];
+
+int test (int i, double x);
+struct s1 {int (*f) (int a);};
+struct s2 {int (*f) (double a);};
+int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int);
+int argc;
+char **argv;
+int
+main ()
+{
+return f (e, argv, 0) != argv[0]  ||  f (e, argv, 1) != argv[1];
+  ;
+  return 0;
+}
+_ACEOF
+for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std \
+	-Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__"
+do
+  CC="$ac_save_CC $ac_arg"
+  rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_compile") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
+  ac_cv_prog_cc_c89=$ac_arg
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+
+fi
+
+rm -f core conftest.err conftest.$ac_objext
+  test "x$ac_cv_prog_cc_c89" != "xno" && break
+done
+rm -f conftest.$ac_ext
+CC=$ac_save_CC
+
+fi
+# AC_CACHE_VAL
+case "x$ac_cv_prog_cc_c89" in
+  x)
+    { echo "$as_me:$LINENO: result: none needed" >&5
+echo "${ECHO_T}none needed" >&6; } ;;
+  xno)
+    { echo "$as_me:$LINENO: result: unsupported" >&5
+echo "${ECHO_T}unsupported" >&6; } ;;
+  *)
+    CC="$CC $ac_cv_prog_cc_c89"
+    { echo "$as_me:$LINENO: result: $ac_cv_prog_cc_c89" >&5
+echo "${ECHO_T}$ac_cv_prog_cc_c89" >&6; } ;;
+esac
+
+
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+{ echo "$as_me:$LINENO: checking how to run the C preprocessor" >&5
+echo $ECHO_N "checking how to run the C preprocessor... $ECHO_C" >&6; }
+# On Suns, sometimes $CPP names a directory.
+if test -n "$CPP" && test -d "$CPP"; then
+  CPP=
+fi
+if test -z "$CPP"; then
+  if test "${ac_cv_prog_CPP+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+      # Double quotes because CPP needs to be expanded
+    for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp"
+    do
+      ac_preproc_ok=false
+for ac_c_preproc_warn_flag in '' yes
+do
+  # Use a header file that comes with gcc, so configuring glibc
+  # with a fresh cross-compiler works.
+  # Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
+  # <limits.h> exists even on freestanding compilers.
+  # On the NeXT, cc -E runs the code through the compiler's parser,
+  # not just through cpp. "Syntax error" is here to catch this case.
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#ifdef __STDC__
+# include <limits.h>
+#else
+# include <assert.h>
+#endif
+		     Syntax error
+_ACEOF
+if { (ac_try="$ac_cpp conftest.$ac_ext"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } >/dev/null && {
+	 test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       }; then
+  :
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+  # Broken: fails on valid input.
+continue
+fi
+
+rm -f conftest.err conftest.$ac_ext
+
+  # OK, works on sane cases.  Now check whether nonexistent headers
+  # can be detected and how.
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#include <ac_nonexistent.h>
+_ACEOF
+if { (ac_try="$ac_cpp conftest.$ac_ext"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } >/dev/null && {
+	 test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       }; then
+  # Broken: success on invalid input.
+continue
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+  # Passes both tests.
+ac_preproc_ok=:
+break
+fi
+
+rm -f conftest.err conftest.$ac_ext
+
+done
+# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped.
+rm -f conftest.err conftest.$ac_ext
+if $ac_preproc_ok; then
+  break
+fi
+
+    done
+    ac_cv_prog_CPP=$CPP
+
+fi
+  CPP=$ac_cv_prog_CPP
+else
+  ac_cv_prog_CPP=$CPP
+fi
+{ echo "$as_me:$LINENO: result: $CPP" >&5
+echo "${ECHO_T}$CPP" >&6; }
+ac_preproc_ok=false
+for ac_c_preproc_warn_flag in '' yes
+do
+  # Use a header file that comes with gcc, so configuring glibc
+  # with a fresh cross-compiler works.
+  # Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
+  # <limits.h> exists even on freestanding compilers.
+  # On the NeXT, cc -E runs the code through the compiler's parser,
+  # not just through cpp. "Syntax error" is here to catch this case.
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#ifdef __STDC__
+# include <limits.h>
+#else
+# include <assert.h>
+#endif
+		     Syntax error
+_ACEOF
+if { (ac_try="$ac_cpp conftest.$ac_ext"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } >/dev/null && {
+	 test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       }; then
+  :
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+  # Broken: fails on valid input.
+continue
+fi
+
+rm -f conftest.err conftest.$ac_ext
+
+  # OK, works on sane cases.  Now check whether nonexistent headers
+  # can be detected and how.
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#include <ac_nonexistent.h>
+_ACEOF
+if { (ac_try="$ac_cpp conftest.$ac_ext"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } >/dev/null && {
+	 test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       }; then
+  # Broken: success on invalid input.
+continue
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+  # Passes both tests.
+ac_preproc_ok=:
+break
+fi
+
+rm -f conftest.err conftest.$ac_ext
+
+done
+# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped.
+rm -f conftest.err conftest.$ac_ext
+if $ac_preproc_ok; then
+  :
+else
+  { { echo "$as_me:$LINENO: error: C preprocessor \"$CPP\" fails sanity check
+See \`config.log' for more details." >&5
+echo "$as_me: error: C preprocessor \"$CPP\" fails sanity check
+See \`config.log' for more details." >&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
+
+
+{ echo "$as_me:$LINENO: checking for grep that handles long lines and -e" >&5
+echo $ECHO_N "checking for grep that handles long lines and -e... $ECHO_C" >&6; }
+if test "${ac_cv_path_GREP+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  # Extract the first word of "grep ggrep" to use in msg output
+if test -z "$GREP"; then
+set dummy grep ggrep; ac_prog_name=$2
+if test "${ac_cv_path_GREP+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  ac_path_GREP_found=false
+# Loop through the user's path and test for each of PROGNAME-LIST
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for ac_prog in grep ggrep; do
+  for ac_exec_ext in '' $ac_executable_extensions; do
+    ac_path_GREP="$as_dir/$ac_prog$ac_exec_ext"
+    { test -f "$ac_path_GREP" && $as_test_x "$ac_path_GREP"; } || continue
+    # Check for GNU ac_path_GREP and select it if it is found.
+  # Check for GNU $ac_path_GREP
+case `"$ac_path_GREP" --version 2>&1` in
+*GNU*)
+  ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_found=:;;
+*)
+  ac_count=0
+  echo $ECHO_N "0123456789$ECHO_C" >"conftest.in"
+  while :
+  do
+    cat "conftest.in" "conftest.in" >"conftest.tmp"
+    mv "conftest.tmp" "conftest.in"
+    cp "conftest.in" "conftest.nl"
+    echo 'GREP' >> "conftest.nl"
+    "$ac_path_GREP" -e 'GREP$' -e '-(cannot match)-' < "conftest.nl" >"conftest.out" 2>/dev/null || break
+    diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break
+    ac_count=`expr $ac_count + 1`
+    if test $ac_count -gt ${ac_path_GREP_max-0}; then
+      # Best one so far, save it but keep looking for a better one
+      ac_cv_path_GREP="$ac_path_GREP"
+      ac_path_GREP_max=$ac_count
+    fi
+    # 10*(2^10) chars as input seems more than enough
+    test $ac_count -gt 10 && break
+  done
+  rm -f conftest.in conftest.tmp conftest.nl conftest.out;;
+esac
+
+
+    $ac_path_GREP_found && break 3
+  done
+done
+
+done
+IFS=$as_save_IFS
+
+
+fi
+
+GREP="$ac_cv_path_GREP"
+if test -z "$GREP"; then
+  { { echo "$as_me:$LINENO: error: no acceptable $ac_prog_name could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&5
+echo "$as_me: error: no acceptable $ac_prog_name could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&2;}
+   { (exit 1); exit 1; }; }
+fi
+
+else
+  ac_cv_path_GREP=$GREP
+fi
+
+
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_path_GREP" >&5
+echo "${ECHO_T}$ac_cv_path_GREP" >&6; }
+ GREP="$ac_cv_path_GREP"
+
+
+{ echo "$as_me:$LINENO: checking for egrep" >&5
+echo $ECHO_N "checking for egrep... $ECHO_C" >&6; }
+if test "${ac_cv_path_EGREP+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if echo a | $GREP -E '(a|b)' >/dev/null 2>&1
+   then ac_cv_path_EGREP="$GREP -E"
+   else
+     # Extract the first word of "egrep" to use in msg output
+if test -z "$EGREP"; then
+set dummy egrep; ac_prog_name=$2
+if test "${ac_cv_path_EGREP+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  ac_path_EGREP_found=false
+# Loop through the user's path and test for each of PROGNAME-LIST
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for ac_prog in egrep; do
+  for ac_exec_ext in '' $ac_executable_extensions; do
+    ac_path_EGREP="$as_dir/$ac_prog$ac_exec_ext"
+    { test -f "$ac_path_EGREP" && $as_test_x "$ac_path_EGREP"; } || continue
+    # Check for GNU ac_path_EGREP and select it if it is found.
+  # Check for GNU $ac_path_EGREP
+case `"$ac_path_EGREP" --version 2>&1` in
+*GNU*)
+  ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_found=:;;
+*)
+  ac_count=0
+  echo $ECHO_N "0123456789$ECHO_C" >"conftest.in"
+  while :
+  do
+    cat "conftest.in" "conftest.in" >"conftest.tmp"
+    mv "conftest.tmp" "conftest.in"
+    cp "conftest.in" "conftest.nl"
+    echo 'EGREP' >> "conftest.nl"
+    "$ac_path_EGREP" 'EGREP$' < "conftest.nl" >"conftest.out" 2>/dev/null || break
+    diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break
+    ac_count=`expr $ac_count + 1`
+    if test $ac_count -gt ${ac_path_EGREP_max-0}; then
+      # Best one so far, save it but keep looking for a better one
+      ac_cv_path_EGREP="$ac_path_EGREP"
+      ac_path_EGREP_max=$ac_count
+    fi
+    # 10*(2^10) chars as input seems more than enough
+    test $ac_count -gt 10 && break
+  done
+  rm -f conftest.in conftest.tmp conftest.nl conftest.out;;
+esac
+
+
+    $ac_path_EGREP_found && break 3
+  done
+done
+
+done
+IFS=$as_save_IFS
+
+
+fi
+
+EGREP="$ac_cv_path_EGREP"
+if test -z "$EGREP"; then
+  { { echo "$as_me:$LINENO: error: no acceptable $ac_prog_name could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&5
+echo "$as_me: error: no acceptable $ac_prog_name could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&2;}
+   { (exit 1); exit 1; }; }
+fi
+
+else
+  ac_cv_path_EGREP=$EGREP
+fi
+
+
+   fi
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_path_EGREP" >&5
+echo "${ECHO_T}$ac_cv_path_EGREP" >&6; }
+ EGREP="$ac_cv_path_EGREP"
+
+
+{ echo "$as_me:$LINENO: checking for ANSI C header files" >&5
+echo $ECHO_N "checking for ANSI C header files... $ECHO_C" >&6; }
+if test "${ac_cv_header_stdc+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#include <stdlib.h>
+#include <stdarg.h>
+#include <string.h>
+#include <float.h>
+
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_compile") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
+  ac_cv_header_stdc=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	ac_cv_header_stdc=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+
+if test $ac_cv_header_stdc = yes; then
+  # SunOS 4.x string.h does not declare mem*, contrary to ANSI.
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#include <string.h>
+
+_ACEOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+  $EGREP "memchr" >/dev/null 2>&1; then
+  :
+else
+  ac_cv_header_stdc=no
+fi
+rm -f conftest*
+
+fi
+
+if test $ac_cv_header_stdc = yes; then
+  # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI.
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#include <stdlib.h>
+
+_ACEOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+  $EGREP "free" >/dev/null 2>&1; then
+  :
+else
+  ac_cv_header_stdc=no
+fi
+rm -f conftest*
+
+fi
+
+if test $ac_cv_header_stdc = yes; then
+  # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi.
+  if test "$cross_compiling" = yes; then
+  :
+else
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#include <ctype.h>
+#include <stdlib.h>
+#if ((' ' & 0x0FF) == 0x020)
+# define ISLOWER(c) ('a' <= (c) && (c) <= 'z')
+# define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c))
+#else
+# define ISLOWER(c) \
+		   (('a' <= (c) && (c) <= 'i') \
+		     || ('j' <= (c) && (c) <= 'r') \
+		     || ('s' <= (c) && (c) <= 'z'))
+# define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c))
+#endif
+
+#define XOR(e, f) (((e) && !(f)) || (!(e) && (f)))
+int
+main ()
+{
+  int i;
+  for (i = 0; i < 256; i++)
+    if (XOR (islower (i), ISLOWER (i))
+	|| toupper (i) != TOUPPER (i))
+      return 2;
+  return 0;
+}
+_ACEOF
+rm -f conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_link") 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
+  { (case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_try") 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  :
+else
+  echo "$as_me: program exited with status $ac_status" >&5
+echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+( exit $ac_status )
+ac_cv_header_stdc=no
+fi
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
+fi
+
+
+fi
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_header_stdc" >&5
+echo "${ECHO_T}$ac_cv_header_stdc" >&6; }
+if test $ac_cv_header_stdc = yes; then
+
+cat >>confdefs.h <<\_ACEOF
+#define STDC_HEADERS 1
+_ACEOF
+
+fi
+
+# On IRIX 5.3, sys/types and inttypes.h are conflicting.
+
+
+
+
+
+
+
+
+
+for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \
+		  inttypes.h stdint.h unistd.h
+do
+as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
+{ echo "$as_me:$LINENO: checking for $ac_header" >&5
+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; }
+if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+$ac_includes_default
+
+#include <$ac_header>
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_compile") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
+  eval "$as_ac_Header=yes"
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	eval "$as_ac_Header=no"
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+ac_res=`eval echo '${'$as_ac_Header'}'`
+	       { echo "$as_me:$LINENO: result: $ac_res" >&5
+echo "${ECHO_T}$ac_res" >&6; }
+if test `eval echo '${'$as_ac_Header'}'` = yes; then
+  cat >>confdefs.h <<_ACEOF
+#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
+_ACEOF
+
+fi
+
+done
+
+
+
+for ac_header in llvm-c/Core.h
+do
+as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
+if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
+  { echo "$as_me:$LINENO: checking for $ac_header" >&5
+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; }
+if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+fi
+ac_res=`eval echo '${'$as_ac_Header'}'`
+	       { echo "$as_me:$LINENO: result: $ac_res" >&5
+echo "${ECHO_T}$ac_res" >&6; }
+else
+  # Is the header compilable?
+{ echo "$as_me:$LINENO: checking $ac_header usability" >&5
+echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6; }
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+$ac_includes_default
+#include <$ac_header>
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_compile") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
+  ac_header_compiler=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	ac_header_compiler=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+{ echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
+echo "${ECHO_T}$ac_header_compiler" >&6; }
+
+# Is the header present?
+{ echo "$as_me:$LINENO: checking $ac_header presence" >&5
+echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6; }
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#include <$ac_header>
+_ACEOF
+if { (ac_try="$ac_cpp conftest.$ac_ext"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } >/dev/null && {
+	 test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       }; then
+  ac_header_preproc=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+  ac_header_preproc=no
+fi
+
+rm -f conftest.err conftest.$ac_ext
+{ echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
+echo "${ECHO_T}$ac_header_preproc" >&6; }
+
+# So?  What about this header?
+case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
+  yes:no: )
+    { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
+echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5
+echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;}
+    ac_header_preproc=yes
+    ;;
+  no:yes:* )
+    { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
+echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header:     check for missing prerequisite headers?" >&5
+echo "$as_me: WARNING: $ac_header:     check for missing prerequisite headers?" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5
+echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\"" >&5
+echo "$as_me: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\"" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
+echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
+echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
+    ( cat <<\_ASBOX
+## --------------------------------- ##
+## Report this to bos@serpentine.com ##
+## --------------------------------- ##
+_ASBOX
+     ) | sed "s/^/$as_me: WARNING:     /" >&2
+    ;;
+esac
+{ echo "$as_me:$LINENO: checking for $ac_header" >&5
+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; }
+if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  eval "$as_ac_Header=\$ac_header_preproc"
+fi
+ac_res=`eval echo '${'$as_ac_Header'}'`
+	       { echo "$as_me:$LINENO: result: $ac_res" >&5
+echo "${ECHO_T}$ac_res" >&6; }
+
+fi
+if test `eval echo '${'$as_ac_Header'}'` = yes; then
+  cat >>confdefs.h <<_ACEOF
+#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
+_ACEOF
+
+else
+  { { echo "$as_me:$LINENO: error: could not find LLVM C bindings" >&5
+echo "$as_me: error: could not find LLVM C bindings" >&2;}
+   { (exit 1); exit 1; }; }
+fi
+
+done
+
+
+LIBS="-lLLVMSupport -lLLVMSystem $LIBS"
+
+# We have to link using the C++ compiler.
+CC=$CXX
+
+
+{ echo "$as_me:$LINENO: checking for LLVMModuleCreateWithName in -lLLVMCore" >&5
+echo $ECHO_N "checking for LLVMModuleCreateWithName in -lLLVMCore... $ECHO_C" >&6; }
+if test "${ac_cv_lib_LLVMCore_LLVMModuleCreateWithName+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-lLLVMCore  $LIBS"
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+/* Override any GCC internal prototype to avoid an error.
+   Use char because int might match the return type of a GCC
+   builtin and then its argument prototype would still apply.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+char LLVMModuleCreateWithName ();
+int
+main ()
+{
+return LLVMModuleCreateWithName ();
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_link") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest$ac_exeext &&
+       $as_test_x conftest$ac_exeext; then
+  ac_cv_lib_LLVMCore_LLVMModuleCreateWithName=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	ac_cv_lib_LLVMCore_LLVMModuleCreateWithName=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+      conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_lib_LLVMCore_LLVMModuleCreateWithName" >&5
+echo "${ECHO_T}$ac_cv_lib_LLVMCore_LLVMModuleCreateWithName" >&6; }
+if test $ac_cv_lib_LLVMCore_LLVMModuleCreateWithName = yes; then
+  cat >>confdefs.h <<_ACEOF
+#define HAVE_LIBLLVMCORE 1
+_ACEOF
+
+  LIBS="-lLLVMCore $LIBS"
+
+else
+  { { echo "$as_me:$LINENO: error: could not find LLVM C bindings" >&5
+echo "$as_me: error: could not find LLVM C bindings" >&2;}
+   { (exit 1); exit 1; }; }
+fi
+
+
+
+
+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 more Bourne compatible
+DUALCASE=1; export DUALCASE # for MKS sh
+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
+
+
+
+
+# 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
+
+if test -x / >/dev/null 2>&1; then
+  as_test_x='test -x'
+else
+  if ls -dL / >/dev/null 2>&1; then
+    as_ls_L_option=L
+  else
+    as_ls_L_option=
+  fi
+  as_test_x='
+    eval sh -c '\''
+      if test -d "$1"; then
+        test -d "$1/.";
+      else
+	case $1 in
+        -*)set "./$1";;
+	esac;
+	case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in
+	???[sx]*):;;*)false;;esac;fi
+    '\'' sh
+  '
+fi
+as_executable_p=$as_test_x
+
+# 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 Haskell LLVM bindings $as_me 0.0.2, which was
+generated by GNU Autoconf 2.61.  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 and configuration settings, 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="\\
+Haskell LLVM bindings config.status 0.0.2
+configured by $0, generated by GNU Autoconf 2.61,
+  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
+    "llvm.buildinfo") CONFIG_FILES="$CONFIG_FILES llvm.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
+CXX!$CXX$ac_delim
+CXXFLAGS!$CXXFLAGS$ac_delim
+LDFLAGS!$LDFLAGS$ac_delim
+CPPFLAGS!$CPPFLAGS$ac_delim
+ac_ct_CXX!$ac_ct_CXX$ac_delim
+EXEEXT!$EXEEXT$ac_delim
+OBJEXT!$OBJEXT$ac_delim
+llvm_config!$llvm_config$ac_delim
+CC!$CC$ac_delim
+CFLAGS!$CFLAGS$ac_delim
+ac_ct_CC!$ac_ct_CC$ac_delim
+CPP!$CPP$ac_delim
+GREP!$GREP$ac_delim
+EGREP!$EGREP$ac_delim
+llvm_cppflags!$llvm_cppflags$ac_delim
+llvm_engine_libs!$llvm_engine_libs$ac_delim
+llvm_includedir!$llvm_includedir$ac_delim
+llvm_ldflags!$llvm_ldflags$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` = 57; 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,47 @@
+AC_INIT([Haskell LLVM bindings], [0.0.2], [bos@serpentine.com], [llvm])
+
+AC_CONFIG_SRCDIR([LLVM/ExecutionEngine.hs])
+
+AC_CONFIG_FILES([llvm.buildinfo])
+
+AC_PROG_CXX
+
+AC_ARG_WITH(llvm_prefix,
+  [AS_HELP_STRING([--with-llvm-prefix],
+    [use the version of LLVM at the given location])],
+  llvm_prefix="$withval",
+  llvm_prefix=/usr/local)dnl
+
+AC_ARG_WITH(llvm_bindir,
+  [AS_HELP_STRING([--with-llvm-bindir],
+    [use LLVM binaries at the given location])],
+  llvm_bindir="$withval",
+  llvm_bindir="$llvm_prefix/bin")dnl
+
+AC_PATH_PROG(llvm_config, llvm-config,
+  [AC_MSG_ERROR(could not find llvm-config in $llvm_bindir)],
+  [$llvm_bindir])
+
+llvm_cppflags="`$llvm_config --cppflags`"
+llvm_includedir="`$llvm_config --includedir`"
+llvm_ldflags="`$llvm_config --ldflags`"
+
+llvm_engine_libs="`$llvm_config --libs engine`"
+
+CPPFLAGS="$llvm_cppflags $CPPFLAGS"
+LDFLAGS="$llvm_ldflags $LDFLAGS"
+
+AC_CHECK_HEADERS([llvm-c/Core.h], [],
+  [AC_MSG_ERROR(could not find LLVM C bindings)])
+
+LIBS="-lLLVMSupport -lLLVMSystem $LIBS"
+
+# We have to link using the C++ compiler.
+CC=$CXX
+
+AC_CHECK_LIB(LLVMCore, LLVMModuleCreateWithName, [],
+  [AC_MSG_ERROR(could not find LLVM C bindings)])
+
+AC_SUBST([llvm_cppflags llvm_engine_libs llvm_includedir llvm_ldflags])
+
+AC_OUTPUT
diff --git a/examples/Fibonacci.hs b/examples/Fibonacci.hs
new file mode 100644
--- /dev/null
+++ b/examples/Fibonacci.hs
@@ -0,0 +1,61 @@
+{-# LANGUAGE TypeOperators #-}
+
+module Fibonacci (main) where
+
+import Control.Monad (forM_)
+import Data.Int (Int32)
+import System.Environment (getArgs)
+
+import qualified LLVM.Core as Core
+import qualified LLVM.Core.Builder as B
+import qualified LLVM.Core.Constant as C
+import qualified LLVM.Core.Instruction as I
+import qualified LLVM.Core.Type as T
+import qualified LLVM.Core.Value as V
+import qualified LLVM.Core.Utils as U
+import qualified LLVM.ExecutionEngine as EE
+
+buildFib :: T.Module -> IO (V.Function T.Int32 T.Int32)
+buildFib m = do
+  let one = C.const (1::Int32)
+      two = C.const (2::Int32)
+  (fib, entry) <- U.defineFunction m "fib" (T.function undefined undefined)
+  bld <- B.createBuilder
+  exit <- Core.appendBasicBlock fib "return"
+  recurse <- Core.appendBasicBlock fib "recurse"
+  let arg = V.params fib
+
+  B.positionAtEnd bld entry
+  test <- B.icmp bld "" I.IntSLE arg two
+  B.condBr bld test exit recurse
+
+  B.positionAtEnd bld exit
+  B.ret bld one
+
+  B.positionAtEnd bld recurse
+  x1 <- B.sub bld "" arg one
+  fibx1 <- B.call bld "" fib x1
+
+  x2 <- B.sub bld "" arg two
+  fibx2 <- B.call bld "" fib x2
+
+  B.add bld "" fibx1 fibx2 >>= B.ret bld
+  return fib
+
+main :: IO ()
+main = do
+  args <- getArgs
+  let args' = if null args then ["10"] else args
+
+  m <- Core.createModule "fib"
+  fib <- buildFib m
+  V.dumpValue fib
+
+  prov <- Core.createModuleProviderForExistingModule m
+  ee <- EE.createExecutionEngine prov
+  
+  forM_ args' $ \num -> do
+    putStr $ "fib " ++ num ++ " = "
+    parm <- EE.createGeneric (read num :: Int)
+    gv <- EE.runFunction ee fib [parm]
+    print (EE.fromGeneric gv :: Int)
diff --git a/examples/HelloJIT.hs b/examples/HelloJIT.hs
new file mode 100644
--- /dev/null
+++ b/examples/HelloJIT.hs
@@ -0,0 +1,44 @@
+{-# LANGUAGE TypeOperators #-}
+module HelloJIT (main) where
+
+import Data.Int (Int32)
+import Prelude hiding (mod)
+
+import qualified LLVM.Core as Core
+import qualified LLVM.Core.Builder as B
+import qualified LLVM.Core.Constant as C
+import qualified LLVM.Core.Type as T
+import qualified LLVM.Core.Value as V
+import qualified LLVM.Core.Utils as U
+import qualified LLVM.ExecutionEngine as EE
+
+
+buildModule :: IO (T.Module, V.Function T.Int32 ())
+buildModule = do
+  mod <- Core.createModule "hello"
+  greetz <- U.defineGlobal mod "greeting" (C.const "hello jit!")
+  let t = T.function (undefined :: T.Int32) (undefined :: T.Pointer T.Int8)
+  putStrLn $ "type of puts: " ++ show t
+  puts <- U.declareFunction mod "puts" t
+  (func, entry) <- U.defineFunction mod "main"
+                   (T.function (undefined :: T.Int32) ())
+  bld <- B.createBuilder
+  B.positionAtEnd bld entry
+  let zero = C.const (0::Int32)
+  tmp <- B.getElementPtr bld "tmp" greetz [zero, zero]
+  B.call_ bld "" puts tmp
+  B.ret bld zero
+  return (mod, func)
+
+execute :: T.Module -> V.Function T.Int32 () -> IO ()
+execute mod func = do
+  prov <- Core.createModuleProviderForExistingModule mod
+  ee <- EE.createExecutionEngine prov
+  EE.runStaticConstructors ee
+  gv <- EE.runFunction ee func []
+  print (EE.fromGeneric gv :: Int32)
+  EE.runStaticDestructors ee
+  return ()
+
+main :: IO ()
+main = buildModule >>= uncurry execute
diff --git a/examples/HowToUseJIT.hs b/examples/HowToUseJIT.hs
new file mode 100644
--- /dev/null
+++ b/examples/HowToUseJIT.hs
@@ -0,0 +1,43 @@
+{-# LANGUAGE TypeOperators #-}
+
+module HowToUseJIT (main) where
+
+import LLVM.Core.Type ((:->)(..))
+import qualified LLVM.Core as Core
+import qualified LLVM.Core.Builder as B
+import qualified LLVM.Core.Constant as C
+import qualified LLVM.Core.Type as T
+import qualified LLVM.Core.Value as V
+import qualified LLVM.Core.Utils as U
+import qualified LLVM.ExecutionEngine as EE
+import Data.Int (Int32)
+
+main :: IO ()
+main = do
+  m <- Core.createModule "test"
+  let t = T.function (undefined :: T.Int32) (undefined :: T.Int32 :-> T.Int32)
+
+  (add1, addEntry) <- U.defineFunction m "add1" t
+  let a :-> b = V.params add1
+  V.setName a "a"
+
+  bld <- B.createBuilder
+  B.positionAtEnd bld addEntry
+  v1 <- B.add bld "" (C.const (1::Int32)) a
+  v2 <- B.add bld "" v1 b
+  B.ret bld v2
+  V.dumpValue add1
+
+  (foo, fooEntry) <- U.defineFunction m "foo" (T.function (undefined :: T.Int32) ())
+  B.positionAtEnd bld fooEntry
+  c <- B.call bld "wibble" add1 (C.const (1::Int32) :-> C.const (10::Int32))
+  B.ret bld c
+  V.dumpValue foo
+
+  prov <- Core.createModuleProviderForExistingModule m
+  ee <- EE.createExecutionEngine prov
+  EE.runStaticConstructors ee
+  gv <- EE.runFunction ee foo []
+  EE.runStaticDestructors ee
+  print (EE.fromGeneric gv :: Int32)
+  return ()
diff --git a/examples/Makefile b/examples/Makefile
new file mode 100644
--- /dev/null
+++ b/examples/Makefile
@@ -0,0 +1,11 @@
+ghc := ghc
+ghcflags := -Wall -Werror
+examples := Fibonacci HelloJIT HowToUseJIT
+
+all: $(examples)
+
+%: %.hs
+	$(ghc) $(ghcflags) --make -o $@ -main-is $(basename $<).main $<
+
+clean:
+	-rm -f *.o *.hi $(examples)
diff --git a/llvm.buildinfo.in b/llvm.buildinfo.in
new file mode 100644
--- /dev/null
+++ b/llvm.buildinfo.in
@@ -0,0 +1,4 @@
+ghc-options: @llvm_cppflags@ -pgml @CXX@
+ld-options: @llvm_ldflags@ @llvm_engine_libs@ -lstdc++
+include-dirs: @llvm_includedir@
+extra-libraries: LLVMCore LLVMTarget LLVMSupport LLVMSystem
diff --git a/llvm.cabal b/llvm.cabal
new file mode 100644
--- /dev/null
+++ b/llvm.cabal
@@ -0,0 +1,64 @@
+name: llvm
+version: 0.0.2
+license: BSD3
+license-file: LICENSE
+synopsis: Bindings to the LLVM compiler toolkit
+description: Bindings to the LLVM compiler toolkit
+author: Bryan O'Sullivan
+maintainer: Bryan O'Sullivan <bos@serpentine.com>
+category: Compilers/Interpreters
+cabal-version: >= 1.2.1
+
+extra-source-files:
+    INSTALL.txt
+    Makefile
+    PROBLEMS.txt
+    README.txt
+    configure
+    configure.ac
+    examples/Fibonacci.hs
+    examples/HelloJIT.hs
+    examples/HowToUseJIT.hs
+    examples/Makefile
+    llvm.buildinfo.in
+
+extra-tmp-files:
+    autom4te.cache
+    config.log
+    config.status
+    llvm.buildinfo
+
+flag bytestring-in-base
+  description: bytestring was part of the base library in ghc-6.6
+               days. The bytestring low level interface is in
+               Data.ByteString.Internal and Data.Bytestring.Unsafe not
+               Data.ByteString.Base
+
+library
+  if flag(bytestring-in-base)
+    -- bytestring was in base-2.0 and 2.1.1
+    build-depends: base >= 2.0 && < 2.2
+    cpp-options:   -DBYTESTRING_IN_BASE
+  else
+    build-depends: base < 2.0 || >= 2.2, bytestring >= 0.9 
+
+  extensions:
+      EmptyDataDecls
+      FlexibleInstances
+      ForeignFunctionInterface
+      GeneralizedNewtypeDeriving
+      TypeOperators
+      TypeSynonymInstances
+  ghc-options: -Wall -Werror
+
+  exposed-modules:
+      LLVM.Core
+      LLVM.Core.FFI
+      LLVM.Core.Builder
+      LLVM.Core.Constant
+      LLVM.Core.Instruction
+      LLVM.Core.Type
+      LLVM.Core.Utils
+      LLVM.Core.Value
+      LLVM.ExecutionEngine
+      LLVM.ExecutionEngine.FFI
