llvm-base (empty) → 3.0.0.0
raw patch · 45 files changed
+8680/−0 lines, 45 filesdep +basebuild-type:Customsetup-changed
Dependencies added: base
Files
- INSTALL.md +61/−0
- LICENSE +69/−0
- LLVM/FFI/Analysis.hsc +23/−0
- LLVM/FFI/BitReader.hsc +25/−0
- LLVM/FFI/BitWriter.hsc +18/−0
- LLVM/FFI/Core.hsc +1720/−0
- LLVM/FFI/ExecutionEngine.hsc +166/−0
- LLVM/FFI/Support.hsc +20/−0
- LLVM/FFI/Target.hsc +56/−0
- LLVM/FFI/Transforms/IPO.hsc +34/−0
- LLVM/FFI/Transforms/Scalar.hsc +50/−0
- LLVM/Target/ARM.hs +10/−0
- LLVM/Target/Alpha.hs +10/−0
- LLVM/Target/Blackfin.hs +10/−0
- LLVM/Target/CBackend.hs +10/−0
- LLVM/Target/CellSPU.hs +10/−0
- LLVM/Target/CppBackend.hs +10/−0
- LLVM/Target/MSP430.hs +10/−0
- LLVM/Target/Mips.hs +10/−0
- LLVM/Target/Native.hs +20/−0
- LLVM/Target/PIC16.hs +10/−0
- LLVM/Target/PowerPC.hs +10/−0
- LLVM/Target/Sparc.hs +10/−0
- LLVM/Target/SystemZ.hs +10/−0
- LLVM/Target/X86.hs +10/−0
- LLVM/Target/XCore.hs +10/−0
- README.md +58/−0
- Setup.hs +122/−0
- cbits/extra.cpp +563/−0
- cbits/free.c +17/−0
- cbits/malloc.c +190/−0
- cbits/support.cpp +90/−0
- configure +4506/−0
- configure.ac +134/−0
- include/extra.h +248/−0
- include/hs_llvm_config.h.in +64/−0
- include/support.h +24/−0
- llvm-base.buildinfo.in +7/−0
- llvm-base.buildinfo.windows.in +4/−0
- llvm-base.cabal +106/−0
- tools/DiffFFI.hs +39/−0
- tools/FunctionMangler.hs +8/−0
- tools/FunctionMangulation.hs +65/−0
- tools/IntrinsicMangler.hs +22/−0
- tools/Makefile +11/−0
+ INSTALL.md view
@@ -0,0 +1,61 @@+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+-------------++Firstly, you'll need to have LLVM. I recommend installing LLVM+version 2.9 (from [llvm.org](http://llvm.org/releases/)), which is+what this package has mostly been tested with.++We try to work with both the current and one previous release of LLVM.++It's easy to install LLVM itself from source:++ cd llvm+ ./configure --prefix=$SOMEWHERE+ make+ make install++It's a good idea to have `$SOMEWHERE/bin` in your path.++Installing from source on Windows requires MinGW.+++Building+--------++(*Note*: If you're building from a clone of the `git` repository+rather than a release, you *must* run `autoreconf` before you can+build!)++This is a normal Haskell package, but needs a `configure` script to+configure some system-specific details of LLVM.++If you have LLVM installed in a fairly normal location (`/usr` or+`/usr/local`), the usual install command should just work:++ cabal install++On the other hand, if you've installed LLVM in an unusual place,+you'll need some `--configure-option` magic to tell the build where to+find it:++ cabal install --configure-option --with-llvm-prefix=$SOMEWHERE+++Building examples+-----------------++In the `examples` directory are a few example programs. There's a GNU+Makefile in there, so running `make` in that directory will build the+examples, as will `make examples` in the top-level directory. Doing+`make run` will build and run the examples.++Note: On older versions of MacOS X you may see a lot of "atom sorting+error" warnings. They seem to be harmless.
+ LICENSE view
@@ -0,0 +1,69 @@+======================================================================+Haskell LLVM Bindings Release License+======================================================================+University of Illinois/NCSA+Open Source License++Copyright (c) 2007-2009 Bryan O'Sullivan+All rights reserved.++Developed by:++ Bryan O'Sullivan <bos@serpentine.com>+ http://www.serpentine.com/blog/++ Lennart Augustsson <lennart@augustsson.net>++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 .++
+ LLVM/FFI/Analysis.hsc view
@@ -0,0 +1,23 @@+{-# LANGUAGE CPP, ForeignFunctionInterface, EmptyDataDecls #-}++module LLVM.FFI.Analysis where+import Foreign.C.String(CString)+#if __GLASGOW_HASKELL__ >= 704+import Foreign.C.Types(CInt(..))+#else+import Foreign.C.Types(CInt)+#endif+import Foreign.Ptr(Ptr)++import LLVM.FFI.Core++type VerifierFailureAction = CInt++foreign import ccall unsafe "LLVMVerifyFunction" verifyFunction+ :: ValueRef -> VerifierFailureAction -> IO CInt+foreign import ccall unsafe "LLVMVerifyModule" verifyModule+ :: ModuleRef -> VerifierFailureAction -> (Ptr CString) -> IO CInt+foreign import ccall unsafe "LLVMViewFunctionCFG" viewFunctionCFG+ :: ValueRef -> IO ()+foreign import ccall unsafe "LLVMViewFunctionCFGOnly" viewFunctionCFGOnly+ :: ValueRef -> IO ()
+ LLVM/FFI/BitReader.hsc view
@@ -0,0 +1,25 @@+{-# LANGUAGE CPP, ForeignFunctionInterface, EmptyDataDecls #-}++module LLVM.FFI.BitReader where+import Foreign.C.String(CString)+#if __GLASGOW_HASKELL__ >= 704+import Foreign.C.Types(CInt(..))+#else+import Foreign.C.Types(CInt)+#endif+import Foreign.Ptr(Ptr)++import LLVM.FFI.Core++foreign import ccall unsafe "LLVMGetBitcodeModuleProvider" getBitcodeModuleProvider+ :: MemoryBufferRef -> (Ptr ModuleProviderRef) -> (Ptr CString) -> IO CInt+foreign import ccall unsafe "LLVMParseBitcode" parseBitcode+ :: MemoryBufferRef -> (Ptr ModuleRef) -> (Ptr CString) -> IO CInt+foreign import ccall unsafe "LLVMGetBitcodeModuleProviderInContext" getBitcodeModuleProviderInContext+ :: ContextRef -> MemoryBufferRef -> (Ptr ModuleProviderRef) -> (Ptr CString) -> IO CInt+foreign import ccall unsafe "LLVMParseBitcodeInContext" parseBitcodeInContext+ :: ContextRef -> MemoryBufferRef -> (Ptr ModuleRef) -> (Ptr CString) -> IO CInt+foreign import ccall unsafe "LLVMGetBitcodeModule" getBitcodeModule+ :: MemoryBufferRef -> (Ptr ModuleRef) -> (Ptr CString) -> IO Bool+foreign import ccall unsafe "LLVMGetBitcodeModuleInContext" getBitcodeModuleInContext+ :: ContextRef -> MemoryBufferRef -> (Ptr ModuleRef) -> (Ptr CString) -> IO Bool
+ LLVM/FFI/BitWriter.hsc view
@@ -0,0 +1,18 @@+{-# LANGUAGE CPP, ForeignFunctionInterface, EmptyDataDecls #-}++module LLVM.FFI.BitWriter where+import Foreign.C.String(CString)+#if __GLASGOW_HASKELL__ >= 704+import Foreign.C.Types(CInt(..))+#else+import Foreign.C.Types(CInt)+#endif++import LLVM.FFI.Core++foreign import ccall unsafe "LLVMWriteBitcodeToFile" writeBitcodeToFile+ :: ModuleRef -> CString -> IO CInt+foreign import ccall unsafe "LLVMWriteBitcodeToFileHandle" writeBitcodeToFileHandle+ :: ModuleRef -> CInt -> IO CInt+foreign import ccall unsafe "LLVMWriteBitcodeToFD" writeBitcodeToFD+ :: ModuleRef -> CInt -> CInt -> CInt -> IO CInt
+ LLVM/FFI/Core.hsc view
@@ -0,0 +1,1720 @@+{-# LANGUAGE ForeignFunctionInterface, EmptyDataDecls, DeriveDataTypeable #-}++-- |+-- Module: LLVM.FFI.Core+-- Copyright: Bryan O'Sullivan 2007, 2008+-- License: BSD-style (see the file LICENSE)+--+-- Maintainer: bos@serpentine.com+-- Stability: experimental+-- Portability: requires GHC 6.8, LLVM+--+-- This module provides direct access to the LLVM C bindings.++module LLVM.FFI.Core+ (+ -- * Modules+ Module+ , ModuleRef+ , moduleCreateWithName+ , disposeModule+ , ptrDisposeModule++ , getDataLayout+ , setDataLayout++ , getTarget+ , setTarget++ -- * Module providers+ , ModuleProvider+ , ModuleProviderRef+ , createModuleProviderForExistingModule+ , ptrDisposeModuleProvider++ -- * Types+ , Type+ , TypeRef+ , addTypeName+ , deleteTypeName++ , getTypeKind+ , TypeKind(..)++ -- ** Integer types+ , int1Type+ , int8Type+ , int16Type+ , int32Type+ , int64Type+ , integerType+ , getIntTypeWidth++ -- ** Real types+ , floatType+ , doubleType+ , x86FP80Type+ , fp128Type+ , ppcFP128Type++ -- ** Function types+ , functionType+ , isFunctionVarArg+ , getReturnType+ , countParamTypes+ , getParamTypes++ -- ** Other types+ , voidType+ , labelType+ , opaqueType++ -- ** Array, pointer, and vector types+ , arrayType+ , pointerType+ , vectorType+ , getElementType+ , getArrayLength+ , getPointerAddressSpace+ , getVectorSize++ -- ** Struct types+ , structType+ , countStructElementTypes+ , getStructElementTypes+ , isPackedStruct++ -- * Type handles+ , TypeHandleRef+ , createTypeHandle+ , refineType+ , resolveTypeHandle+ , disposeTypeHandle++ -- * Values+ , Value+ , ValueRef+ , typeOf+ , getValueName+ , setValueName+ , dumpValue++ -- ** Constants+ , constNull+ , constAllOnes+ , getUndef+ , isConstant+ , isNull+ , isUndef++ -- ** Global variables, functions, and aliases (globals)+ , Linkage(..)+ , fromLinkage+ , toLinkage+ , getLinkage+ , setLinkage++ , Visibility(..)+ , fromVisibility+ , toVisibility+ , getVisibility+ , setVisibility++ , isDeclaration+ , getSection+ , setSection+ , getAlignment+ , setAlignment+ + -- ** Global variables+ , addGlobal+ , getNamedGlobal+ , deleteGlobal+ , getInitializer+ , setInitializer+ , isThreadLocal+ , setThreadLocal+ , isGlobalConstant+ , setGlobalConstant+ , getFirstGlobal+ , getNextGlobal+ , getPreviousGlobal+ , getLastGlobal+ , getGlobalParent++ -- ** Functions+ , addFunction+ , getNamedFunction+ , deleteFunction+ , countParams+ , getParams+ , getParam+ , getIntrinsicID+ , getGC+ , setGC+ , getFirstFunction+ , getNextFunction+ , getPreviousFunction+ , getLastFunction+ , getFirstParam+ , getNextParam+ , getPreviousParam+ , getLastParam+ , getParamParent+ , isTailCall+ , setTailCall++ -- ** Phi nodes+ , addIncoming+ , countIncoming+ , getIncomingValue+ , getIncomingBlock++ -- ** Calling conventions+ , CallingConvention(..)+ , fromCallingConvention+ , toCallingConvention+ , getFunctionCallConv+ , setFunctionCallConv+ , getInstructionCallConv+ , setInstructionCallConv++ -- * Constants++ -- ** Scalar constants+ , constInt+ , constReal++ -- ** Composite constants+ , constArray+ , constString+ , constStruct+ , constVector++ -- ** Constant expressions+ , sizeOf+ , constNeg+ , constNot+ , constAdd+ , constSub+ , constMul+ , constExactSDiv+ , constFAdd+ , constFMul+ , constFNeg+ , constFPCast+ , constFSub+ , 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+ , constRealOfString+ , constNSWMul+ , constNSWNeg+ , constNSWSub+ , constNUWAdd+ , constNUWMul+ , constNUWNeg+ , constNUWSub++ -- * Basic blocks+ , BasicBlock+ , BasicBlockRef+ , basicBlockAsValue+ , valueIsBasicBlock+ , valueAsBasicBlock+ , countBasicBlocks+ , getBasicBlocks+ , getEntryBasicBlock+ , appendBasicBlock+ , insertBasicBlock+ , deleteBasicBlock+ , getFirstBasicBlock+ , getNextBasicBlock+ , getPreviousBasicBlock+ , getLastBasicBlock+ , getInsertBlock+ , getBasicBlockParent++ -- * Instruction field accessors+ , instGetOpcode, cmpInstGetPredicate++ -- * Instruction building+ , Builder+ , BuilderRef+ , createBuilder+ , ptrDisposeBuilder+ , positionBuilder+ , positionBefore+ , positionAtEnd+ , getFirstInstruction+ , getNextInstruction+ , getPreviousInstruction+ , getLastInstruction+ , getInstructionParent++ -- ** Terminators+ , buildRetVoid+ , buildRet+ , buildBr+ , buildIndirectBr+ , buildCondBr+ , buildSwitch+ , buildInvoke+ , buildUnwind+ , buildUnreachable++ -- ** Arithmetic+ , buildAdd+ , buildSub+ , buildMul+ , buildFAdd+ , buildFMul+ , buildFPCast+ , buildFSub+ , buildUDiv+ , buildSDiv+ , buildExactSDiv+ , buildFDiv+ , buildURem+ , buildSRem+ , buildFRem+ , buildShl+ , buildLShr+ , buildAShr+ , buildAnd+ , buildOr+ , buildXor+ , buildNeg+ , buildFNeg+ , buildNot+ , buildNSWMul+ , buildNSWNeg+ , buildNSWSub+ , buildNUWAdd+ , buildNUWMul+ , buildNUWNeg+ , buildNUWSub++ -- ** Memory+ , buildMalloc+ , buildArrayMalloc+ , buildAlloca+ , buildArrayAlloca+ , buildFree+ , buildLoad+ , buildStore+ , buildGEP++ -- ** Casts+ , buildTrunc+ , buildZExt+ , buildSExt+ , buildFPToUI+ , buildFPToSI+ , buildUIToFP+ , buildSIToFP+ , buildFPTrunc+ , buildFPExt+ , buildPtrToInt+ , buildIntToPtr+ , buildBitCast+ , buildPointerCast+ , buildTruncOrBitCast+ , buildZExtOrBitCast+ , buildSExtOrBitCast++ , buildPtrDiff++ -- * Misc+ , buildAggregateRet+ , buildGlobalString+ , buildGlobalStringPtr+ , buildInBoundsGEP+ , buildIsNotNull+ , buildIsNull+ , buildNSWAdd+ , buildStructGEP++ -- ** Comparisons+ , buildICmp+ , buildFCmp++ -- ** Miscellaneous instructions+ , buildPhi+ , buildCall+ , buildSelect+ , buildVAArg+ , buildExtractElement+ , buildInsertElement+ , buildShuffleVector++ -- ** Other helpers+ , addCase++ -- * Memory buffers+ , MemoryBuffer+ , MemoryBufferRef+ , createMemoryBufferWithContentsOfFile+ , createMemoryBufferWithSTDIN+ , disposeMemoryBuffer++ -- * Error handling+ , disposeMessage++ -- * Parameter passing+ , addAttribute+ , setInstrParamAlignment+ , setParamAlignment+ , Attribute(..)+ , fromAttribute+ , toAttribute+ , addInstrAttribute+ , removeFunctionAttr+ , removeAttribute+ , removeInstrAttribute+ , addFunctionAttr++ -- * Pass manager+ , PassManager+ , PassManagerRef+ , createFunctionPassManager+ , createPassManager+ , disposePassManager+ , ptrDisposePassManager+ , finalizeFunctionPassManager+ , initializeFunctionPassManager+ , runFunctionPassManager+ , runPassManager++ -- * Context functions+ , Context+ , ContextRef++ -- * Debug+ , dumpModule+++ -- * Misc+ , alignOf+ , constInBoundsGEP+ , constIntCast+ , constIntOfString+ , constIntOfStringAndSize+ , constNSWAdd+ , constPointerCast+ , constPointerNull+ , constRealOfStringAndSize+ , constSExtOrBitCast++ , getTypeByName+ , insertIntoBuilderWithName++ -- * Context functions+ , moduleCreateWithNameInContext+ , appendBasicBlockInContext+ , insertBasicBlockInContext+ , createBuilderInContext++ , contextDispose++ , constStringInContext+ , constStructInContext+ , constTruncOrBitCast+ , constZExtOrBitCast++ , doubleTypeInContext+ , fP128TypeInContext+ , floatTypeInContext+ , int16TypeInContext+ , int1TypeInContext+ , int32TypeInContext+ , int64TypeInContext+ , int8TypeInContext+ , intTypeInContext+ , labelTypeInContext+ , opaqueTypeInContext+ , pPCFP128TypeInContext+ , structTypeInContext+ , voidTypeInContext+ , x86FP80TypeInContext+ , getTypeContext++ , addAlias+ , addDestination+ , addGlobalInAddressSpace+ , blockAddress+ , clearInsertionPosition+ , constExtractValue+ , constInlineAsm+ , constInsertValue+ , constIntGetSExtValue+ , constIntGetZExtValue++-- , constUnion+ , contextCreate+-- , countUnionElementTypes+ , createFunctionPassManagerForModule+ , getAttribute+ , getCurrentDebugLocation+ , getFunctionAttr+ , getGlobalContext+ , getMDKindID+ , getMDKindIDInContext+ , getMetadata+ , getOperand+ , getNumOperands+-- , getUnionElementTypes+ , hasMetadata+ , insertIntoBuilder+ , mDNode+ , mDNodeInContext+ , mDString+ , mDStringInContext+ , replaceAllUsesWith+ , setCurrentDebugLocation+ , setInstDebugLocation+ , setMetadata+-- , unionType+-- , unionTypeInContext++ -- ** Build instruction from opcode+ , buildBinOp+ , getConstOpcode++ , buildCast+ , buildExtractValue+ , buildInsertValue++ -- ** Use+ , OpaqueUse+ , UseRef+ , getFirstUse+ , getNextUse+ , getNumUses+ , getUsedValue+ , getUser+ , isUsedInBasicBlock++ ) where+import Data.Typeable(Typeable)+import Foreign.C.String (CString)+#if __GLASGOW_HASKELL__ >= 704+import Foreign.C.Types (CDouble(..), CInt(..), CUInt(..), CLLong(..), CULLong(..))+#else+import Foreign.C.Types (CDouble, CInt, CUInt, CLLong, CULLong)+#endif+import Foreign.Ptr (Ptr, FunPtr)++#include <llvm-c/Core.h>++data Module+ deriving (Typeable)+type ModuleRef = Ptr Module++foreign import ccall unsafe "LLVMModuleCreateWithName" moduleCreateWithName+ :: CString -> IO ModuleRef++foreign import ccall unsafe "LLVMDisposeModule" disposeModule+ :: ModuleRef -> IO ()++foreign import ccall unsafe "&LLVMDisposeModule" ptrDisposeModule+ :: FunPtr (ModuleRef -> IO ())++foreign import ccall unsafe "LLVMGetDataLayout" getDataLayout+ :: ModuleRef -> IO CString++foreign import ccall unsafe "LLVMSetDataLayout" setDataLayout+ :: ModuleRef -> CString -> IO ()+++data ModuleProvider+ deriving (Typeable)+type ModuleProviderRef = Ptr ModuleProvider++foreign import ccall unsafe "LLVMCreateModuleProviderForExistingModule"+ createModuleProviderForExistingModule+ :: ModuleRef -> IO ModuleProviderRef++foreign import ccall unsafe "&LLVMDisposeModuleProvider" ptrDisposeModuleProvider+ :: FunPtr (ModuleProviderRef -> IO ())+++data Type+ deriving (Typeable)+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 -> IO CInt++-- | Give a function's return type.+foreign import ccall unsafe "LLVMGetReturnType" getReturnType+ :: TypeRef -> IO TypeRef++-- | Give the number of fixed parameters that a function takes.+foreign import ccall unsafe "LLVMCountParamTypes" countParamTypes+ :: TypeRef -> IO 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 ()++-- | Get the type of a sequential type's elements.+foreign import ccall unsafe "LLVMGetElementType" getElementType+ :: TypeRef -> IO TypeRef+++data Value+ deriving (Typeable)+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 "LLVMGetNamedGlobal" getNamedGlobal+ :: ModuleRef -> CString -> IO ValueRef++foreign import ccall unsafe "LLVMGetInitializer" getInitializer+ :: ValueRef -> IO ValueRef++foreign import ccall unsafe "LLVMIsThreadLocal" isThreadLocal+ :: ValueRef -> IO CInt++foreign import ccall unsafe "LLVMSetThreadLocal" setThreadLocal+ :: ValueRef -> CInt -> IO ()++foreign import ccall unsafe "LLVMIsGlobalConstant" isGlobalConstant+ :: ValueRef -> IO CInt++foreign import ccall unsafe "LLVMSetGlobalConstant" setGlobalConstant+ :: ValueRef -> CInt -> 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 "LLVMConstAllOnes" constAllOnes+ :: TypeRef -> ValueRef++foreign import ccall unsafe "LLVMConstArray" constArray+ :: TypeRef -> Ptr ValueRef -> CUInt -> ValueRef++foreign import ccall unsafe "LLVMConstNull" constNull+ :: TypeRef -> ValueRef++foreign import ccall unsafe "LLVMIsConstant" isConstant+ :: ValueRef -> IO CInt++foreign import ccall unsafe "LLVMGetUndef" getUndef+ :: TypeRef -> ValueRef++foreign import ccall unsafe "LLVMIsNull" isNull+ :: ValueRef -> IO CInt++foreign import ccall unsafe "LLVMIsUndef" isUndef+ :: ValueRef -> IO CInt++foreign import ccall unsafe "LLVMGetNamedFunction" getNamedFunction+ :: ModuleRef -- ^ module+ -> CString -- ^ name+ -> IO ValueRef -- ^ function (@nullPtr@ if not found)++foreign import ccall unsafe "LLVMAddFunction" addFunction+ :: ModuleRef -- ^ module+ -> CString -- ^ name+ -> TypeRef -- ^ type+ -> IO ValueRef++foreign import ccall unsafe "LLVMDeleteFunction" deleteFunction+ :: ValueRef -- ^ function+ -> IO ()++foreign import ccall unsafe "LLVMCountParams" countParams+ :: ValueRef -- ^ function+ -> CUInt++foreign import ccall unsafe "LLVMGetParam" getParam+ :: ValueRef -- ^ function+ -> CUInt -- ^ offset into array+ -> ValueRef++foreign import ccall unsafe "LLVMGetParams" getParams+ :: ValueRef -- ^ function+ -> Ptr ValueRef -- ^ array to fill out+ -> IO ()++foreign import ccall unsafe "LLVMGetIntrinsicID" getIntrinsicID+ :: ValueRef -- ^ function+ -> CUInt++data CallingConvention = C+ | Fast+ | Cold+ | X86StdCall+ | X86FastCall+ | GHC+ deriving (Show, Eq, Ord, Enum, Bounded, Typeable)++fromCallingConvention :: CallingConvention -> CUInt+fromCallingConvention C = (#const LLVMCCallConv)+fromCallingConvention Fast = (#const LLVMFastCallConv)+fromCallingConvention Cold = (#const LLVMColdCallConv)+fromCallingConvention X86StdCall = (#const LLVMX86FastcallCallConv)+fromCallingConvention X86FastCall = (#const LLVMX86StdcallCallConv)+fromCallingConvention GHC = 10++toCallingConvention :: CUInt -> CallingConvention+toCallingConvention c | c == (#const LLVMCCallConv) = C+toCallingConvention c | c == (#const LLVMFastCallConv) = Fast+toCallingConvention c | c == (#const LLVMColdCallConv) = Cold+toCallingConvention c | c == (#const LLVMX86StdcallCallConv) = X86StdCall+toCallingConvention c | c == (#const LLVMX86FastcallCallConv) = X86FastCall+toCallingConvention c | c == 10 = GHC+toCallingConvention c = error $ "LLVM.Core.FFI.toCallingConvention: " +++ "unsupported calling convention" ++ show c++foreign import ccall unsafe "LLVMGetFunctionCallConv" getFunctionCallConv+ :: ValueRef -- ^ function+ -> IO CUInt++foreign import ccall unsafe "LLVMSetFunctionCallConv" setFunctionCallConv+ :: ValueRef -- ^ function+ -> CUInt+ -> IO ()++foreign import ccall unsafe "LLVMGetGC" getGC+ :: ValueRef -> IO CString++foreign import ccall unsafe "LLVMSetGC" setGC+ :: ValueRef -> CString -> IO ()++foreign import ccall unsafe "LLVMIsDeclaration" isDeclaration+ :: ValueRef -> IO CInt++-- |An enumeration for the kinds of linkage for global values.+data Linkage+ = ExternalLinkage -- ^Externally visible function+ | AvailableExternallyLinkage + | LinkOnceAnyLinkage -- ^Keep one copy of function when linking (inline)+ | LinkOnceODRLinkage -- ^Same, but only replaced by something equivalent.+ | WeakAnyLinkage -- ^Keep one copy of named function when linking (weak)+ | WeakODRLinkage -- ^Same, but only replaced by something equivalent.+ | AppendingLinkage -- ^Special purpose, only applies to global arrays+ | InternalLinkage -- ^Rename collisions when linking (static functions)+ | PrivateLinkage -- ^Like Internal, but omit from symbol table+ | DLLImportLinkage -- ^Function to be imported from DLL+ | DLLExportLinkage -- ^Function to be accessible from DLL+ | ExternalWeakLinkage -- ^ExternalWeak linkage description+ | GhostLinkage -- ^Stand-in functions for streaming fns from BC files + | CommonLinkage -- ^Tentative definitions+ | LinkerPrivateLinkage -- ^Like Private, but linker removes.+ deriving (Show, Eq, Ord, Enum, Typeable)++fromLinkage :: Linkage -> CUInt+fromLinkage ExternalLinkage = (#const LLVMExternalLinkage)+fromLinkage AvailableExternallyLinkage = (#const LLVMAvailableExternallyLinkage )+fromLinkage LinkOnceAnyLinkage = (#const LLVMLinkOnceAnyLinkage)+fromLinkage LinkOnceODRLinkage = (#const LLVMLinkOnceODRLinkage)+fromLinkage WeakAnyLinkage = (#const LLVMWeakAnyLinkage)+fromLinkage WeakODRLinkage = (#const LLVMWeakODRLinkage)+fromLinkage AppendingLinkage = (#const LLVMAppendingLinkage)+fromLinkage InternalLinkage = (#const LLVMInternalLinkage)+fromLinkage PrivateLinkage = (#const LLVMPrivateLinkage)+fromLinkage DLLImportLinkage = (#const LLVMDLLImportLinkage)+fromLinkage DLLExportLinkage = (#const LLVMDLLExportLinkage)+fromLinkage ExternalWeakLinkage = (#const LLVMExternalWeakLinkage)+fromLinkage GhostLinkage = (#const LLVMGhostLinkage)+fromLinkage CommonLinkage = (#const LLVMCommonLinkage)+fromLinkage LinkerPrivateLinkage = (#const LLVMLinkerPrivateLinkage)++toLinkage :: CUInt -> Linkage+toLinkage c | c == (#const LLVMExternalLinkage) = ExternalLinkage+toLinkage c | c == (#const LLVMAvailableExternallyLinkage) = AvailableExternallyLinkage +toLinkage c | c == (#const LLVMLinkOnceAnyLinkage) = LinkOnceAnyLinkage+toLinkage c | c == (#const LLVMLinkOnceODRLinkage) = LinkOnceODRLinkage+toLinkage c | c == (#const LLVMWeakAnyLinkage) = WeakAnyLinkage+toLinkage c | c == (#const LLVMWeakODRLinkage) = WeakODRLinkage+toLinkage c | c == (#const LLVMAppendingLinkage) = AppendingLinkage+toLinkage c | c == (#const LLVMInternalLinkage) = InternalLinkage+toLinkage c | c == (#const LLVMPrivateLinkage) = PrivateLinkage+toLinkage c | c == (#const LLVMDLLImportLinkage) = DLLImportLinkage+toLinkage c | c == (#const LLVMDLLExportLinkage) = DLLExportLinkage+toLinkage c | c == (#const LLVMExternalWeakLinkage) = ExternalWeakLinkage+toLinkage c | c == (#const LLVMGhostLinkage) = GhostLinkage+toLinkage c | c == (#const LLVMCommonLinkage) = CommonLinkage+toLinkage c | c == (#const LLVMLinkerPrivateLinkage) = LinkerPrivateLinkage+toLinkage _ = error "toLinkage: bad value"++foreign import ccall unsafe "LLVMGetLinkage" getLinkage+ :: ValueRef -> IO CUInt++foreign import ccall unsafe "LLVMSetLinkage" setLinkage+ :: ValueRef -> CUInt -> IO ()++foreign import ccall unsafe "LLVMGetSection" getSection+ :: ValueRef -> IO CString++foreign import ccall unsafe "LLVMSetSection" setSection+ :: ValueRef -> CString -> IO ()++-- |An enumeration for the kinds of visibility of global values.+data Visibility+ = DefaultVisibility -- ^The GV is visible+ | HiddenVisibility -- ^The GV is hidden+ | ProtectedVisibility -- ^The GV is protected+ deriving (Show, Eq, Ord, Enum)++fromVisibility :: Visibility -> CUInt+fromVisibility DefaultVisibility = (#const LLVMDefaultVisibility)+fromVisibility HiddenVisibility = (#const LLVMHiddenVisibility)+fromVisibility ProtectedVisibility = (#const LLVMProtectedVisibility)++toVisibility :: CUInt -> Visibility+toVisibility c | c == (#const LLVMDefaultVisibility) = DefaultVisibility+toVisibility c | c == (#const LLVMHiddenVisibility) = HiddenVisibility+toVisibility c | c == (#const LLVMProtectedVisibility) = ProtectedVisibility+toVisibility _ = error "toVisibility: bad value"++foreign import ccall unsafe "LLVMGetVisibility" getVisibility+ :: ValueRef -> IO CUInt++foreign import ccall unsafe "LLVMSetVisibility" setVisibility+ :: ValueRef -> CUInt -> IO ()++foreign import ccall unsafe "LLVMGetAlignment" getAlignment+ :: ValueRef -> IO CUInt++foreign import ccall unsafe "LLVMSetAlignment" setAlignment+ :: ValueRef -> CUInt -> 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 "LLVMConstStruct" constStruct+ :: Ptr ValueRef -> CUInt -> CInt -> ValueRef++foreign import ccall unsafe "LLVMConstVector" constVector+ :: Ptr ValueRef -> CUInt -> 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 "LLVMBasicBlockAsValue" basicBlockAsValue+ :: BasicBlockRef -> ValueRef++foreign import ccall unsafe "LLVMValueIsBasicBlock" valueIsBasicBlock+ :: ValueRef -> Bool++foreign import ccall unsafe "LLVMValueAsBasicBlock" valueAsBasicBlock+ :: ValueRef -- ^ basic block+ -> BasicBlockRef++foreign import ccall unsafe "LLVMCountBasicBlocks" countBasicBlocks+ :: ValueRef -- ^ function+ -> IO CUInt++foreign import ccall unsafe "LLVMGetBasicBlocks" getBasicBlocks+ :: ValueRef -- ^ function+ -> Ptr BasicBlockRef -- ^ array to fill out+ -> IO ()++foreign import ccall unsafe "LLVMGetEntryBasicBlock" getEntryBasicBlock+ :: ValueRef -- ^ function+ -> IO BasicBlockRef++foreign import ccall unsafe "LLVMAppendBasicBlock" appendBasicBlock+ :: ValueRef -- ^ function+ -> CString -- ^ name for label+ -> IO BasicBlockRef++foreign import ccall unsafe "LLVMInsertBasicBlock" insertBasicBlock+ :: BasicBlockRef -- ^ insert before this one+ -> CString -- ^ name for label+ -> IO BasicBlockRef++foreign import ccall unsafe "LLVMDeleteBasicBlock" deleteBasicBlock+ :: BasicBlockRef -> IO ()++foreign import ccall unsafe "LLVMInstGetOpcode" instGetOpcode+ :: ValueRef -> IO Int++foreign import ccall unsafe "LLVMCmpInstGetPredicate" cmpInstGetPredicate+ :: ValueRef -> IO Int++data Builder+ deriving (Typeable)+type BuilderRef = Ptr Builder++foreign import ccall unsafe "LLVMCreateBuilder" createBuilder+ :: IO BuilderRef++foreign import ccall unsafe "&LLVMDisposeBuilder" ptrDisposeBuilder+ :: FunPtr (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 "LLVMCountIncoming" countIncoming+ :: ValueRef -> IO CUInt+foreign import ccall unsafe "LLVMAddIncoming" addIncoming+ :: ValueRef -> Ptr ValueRef -> Ptr ValueRef -> CUInt -> IO ()+foreign import ccall unsafe "LLVMGetIncomingValue" getIncomingValue+ :: ValueRef -> CUInt -> IO ValueRef+foreign import ccall unsafe "LLVMGetIncomingBlock" getIncomingBlock+ :: ValueRef -> CUInt -> IO BasicBlockRef+ +foreign import ccall unsafe "LLVMGetInstructionCallConv" getInstructionCallConv+ :: ValueRef -> IO CUInt+foreign import ccall unsafe "LLVMSetInstructionCallConv" setInstructionCallConv+ :: ValueRef -> CUInt -> IO ()++foreign import ccall unsafe "LLVMStructType" structType+ :: Ptr TypeRef -> CUInt -> CInt -> TypeRef+foreign import ccall unsafe "LLVMCountStructElementTypes"+ countStructElementTypes :: TypeRef -> CUInt+foreign import ccall unsafe "LLVMGetStructElementTypes" getStructElementTypes+ :: TypeRef -> Ptr TypeRef -> IO ()+foreign import ccall unsafe "LLVMIsPackedStruct" isPackedStruct+ :: TypeRef -> CInt++data MemoryBuffer+ deriving (Typeable)+type MemoryBufferRef = Ptr MemoryBuffer++data TypeHandle+ deriving (Typeable)+type TypeHandleRef = Ptr TypeHandle++data TypeKind+ = VoidTypeKind+ | FloatTypeKind+ | DoubleTypeKind+ | X86_FP80TypeKind+ | FP128TypeKind+ | PPC_FP128TypeKind+ | LabelTypeKind+ | IntegerTypeKind+ | FunctionTypeKind+ | StructTypeKind+ | ArrayTypeKind+ | PointerTypeKind+ | OpaqueTypeKind+ | VectorTypeKind+ deriving (Eq, Ord, Enum, Bounded, Show, Read, Typeable)++getTypeKind :: TypeRef -> IO TypeKind+getTypeKind = fmap (toEnum . fromIntegral) . getTypeKindCUInt++foreign import ccall unsafe "LLVMCreateMemoryBufferWithContentsOfFile" createMemoryBufferWithContentsOfFile+ :: CString -> Ptr MemoryBufferRef -> Ptr CString -> IO CInt+foreign import ccall unsafe "LLVMCreateMemoryBufferWithSTDIN" createMemoryBufferWithSTDIN+ :: Ptr MemoryBufferRef -> Ptr CString -> IO CInt+foreign import ccall unsafe "LLVMCreateTypeHandle" createTypeHandle+ :: TypeRef -> IO TypeHandleRef+foreign import ccall unsafe "LLVMDisposeMemoryBuffer" disposeMemoryBuffer+ :: MemoryBufferRef -> IO ()+foreign import ccall unsafe "LLVMDisposeMessage" disposeMessage+ :: CString -> IO ()+foreign import ccall unsafe "LLVMDisposeTypeHandle" disposeTypeHandle+ :: TypeHandleRef -> IO ()+foreign import ccall unsafe "LLVMGetArrayLength" getArrayLength+ :: TypeRef -> IO CUInt+foreign import ccall unsafe "LLVMGetIntTypeWidth" getIntTypeWidth+ :: TypeRef -> IO CUInt+foreign import ccall unsafe "LLVMGetPointerAddressSpace" getPointerAddressSpace+ :: TypeRef -> IO CUInt+foreign import ccall unsafe "LLVMGetTarget" getTarget+ :: ModuleRef -> IO CString+foreign import ccall unsafe "LLVMGetTypeKind" getTypeKindCUInt+ :: TypeRef -> IO CUInt+foreign import ccall unsafe "LLVMGetVectorSize" getVectorSize+ :: TypeRef -> IO CUInt+foreign import ccall unsafe "LLVMRefineType" refineType+ :: TypeRef -> TypeRef -> IO ()+foreign import ccall unsafe "LLVMResolveTypeHandle" resolveTypeHandle+ :: TypeHandleRef -> IO TypeRef+foreign import ccall unsafe "LLVMSetTarget" setTarget+ :: ModuleRef -> CString -> IO ()+foreign import ccall unsafe "LLVMSizeOf" sizeOf+ :: TypeRef -> IO ValueRef++data Attribute+ = ZExtAttribute+ | SExtAttribute+ | NoReturnAttribute+ | InRegAttribute+ | StructRetAttribute+ | NoUnwindAttribute+ | NoAliasAttribute+ | ByValAttribute+ | NestAttribute+ | ReadNoneAttribute+ | ReadOnlyAttribute+ | NoInlineAttribute+ | AlwaysInlineAttribute+ | OptimizeForSizeAttribute+ | StackProtectAttribute+ | StackProtectReqAttribute+ | NoCaptureAttribute+ | NoRedZoneAttribute+ | NoImplicitFloatAttribute+ | NakedAttribute+ deriving (Show, Eq, Ord, Enum, Bounded, Typeable)++fromAttribute :: Attribute -> CAttribute+fromAttribute ZExtAttribute = (#const LLVMZExtAttribute)+fromAttribute SExtAttribute = (#const LLVMSExtAttribute)+fromAttribute NoReturnAttribute = (#const LLVMNoReturnAttribute)+fromAttribute InRegAttribute = (#const LLVMInRegAttribute)+fromAttribute StructRetAttribute = (#const LLVMStructRetAttribute)+fromAttribute NoUnwindAttribute = (#const LLVMNoUnwindAttribute)+fromAttribute NoAliasAttribute = (#const LLVMNoAliasAttribute)+fromAttribute ByValAttribute = (#const LLVMByValAttribute)+fromAttribute NestAttribute = (#const LLVMNestAttribute)+fromAttribute ReadNoneAttribute = (#const LLVMReadNoneAttribute)+fromAttribute ReadOnlyAttribute = (#const LLVMReadOnlyAttribute)+fromAttribute NoInlineAttribute = (#const LLVMNoInlineAttribute)+fromAttribute AlwaysInlineAttribute = (#const LLVMAlwaysInlineAttribute)+fromAttribute OptimizeForSizeAttribute = (#const LLVMOptimizeForSizeAttribute)+fromAttribute StackProtectAttribute = (#const LLVMStackProtectAttribute)+fromAttribute StackProtectReqAttribute = (#const LLVMStackProtectReqAttribute)+fromAttribute NoCaptureAttribute = (#const LLVMNoCaptureAttribute)+fromAttribute NoRedZoneAttribute = (#const LLVMNoRedZoneAttribute)+fromAttribute NoImplicitFloatAttribute = (#const LLVMNoImplicitFloatAttribute)+fromAttribute NakedAttribute = (#const LLVMNakedAttribute)++toAttribute :: CAttribute -> Attribute+toAttribute c | c == (#const LLVMZExtAttribute) = ZExtAttribute+toAttribute c | c == (#const LLVMSExtAttribute) = SExtAttribute+toAttribute c | c == (#const LLVMNoReturnAttribute) = NoReturnAttribute+toAttribute c | c == (#const LLVMInRegAttribute) = InRegAttribute+toAttribute c | c == (#const LLVMStructRetAttribute) = StructRetAttribute+toAttribute c | c == (#const LLVMNoUnwindAttribute) = NoUnwindAttribute+toAttribute c | c == (#const LLVMNoAliasAttribute) = NoAliasAttribute+toAttribute c | c == (#const LLVMByValAttribute) = ByValAttribute+toAttribute c | c == (#const LLVMNestAttribute) = NestAttribute+toAttribute c | c == (#const LLVMReadNoneAttribute) = ReadNoneAttribute+toAttribute c | c == (#const LLVMReadOnlyAttribute) = ReadOnlyAttribute+toAttribute c | c == (#const LLVMNoInlineAttribute) = NoInlineAttribute+toAttribute c | c == (#const LLVMAlwaysInlineAttribute) = AlwaysInlineAttribute+toAttribute c | c == (#const LLVMOptimizeForSizeAttribute) = OptimizeForSizeAttribute+toAttribute c | c == (#const LLVMStackProtectAttribute) = StackProtectAttribute+toAttribute c | c == (#const LLVMStackProtectReqAttribute) = StackProtectReqAttribute+toAttribute c | c == (#const LLVMNoCaptureAttribute) = NoCaptureAttribute+toAttribute c | c == (#const LLVMNoRedZoneAttribute) = NoRedZoneAttribute+toAttribute c | c == (#const LLVMNoImplicitFloatAttribute) = NoImplicitFloatAttribute+toAttribute c | c == (#const LLVMNakedAttribute) = NakedAttribute+toAttribute _ = error "toAttribute: bad value"++type CAttribute = CInt++data PassManager+ deriving (Typeable)+type PassManagerRef = Ptr PassManager++data OpaqueUse+ deriving (Typeable)+type UseRef = Ptr OpaqueUse++foreign import ccall unsafe "LLVMConstRealOfString" constRealOfString+ :: TypeRef -> CString -> IO ValueRef+foreign import ccall unsafe "LLVMCreateFunctionPassManager" createFunctionPassManager+ :: ModuleProviderRef -> IO PassManagerRef+foreign import ccall unsafe "LLVMCreatePassManager" createPassManager+ :: IO PassManagerRef+foreign import ccall unsafe "LLVMDisposePassManager" disposePassManager+ :: PassManagerRef -> IO ()+foreign import ccall unsafe "&LLVMDisposePassManager" ptrDisposePassManager+ :: FunPtr (PassManagerRef -> IO ())+foreign import ccall unsafe "LLVMDumpModule" dumpModule+ :: ModuleRef -> IO ()+foreign import ccall unsafe "LLVMFinalizeFunctionPassManager" finalizeFunctionPassManager+ :: PassManagerRef -> IO CInt+foreign import ccall unsafe "LLVMGetBasicBlockParent" getBasicBlockParent+ :: BasicBlockRef -> IO ValueRef+foreign import ccall unsafe "LLVMGetFirstBasicBlock" getFirstBasicBlock+ :: ValueRef -> IO BasicBlockRef+foreign import ccall unsafe "LLVMGetFirstFunction" getFirstFunction+ :: ModuleRef -> IO ValueRef+foreign import ccall unsafe "LLVMGetFirstGlobal" getFirstGlobal+ :: ModuleRef -> IO ValueRef+foreign import ccall unsafe "LLVMGetFirstInstruction" getFirstInstruction+ :: BasicBlockRef -> IO ValueRef+foreign import ccall unsafe "LLVMGetFirstParam" getFirstParam+ :: ValueRef -> IO ValueRef+foreign import ccall unsafe "LLVMGetGlobalParent" getGlobalParent+ :: ValueRef -> IO ModuleRef+foreign import ccall unsafe "LLVMGetInsertBlock" getInsertBlock+ :: BuilderRef -> IO BasicBlockRef+foreign import ccall unsafe "LLVMGetInstructionParent" getInstructionParent+ :: ValueRef -> IO BasicBlockRef+foreign import ccall unsafe "LLVMGetLastBasicBlock" getLastBasicBlock+ :: ValueRef -> IO BasicBlockRef+foreign import ccall unsafe "LLVMGetLastFunction" getLastFunction+ :: ModuleRef -> IO ValueRef+foreign import ccall unsafe "LLVMGetLastGlobal" getLastGlobal+ :: ModuleRef -> IO ValueRef+foreign import ccall unsafe "LLVMGetLastInstruction" getLastInstruction+ :: BasicBlockRef -> IO ValueRef+foreign import ccall unsafe "LLVMGetLastParam" getLastParam+ :: ValueRef -> IO ValueRef+foreign import ccall unsafe "LLVMGetNextBasicBlock" getNextBasicBlock+ :: BasicBlockRef -> IO BasicBlockRef+foreign import ccall unsafe "LLVMGetNextFunction" getNextFunction+ :: ValueRef -> IO ValueRef+foreign import ccall unsafe "LLVMGetNextGlobal" getNextGlobal+ :: ValueRef -> IO ValueRef+foreign import ccall unsafe "LLVMGetNextInstruction" getNextInstruction+ :: ValueRef -> IO ValueRef+foreign import ccall unsafe "LLVMGetNextParam" getNextParam+ :: ValueRef -> IO ValueRef+foreign import ccall unsafe "LLVMGetParamParent" getParamParent+ :: ValueRef -> IO ValueRef+foreign import ccall unsafe "LLVMGetPreviousBasicBlock" getPreviousBasicBlock+ :: BasicBlockRef -> IO BasicBlockRef+foreign import ccall unsafe "LLVMGetPreviousFunction" getPreviousFunction+ :: ValueRef -> IO ValueRef+foreign import ccall unsafe "LLVMGetPreviousGlobal" getPreviousGlobal+ :: ValueRef -> IO ValueRef+foreign import ccall unsafe "LLVMGetPreviousInstruction" getPreviousInstruction+ :: ValueRef -> IO ValueRef+foreign import ccall unsafe "LLVMGetPreviousParam" getPreviousParam+ :: ValueRef -> IO ValueRef+foreign import ccall unsafe "LLVMInitializeFunctionPassManager" initializeFunctionPassManager+ :: PassManagerRef -> IO CInt+foreign import ccall unsafe "LLVMLabelType" labelType+ :: TypeRef+foreign import ccall unsafe "LLVMOpaqueType" opaqueType+ :: TypeRef+foreign import ccall unsafe "LLVMPositionBuilder" positionBuilder+ :: BuilderRef -> BasicBlockRef -> ValueRef -> IO ()+foreign import ccall unsafe "LLVMRunFunctionPassManager" runFunctionPassManager+ :: PassManagerRef -> ValueRef -> IO CInt+foreign import ccall unsafe "LLVMRunPassManager" runPassManager+ :: PassManagerRef -> ModuleRef -> IO CInt+foreign import ccall unsafe "LLVMSetInstrParamAlignment" setInstrParamAlignment+ :: ValueRef -> CUInt -> CUInt -> IO ()+foreign import ccall unsafe "LLVMSetParamAlignment" setParamAlignment+ :: ValueRef -> CUInt -> IO ()+++data Context+ deriving (Typeable)+type ContextRef = Ptr Context++foreign import ccall unsafe "LLVMAddAttribute" addAttribute+ :: ValueRef -> CAttribute -> IO ()+foreign import ccall unsafe "LLVMAddInstrAttribute" addInstrAttribute+ :: ValueRef -> CUInt -> CAttribute -> IO ()+foreign import ccall unsafe "LLVMIsTailCall" isTailCall+ :: ValueRef -> IO CInt+foreign import ccall unsafe "LLVMRemoveAttribute" removeAttribute+ :: ValueRef -> CAttribute -> IO ()+foreign import ccall unsafe "LLVMRemoveInstrAttribute" removeInstrAttribute+ :: ValueRef -> CUInt -> CAttribute -> IO ()+foreign import ccall unsafe "LLVMSetTailCall" setTailCall+ :: ValueRef -> CInt -> IO ()+foreign import ccall unsafe "LLVMAddFunctionAttr" addFunctionAttr+ :: ValueRef -> CAttribute -> IO ()+foreign import ccall unsafe "LLVMAlignOf" alignOf+ :: TypeRef -> IO ValueRef+foreign import ccall unsafe "LLVMAppendBasicBlockInContext" appendBasicBlockInContext+ :: ContextRef -> ValueRef -> CString -> IO BasicBlockRef+foreign import ccall unsafe "LLVMBuildAggregateRet" buildAggregateRet+ :: BuilderRef -> (Ptr ValueRef) -> CUInt -> IO ValueRef+foreign import ccall unsafe "LLVMBuildExactSDiv" buildExactSDiv+ :: BuilderRef -> ValueRef -> ValueRef -> CString -> IO ValueRef+foreign import ccall unsafe "LLVMBuildFAdd" buildFAdd+ :: BuilderRef -> ValueRef -> ValueRef -> CString -> IO ValueRef+foreign import ccall unsafe "LLVMBuildFMul" buildFMul+ :: BuilderRef -> ValueRef -> ValueRef -> CString -> IO ValueRef+foreign import ccall unsafe "LLVMBuildFPCast" buildFPCast+ :: BuilderRef -> ValueRef -> TypeRef -> CString -> IO ValueRef+foreign import ccall unsafe "LLVMBuildFSub" buildFSub+ :: BuilderRef -> ValueRef -> ValueRef -> CString -> IO ValueRef+foreign import ccall unsafe "LLVMBuildFNeg" buildFNeg+ :: BuilderRef -> ValueRef -> CString -> IO ValueRef+foreign import ccall unsafe "LLVMBuildGlobalString" buildGlobalString+ :: BuilderRef -> CString -> CString -> IO ValueRef+foreign import ccall unsafe "LLVMBuildGlobalStringPtr" buildGlobalStringPtr+ :: BuilderRef -> CString -> CString -> IO ValueRef+foreign import ccall unsafe "LLVMBuildInBoundsGEP" buildInBoundsGEP+ :: BuilderRef -> ValueRef -> (Ptr ValueRef) -> CUInt -> CString -> IO ValueRef+foreign import ccall unsafe "LLVMBuildIsNotNull" buildIsNotNull+ :: BuilderRef -> ValueRef -> CString -> IO ValueRef+foreign import ccall unsafe "LLVMBuildIsNull" buildIsNull+ :: BuilderRef -> ValueRef -> CString -> IO ValueRef+foreign import ccall unsafe "LLVMBuildNSWAdd" buildNSWAdd+ :: BuilderRef -> ValueRef -> ValueRef -> CString -> IO ValueRef+foreign import ccall unsafe "LLVMBuildPointerCast" buildPointerCast+ :: BuilderRef -> ValueRef -> TypeRef -> CString -> IO ValueRef+foreign import ccall unsafe "LLVMBuildPtrDiff" buildPtrDiff+ :: BuilderRef -> ValueRef -> ValueRef -> CString -> IO ValueRef+foreign import ccall unsafe "LLVMBuildSExtOrBitCast" buildSExtOrBitCast+ :: BuilderRef -> ValueRef -> TypeRef -> CString -> IO ValueRef+foreign import ccall unsafe "LLVMBuildStructGEP" buildStructGEP+ :: BuilderRef -> ValueRef -> CUInt -> CString -> IO ValueRef+foreign import ccall unsafe "LLVMBuildTruncOrBitCast" buildTruncOrBitCast+ :: BuilderRef -> ValueRef -> TypeRef -> CString -> IO ValueRef+foreign import ccall unsafe "LLVMBuildZExtOrBitCast" buildZExtOrBitCast+ :: BuilderRef -> ValueRef -> TypeRef -> CString -> IO ValueRef+foreign import ccall unsafe "LLVMConstExactSDiv" constExactSDiv+ :: ValueRef -> ValueRef -> IO ValueRef+foreign import ccall unsafe "LLVMConstFAdd" constFAdd+ :: ValueRef -> ValueRef -> ValueRef+foreign import ccall unsafe "LLVMConstFMul" constFMul+ :: ValueRef -> ValueRef -> ValueRef+foreign import ccall unsafe "LLVMConstFNeg" constFNeg+ :: ValueRef -> ValueRef+foreign import ccall unsafe "LLVMConstFPCast" constFPCast+ :: ValueRef -> TypeRef -> ValueRef+foreign import ccall unsafe "LLVMConstFSub" constFSub+ :: ValueRef -> ValueRef -> ValueRef+foreign import ccall unsafe "LLVMConstInBoundsGEP" constInBoundsGEP+ :: ValueRef -> (Ptr ValueRef) -> CUInt -> IO ValueRef+foreign import ccall unsafe "LLVMConstIntCast" constIntCast+ :: ValueRef -> TypeRef -> CUInt -> IO ValueRef+foreign import ccall unsafe "LLVMConstIntOfString" constIntOfString+ :: TypeRef -> CString -> CUInt -> IO ValueRef+foreign import ccall unsafe "LLVMConstIntOfStringAndSize" constIntOfStringAndSize+ :: TypeRef -> CString -> CUInt -> CUInt -> IO ValueRef+foreign import ccall unsafe "LLVMConstNSWAdd" constNSWAdd+ :: ValueRef -> ValueRef -> IO ValueRef+foreign import ccall unsafe "LLVMConstPointerCast" constPointerCast+ :: ValueRef -> TypeRef -> IO ValueRef+foreign import ccall unsafe "LLVMConstPointerNull" constPointerNull+ :: TypeRef -> IO ValueRef+foreign import ccall unsafe "LLVMConstRealOfStringAndSize" constRealOfStringAndSize+ :: TypeRef -> CString -> CUInt -> IO ValueRef+foreign import ccall unsafe "LLVMConstSExtOrBitCast" constSExtOrBitCast+ :: ValueRef -> TypeRef -> IO ValueRef+foreign import ccall unsafe "LLVMConstStringInContext" constStringInContext+ :: ContextRef -> CString -> CUInt -> CInt -> IO ValueRef+foreign import ccall unsafe "LLVMConstStructInContext" constStructInContext+ :: ContextRef -> (Ptr ValueRef) -> CUInt -> CInt -> IO ValueRef+foreign import ccall unsafe "LLVMConstTruncOrBitCast" constTruncOrBitCast+ :: ValueRef -> TypeRef -> IO ValueRef+foreign import ccall unsafe "LLVMConstZExtOrBitCast" constZExtOrBitCast+ :: ValueRef -> TypeRef -> IO ValueRef+foreign import ccall unsafe "LLVMContextDispose" contextDispose+ :: ContextRef -> IO ()+foreign import ccall unsafe "LLVMCreateBuilderInContext" createBuilderInContext+ :: ContextRef -> IO BuilderRef+foreign import ccall unsafe "LLVMDoubleTypeInContext" doubleTypeInContext+ :: ContextRef -> IO TypeRef+foreign import ccall unsafe "LLVMFP128TypeInContext" fP128TypeInContext+ :: ContextRef -> IO TypeRef+foreign import ccall unsafe "LLVMFloatTypeInContext" floatTypeInContext+ :: ContextRef -> IO TypeRef+foreign import ccall unsafe "LLVMGetTypeByName" getTypeByName+ :: ModuleRef -> CString -> IO TypeRef+foreign import ccall unsafe "LLVMGetTypeContext" getTypeContext+ :: TypeRef -> IO ContextRef+foreign import ccall unsafe "LLVMInsertBasicBlockInContext" insertBasicBlockInContext+ :: ContextRef -> BasicBlockRef -> CString -> IO BasicBlockRef+foreign import ccall unsafe "LLVMInsertIntoBuilderWithName" insertIntoBuilderWithName+ :: BuilderRef -> ValueRef -> CString -> IO ()+foreign import ccall unsafe "LLVMInt16TypeInContext" int16TypeInContext+ :: ContextRef -> IO TypeRef+foreign import ccall unsafe "LLVMInt1TypeInContext" int1TypeInContext+ :: ContextRef -> IO TypeRef+foreign import ccall unsafe "LLVMInt32TypeInContext" int32TypeInContext+ :: ContextRef -> IO TypeRef+foreign import ccall unsafe "LLVMInt64TypeInContext" int64TypeInContext+ :: ContextRef -> IO TypeRef+foreign import ccall unsafe "LLVMInt8TypeInContext" int8TypeInContext+ :: ContextRef -> IO TypeRef+foreign import ccall unsafe "LLVMIntTypeInContext" intTypeInContext+ :: ContextRef -> CUInt -> IO TypeRef+foreign import ccall unsafe "LLVMLabelTypeInContext" labelTypeInContext+ :: ContextRef -> IO TypeRef+foreign import ccall unsafe "LLVMModuleCreateWithNameInContext" moduleCreateWithNameInContext+ :: CString -> ContextRef -> IO ModuleRef+foreign import ccall unsafe "LLVMOpaqueTypeInContext" opaqueTypeInContext+ :: ContextRef -> IO TypeRef+foreign import ccall unsafe "LLVMPPCFP128TypeInContext" pPCFP128TypeInContext+ :: ContextRef -> IO TypeRef+foreign import ccall unsafe "LLVMRemoveFunctionAttr" removeFunctionAttr+ :: ValueRef -> CAttribute -> IO ()+foreign import ccall unsafe "LLVMStructTypeInContext" structTypeInContext+ :: ContextRef -> (Ptr TypeRef) -> CUInt -> CInt -> IO TypeRef+foreign import ccall unsafe "LLVMVoidTypeInContext" voidTypeInContext+ :: ContextRef -> IO TypeRef+foreign import ccall unsafe "LLVMX86FP80TypeInContext" x86FP80TypeInContext+ :: ContextRef -> IO TypeRef+++++foreign import ccall unsafe "LLVMAddAlias" addAlias+ :: ModuleRef -> TypeRef -> ValueRef -> CString -> IO ValueRef+foreign import ccall unsafe "LLVMAddDestination" addDestination+ :: ValueRef -> BasicBlockRef -> IO ()+foreign import ccall unsafe "LLVMAddGlobalInAddressSpace" addGlobalInAddressSpace+ :: ModuleRef -> TypeRef -> CString -> CUInt -> IO ValueRef+foreign import ccall unsafe "LLVMBlockAddress" blockAddress+ :: ValueRef -> BasicBlockRef -> IO ValueRef+foreign import ccall unsafe "LLVMBuildBinOp" buildBinOp+ :: BuilderRef -> CUInt{-Opcode-} -> ValueRef -> ValueRef -> CString -> IO ValueRef+foreign import ccall unsafe "LLVMBuildCast" buildCast+ :: BuilderRef -> CUInt{-Opcode-} -> ValueRef -> TypeRef -> CString -> IO ValueRef+foreign import ccall unsafe "LLVMBuildExtractValue" buildExtractValue+ :: BuilderRef -> ValueRef -> CUInt -> CString -> IO ValueRef+foreign import ccall unsafe "LLVMBuildIndirectBr" buildIndirectBr+ :: BuilderRef -> ValueRef -> CUInt -> IO ValueRef+foreign import ccall unsafe "LLVMBuildInsertValue" buildInsertValue+ :: BuilderRef -> ValueRef -> ValueRef -> CUInt -> CString -> IO ValueRef+foreign import ccall unsafe "LLVMBuildNSWMul" buildNSWMul+ :: BuilderRef -> ValueRef -> ValueRef -> CString -> IO ValueRef+foreign import ccall unsafe "LLVMBuildNSWNeg" buildNSWNeg+ :: BuilderRef -> ValueRef -> CString -> IO ValueRef+foreign import ccall unsafe "LLVMBuildNSWSub" buildNSWSub+ :: BuilderRef -> ValueRef -> ValueRef -> CString -> IO ValueRef+foreign import ccall unsafe "LLVMBuildNUWAdd" buildNUWAdd+ :: BuilderRef -> ValueRef -> ValueRef -> CString -> IO ValueRef+foreign import ccall unsafe "LLVMBuildNUWMul" buildNUWMul+ :: BuilderRef -> ValueRef -> ValueRef -> CString -> IO ValueRef+foreign import ccall unsafe "LLVMBuildNUWNeg" buildNUWNeg+ :: BuilderRef -> ValueRef -> CString -> IO ValueRef+foreign import ccall unsafe "LLVMBuildNUWSub" buildNUWSub+ :: BuilderRef -> ValueRef -> ValueRef -> CString -> IO ValueRef+foreign import ccall unsafe "LLVMClearInsertionPosition" clearInsertionPosition+ :: BuilderRef -> IO ()+foreign import ccall unsafe "LLVMConstExtractValue" constExtractValue+ :: ValueRef -> Ptr CUInt -> CUInt -> IO ValueRef+foreign import ccall unsafe "LLVMConstInlineAsm" constInlineAsm+ :: TypeRef -> CString -> CString -> Bool -> Bool -> IO ValueRef+foreign import ccall unsafe "LLVMConstInsertValue" constInsertValue+ :: ValueRef -> ValueRef -> Ptr CUInt -> CUInt -> IO ValueRef+foreign import ccall unsafe "LLVMConstIntGetSExtValue" constIntGetSExtValue+ :: ValueRef -> IO CLLong+foreign import ccall unsafe "LLVMConstIntGetZExtValue" constIntGetZExtValue+ :: ValueRef -> IO CULLong+foreign import ccall unsafe "LLVMConstNSWMul" constNSWMul+ :: ValueRef -> ValueRef -> IO ValueRef+foreign import ccall unsafe "LLVMConstNSWNeg" constNSWNeg+ :: ValueRef -> IO ValueRef+foreign import ccall unsafe "LLVMConstNSWSub" constNSWSub+ :: ValueRef -> ValueRef -> IO ValueRef+foreign import ccall unsafe "LLVMConstNUWAdd" constNUWAdd+ :: ValueRef -> ValueRef -> IO ValueRef+foreign import ccall unsafe "LLVMConstNUWMul" constNUWMul+ :: ValueRef -> ValueRef -> IO ValueRef+foreign import ccall unsafe "LLVMConstNUWNeg" constNUWNeg+ :: ValueRef -> IO ValueRef+foreign import ccall unsafe "LLVMConstNUWSub" constNUWSub+ :: ValueRef -> ValueRef -> IO ValueRef+{-+foreign import ccall unsafe "LLVMConstUnion" constUnion+ :: TypeRef -> ValueRef -> IO ValueRef+-}+foreign import ccall unsafe "LLVMContextCreate" contextCreate+ :: IO ContextRef+{-+foreign import ccall unsafe "LLVMCountUnionElementTypes" countUnionElementTypes+ :: TypeRef -> IO CUInt+-}+foreign import ccall unsafe "LLVMCreateFunctionPassManagerForModule" createFunctionPassManagerForModule+ :: ModuleRef -> IO PassManagerRef+foreign import ccall unsafe "LLVMGetAttribute" getAttribute+ :: ValueRef -> IO CUInt{-Attribute-}+foreign import ccall unsafe "LLVMGetConstOpcode" getConstOpcode+ :: ValueRef -> IO CUInt {-Opcode-}+foreign import ccall unsafe "LLVMGetCurrentDebugLocation" getCurrentDebugLocation+ :: BuilderRef -> IO ValueRef+foreign import ccall unsafe "LLVMGetFirstUse" getFirstUse+ :: ValueRef -> IO UseRef+foreign import ccall unsafe "LLVMGetFunctionAttr" getFunctionAttr+ :: ValueRef -> IO CUInt {-Attribute-}+foreign import ccall unsafe "LLVMGetGlobalContext" getGlobalContext+ :: IO ContextRef+foreign import ccall unsafe "LLVMGetMDKindID" getMDKindID+ :: CString -> CUInt -> IO CUInt+foreign import ccall unsafe "LLVMGetMDKindIDInContext" getMDKindIDInContext+ :: ContextRef -> CString -> CUInt -> IO CUInt+foreign import ccall unsafe "LLVMGetMetadata" getMetadata+ :: ValueRef -> CUInt -> IO ValueRef+foreign import ccall unsafe "LLVMGetNextUse" getNextUse+ :: UseRef -> IO UseRef+foreign import ccall unsafe "LLVMGetOperand" getOperand+ :: ValueRef -> CUInt -> IO ValueRef+foreign import ccall unsafe "LLVMGetNumOperands" getNumOperands+ :: ValueRef -> IO CUInt+{-+foreign import ccall unsafe "LLVMGetUnionElementTypes" getUnionElementTypes+ :: TypeRef -> (Ptr TypeRef) -> IO ()+-}+foreign import ccall unsafe "LLVMValueIsUsedInBasicBlock" isUsedInBasicBlock+ :: BasicBlockRef -> ValueRef -> IO CInt+foreign import ccall unsafe "LLVMValueGetNumUses" getNumUses+ :: ValueRef -> IO CUInt+foreign import ccall unsafe "LLVMGetUsedValue" getUsedValue+ :: UseRef -> IO ValueRef+foreign import ccall unsafe "LLVMGetUser" getUser+ :: UseRef -> IO ValueRef+foreign import ccall unsafe "LLVMHasMetadata" hasMetadata+ :: ValueRef -> IO CInt+foreign import ccall unsafe "LLVMInsertIntoBuilder" insertIntoBuilder+ :: BuilderRef -> ValueRef -> IO ()+foreign import ccall unsafe "LLVMMDNode" mDNode+ :: (Ptr ValueRef) -> CUInt -> IO ValueRef+foreign import ccall unsafe "LLVMMDNodeInContext" mDNodeInContext+ :: ContextRef -> (Ptr ValueRef) -> CUInt -> IO ValueRef+foreign import ccall unsafe "LLVMMDString" mDString+ :: CString -> CUInt -> IO ValueRef+foreign import ccall unsafe "LLVMMDStringInContext" mDStringInContext+ :: ContextRef -> CString -> CUInt -> IO ValueRef+foreign import ccall unsafe "LLVMReplaceAllUsesWith" replaceAllUsesWith+ :: ValueRef -> ValueRef -> IO ()+foreign import ccall unsafe "LLVMSetCurrentDebugLocation" setCurrentDebugLocation+ :: BuilderRef -> ValueRef -> IO ()+foreign import ccall unsafe "LLVMSetInstDebugLocation" setInstDebugLocation+ :: BuilderRef -> ValueRef -> IO ()+foreign import ccall unsafe "LLVMSetMetadata" setMetadata+ :: ValueRef -> CUInt -> ValueRef -> IO ()+{-+foreign import ccall unsafe "LLVMUnionType" unionType+ :: (Ptr TypeRef) -> CUInt -> IO TypeRef+foreign import ccall unsafe "LLVMUnionTypeInContext" unionTypeInContext+ :: ContextRef -> (Ptr TypeRef) -> CUInt -> IO TypeRef+-}
+ LLVM/FFI/ExecutionEngine.hsc view
@@ -0,0 +1,166 @@+{-# LANGUAGE CPP, ForeignFunctionInterface, EmptyDataDecls, DeriveDataTypeable #-}++module LLVM.FFI.ExecutionEngine+ (+ -- * Execution engines+ ExecutionEngine+ , createExecutionEngine+ , ptrDisposeExecutionEngine+ , createInterpreter+ , createJITCompiler+ , addModuleProvider+ , removeModuleProvider+ , findFunction+ , freeMachineCodeForFunction+ , runStaticConstructors+ , runStaticDestructors+ , runFunction+ , runFunctionAsMain+ , getExecutionEngineTargetData+ , addGlobalMapping+ , getPointerToGlobal++ , addModule+ , createExecutionEngineForModule+ , createInterpreterForModule+ , createJITCompilerForModule+ , disposeExecutionEngine+ , removeModule++ -- * Generic values+ , GenericValue+ , GenericValueRef+ , createGenericValueOfInt+ , genericValueToInt+ , genericValueIntWidth+ , createGenericValueOfFloat+ , genericValueToFloat+ , createGenericValueOfPointer+ , genericValueToPointer+ , ptrDisposeGenericValue++ -- * Linking+-- , linkInInterpreter+ , linkInJIT+ ) where+import Data.Typeable+import Foreign.C.String (CString)+#if __GLASGOW_HASKELL__ >= 704+import Foreign.C.Types (CDouble(..), CInt(..), CUInt(..), CULLong(..))+#else+import Foreign.C.Types (CDouble, CInt, CUInt, CULLong)+#endif+import Foreign.Ptr (Ptr, FunPtr)++import LLVM.FFI.Core (ModuleRef, ModuleProviderRef, TypeRef, ValueRef)+import LLVM.FFI.Target(TargetDataRef)++data ExecutionEngine+ deriving (Typeable)+type ExecutionEngineRef = Ptr ExecutionEngine++foreign import ccall unsafe "LLVMCreateExecutionEngine" createExecutionEngine+ :: Ptr ExecutionEngineRef -> ModuleProviderRef -> Ptr CString+ -> IO CInt++foreign import ccall unsafe "&LLVMDisposeExecutionEngine" ptrDisposeExecutionEngine+ :: FunPtr (ExecutionEngineRef -> IO ())++foreign import ccall unsafe "LLVMRunStaticConstructors" runStaticConstructors+ :: ExecutionEngineRef -> IO ()++foreign import ccall unsafe "LLVMRunStaticDestructors" runStaticDestructors+ :: ExecutionEngineRef -> IO ()+++data GenericValue+ deriving (Typeable)+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+ :: TypeRef -> GenericValueRef -> CDouble++foreign import ccall unsafe "&LLVMDisposeGenericValue" ptrDisposeGenericValue+ :: FunPtr (GenericValueRef -> IO ())++{-+safe call is important, since the running LLVM code may call back into Haskell code++See+http://www.cse.unsw.edu.au/~chak/haskell/ffi/ffi/ffise3.html#x6-130003.3 says:++"Optionally, an import declaration can specify,+after the calling convention,+the safety level that should be used when invoking an external entity.+..."+-}+foreign import ccall safe "LLVMRunFunction" runFunction+ :: ExecutionEngineRef -> ValueRef -> CUInt+ -> Ptr GenericValueRef -> IO GenericValueRef++foreign import ccall unsafe "LLVMAddModuleProvider" addModuleProvider+ :: ExecutionEngineRef -> ModuleProviderRef -> IO ()+foreign import ccall unsafe "LLVMCreateGenericValueOfPointer"+ createGenericValueOfPointer :: Ptr a -> IO GenericValueRef+foreign import ccall unsafe "LLVMCreateInterpreter" createInterpreter+ :: Ptr ExecutionEngineRef -> ModuleProviderRef -> Ptr CString -> IO CInt+foreign import ccall unsafe "LLVMCreateJITCompiler" createJITCompiler+ :: Ptr ExecutionEngineRef -> ModuleProviderRef -> CUInt -> Ptr CString -> IO CInt+foreign import ccall unsafe "LLVMFindFunction" findFunction+ :: ExecutionEngineRef -> CString -> Ptr ValueRef -> IO CInt+foreign import ccall unsafe "LLVMFreeMachineCodeForFunction"+ freeMachineCodeForFunction :: ExecutionEngineRef -> ValueRef -> IO ()+foreign import ccall unsafe "LLVMGenericValueIntWidth" genericValueIntWidth+ :: GenericValueRef -> IO CUInt+foreign import ccall unsafe "LLVMGenericValueToPointer" genericValueToPointer+ :: GenericValueRef -> IO (Ptr a)+foreign import ccall unsafe "LLVMRemoveModuleProvider" removeModuleProvider+ :: ExecutionEngineRef -> ModuleProviderRef -> Ptr ModuleRef -> Ptr CString+ -> IO CInt+foreign import ccall safe "LLVMRunFunctionAsMain" runFunctionAsMain+ :: ExecutionEngineRef -> ValueRef -> CUInt+ -> Ptr CString -- ^ argv+ -> Ptr CString -- ^ envp+ -> IO CInt++foreign import ccall unsafe "LLVMGetExecutionEngineTargetData" getExecutionEngineTargetData+ :: ExecutionEngineRef -> IO TargetDataRef+foreign import ccall unsafe "LLVMAddGlobalMapping" addGlobalMapping+ :: ExecutionEngineRef -> ValueRef -> Ptr () -> IO ()++foreign import ccall unsafe "LLVMGetPointerToGlobal" getPointerToGlobal+ :: ExecutionEngineRef -> ValueRef -> IO (FunPtr a)++{-+foreign import ccall unsafe "LLVMLinkInInterpreter" linkInInterpreter+ :: IO ()+-}+foreign import ccall unsafe "LLVMLinkInJIT" linkInJIT+ :: IO ()++foreign import ccall unsafe "LLVMAddModule" addModule+ :: ExecutionEngineRef -> ModuleRef -> IO ()+foreign import ccall unsafe "LLVMCreateExecutionEngineForModule" createExecutionEngineForModule+ :: (Ptr ExecutionEngineRef) -> ModuleRef -> (Ptr CString) -> IO Bool+foreign import ccall unsafe "LLVMCreateInterpreterForModule" createInterpreterForModule+ :: (Ptr ExecutionEngineRef) -> ModuleRef -> (Ptr CString) -> IO Bool+foreign import ccall unsafe "LLVMCreateJITCompilerForModule" createJITCompilerForModule+ :: (Ptr ExecutionEngineRef) -> ModuleRef -> CUInt -> (Ptr CString) -> IO Bool+foreign import ccall unsafe "LLVMDisposeExecutionEngine" disposeExecutionEngine+ :: ExecutionEngineRef -> IO ()+{-+foreign import ccall unsafe "LLVMDisposeGenericValue" disposeGenericValue+ :: GenericValueRef -> IO ()+-}+foreign import ccall unsafe "LLVMRemoveModule" removeModule+ :: ExecutionEngineRef -> ModuleRef -> (Ptr ModuleRef) -> (Ptr CString) -> IO Bool
+ LLVM/FFI/Support.hsc view
@@ -0,0 +1,20 @@+{-# LANGUAGE CPP, ForeignFunctionInterface #-}++module LLVM.FFI.Support+ (+ createStandardModulePasses+ , createStandardFunctionPasses+ ) where++#if __GLASGOW_HASKELL__ >= 704+import Foreign.C.Types (CInt(..), CUInt(..))+#else+import Foreign.C.Types (CInt, CUInt)+#endif+import LLVM.FFI.Core (PassManagerRef)++foreign import ccall unsafe "LLVMCreateStandardFunctionPasses" createStandardFunctionPasses+ :: PassManagerRef -> CUInt -> IO ()++foreign import ccall unsafe "LLVMCreateStandardModulePasses" createStandardModulePasses+ :: PassManagerRef -> CUInt -> CInt -> CInt -> CInt -> CInt -> CInt -> CInt -> IO ()
+ LLVM/FFI/Target.hsc view
@@ -0,0 +1,56 @@+{-# LANGUAGE CPP, ForeignFunctionInterface, EmptyDataDecls, DeriveDataTypeable #-}++module LLVM.FFI.Target where+import Data.Typeable+import Foreign.C.String (CString)+#if __GLASGOW_HASKELL__ >= 704+import Foreign.C.Types (CInt(..), CUInt(..), CULLong(..))+#else+import Foreign.C.Types (CInt, CUInt, CULLong)+#endif+import Foreign.Ptr (Ptr)++import LLVM.FFI.Core++-- enum { LLVMBigEndian, LLVMLittleEndian };+type ByteOrdering = CInt++data TargetData+ deriving (Typeable)+type TargetDataRef = Ptr TargetData++foreign import ccall unsafe "LLVMABIAlignmentOfType" aBIAlignmentOfType+ :: TargetDataRef -> TypeRef -> CUInt+foreign import ccall unsafe "LLVMABISizeOfType" aBISizeOfType+ :: TargetDataRef -> TypeRef -> CULLong+foreign import ccall unsafe "LLVMAddTargetData" addTargetData+ :: TargetDataRef -> PassManagerRef -> IO ()+foreign import ccall unsafe "LLVMByteOrder" byteOrder+ :: TargetDataRef -> ByteOrdering+foreign import ccall unsafe "LLVMCallFrameAlignmentOfType" callFrameAlignmentOfType+ :: TargetDataRef -> TypeRef -> CUInt+foreign import ccall unsafe "LLVMCopyStringRepOfTargetData" copyStringRepOfTargetData+ :: TargetDataRef -> IO CString+foreign import ccall unsafe "LLVMCreateTargetData" createTargetData+ :: CString -> IO TargetDataRef+foreign import ccall unsafe "LLVMDisposeTargetData" disposeTargetData+ :: TargetDataRef -> IO ()+foreign import ccall unsafe "LLVMElementAtOffset" elementAtOffset+ :: TargetDataRef -> TypeRef -> CULLong -> CUInt+foreign import ccall unsafe "LLVMIntPtrType" intPtrType+ :: TargetDataRef -> TypeRef+foreign import ccall unsafe "LLVMInvalidateStructLayout" invalidateStructLayout+ :: TargetDataRef -> TypeRef -> IO ()+foreign import ccall unsafe "LLVMOffsetOfElement" offsetOfElement+ :: TargetDataRef -> TypeRef -> CUInt -> CULLong+foreign import ccall unsafe "LLVMPointerSize" pointerSize+ :: TargetDataRef -> CUInt+foreign import ccall unsafe "LLVMPreferredAlignmentOfGlobal" preferredAlignmentOfGlobal+ :: TargetDataRef -> ValueRef -> CUInt+foreign import ccall unsafe "LLVMPreferredAlignmentOfType" preferredAlignmentOfType+ :: TargetDataRef -> TypeRef -> CUInt+foreign import ccall unsafe "LLVMSizeOfTypeInBits" sizeOfTypeInBits+ :: TargetDataRef -> TypeRef -> CULLong+foreign import ccall unsafe "LLVMStoreSizeOfType" storeSizeOfType+ :: TargetDataRef -> TypeRef -> CULLong+
+ LLVM/FFI/Transforms/IPO.hsc view
@@ -0,0 +1,34 @@+{-# LANGUAGE ForeignFunctionInterface, EmptyDataDecls #-}++module LLVM.FFI.Transforms.IPO where++import LLVM.FFI.Core++foreign import ccall unsafe "LLVMAddArgumentPromotionPass" addArgumentPromotionPass+ :: PassManagerRef -> IO ()+foreign import ccall unsafe "LLVMAddConstantMergePass" addConstantMergePass+ :: PassManagerRef -> IO ()+foreign import ccall unsafe "LLVMAddDeadArgEliminationPass" addDeadArgEliminationPass+ :: PassManagerRef -> IO ()+foreign import ccall unsafe "LLVMAddDeadTypeEliminationPass" addDeadTypeEliminationPass+ :: PassManagerRef -> IO ()+foreign import ccall unsafe "LLVMAddFunctionAttrsPass" addFunctionAttrsPass+ :: PassManagerRef -> IO ()+foreign import ccall unsafe "LLVMAddFunctionInliningPass" addFunctionInliningPass+ :: PassManagerRef -> IO ()+foreign import ccall unsafe "LLVMAddGlobalDCEPass" addGlobalDCEPass+ :: PassManagerRef -> IO ()+foreign import ccall unsafe "LLVMAddGlobalOptimizerPass" addGlobalOptimizerPass+ :: PassManagerRef -> IO ()+foreign import ccall unsafe "LLVMAddIPConstantPropagationPass" addIPConstantPropagationPass+ :: PassManagerRef -> IO ()+foreign import ccall unsafe "LLVMAddPruneEHPass" addPruneEHPass+ :: PassManagerRef -> IO ()+foreign import ccall unsafe "LLVMAddIPSCCPPass" addIPSCCPPass+ :: PassManagerRef -> IO ()+foreign import ccall unsafe "LLVMAddRaiseAllocationsPass" addRaiseAllocationsPass+ :: PassManagerRef -> IO ()+foreign import ccall unsafe "LLVMAddStripDeadPrototypesPass" addStripDeadPrototypesPass+ :: PassManagerRef -> IO ()+foreign import ccall unsafe "LLVMAddStripSymbolsPass" addStripSymbolsPass+ :: PassManagerRef -> IO ()
+ LLVM/FFI/Transforms/Scalar.hsc view
@@ -0,0 +1,50 @@+{-# LANGUAGE ForeignFunctionInterface, EmptyDataDecls #-}++module LLVM.FFI.Transforms.Scalar where++import LLVM.FFI.Core++foreign import ccall unsafe "LLVMAddCFGSimplificationPass" addCFGSimplificationPass+ :: PassManagerRef -> IO ()+foreign import ccall unsafe "LLVMAddConstantPropagationPass" addConstantPropagationPass+ :: PassManagerRef -> IO ()+foreign import ccall unsafe "LLVMAddDemoteMemoryToRegisterPass" addDemoteMemoryToRegisterPass+ :: PassManagerRef -> IO ()+foreign import ccall unsafe "LLVMAddGVNPass" addGVNPass+ :: PassManagerRef -> IO ()+foreign import ccall unsafe "LLVMAddInstructionCombiningPass" addInstructionCombiningPass+ :: PassManagerRef -> IO ()+foreign import ccall unsafe "LLVMAddPromoteMemoryToRegisterPass" addPromoteMemoryToRegisterPass+ :: PassManagerRef -> IO ()+foreign import ccall unsafe "LLVMAddReassociatePass" addReassociatePass+ :: PassManagerRef -> IO ()+foreign import ccall unsafe "LLVMAddAggressiveDCEPass" addAggressiveDCEPass+ :: PassManagerRef -> IO ()+foreign import ccall unsafe "LLVMAddDeadStoreEliminationPass" addDeadStoreEliminationPass+ :: PassManagerRef -> IO ()+foreign import ccall unsafe "LLVMAddIndVarSimplifyPass" addIndVarSimplifyPass+ :: PassManagerRef -> IO ()+foreign import ccall unsafe "LLVMAddJumpThreadingPass" addJumpThreadingPass+ :: PassManagerRef -> IO ()+foreign import ccall unsafe "LLVMAddLICMPass" addLICMPass+ :: PassManagerRef -> IO ()+foreign import ccall unsafe "LLVMAddLoopDeletionPass" addLoopDeletionPass+ :: PassManagerRef -> IO ()+foreign import ccall unsafe "LLVMAddLoopRotatePass" addLoopRotatePass+ :: PassManagerRef -> IO ()+foreign import ccall unsafe "LLVMAddLoopUnrollPass" addLoopUnrollPass+ :: PassManagerRef -> IO ()+foreign import ccall unsafe "LLVMAddLoopUnswitchPass" addLoopUnswitchPass+ :: PassManagerRef -> IO ()+foreign import ccall unsafe "LLVMAddMemCpyOptPass" addMemCpyOptPass+ :: PassManagerRef -> IO ()+foreign import ccall unsafe "LLVMAddSCCPPass" addSCCPPass+ :: PassManagerRef -> IO ()+foreign import ccall unsafe "LLVMAddScalarReplAggregatesPass" addScalarReplAggregatesPass+ :: PassManagerRef -> IO ()+foreign import ccall unsafe "LLVMAddSimplifyLibCallsPass" addSimplifyLibCallsPass+ :: PassManagerRef -> IO ()+foreign import ccall unsafe "LLVMAddTailCallEliminationPass" addTailCallEliminationPass+ :: PassManagerRef -> IO ()+foreign import ccall unsafe "LLVMAddVerifierPass" addVerifierPass+ :: PassManagerRef -> IO ()
+ LLVM/Target/ARM.hs view
@@ -0,0 +1,10 @@+{-# LANGUAGE ForeignFunctionInterface #-}+module LLVM.Target.ARM(initializeTarget) where++initializeTarget :: IO ()+initializeTarget = do+ initializeARMTargetInfo+ initializeARMTarget++foreign import ccall unsafe "LLVMInitializeARMTargetInfo" initializeARMTargetInfo :: IO ()+foreign import ccall unsafe "LLVMInitializeARMTarget" initializeARMTarget :: IO ()
+ LLVM/Target/Alpha.hs view
@@ -0,0 +1,10 @@+{-# LANGUAGE ForeignFunctionInterface #-}+module LLVM.Target.Alpha(initializeTarget) where++initializeTarget :: IO ()+initializeTarget = do+ initializeAlphaTargetInfo+ initializeAlphaTarget++foreign import ccall unsafe "LLVMInitializeAlphaTargetInfo" initializeAlphaTargetInfo :: IO ()+foreign import ccall unsafe "LLVMInitializeAlphaTarget" initializeAlphaTarget :: IO ()
+ LLVM/Target/Blackfin.hs view
@@ -0,0 +1,10 @@+{-# LANGUAGE ForeignFunctionInterface #-}+module LLVM.Target.Blackfin(initializeTarget) where++initializeTarget :: IO ()+initializeTarget = do+ initializeBlackfinTargetInfo+ initializeBlackfinTarget++foreign import ccall unsafe "LLVMInitializeBlackfinTargetInfo" initializeBlackfinTargetInfo :: IO ()+foreign import ccall unsafe "LLVMInitializeBlackfinTarget" initializeBlackfinTarget :: IO ()
+ LLVM/Target/CBackend.hs view
@@ -0,0 +1,10 @@+{-# LANGUAGE ForeignFunctionInterface #-}+module LLVM.Target.CBackend(initializeTarget) where++initializeTarget :: IO ()+initializeTarget = do+ initializeCBackendTargetInfo+ initializeCBackendTarget++foreign import ccall unsafe "LLVMInitializeCBackendTargetInfo" initializeCBackendTargetInfo :: IO ()+foreign import ccall unsafe "LLVMInitializeCBackendTarget" initializeCBackendTarget :: IO ()
+ LLVM/Target/CellSPU.hs view
@@ -0,0 +1,10 @@+{-# LANGUAGE ForeignFunctionInterface #-}+module LLVM.Target.CellSPU(initializeTarget) where++initializeTarget :: IO ()+initializeTarget = do+ initializeCellSPUTargetInfo+ initializeCellSPUTarget++foreign import ccall unsafe "LLVMInitializeCellSPUTargetInfo" initializeCellSPUTargetInfo :: IO ()+foreign import ccall unsafe "LLVMInitializeCellSPUTarget" initializeCellSPUTarget :: IO ()
+ LLVM/Target/CppBackend.hs view
@@ -0,0 +1,10 @@+{-# LANGUAGE ForeignFunctionInterface #-}+module LLVM.Target.CppBackend(initializeTarget) where++initializeTarget :: IO ()+initializeTarget = do+ initializeCppBackendTargetInfo+ initializeCppBackendTarget++foreign import ccall unsafe "LLVMInitializeCppBackendTargetInfo" initializeCppBackendTargetInfo :: IO ()+foreign import ccall unsafe "LLVMInitializeCppBackendTarget" initializeCppBackendTarget :: IO ()
+ LLVM/Target/MSP430.hs view
@@ -0,0 +1,10 @@+{-# LANGUAGE ForeignFunctionInterface #-}+module LLVM.Target.MSP430(initializeTarget) where++initializeTarget :: IO ()+initializeTarget = do+ initializeMSP430TargetInfo+ initializeMSP430Target++foreign import ccall unsafe "LLVMInitializeMSP430TargetInfo" initializeMSP430TargetInfo :: IO ()+foreign import ccall unsafe "LLVMInitializeMSP430Target" initializeMSP430Target :: IO ()
+ LLVM/Target/Mips.hs view
@@ -0,0 +1,10 @@+{-# LANGUAGE ForeignFunctionInterface #-}+module LLVM.Target.Mips(initializeTarget) where++initializeTarget :: IO ()+initializeTarget = do+ initializeMipsTargetInfo+ initializeMipsTarget++foreign import ccall unsafe "LLVMInitializeMipsTargetInfo" initializeMipsTargetInfo :: IO ()+foreign import ccall unsafe "LLVMInitializeMipsTarget" initializeMipsTarget :: IO ()
+ LLVM/Target/Native.hs view
@@ -0,0 +1,20 @@+{-# LANGUAGE CPP #-}+module LLVM.Target.Native(initializeNativeTarget) where+import Control.Monad+import Control.Concurrent.MVar+import System.IO.Unsafe++-- TARGET is expanded by CPP to the native target architecture.+import LLVM.Target.TARGET++-- | Initialize jitter to the native target.+-- The operation is idempotent.+initializeNativeTarget :: IO ()+initializeNativeTarget = do+ done <- takeMVar refDone+ when (not done) initializeTarget+ putMVar refDone True++-- UNSAFE: global variable to keep track of initialization state.+refDone :: MVar Bool+refDone = unsafePerformIO $ newMVar False
+ LLVM/Target/PIC16.hs view
@@ -0,0 +1,10 @@+{-# LANGUAGE ForeignFunctionInterface #-}+module LLVM.Target.PIC16(initializeTarget) where++initializeTarget :: IO ()+initializeTarget = do+ initializePIC16TargetInfo+ initializePIC16Target++foreign import ccall unsafe "LLVMInitializePIC16TargetInfo" initializePIC16TargetInfo :: IO ()+foreign import ccall unsafe "LLVMInitializePIC16Target" initializePIC16Target :: IO ()
+ LLVM/Target/PowerPC.hs view
@@ -0,0 +1,10 @@+{-# LANGUAGE ForeignFunctionInterface #-}+module LLVM.Target.PowerPC(initializeTarget) where++initializeTarget :: IO ()+initializeTarget = do+ initializePowerPCTargetInfo+ initializePowerPCTarget++foreign import ccall unsafe "LLVMInitializePowerPCTargetInfo" initializePowerPCTargetInfo :: IO ()+foreign import ccall unsafe "LLVMInitializePowerPCTarget" initializePowerPCTarget :: IO ()
+ LLVM/Target/Sparc.hs view
@@ -0,0 +1,10 @@+{-# LANGUAGE ForeignFunctionInterface #-}+module LLVM.Target.Sparc(initializeTarget) where++initializeTarget :: IO ()+initializeTarget = do+ initializeSparcTargetInfo+ initializeSparcTarget++foreign import ccall unsafe "LLVMInitializeSparcTargetInfo" initializeSparcTargetInfo :: IO ()+foreign import ccall unsafe "LLVMInitializeSparcTarget" initializeSparcTarget :: IO ()
+ LLVM/Target/SystemZ.hs view
@@ -0,0 +1,10 @@+{-# LANGUAGE ForeignFunctionInterface #-}+module LLVM.Target.SystemZ(initializeTarget) where++initializeTarget :: IO ()+initializeTarget = do+ initializeSystemZTargetInfo+ initializeSystemZTarget++foreign import ccall unsafe "LLVMInitializeSystemZTargetInfo" initializeSystemZTargetInfo :: IO ()+foreign import ccall unsafe "LLVMInitializeSystemZTarget" initializeSystemZTarget :: IO ()
+ LLVM/Target/X86.hs view
@@ -0,0 +1,10 @@+{-# LANGUAGE ForeignFunctionInterface #-}+module LLVM.Target.X86(initializeTarget) where++initializeTarget :: IO ()+initializeTarget = do+ initializeX86TargetInfo+ initializeX86Target++foreign import ccall unsafe "LLVMInitializeX86TargetInfo" initializeX86TargetInfo :: IO ()+foreign import ccall unsafe "LLVMInitializeX86Target" initializeX86Target :: IO ()
+ LLVM/Target/XCore.hs view
@@ -0,0 +1,10 @@+{-# LANGUAGE ForeignFunctionInterface #-}+module LLVM.Target.XCore(initializeTarget) where++initializeTarget :: IO ()+initializeTarget = do+ initializeXCoreTargetInfo+ initializeXCoreTarget++foreign import ccall unsafe "LLVMInitializeXCoreTargetInfo" initializeXCoreTargetInfo :: IO ()+foreign import ccall unsafe "LLVMInitializeXCoreTarget" initializeXCoreTarget :: IO ()
+ README.md view
@@ -0,0 +1,58 @@+Haskell LLVM bindings+---------------------++This package provides Haskell bindings for the popular+[LLVM](http://llvm.org/) compiler infrastructure project.+++Compatibility+-------------++We try to stay up to date with LLVM releases. The current version of+this package is compatible with LLVM 2.9 and 2.8. Please understand+that the package may or may not work against older LLVM releases; we+don't have the time or resources to test across multiple releases.+++Configuration+-------------++By default, when you run `cabal install`, the Haskell bindings will be+configured to look for LLVM in `/usr/local`.++If you have LLVM installed in a different location, e.g. `/usr`, you+can tell the `configure` script where to find it as follows:++ cabal install --configure-option=--with-llvm-prefix=/usr+++Package status - what to expect+-------------------------------++This package is still under development.++The high level bindings are currently incomplete, so there are some+limits on what you can do. Adding new functions is generally easy,+though, so don't be afraid to get your hands dirty.++The high level interface is mostly safe, but the type system cannot+protect against everything that can go wrong, so take care. And, of+course, there's no way to guarantee anything about the generated code.+++Staying in touch+----------------++There is a low-volume mailing list named+[haskell-llvm@projects.haskellorg](http://projects.haskell.org/cgi-bin/mailman/listinfo/haskell-llvm).+If you use the LLVM bindings, you should think about joining.++If you want to contribute patches, please clone a copy of the+[git repository](https://github.com/bos/llvm):++ git clone git://github.com/bos/llvm++Patches are best submitted via the github "pull request" interface.++To file a bug or a request for an enhancement, please use the+[github issue tracker](https://github.com/bos/llvm/issues).
+ Setup.hs view
@@ -0,0 +1,122 @@+{-# LANGUAGE CPP #-}+{-# LANGUAGE PatternGuards #-}+import System.Directory+import System.Environment+import System.FilePath+import System.Info+import Control.Monad+import Data.List+import Data.Maybe+import Distribution.Simple+import Distribution.Simple.Setup+import Distribution.InstalledPackageInfo+import Distribution.PackageDescription+import Distribution.Simple.LocalBuildInfo+import Distribution.Simple.Install+import Distribution.Simple.Register+import Distribution.Simple.Utils+import Distribution.Text ( display )++main = do+ let hooks = autoconfUserHooks { postConf = if os == "mingw32" + then generateBuildInfo + else postConf autoconfUserHooks+ , instHook = installHookWithExtraGhciLibraries+ , regHook = regHookWithExtraGhciLibraries+ }+ defaultMainWithHooks hooks++-- On Windows we can't count on the configure script, so generate the+-- llvm.buildinfo from a template.+generateBuildInfo _ conf _ _ = do+ let args = configConfigureArgs conf+ let pref = "--with-llvm-prefix="+ let path = case [ p | arg <- args, Just p <- [stripPrefix pref arg] ] of+ [p] -> p+ _ -> error $ "Use '--configure-option " ++ pref ++ "PATH' to give LLVM installation path"+ info <- readFile "llvm.buildinfo.windows.in"+ writeFile "llvm.buildinfo" $ subst "@llvm_path@" path info++subst from to [] = []+subst from to xs | Just r <- stripPrefix from xs = to ++ subst from to r+subst from to (x:xs) = x : subst from to xs++{-+To compensate for Cabal's current design,+we need to replicate the default registration hook code here,+to inject a value for extra-ghci-libraries into the package registration info.+(Inspired by 'Gtk2HsSetup.hs'.)+This only works for Cabal 1.10,+thus we added an according constraint to llvm.cabal.++We define an extension field 'x-extra-ghci-libraries' in the .buildinfo file+in order to communicate the version information of the LLVM dynamic library+from the configure script to the registration code.+-}+installHookWithExtraGhciLibraries :: PackageDescription -> LocalBuildInfo+ -> UserHooks -> InstallFlags -> IO ()+installHookWithExtraGhciLibraries pkg_descr localbuildinfo _ flags = do+ let copyFlags = defaultCopyFlags {+ copyDistPref = installDistPref flags,+ copyDest = toFlag NoCopyDest,+ copyVerbosity = installVerbosity flags+ }+ install pkg_descr localbuildinfo copyFlags+ let registerFlags = defaultRegisterFlags {+ regDistPref = installDistPref flags,+ regInPlace = installInPlace flags,+ regPackageDB = installPackageDB flags,+ regVerbosity = installVerbosity flags+ }+ when (hasLibs pkg_descr) $ register' pkg_descr localbuildinfo registerFlags++regHookWithExtraGhciLibraries :: PackageDescription -> LocalBuildInfo+ -> UserHooks -> RegisterFlags -> IO ()+regHookWithExtraGhciLibraries pkg_descr localbuildinfo _ flags =+ if hasLibs pkg_descr+ then register' pkg_descr localbuildinfo flags+ else setupMessage verbosity+ "Package contains no library to register:" (packageId pkg_descr)+ where verbosity = fromFlag (regVerbosity flags)+ +register' :: PackageDescription -> LocalBuildInfo+ -> RegisterFlags -- ^Install in the user's database?; verbose+ -> IO ()+register' pkg@PackageDescription { library = Just lib }+ lbi@LocalBuildInfo { libraryConfig = Just clbi } regFlags+ = do++ installedPkgInfoRaw <- generateRegistrationInfo+ verbosity pkg lib lbi clbi inplace distPref++ let ghciLibraries = case lookup "x-extra-ghci-libraries" (customFieldsBI (libBuildInfo lib)) of+ Nothing -> []+ Just s -> [s]+ installedPkgInfo = installedPkgInfoRaw {+ extraGHCiLibraries = ghciLibraries }++ -- Three different modes:+ case () of+ _ | modeGenerateRegFile -> writeRegistrationFile installedPkgInfo+ | modeGenerateRegScript -> die "Generate Reg Script not supported"+ | otherwise -> registerPackage verbosity+ installedPkgInfo pkg lbi inplace+ (withPackageDB lbi)++ where+ modeGenerateRegFile = isJust (flagToMaybe (regGenPkgConf regFlags))+ modeGenerateRegScript = fromFlag (regGenScript regFlags)+ inplace = fromFlag (regInPlace regFlags)+ packageDb = nub $ withPackageDB lbi +++ maybeToList (flagToMaybe (regPackageDB regFlags))+ distPref = fromFlag (regDistPref regFlags)+ verbosity = fromFlag (regVerbosity regFlags)+ regFile = fromMaybe (display (packageId pkg) <.> "conf")+ (fromFlag (regGenPkgConf regFlags))+ writeRegistrationFile installedPkgInfo = do+ notice verbosity ("Creating package registration file: " ++ regFile)+ writeUTF8File regFile (showInstalledPackageInfo installedPkgInfo)++register' _ _ regFlags = notice verbosity "No package to register"+ where+ verbosity = fromFlag (regVerbosity regFlags)
+ cbits/extra.cpp view
@@ -0,0 +1,563 @@+/*+ * Copyright (c) 2008-10, Mahadevan R All rights reserved.+ *+ * Redistribution and use in source and binary forms, with or without+ * modification, are permitted provided that the following conditions are met:+ *+ * * Redistributions of source code must retain the above copyright notice,+ * this list of conditions and the following disclaimer.+ *+ * * Redistributions in binary form must reproduce the above copyright notice,+ * this list of conditions and the following disclaimer in the documentation+ * and/or other materials provided with the distribution.+ *+ * * Neither the name of this software, nor the names of its + * contributors may be used to endorse or promote products derived from+ * this software without specific prior written permission.+ *+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.+ */++/**+ * These are some "extra" functions not available in the standard LLVM-C+ * bindings, but are required / good-to-have inorder to implement the+ * Python bindings.+ */++#include "hs_llvm_config.h"++// standard includes+#include <cassert>+#include <cstdlib>+#include <cstring>+#include <sstream>++#define __STDC_LIMIT_MACROS+#define __STDC_CONSTANT_MACROS++// LLVM includes+#include "llvm/LLVMContext.h"+#include "llvm/Bitcode/ReaderWriter.h"+#include "llvm/Support/MemoryBuffer.h"+#include "llvm/Support/Casting.h"+#include "llvm/Constants.h"+#include "llvm/DerivedTypes.h"+#include "llvm/GlobalVariable.h"+#if HS_LLVM_VERSION < 300+#include "llvm/TypeSymbolTable.h"+#endif+#include "llvm/Support/MemoryBuffer.h"+#include "llvm/Support/CallSite.h"+#include "llvm/IntrinsicInst.h"+#include "llvm/Analysis/Verifier.h"+#include "llvm/Assembly/Parser.h"+#ifdef HAVE_LLVM_SUPPORT_DYNAMICLIBRARY_H+# include "llvm/Support/DynamicLibrary.h"+#else+# include "llvm/System/DynamicLibrary.h"+#endif+#include "llvm/PassManager.h"+#include "llvm/ExecutionEngine/ExecutionEngine.h"+#include "llvm/Analysis/LoopPass.h"+#include "llvm/Analysis/Passes.h"+#include "llvm/Analysis/DomPrinter.h"+#include "llvm/Transforms/Scalar.h"+#include "llvm/Transforms/IPO.h"+#include "llvm/Transforms/Utils/UnifyFunctionExitNodes.h"+#include "llvm/Transforms/Instrumentation.h"+#include "llvm/Transforms/Utils/Cloning.h"+#include "llvm/Linker.h"+#include "llvm/Support/SourceMgr.h"++// LLVM-C includes+#include "llvm-c/Core.h"+#include "llvm-c/ExecutionEngine.h"+#include "llvm-c/Target.h"++// our includes+#include "extra.h"++//using namespace llvm;++char *LLVMDumpModuleToString(LLVMModuleRef module)+{+ std::string s;+ llvm::raw_string_ostream buf(s);+ llvm::Module *p = llvm::unwrap(module);+ assert(p);+ p->print(buf, NULL);+ return strdup(buf.str().c_str());+}++char *LLVMDumpTypeToString(LLVMTypeRef type)+{+ std::string s;+ llvm::raw_string_ostream buf(s);+ llvm::Type *p = llvm::unwrap(type);+ assert(p);+ p->print(buf);+ return strdup(buf.str().c_str());+}++char *LLVMDumpValueToString(LLVMValueRef value)+{+ std::string s;+ llvm::raw_string_ostream buf(s);+ llvm::Value *p = llvm::unwrap(value);+ assert(p);+ p->print(buf);+ return strdup(buf.str().c_str());+}++unsigned LLVMModuleGetPointerSize(LLVMModuleRef module)+{+ llvm::Module *modulep = llvm::unwrap(module);+ assert(modulep);++ llvm::Module::PointerSize p = modulep->getPointerSize();+ if (p == llvm::Module::Pointer32)+ return 32;+ else if (p == llvm::Module::Pointer64)+ return 64;+ return 0;+}++LLVMValueRef LLVMModuleGetOrInsertFunction(LLVMModuleRef module,+ const char *name, LLVMTypeRef function_type)+{+ assert(name);++ llvm::Module *modulep = llvm::unwrap(module);+ assert(modulep);++ llvm::FunctionType *ftp = llvm::unwrap<llvm::FunctionType>(function_type);+ assert(ftp);++ llvm::Constant *f = modulep->getOrInsertFunction(name, ftp);+ return wrap(f);+}++int LLVMHasInitializer(LLVMValueRef global_var)+{+ llvm::GlobalVariable *gvp = llvm::unwrap<llvm::GlobalVariable>(global_var);+ assert(gvp);++ return gvp->hasInitializer();+}++#define inst_checkfn(ourfn, llvmfn) \+unsigned ourfn (LLVMValueRef v) { \+ llvm::Instruction *ip = llvm::unwrap<llvm::Instruction>(v); \+ assert(ip); \+ return ip-> llvmfn () ? 1 : 0; \+}++inst_checkfn(LLVMInstIsTerminator, isTerminator)+inst_checkfn(LLVMInstIsBinaryOp, isBinaryOp)+inst_checkfn(LLVMInstIsShift, isShift)+inst_checkfn(LLVMInstIsCast, isCast)+inst_checkfn(LLVMInstIsLogicalShift, isLogicalShift)+inst_checkfn(LLVMInstIsArithmeticShift, isArithmeticShift)+inst_checkfn(LLVMInstIsAssociative, isAssociative)+inst_checkfn(LLVMInstIsCommutative, isCommutative)++unsigned LLVMInstIsVolatile(LLVMValueRef v)+{+ using namespace llvm;+ Instruction *ip = unwrap<Instruction>(v);+ assert(ip);+ return ((isa<LoadInst>(*ip) && cast<LoadInst>(*ip).isVolatile()) ||+ (isa<StoreInst>(*ip) && cast<StoreInst>(*ip).isVolatile()) );+}++const char *LLVMInstGetOpcodeName(LLVMValueRef inst)+{+ llvm::Instruction *instp = llvm::unwrap<llvm::Instruction>(inst);+ assert(instp);+ return instp->getOpcodeName();+}++unsigned LLVMInstGetOpcode(LLVMValueRef inst)+{+ llvm::Instruction *instp = llvm::unwrap<llvm::Instruction>(inst);+ assert(instp);+ return instp->getOpcode();+}++unsigned LLVMCmpInstGetPredicate(LLVMValueRef cmpinst)+{+ llvm::CmpInst *instp = llvm::unwrap<llvm::CmpInst>(cmpinst);+ assert(instp);+ return instp->getPredicate();+}++/* llvm::unwrap a set of `n' wrapped objects starting at `values',+ * into a vector of pointers to llvm::unwrapped objects `out'. */+template <typename W, typename UW>+void unwrap_vec(W *values, unsigned n, std::vector<UW *>& out)+{+ out.clear();++ while (n--) {+ UW *p = llvm::unwrap(*values);+ assert(p);+ out.push_back(p);+ ++values;+ }+}++/* Same as llvm::unwrap_vec, but use a vector of const pointers. */+template <typename W, typename UW>+void unwrap_cvec(W *values, unsigned n, std::vector<const UW *>& out)+{+ out.clear();++ while (n--) {+ UW *p = llvm::unwrap(*values);+ assert(p);+ out.push_back(p);+ ++values;+ }+}++LLVMValueRef LLVMBuildRetMultiple(LLVMBuilderRef builder, + LLVMValueRef *values, unsigned n_values)+{+ assert(values);++ std::vector<llvm::Value *> values_vec;+ unwrap_vec(values, n_values, values_vec);++ llvm::IRBuilder<> *builderp = llvm::unwrap(builder);+ assert(builderp);++ return llvm::wrap(builderp->CreateAggregateRet(&values_vec[0], values_vec.size()));+}++LLVMValueRef LLVMBuildGetResult(LLVMBuilderRef builder, + LLVMValueRef value, unsigned index, const char *name)+{+ assert(name);++ llvm::IRBuilder<> *builderp = llvm::unwrap(builder);+ assert(builderp);++ return llvm::wrap(builderp->CreateExtractValue(llvm::unwrap(value), index, name));+}++unsigned LLVMValueGetID(LLVMValueRef value)+{+ llvm::Value *valuep = llvm::unwrap(value);+ assert(valuep);++ return valuep->getValueID();+}+++unsigned LLVMValueGetNumUses(LLVMValueRef value)+{+ llvm::Value *valuep = llvm::unwrap(value);+ assert(valuep);++ return valuep->getNumUses();+}+++unsigned LLVMValueGetUses(LLVMValueRef value, LLVMValueRef **refs)+{+ llvm::Value *valuep = llvm::unwrap(value);+ assert(valuep);++ unsigned n = valuep->getNumUses();+ if (n == 0)+ return 0;++ assert(refs);+ LLVMValueRef *out = (LLVMValueRef *)malloc(sizeof(LLVMValueRef) * n);+ if (!out)+ return 0;+ *refs = out;++ memset(out, 0, sizeof(LLVMValueRef) * n);+ llvm::Value::use_iterator it = valuep->use_begin();+ while (it != valuep->use_end()) {+ *out++ = llvm::wrap(*it);+ ++it;+ }++ return n;+}++unsigned LLVMValueIsUsedInBasicBlock(LLVMValueRef value, LLVMBasicBlockRef bb)+{+ llvm::Value *valuep = llvm::unwrap(value);+ assert(valuep);+ llvm::BasicBlock *bbp = llvm::unwrap(bb);+ assert(bbp);+ return valuep->isUsedInBasicBlock(bbp);+}++void LLVMDisposeValueRefArray(LLVMValueRef *refs)+{+ assert(refs);+ free(refs);+}++unsigned LLVMUserGetNumOperands(LLVMValueRef user)+{+ llvm::User *userp = llvm::unwrap<llvm::User>(user);+ assert(userp);+ return userp->getNumOperands();+}++LLVMValueRef LLVMUserGetOperand(LLVMValueRef user, unsigned idx)+{+ llvm::User *userp = llvm::unwrap<llvm::User>(user);+ assert(userp);+ llvm::Value *operand = userp->getOperand(idx);+ return llvm::wrap(operand);+}++unsigned LLVMGetDoesNotThrow(LLVMValueRef fn)+{+ llvm::Function *fnp = llvm::unwrap<llvm::Function>(fn);+ assert(fnp);++ return fnp->doesNotThrow();+}++void LLVMSetDoesNotThrow(LLVMValueRef fn, int DoesNotThrow)+{+ llvm::Function *fnp = llvm::unwrap<llvm::Function>(fn);+ assert(fnp);++ return fnp->setDoesNotThrow((bool)DoesNotThrow);+}++LLVMValueRef LLVMGetIntrinsic(LLVMModuleRef module, int id,+ LLVMTypeRef *types, unsigned n_types)+{+ assert(types);++#if HS_LLVM_VERSION >= 300+ std::vector<llvm::Type*> types_vec;+ unwrap_vec(types, n_types, types_vec);+#else+ std::vector<const llvm::Type*> types_vec;+ unwrap_cvec(types, n_types, types_vec);+#endif++ llvm::Module *modulep = llvm::unwrap(module);+ assert(modulep);++#if HS_LLVM_VERSION >= 300+ llvm::Function *intfunc = llvm::Intrinsic::getDeclaration(modulep, + llvm::Intrinsic::ID(id), types_vec);+#else+ llvm::Function *intfunc = llvm::Intrinsic::getDeclaration(modulep, + llvm::Intrinsic::ID(id), &types_vec[0], types_vec.size());+#endif+ return wrap(intfunc);+}++LLVMModuleRef LLVMGetModuleFromAssembly(const char *asmtext, unsigned txtlen,+ char **out)+{+ assert(asmtext);+ assert(out);++ llvm::Module *modulep;+ llvm::SMDiagnostic error;+ if (!(modulep = llvm::ParseAssemblyString(asmtext, NULL, error,+ llvm::getGlobalContext()))) {+ std::string s;+ llvm::raw_string_ostream buf(s);+ error.Print("llvm-py", buf);+ *out = strdup(buf.str().c_str());+ return NULL;+ }++ return wrap(modulep);+}++LLVMModuleRef LLVMGetModuleFromBitcode(const char *bitcode, unsigned bclen,+ char **out)+{+ assert(bitcode);+ assert(out);++ llvm::StringRef as_str(bitcode, bclen);++ llvm::MemoryBuffer *mbp;+ if (!(mbp = llvm::MemoryBuffer::getMemBufferCopy(as_str)))+ return NULL;++ std::string msg;+ llvm::Module *modulep;+ if (!(modulep = llvm::ParseBitcodeFile(mbp, llvm::getGlobalContext(),+ &msg)))+ *out = strdup(msg.c_str());++ delete mbp;+ return wrap(modulep);+}++unsigned LLVMLinkModules(LLVMModuleRef dest, LLVMModuleRef src, unsigned mode,+ char **out)+{+ llvm::Module *sourcep = llvm::unwrap(src);+ assert(sourcep);+ llvm::Module *destinationp = llvm::unwrap(dest);+ assert(destinationp);++ std::string msg;+ bool err;++#if HS_LLVM_VERSION >= 300 + err = llvm::Linker::LinkModules(destinationp, sourcep, mode, &msg);+#else+ err = llvm::Linker::LinkModules(destinationp, sourcep, &msg);+#endif++ if (err) {+ *out = strdup(msg.c_str());+ return 0;+ }++ return 1;+}++unsigned char *LLVMGetBitcodeFromModule(LLVMModuleRef module, unsigned *lenp)+{+ assert(lenp);++ llvm::Module *modulep = llvm::unwrap(module);+ assert(modulep);++ /* get bc into a string */+ std::string s;+ llvm::raw_string_ostream buf(s);+ llvm::WriteBitcodeToFile(modulep, buf);+ const std::string& bc = buf.str();++ /* and then into a malloc()-ed block */+ size_t bclen = bc.size();+ unsigned char *bytes = (unsigned char *)malloc(bclen);+ if (!bytes)+ return NULL;+ memcpy(bytes, bc.data(), bclen);++ /* return */+ *lenp = bclen;+ return bytes;+}++/* Return 0 on failure (with errmsg filled in), 1 on success. */+unsigned LLVMLoadLibraryPermanently(const char* filename, char **errmsg)+{+ assert(filename);+ assert(errmsg);++ /* Note: the LLVM API returns true on failure. Don't ask why. */+ std::string msg;+ if (llvm::sys::DynamicLibrary::LoadLibraryPermanently(filename, &msg)) {+ *errmsg = strdup(msg.c_str());+ return 0;+ }++ return 1;+}++void *LLVMGetPointerToFunction(LLVMExecutionEngineRef ee, LLVMValueRef fn)+{+ llvm::ExecutionEngine *eep = llvm::unwrap(ee);+ assert(eep);++ llvm::Function *fnp = llvm::unwrap<llvm::Function>(fn);+ assert(fnp);++ return eep->getPointerToFunction(fnp);+}++int LLVMInlineFunction(LLVMValueRef call)+{+ llvm::Value *callp = llvm::unwrap(call);+ assert(callp);++ llvm::CallSite cs = llvm::CallSite(callp);++ llvm::InlineFunctionInfo unused;+ return llvm::InlineFunction(cs, unused);+}+++/* Passes. A few passes (listed below) are used directly from LLVM-C,+ * rest are defined here.+ */++#define define_pass(P) \+void LLVMAdd ## P ## Pass (LLVMPassManagerRef passmgr) { \+ using namespace llvm; \+ llvm::PassManagerBase *pmp = llvm::unwrap(passmgr); \+ assert(pmp); \+ pmp->add( create ## P ## Pass ()); \+}++define_pass( AAEval )+define_pass( AliasAnalysisCounter )+define_pass( AlwaysInliner )+define_pass( BasicAliasAnalysis )+define_pass( BlockPlacement )+define_pass( BreakCriticalEdges )+define_pass( CodeGenPrepare )+define_pass( DbgInfoPrinter )+define_pass( DeadCodeElimination )+define_pass( DeadInstElimination )+define_pass( DemoteRegisterToMemory )+define_pass( DomOnlyPrinter )+define_pass( DomOnlyViewer )+define_pass( DomPrinter )+define_pass( DomViewer )+define_pass( EdgeProfiler )+define_pass( GlobalsModRef )+define_pass( InstCount )+define_pass( InstructionNamer )+define_pass( LazyValueInfo )+define_pass( LCSSA )+define_pass( LoopDependenceAnalysis )+define_pass( LoopExtractor )+define_pass( LoopSimplify )+define_pass( LoopStrengthReduce )+define_pass( LowerInvoke )+define_pass( LowerSwitch )+define_pass( MergeFunctions )+define_pass( NoAA )+define_pass( NoProfileInfo )+define_pass( OptimalEdgeProfiler )+define_pass( PartialInlining )+define_pass( PostDomOnlyPrinter )+define_pass( PostDomOnlyViewer )+define_pass( PostDomPrinter )+define_pass( PostDomViewer )+define_pass( ProfileEstimator )+define_pass( ProfileLoader )+define_pass( ProfileVerifier )+define_pass( ScalarEvolutionAliasAnalysis )+define_pass( SingleLoopExtractor )+define_pass( StripNonDebugSymbols )+define_pass( UnifyFunctionExitNodes )++/* we support only internalize(true) */+llvm::ModulePass *createInternalize2Pass() { return llvm::createInternalizePass(true); }+define_pass( Internalize2 )+
+ cbits/free.c view
@@ -0,0 +1,17 @@+#define __STDC_LIMIT_MACROS+#define __STDC_CONSTANT_MACROS+#include <llvm-c/Core.h>+#include <llvm-c/ExecutionEngine.h>++/* C function to free function object resources. Can be called from a finalizer. */+void+c_freeFunctionObject(LLVMExecutionEngineRef execEngine,+ LLVMModuleProviderRef moduleProvider,+ LLVMValueRef f)+{+ LLVMModuleRef mod;+ LLVMFreeMachineCodeForFunction(execEngine, f);+ if (!LLVMRemoveModuleProvider(execEngine, moduleProvider, &mod, 0)) {+ LLVMDisposeModule(mod);+ }+}
+ cbits/malloc.c view
@@ -0,0 +1,190 @@+#include <stdlib.h>+#include <stdint.h>++#ifdef DEBUG+#include <stdio.h>+#endif++#ifdef TEST+#include <stdio.h>+#endif+++size_t gcd(size_t x, size_t y) {+ while (x!=0) {+ size_t tmp = y%x;+ y = x;+ x = tmp;+ }+ return y;+};++__inline__+size_t lcm(size_t x, size_t y) {+ return x*(y/gcd(x,y));+};++__inline__+size_t round_down_multiple(size_t x, size_t y) {+ return x - (x%y);+};++/*+This is the alignment that malloc always warrants.+If smaller alignments are requested, then we do not need to pad.++FIXME:+This was only tested on ix86-linux.+How to get the right number for every platform?+*/+const size_t default_align = 8;++/*+We have to waste a lot of memory,+since we need an aligned address+and before that space for a pointer.+Less memory can be wasted if 'free' also gets size and align information.+In this case we could omit padding in some cases+and in the other cases we could put the pointer after the memory chunk,+which allows us to use less padding.+*/+void *aligned_malloc(size_t size, size_t requested_align) {+ const size_t ptrsize = sizeof(void *);+ /*+ Ensure that alignment always allows to store a pointer+ (to the whole allocated block).+ */+ const size_t align = lcm(requested_align, ptrsize);+ const size_t pad = align;+ void *ptr = malloc(pad+ptrsize+size);+ if (ptr) {+ void **alignedptr = (void **) round_down_multiple((size_t)(ptr+pad+ptrsize), align);+ *(alignedptr-1) = ptr;+#ifdef DEBUG+ printf("allocated size %x with alignment %x at %08x %08x \n",+ size, align, (size_t) ptr, (size_t) alignedptr);+#endif+ return alignedptr;+ } else {+ return NULL;+ }+};++/* align must be a power of two */+void *power2_aligned_malloc(size_t size, size_t align) {+ const size_t ptrsize = sizeof(void *);+ size_t pad = align>=default_align ? align-default_align : 0;+ void *ptr = malloc(pad+ptrsize+size);+ if (ptr) {+ void **alignedptr = (void **)((size_t)(ptr+pad+ptrsize) & (-align));+ *(alignedptr-1) = ptr;+#ifdef DEBUG+ printf("allocated size 0x%x with alignment 0x%x at %08x %08x \n",+ size, align, (size_t) ptr, (size_t) alignedptr);+#endif+ return alignedptr;+ } else {+ return NULL;+ }+};++void aligned_free(void *alignedptr) {+ if (alignedptr) {+ void **sptr = (void **) alignedptr;+ void *ptr = *(sptr - 1);+#ifdef DEBUG+ printf("freed %08x %08x \n", (size_t) ptr, (size_t) alignedptr);+#endif+ free(ptr);+ } else {+ /*+ What shall we do about NULL pointers?+ Crash immediately? Make an official crash by 'free'?+ */+ free(alignedptr);+ }+};+++/*+Abuse a pointer type as a size_t compatible type+and choose a name that will hopefully not clash+with names an llvm user already uses (such as 'malloc').+*/+void *aligned_malloc_sizeptr(void *size, void *align) {+ return aligned_malloc((size_t) size, (size_t) align);+}+++const int+ prepadsize = 1024,+ postpadsize = 1024;++void *padded_aligned_malloc(size_t size, size_t align) {+ void *ptr = aligned_malloc(prepadsize+size+postpadsize, align);+ return ptr ? ptr+prepadsize : NULL;+};++void padded_aligned_free(void *ptr) {+ aligned_free(ptr ? ptr-prepadsize : NULL);+};+++#ifdef TEST+void test_gcd (size_t x, size_t y) {+ printf("gcd(%d,%d) = %d\n", x, y, gcd (x,y));+}++void test_malloc (size_t size, size_t align) {+ uint8_t *ptr = aligned_malloc (size, align);+ if (ptr) {+ if (((size_t) ptr) % align) {+ printf ("ptr %08x not correctly aligned\n", (size_t) ptr);+ }+ size_t k;+ for (k = 0; k<size; k++) {+ ptr[k] = 0;+ }+ aligned_free (ptr);+ }+}++int main () {+ test_gcd (0,0);+ test_gcd (0,1);+ test_gcd (0,2);+ test_gcd (1,0);+ test_gcd (2,0);+ test_gcd (1,2);+ test_gcd (2,1);+ test_gcd (2,2);+ test_gcd (2,3);+ test_gcd (2,4);+ test_gcd (16,64);+ test_gcd (15,10);+ test_gcd (96,81);++ test_malloc (128, 1);+ test_malloc (128, 2);+ test_malloc (128, 3);+ test_malloc (128, 4);+ test_malloc (128, 5);+ test_malloc (128, 6);+ test_malloc (128, 8);+ test_malloc (128, 16);+ test_malloc (128, 32);+ test_malloc (128, 64);+ test_malloc (111, 1);+ test_malloc (111, 2);+ test_malloc (111, 3);+ test_malloc (111, 4);+ test_malloc (111, 5);+ test_malloc (111, 6);+ test_malloc (111, 8);+ test_malloc (111, 16);+ test_malloc (111, 32);+ test_malloc (111, 64);++ return 0;+}+#endif
+ cbits/support.cpp view
@@ -0,0 +1,90 @@+#define __STDC_LIMIT_MACROS+#define __STDC_CONSTANT_MACROS++#include "hs_llvm_config.h"++#include "llvm-c/Core.h"+#include "llvm/PassManager.h"+#if HS_LLVM_VERSION >= 300+# include "llvm/DefaultPasses.h"+# include "llvm/Transforms/IPO/PassManagerBuilder.h"+# include "llvm/Transforms/IPO.h"+#else+# include "llvm/Support/StandardPasses.h"+#endif++#include "support.h"++using namespace llvm;++void LLVMCreateStandardFunctionPasses(LLVMPassManagerRef PM,+ unsigned OptimizationLevel)+{+#if HS_LLVM_VERSION >= 300+ llvm::PassManagerBuilder Builder;+ Builder.OptLevel = OptimizationLevel;++ llvm::PassManagerBase *pass_man = unwrap(PM);+ llvm::FunctionPassManager *func_man =+ dynamic_cast <FunctionPassManager*>(pass_man);++ if (func_man) {+ Builder.populateFunctionPassManager (*func_man);+ } else {+ // printf ("Cannot create function passes for module pass manager\n");+ }+#else+ createStandardFunctionPasses(unwrap(PM), OptimizationLevel);+#endif+}++void LLVMCreateStandardModulePasses(LLVMPassManagerRef PM,+ unsigned OptLevel,+ int OptimizeSize,+ int UnitAtATime,+ int UnrollLoops,+ int SimplifyLibCalls,+ int HaveExceptions,+ int DisableInline)+{+#if HS_LLVM_VERSION >= 300+ llvm::PassManagerBuilder Builder;+ Builder.OptLevel = OptLevel;+ Builder.SizeLevel = OptimizeSize;+ Builder.DisableUnrollLoops = !UnrollLoops;+ Builder.DisableSimplifyLibCalls = !SimplifyLibCalls;+ Builder.DisableUnitAtATime = !UnitAtATime;+ + Pass *InliningPass = 0;++ if (DisableInline) {+ // No inlining pass+ } else if (OptLevel) {+ unsigned Threshold = 225;+ if (OptLevel > 2)+ Threshold = 275;+ Builder.Inliner = createFunctionInliningPass(Threshold);+ } else {+ Builder.Inliner = createAlwaysInlinerPass();+ }++ Builder.populateModulePassManager (*unwrap(PM));+#else+ Pass *InliningPass = 0;++ if (DisableInline) {+ // No inlining pass+ } else if (OptLevel) {+ unsigned Threshold = 225;+ if (OptLevel > 2)+ Threshold = 275;+ InliningPass = createFunctionInliningPass(Threshold);+ } else {+ InliningPass = createAlwaysInlinerPass();+ }++ createStandardModulePasses(unwrap(PM), OptLevel, OptimizeSize,+ UnitAtATime, UnrollLoops, SimplifyLibCalls,+ HaveExceptions, InliningPass);+#endif+}
+ configure view
@@ -0,0 +1,4506 @@+#! /bin/sh+# Guess values for system-dependent variables and create Makefiles.+# Generated by GNU Autoconf 2.68 for Haskell LLVM FFI bindings 3.0.0.0.+#+# Report bugs to <bos@serpentine.com>.+#+#+# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001,+# 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 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=:+ # Pre-4.2 versions of Zsh do 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_nl='+'+export as_nl+# Printing a long string crashes Solaris 7 /usr/bin/printf.+as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'+as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo+as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo+# Prefer a ksh shell builtin over an external printf program on Solaris,+# but without wasting forks for bash or zsh.+if test -z "$BASH_VERSION$ZSH_VERSION" \+ && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then+ as_echo='print -r --'+ as_echo_n='print -rn --'+elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then+ as_echo='printf %s\n'+ as_echo_n='printf %s'+else+ if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then+ as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"'+ as_echo_n='/usr/ucb/echo -n'+ else+ as_echo_body='eval expr "X$1" : "X\\(.*\\)"'+ as_echo_n_body='eval+ arg=$1;+ case $arg in #(+ *"$as_nl"*)+ expr "X$arg" : "X\\(.*\\)$as_nl";+ arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;;+ esac;+ expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl"+ '+ export as_echo_n_body+ as_echo_n='sh -c $as_echo_n_body as_echo'+ fi+ export as_echo_body+ as_echo='sh -c $as_echo_body as_echo'+fi++# The user is always right.+if test "${PATH_SEPARATOR+set}" != set; then+ PATH_SEPARATOR=:+ (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && {+ (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 ||+ PATH_SEPARATOR=';'+ }+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.)+IFS=" "" $as_nl"++# Find who we are. Look in the path if we contain no directory separator.+as_myself=+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+ $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2+ exit 1+fi++# Unset variables that we do not need and which cause bugs (e.g. in+# pre-3.0 UWIN ksh). But do not cause bugs in bash 2.01; the "|| exit 1"+# suppresses any "Segmentation fault" message there. '((' could+# trigger a bug in pdksh 5.2.14.+for as_var in BASH_ENV ENV MAIL MAILPATH+do eval test x\${$as_var+set} = xset \+ && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || :+done+PS1='$ '+PS2='> '+PS4='+ '++# NLS nuisances.+LC_ALL=C+export LC_ALL+LANGUAGE=C+export LANGUAGE++# CDPATH.+(unset CDPATH) >/dev/null 2>&1 && unset CDPATH++if test "x$CONFIG_SHELL" = x; then+ as_bourne_compatible="if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then :+ emulate sh+ NULLCMD=:+ # Pre-4.2 versions of Zsh do 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_required="as_fn_return () { (exit \$1); }+as_fn_success () { as_fn_return 0; }+as_fn_failure () { as_fn_return 1; }+as_fn_ret_success () { return 0; }+as_fn_ret_failure () { return 1; }++exitcode=0+as_fn_success || { exitcode=1; echo as_fn_success failed.; }+as_fn_failure && { exitcode=1; echo as_fn_failure succeeded.; }+as_fn_ret_success || { exitcode=1; echo as_fn_ret_success failed.; }+as_fn_ret_failure && { exitcode=1; echo as_fn_ret_failure succeeded.; }+if ( set x; as_fn_ret_success y && test x = \"\$1\" ); then :++else+ exitcode=1; echo positional parameters were not saved.+fi+test x\$exitcode = x0 || exit 1"+ as_suggested=" as_lineno_1=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_1a=\$LINENO+ as_lineno_2=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_2a=\$LINENO+ eval 'test \"x\$as_lineno_1'\$as_run'\" != \"x\$as_lineno_2'\$as_run'\" &&+ test \"x\`expr \$as_lineno_1'\$as_run' + 1\`\" = \"x\$as_lineno_2'\$as_run'\"' || exit 1+test \$(( 1 + 1 )) = 2 || exit 1"+ if (eval "$as_required") 2>/dev/null; then :+ as_have_required=yes+else+ as_have_required=no+fi+ if test x$as_have_required = xyes && (eval "$as_suggested") 2>/dev/null; then :++else+ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR+as_found=false+for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH+do+ IFS=$as_save_IFS+ test -z "$as_dir" && as_dir=.+ as_found=:+ case $as_dir in #(+ /*)+ for as_base in sh bash ksh sh5; do+ # Try only shells that exist, to save several forks.+ as_shell=$as_dir/$as_base+ if { test -f "$as_shell" || test -f "$as_shell.exe"; } &&+ { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$as_shell"; } 2>/dev/null; then :+ CONFIG_SHELL=$as_shell as_have_required=yes+ if { $as_echo "$as_bourne_compatible""$as_suggested" | as_run=a "$as_shell"; } 2>/dev/null; then :+ break 2+fi+fi+ done;;+ esac+ as_found=false+done+$as_found || { if { test -f "$SHELL" || test -f "$SHELL.exe"; } &&+ { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$SHELL"; } 2>/dev/null; then :+ CONFIG_SHELL=$SHELL as_have_required=yes+fi; }+IFS=$as_save_IFS+++ if test "x$CONFIG_SHELL" != x; then :+ # We cannot yet assume a decent shell, so we have to provide a+ # neutralization value for shells without unset; and this also+ # works around shells that cannot unset nonexistent variables.+ # Preserve -v and -x to the replacement shell.+ BASH_ENV=/dev/null+ ENV=/dev/null+ (unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV+ export CONFIG_SHELL+ case $- in # ((((+ *v*x* | *x*v* ) as_opts=-vx ;;+ *v* ) as_opts=-v ;;+ *x* ) as_opts=-x ;;+ * ) as_opts= ;;+ esac+ exec "$CONFIG_SHELL" $as_opts "$as_myself" ${1+"$@"}+fi++ if test x$as_have_required = xno; then :+ $as_echo "$0: This script requires a shell more modern than all"+ $as_echo "$0: the shells that I found on your system."+ if test x${ZSH_VERSION+set} = xset ; then+ $as_echo "$0: In particular, zsh $ZSH_VERSION has bugs and should"+ $as_echo "$0: be upgraded to zsh 4.3.4 or later."+ else+ $as_echo "$0: Please tell bug-autoconf@gnu.org and bos@serpentine.com+$0: about your system, including any error possibly output+$0: before this message. Then install a modern shell, or+$0: manually run the script under such a shell if you do+$0: have one."+ fi+ exit 1+fi+fi+fi+SHELL=${CONFIG_SHELL-/bin/sh}+export SHELL+# Unset more variables known to interfere with behavior of common tools.+CLICOLOR_FORCE= GREP_OPTIONS=+unset CLICOLOR_FORCE GREP_OPTIONS++## --------------------- ##+## M4sh Shell Functions. ##+## --------------------- ##+# as_fn_unset VAR+# ---------------+# Portably unset VAR.+as_fn_unset ()+{+ { eval $1=; unset $1;}+}+as_unset=as_fn_unset++# as_fn_set_status STATUS+# -----------------------+# Set $? to STATUS, without forking.+as_fn_set_status ()+{+ return $1+} # as_fn_set_status++# as_fn_exit STATUS+# -----------------+# Exit the shell with STATUS, even in a "trap 0" or "set -e" context.+as_fn_exit ()+{+ set +e+ as_fn_set_status $1+ exit $1+} # as_fn_exit++# as_fn_mkdir_p+# -------------+# Create "$as_dir" as a directory, including parents if necessary.+as_fn_mkdir_p ()+{++ case $as_dir in #(+ -*) as_dir=./$as_dir;;+ esac+ test -d "$as_dir" || eval $as_mkdir_p || {+ as_dirs=+ while :; do+ case $as_dir in #(+ *\'*) as_qdir=`$as_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 ||+$as_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" || as_fn_error $? "cannot create directory $as_dir"+++} # as_fn_mkdir_p+# as_fn_append VAR VALUE+# ----------------------+# Append the text in VALUE to the end of the definition contained in VAR. Take+# advantage of any shell optimizations that allow amortized linear growth over+# repeated appends, instead of the typical quadratic growth present in naive+# implementations.+if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then :+ eval 'as_fn_append ()+ {+ eval $1+=\$2+ }'+else+ as_fn_append ()+ {+ eval $1=\$$1\$2+ }+fi # as_fn_append++# as_fn_arith ARG...+# ------------------+# Perform arithmetic evaluation on the ARGs, and store the result in the+# global $as_val. Take advantage of shells that can avoid forks. The arguments+# must be portable across $(()) and expr.+if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then :+ eval 'as_fn_arith ()+ {+ as_val=$(( $* ))+ }'+else+ as_fn_arith ()+ {+ as_val=`expr "$@" || test $? -eq 1`+ }+fi # as_fn_arith+++# as_fn_error STATUS ERROR [LINENO LOG_FD]+# ----------------------------------------+# Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are+# provided, also output the error to LOG_FD, referencing LINENO. Then exit the+# script with STATUS, using 1 if that was 0.+as_fn_error ()+{+ as_status=$1; test $as_status -eq 0 && as_status=1+ if test "$4"; then+ as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack+ $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4+ fi+ $as_echo "$as_me: error: $2" >&2+ as_fn_exit $as_status+} # as_fn_error++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++if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then+ as_dirname=dirname+else+ as_dirname=false+fi++as_me=`$as_basename -- "$0" ||+$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \+ X"$0" : 'X\(//\)$' \| \+ X"$0" : 'X\(/\)' \| . 2>/dev/null ||+$as_echo X/"$0" |+ sed '/^.*\/\([^/][^/]*\)\/*$/{+ s//\1/+ q+ }+ /^X\/\(\/\/\)$/{+ s//\1/+ q+ }+ /^X\/\(\/\).*/{+ s//\1/+ q+ }+ s/.*/./; q'`++# 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+++ as_lineno_1=$LINENO as_lineno_1a=$LINENO+ as_lineno_2=$LINENO as_lineno_2a=$LINENO+ eval 'test "x$as_lineno_1'$as_run'" != "x$as_lineno_2'$as_run'" &&+ test "x`expr $as_lineno_1'$as_run' + 1`" = "x$as_lineno_2'$as_run'"' || {+ # 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" ||+ { $as_echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2; as_fn_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+}++ECHO_C= ECHO_N= ECHO_T=+case `echo -n x` in #(((((+-n*)+ case `echo 'xy\c'` in+ *c*) ECHO_T=' ';; # ECHO_T is single tab character.+ xy) ECHO_C='\c';;+ *) echo `echo ksh88 bug on AIX 6.1` > /dev/null+ ECHO_T=' ';;+ esac;;+*)+ ECHO_N='-n';;+esac++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 2>/dev/null+fi+if (echo >conf$$.file) 2>/dev/null; then+ 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+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='mkdir -p "$as_dir"'+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'"+++test -n "$DJDIR" || exec 7<&0 </dev/null+exec 6>&1++# Name of the host.+# hostname on some systems (SVR3.2, old GNU/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=++# Identity of this package.+PACKAGE_NAME='Haskell LLVM FFI bindings'+PACKAGE_TARNAME='llvm-base'+PACKAGE_VERSION='3.0.0.0'+PACKAGE_STRING='Haskell LLVM FFI bindings 3.0.0.0'+PACKAGE_BUGREPORT='bos@serpentine.com'+PACKAGE_URL=''++ac_unique_file="LLVM/FFI/Core.hsc"+# 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='LTLIBOBJS+LIBOBJS+llvm_ldoptions+llvm_includedir+llvm_target+llvm_extra_ghci_libs+llvm_extra_libdirs+llvm_extra_libs+llvm_cppflags+llvm_version+EGREP+GREP+CXXCPP+llvm_config+OBJEXT+EXEEXT+ac_ct_CXX+CPPFLAGS+LDFLAGS+CXXFLAGS+CXX+target_alias+host_alias+build_alias+LIBS+ECHO_T+ECHO_N+ECHO_C+DEFS+mandir+localedir+libdir+psdir+pdfdir+dvidir+htmldir+infodir+docdir+oldincludedir+includedir+localstatedir+sharedstatedir+sysconfdir+datadir+datarootdir+libexecdir+sbindir+bindir+program_transform_name+prefix+exec_prefix+PACKAGE_URL+PACKAGE_BUGREPORT+PACKAGE_STRING+PACKAGE_VERSION+PACKAGE_TARNAME+PACKAGE_NAME+PATH_SEPARATOR+SHELL'+ac_subst_files=''+ac_user_opts='+enable_option_checking+with_compiler+with_llvm_prefix+with_llvm_bindir+'+ ac_precious_vars='build_alias+host_alias+target_alias+CXX+CXXFLAGS+LDFLAGS+LIBS+CPPFLAGS+CCC+CXXCPP'+++# Initialize some variables set by options.+ac_init_help=+ac_init_version=false+ac_unrecognized_opts=+ac_unrecognized_sep=+# The variables have the same names as the options, with+# dashes changed to underlines.+cache_file=/dev/null+exec_prefix=NONE+no_create=+no_recursion=+prefix=NONE+program_prefix=NONE+program_suffix=NONE+program_transform_name=s,x,x,+silent=+site=+srcdir=+verbose=+x_includes=NONE+x_libraries=NONE++# Installation directory options.+# These are left unexpanded so users can "make install exec_prefix=/foo"+# and all the variables that are supposed to be based on exec_prefix+# by default will actually change.+# Use braces instead of parens because sh, perl, etc. also accept them.+# (The list follows the same order as the GNU Coding Standards.)+bindir='${exec_prefix}/bin'+sbindir='${exec_prefix}/sbin'+libexecdir='${exec_prefix}/libexec'+datarootdir='${prefix}/share'+datadir='${datarootdir}'+sysconfdir='${prefix}/etc'+sharedstatedir='${prefix}/com'+localstatedir='${prefix}/var'+includedir='${prefix}/include'+oldincludedir='/usr/include'+docdir='${datarootdir}/doc/${PACKAGE_TARNAME}'+infodir='${datarootdir}/info'+htmldir='${docdir}'+dvidir='${docdir}'+pdfdir='${docdir}'+psdir='${docdir}'+libdir='${exec_prefix}/lib'+localedir='${datarootdir}/locale'+mandir='${datarootdir}/man'++ac_prev=+ac_dashdash=+for ac_option+do+ # If the previous option needs an argument, assign it.+ if test -n "$ac_prev"; then+ eval $ac_prev=\$ac_option+ ac_prev=+ continue+ fi++ case $ac_option in+ *=?*) ac_optarg=`expr "X$ac_option" : '[^=]*=\(.*\)'` ;;+ *=) ac_optarg= ;;+ *) ac_optarg=yes ;;+ esac++ # Accept the important Cygnus configure options, so we can diagnose typos.++ case $ac_dashdash$ac_option in+ --)+ ac_dashdash=yes ;;++ -bindir | --bindir | --bindi | --bind | --bin | --bi)+ ac_prev=bindir ;;+ -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*)+ bindir=$ac_optarg ;;++ -build | --build | --buil | --bui | --bu)+ ac_prev=build_alias ;;+ -build=* | --build=* | --buil=* | --bui=* | --bu=*)+ build_alias=$ac_optarg ;;++ -cache-file | --cache-file | --cache-fil | --cache-fi \+ | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c)+ ac_prev=cache_file ;;+ -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \+ | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*)+ cache_file=$ac_optarg ;;++ --config-cache | -C)+ cache_file=config.cache ;;++ -datadir | --datadir | --datadi | --datad)+ ac_prev=datadir ;;+ -datadir=* | --datadir=* | --datadi=* | --datad=*)+ datadir=$ac_optarg ;;++ -datarootdir | --datarootdir | --datarootdi | --datarootd | --dataroot \+ | --dataroo | --dataro | --datar)+ ac_prev=datarootdir ;;+ -datarootdir=* | --datarootdir=* | --datarootdi=* | --datarootd=* \+ | --dataroot=* | --dataroo=* | --dataro=* | --datar=*)+ datarootdir=$ac_optarg ;;++ -disable-* | --disable-*)+ ac_useropt=`expr "x$ac_option" : 'x-*disable-\(.*\)'`+ # Reject names that are not valid shell variable names.+ expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null &&+ as_fn_error $? "invalid feature name: $ac_useropt"+ ac_useropt_orig=$ac_useropt+ ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'`+ case $ac_user_opts in+ *"+"enable_$ac_useropt"+"*) ;;+ *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--disable-$ac_useropt_orig"+ ac_unrecognized_sep=', ';;+ esac+ eval enable_$ac_useropt=no ;;++ -docdir | --docdir | --docdi | --doc | --do)+ ac_prev=docdir ;;+ -docdir=* | --docdir=* | --docdi=* | --doc=* | --do=*)+ docdir=$ac_optarg ;;++ -dvidir | --dvidir | --dvidi | --dvid | --dvi | --dv)+ ac_prev=dvidir ;;+ -dvidir=* | --dvidir=* | --dvidi=* | --dvid=* | --dvi=* | --dv=*)+ dvidir=$ac_optarg ;;++ -enable-* | --enable-*)+ ac_useropt=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'`+ # Reject names that are not valid shell variable names.+ expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null &&+ as_fn_error $? "invalid feature name: $ac_useropt"+ ac_useropt_orig=$ac_useropt+ ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'`+ case $ac_user_opts in+ *"+"enable_$ac_useropt"+"*) ;;+ *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--enable-$ac_useropt_orig"+ ac_unrecognized_sep=', ';;+ esac+ eval enable_$ac_useropt=\$ac_optarg ;;++ -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \+ | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \+ | --exec | --exe | --ex)+ ac_prev=exec_prefix ;;+ -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \+ | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \+ | --exec=* | --exe=* | --ex=*)+ exec_prefix=$ac_optarg ;;++ -gas | --gas | --ga | --g)+ # Obsolete; use --with-gas.+ with_gas=yes ;;++ -help | --help | --hel | --he | -h)+ ac_init_help=long ;;+ -help=r* | --help=r* | --hel=r* | --he=r* | -hr*)+ ac_init_help=recursive ;;+ -help=s* | --help=s* | --hel=s* | --he=s* | -hs*)+ ac_init_help=short ;;++ -host | --host | --hos | --ho)+ ac_prev=host_alias ;;+ -host=* | --host=* | --hos=* | --ho=*)+ host_alias=$ac_optarg ;;++ -htmldir | --htmldir | --htmldi | --htmld | --html | --htm | --ht)+ ac_prev=htmldir ;;+ -htmldir=* | --htmldir=* | --htmldi=* | --htmld=* | --html=* | --htm=* \+ | --ht=*)+ htmldir=$ac_optarg ;;++ -includedir | --includedir | --includedi | --included | --include \+ | --includ | --inclu | --incl | --inc)+ ac_prev=includedir ;;+ -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \+ | --includ=* | --inclu=* | --incl=* | --inc=*)+ includedir=$ac_optarg ;;++ -infodir | --infodir | --infodi | --infod | --info | --inf)+ ac_prev=infodir ;;+ -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*)+ infodir=$ac_optarg ;;++ -libdir | --libdir | --libdi | --libd)+ ac_prev=libdir ;;+ -libdir=* | --libdir=* | --libdi=* | --libd=*)+ libdir=$ac_optarg ;;++ -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \+ | --libexe | --libex | --libe)+ ac_prev=libexecdir ;;+ -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \+ | --libexe=* | --libex=* | --libe=*)+ libexecdir=$ac_optarg ;;++ -localedir | --localedir | --localedi | --localed | --locale)+ ac_prev=localedir ;;+ -localedir=* | --localedir=* | --localedi=* | --localed=* | --locale=*)+ localedir=$ac_optarg ;;++ -localstatedir | --localstatedir | --localstatedi | --localstated \+ | --localstate | --localstat | --localsta | --localst | --locals)+ ac_prev=localstatedir ;;+ -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \+ | --localstate=* | --localstat=* | --localsta=* | --localst=* | --locals=*)+ localstatedir=$ac_optarg ;;++ -mandir | --mandir | --mandi | --mand | --man | --ma | --m)+ ac_prev=mandir ;;+ -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*)+ mandir=$ac_optarg ;;++ -nfp | --nfp | --nf)+ # Obsolete; use --without-fp.+ with_fp=no ;;++ -no-create | --no-create | --no-creat | --no-crea | --no-cre \+ | --no-cr | --no-c | -n)+ no_create=yes ;;++ -no-recursion | --no-recursion | --no-recursio | --no-recursi \+ | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r)+ no_recursion=yes ;;++ -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \+ | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \+ | --oldin | --oldi | --old | --ol | --o)+ ac_prev=oldincludedir ;;+ -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \+ | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \+ | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*)+ oldincludedir=$ac_optarg ;;++ -prefix | --prefix | --prefi | --pref | --pre | --pr | --p)+ ac_prev=prefix ;;+ -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*)+ prefix=$ac_optarg ;;++ -program-prefix | --program-prefix | --program-prefi | --program-pref \+ | --program-pre | --program-pr | --program-p)+ ac_prev=program_prefix ;;+ -program-prefix=* | --program-prefix=* | --program-prefi=* \+ | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*)+ program_prefix=$ac_optarg ;;++ -program-suffix | --program-suffix | --program-suffi | --program-suff \+ | --program-suf | --program-su | --program-s)+ ac_prev=program_suffix ;;+ -program-suffix=* | --program-suffix=* | --program-suffi=* \+ | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*)+ program_suffix=$ac_optarg ;;++ -program-transform-name | --program-transform-name \+ | --program-transform-nam | --program-transform-na \+ | --program-transform-n | --program-transform- \+ | --program-transform | --program-transfor \+ | --program-transfo | --program-transf \+ | --program-trans | --program-tran \+ | --progr-tra | --program-tr | --program-t)+ ac_prev=program_transform_name ;;+ -program-transform-name=* | --program-transform-name=* \+ | --program-transform-nam=* | --program-transform-na=* \+ | --program-transform-n=* | --program-transform-=* \+ | --program-transform=* | --program-transfor=* \+ | --program-transfo=* | --program-transf=* \+ | --program-trans=* | --program-tran=* \+ | --progr-tra=* | --program-tr=* | --program-t=*)+ program_transform_name=$ac_optarg ;;++ -pdfdir | --pdfdir | --pdfdi | --pdfd | --pdf | --pd)+ ac_prev=pdfdir ;;+ -pdfdir=* | --pdfdir=* | --pdfdi=* | --pdfd=* | --pdf=* | --pd=*)+ pdfdir=$ac_optarg ;;++ -psdir | --psdir | --psdi | --psd | --ps)+ ac_prev=psdir ;;+ -psdir=* | --psdir=* | --psdi=* | --psd=* | --ps=*)+ psdir=$ac_optarg ;;++ -q | -quiet | --quiet | --quie | --qui | --qu | --q \+ | -silent | --silent | --silen | --sile | --sil)+ silent=yes ;;++ -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb)+ ac_prev=sbindir ;;+ -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \+ | --sbi=* | --sb=*)+ sbindir=$ac_optarg ;;++ -sharedstatedir | --sharedstatedir | --sharedstatedi \+ | --sharedstated | --sharedstate | --sharedstat | --sharedsta \+ | --sharedst | --shareds | --shared | --share | --shar \+ | --sha | --sh)+ ac_prev=sharedstatedir ;;+ -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \+ | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \+ | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \+ | --sha=* | --sh=*)+ sharedstatedir=$ac_optarg ;;++ -site | --site | --sit)+ ac_prev=site ;;+ -site=* | --site=* | --sit=*)+ site=$ac_optarg ;;++ -srcdir | --srcdir | --srcdi | --srcd | --src | --sr)+ ac_prev=srcdir ;;+ -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*)+ srcdir=$ac_optarg ;;++ -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \+ | --syscon | --sysco | --sysc | --sys | --sy)+ ac_prev=sysconfdir ;;+ -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \+ | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*)+ sysconfdir=$ac_optarg ;;++ -target | --target | --targe | --targ | --tar | --ta | --t)+ ac_prev=target_alias ;;+ -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*)+ target_alias=$ac_optarg ;;++ -v | -verbose | --verbose | --verbos | --verbo | --verb)+ verbose=yes ;;++ -version | --version | --versio | --versi | --vers | -V)+ ac_init_version=: ;;++ -with-* | --with-*)+ ac_useropt=`expr "x$ac_option" : 'x-*with-\([^=]*\)'`+ # Reject names that are not valid shell variable names.+ expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null &&+ as_fn_error $? "invalid package name: $ac_useropt"+ ac_useropt_orig=$ac_useropt+ ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'`+ case $ac_user_opts in+ *"+"with_$ac_useropt"+"*) ;;+ *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--with-$ac_useropt_orig"+ ac_unrecognized_sep=', ';;+ esac+ eval with_$ac_useropt=\$ac_optarg ;;++ -without-* | --without-*)+ ac_useropt=`expr "x$ac_option" : 'x-*without-\(.*\)'`+ # Reject names that are not valid shell variable names.+ expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null &&+ as_fn_error $? "invalid package name: $ac_useropt"+ ac_useropt_orig=$ac_useropt+ ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'`+ case $ac_user_opts in+ *"+"with_$ac_useropt"+"*) ;;+ *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--without-$ac_useropt_orig"+ ac_unrecognized_sep=', ';;+ esac+ eval with_$ac_useropt=no ;;++ --x)+ # Obsolete; use --with-x.+ with_x=yes ;;++ -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \+ | --x-incl | --x-inc | --x-in | --x-i)+ ac_prev=x_includes ;;+ -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \+ | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*)+ x_includes=$ac_optarg ;;++ -x-libraries | --x-libraries | --x-librarie | --x-librari \+ | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l)+ ac_prev=x_libraries ;;+ -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \+ | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*)+ x_libraries=$ac_optarg ;;++ -*) as_fn_error $? "unrecognized option: \`$ac_option'+Try \`$0 --help' for more information"+ ;;++ *=*)+ ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='`+ # Reject names that are not valid shell variable names.+ case $ac_envvar in #(+ '' | [0-9]* | *[!_$as_cr_alnum]* )+ as_fn_error $? "invalid variable name: \`$ac_envvar'" ;;+ esac+ eval $ac_envvar=\$ac_optarg+ export $ac_envvar ;;++ *)+ # FIXME: should be removed in autoconf 3.0.+ $as_echo "$as_me: WARNING: you should use --build, --host, --target" >&2+ expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null &&+ $as_echo "$as_me: WARNING: invalid host type: $ac_option" >&2+ : "${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option}"+ ;;++ esac+done++if test -n "$ac_prev"; then+ ac_option=--`echo $ac_prev | sed 's/_/-/g'`+ as_fn_error $? "missing argument to $ac_option"+fi++if test -n "$ac_unrecognized_opts"; then+ case $enable_option_checking in+ no) ;;+ fatal) as_fn_error $? "unrecognized options: $ac_unrecognized_opts" ;;+ *) $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2 ;;+ esac+fi++# Check all directory arguments for consistency.+for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \+ datadir sysconfdir sharedstatedir localstatedir includedir \+ oldincludedir docdir infodir htmldir dvidir pdfdir psdir \+ libdir localedir mandir+do+ eval ac_val=\$$ac_var+ # Remove trailing slashes.+ case $ac_val in+ */ )+ ac_val=`expr "X$ac_val" : 'X\(.*[^/]\)' \| "X$ac_val" : 'X\(.*\)'`+ eval $ac_var=\$ac_val;;+ esac+ # Be sure to have absolute directory names.+ case $ac_val in+ [\\/$]* | ?:[\\/]* ) continue;;+ NONE | '' ) case $ac_var in *prefix ) continue;; esac;;+ esac+ as_fn_error $? "expected an absolute directory name for --$ac_var: $ac_val"+done++# There might be people who depend on the old broken behavior: `$host'+# used to hold the argument of --host etc.+# FIXME: To remove some day.+build=$build_alias+host=$host_alias+target=$target_alias++# FIXME: To remove some day.+if test "x$host_alias" != x; then+ if test "x$build_alias" = x; then+ cross_compiling=maybe+ $as_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 .` ||+ as_fn_error $? "working directory cannot be determined"+test "X$ac_ls_di" = "X$ac_pwd_ls_di" ||+ as_fn_error $? "pwd does not report name of working directory"+++# Find the source files, if location was not specified.+if test -z "$srcdir"; then+ ac_srcdir_defaulted=yes+ # Try the directory containing this script, then the parent directory.+ ac_confdir=`$as_dirname -- "$as_myself" ||+$as_expr X"$as_myself" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \+ X"$as_myself" : 'X\(//\)[^/]' \| \+ X"$as_myself" : 'X\(//\)$' \| \+ X"$as_myself" : 'X\(/\)' \| . 2>/dev/null ||+$as_echo X"$as_myself" |+ sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{+ s//\1/+ q+ }+ /^X\(\/\/\)[^/].*/{+ s//\1/+ q+ }+ /^X\(\/\/\)$/{+ s//\1/+ q+ }+ /^X\(\/\).*/{+ s//\1/+ q+ }+ s/.*/./; q'`+ srcdir=$ac_confdir+ if test ! -r "$srcdir/$ac_unique_file"; then+ srcdir=..+ fi+else+ ac_srcdir_defaulted=no+fi+if test ! -r "$srcdir/$ac_unique_file"; then+ test "$ac_srcdir_defaulted" = yes && srcdir="$ac_confdir or .."+ as_fn_error $? "cannot find sources ($ac_unique_file) in $srcdir"+fi+ac_msg="sources are in $srcdir, but \`cd $srcdir' does not work"+ac_abs_confdir=`(+ cd "$srcdir" && test -r "./$ac_unique_file" || as_fn_error $? "$ac_msg"+ pwd)`+# When building in place, set srcdir=.+if test "$ac_abs_confdir" = "$ac_pwd"; then+ srcdir=.+fi+# Remove unnecessary trailing slashes from srcdir.+# Double slashes in file names in object file debugging info+# mess up M-x gdb in Emacs.+case $srcdir in+*/) srcdir=`expr "X$srcdir" : 'X\(.*[^/]\)' \| "X$srcdir" : 'X\(.*\)'`;;+esac+for ac_var in $ac_precious_vars; do+ eval ac_env_${ac_var}_set=\${${ac_var}+set}+ eval ac_env_${ac_var}_value=\$${ac_var}+ eval ac_cv_env_${ac_var}_set=\${${ac_var}+set}+ eval ac_cv_env_${ac_var}_value=\$${ac_var}+done++#+# Report the --help message.+#+if test "$ac_init_help" = "long"; then+ # Omit some internal or obsolete options to make the list less imposing.+ # This message is too long to be a string in the A/UX 3.1 sh.+ cat <<_ACEOF+\`configure' configures Haskell LLVM FFI bindings 3.0.0.0 to adapt to many kinds of systems.++Usage: $0 [OPTION]... [VAR=VALUE]...++To assign environment variables (e.g., CC, CFLAGS...), specify them as+VAR=VALUE. See below for descriptions of some of the useful variables.++Defaults for the options are specified in brackets.++Configuration:+ -h, --help display this help and exit+ --help=short display options specific to this package+ --help=recursive display the short help of all the included packages+ -V, --version display version information and exit+ -q, --quiet, --silent do not print \`checking ...' messages+ --cache-file=FILE cache test results in FILE [disabled]+ -C, --config-cache alias for \`--cache-file=config.cache'+ -n, --no-create do not create output files+ --srcdir=DIR find the sources in DIR [configure dir or \`..']++Installation directories:+ --prefix=PREFIX install architecture-independent files in PREFIX+ [$ac_default_prefix]+ --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX+ [PREFIX]++By default, \`make install' will install all the files in+\`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc. You can specify+an installation prefix other than \`$ac_default_prefix' using \`--prefix',+for instance \`--prefix=\$HOME'.++For better control, use the options below.++Fine tuning of the installation directories:+ --bindir=DIR user executables [EPREFIX/bin]+ --sbindir=DIR system admin executables [EPREFIX/sbin]+ --libexecdir=DIR program executables [EPREFIX/libexec]+ --sysconfdir=DIR read-only single-machine data [PREFIX/etc]+ --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com]+ --localstatedir=DIR modifiable single-machine data [PREFIX/var]+ --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-base]+ --htmldir=DIR html documentation [DOCDIR]+ --dvidir=DIR dvi documentation [DOCDIR]+ --pdfdir=DIR pdf documentation [DOCDIR]+ --psdir=DIR ps documentation [DOCDIR]+_ACEOF++ cat <<\_ACEOF++System types:+ --target=TARGET configure for building compilers for TARGET [guessed]+_ACEOF+fi++if test -n "$ac_init_help"; then+ case $ac_init_help in+ short | recursive ) echo "Configuration of Haskell LLVM FFI bindings 3.0.0.0:";;+ esac+ cat <<\_ACEOF++Optional Packages:+ --with-PACKAGE[=ARG] use PACKAGE [ARG=yes]+ --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no)+ --with-compiler use the given Haskell compiler+ --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 (Objective) C/C++ preprocessor flags, e.g. -I<include dir> if+ you have headers in a nonstandard directory <include dir>+ CXXCPP 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" ||+ { cd "$srcdir" && ac_pwd=`pwd` && srcdir=. && test -d "$ac_dir"; } ||+ continue+ ac_builddir=.++case "$ac_dir" in+.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;;+*)+ ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'`+ # A ".." for each directory in $ac_dir_suffix.+ ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'`+ case $ac_top_builddir_sub in+ "") ac_top_builddir_sub=. ac_top_build_prefix= ;;+ *) ac_top_build_prefix=$ac_top_builddir_sub/ ;;+ esac ;;+esac+ac_abs_top_builddir=$ac_pwd+ac_abs_builddir=$ac_pwd$ac_dir_suffix+# for backward compatibility:+ac_top_builddir=$ac_top_build_prefix++case $srcdir in+ .) # We are building in place.+ ac_srcdir=.+ ac_top_srcdir=$ac_top_builddir_sub+ ac_abs_top_srcdir=$ac_pwd ;;+ [\\/]* | ?:[\\/]* ) # Absolute name.+ ac_srcdir=$srcdir$ac_dir_suffix;+ ac_top_srcdir=$srcdir+ ac_abs_top_srcdir=$srcdir ;;+ *) # Relative name.+ ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix+ ac_top_srcdir=$ac_top_build_prefix$srcdir+ ac_abs_top_srcdir=$ac_pwd/$srcdir ;;+esac+ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix++ cd "$ac_dir" || { ac_status=$?; continue; }+ # Check for guested configure.+ if test -f "$ac_srcdir/configure.gnu"; then+ echo &&+ $SHELL "$ac_srcdir/configure.gnu" --help=recursive+ elif test -f "$ac_srcdir/configure"; then+ echo &&+ $SHELL "$ac_srcdir/configure" --help=recursive+ else+ $as_echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2+ fi || ac_status=$?+ cd "$ac_pwd" || { ac_status=$?; break; }+ done+fi++test -n "$ac_init_help" && exit $ac_status+if $ac_init_version; then+ cat <<\_ACEOF+Haskell LLVM FFI bindings configure 3.0.0.0+generated by GNU Autoconf 2.68++Copyright (C) 2010 Free Software Foundation, Inc.+This configure script is free software; the Free Software Foundation+gives unlimited permission to copy, distribute and modify it.+_ACEOF+ exit+fi++## ------------------------ ##+## Autoconf initialization. ##+## ------------------------ ##++# ac_fn_cxx_try_compile LINENO+# ----------------------------+# Try to compile conftest.$ac_ext, and return whether this succeeded.+ac_fn_cxx_try_compile ()+{+ as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack+ rm -f conftest.$ac_objext+ if { { ac_try="$ac_compile"+case "(($ac_try" in+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;+ *) ac_try_echo=$ac_try;;+esac+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""+$as_echo "$ac_try_echo"; } >&5+ (eval "$ac_compile") 2>conftest.err+ ac_status=$?+ if test -s conftest.err; then+ grep -v '^ *+' conftest.err >conftest.er1+ cat conftest.er1 >&5+ mv -f conftest.er1 conftest.err+ fi+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5+ test $ac_status = 0; } && {+ test -z "$ac_cxx_werror_flag" ||+ test ! -s conftest.err+ } && test -s conftest.$ac_objext; then :+ ac_retval=0+else+ $as_echo "$as_me: failed program was:" >&5+sed 's/^/| /' conftest.$ac_ext >&5++ ac_retval=1+fi+ eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno+ as_fn_set_status $ac_retval++} # ac_fn_cxx_try_compile++# ac_fn_cxx_try_cpp LINENO+# ------------------------+# Try to preprocess conftest.$ac_ext, and return whether this succeeded.+ac_fn_cxx_try_cpp ()+{+ as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack+ if { { ac_try="$ac_cpp conftest.$ac_ext"+case "(($ac_try" in+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;+ *) ac_try_echo=$ac_try;;+esac+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""+$as_echo "$ac_try_echo"; } >&5+ (eval "$ac_cpp conftest.$ac_ext") 2>conftest.err+ ac_status=$?+ if test -s conftest.err; then+ grep -v '^ *+' conftest.err >conftest.er1+ cat conftest.er1 >&5+ mv -f conftest.er1 conftest.err+ fi+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5+ test $ac_status = 0; } > conftest.i && {+ test -z "$ac_cxx_preproc_warn_flag$ac_cxx_werror_flag" ||+ test ! -s conftest.err+ }; then :+ ac_retval=0+else+ $as_echo "$as_me: failed program was:" >&5+sed 's/^/| /' conftest.$ac_ext >&5++ ac_retval=1+fi+ eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno+ as_fn_set_status $ac_retval++} # ac_fn_cxx_try_cpp++# ac_fn_cxx_check_header_mongrel LINENO HEADER VAR INCLUDES+# ---------------------------------------------------------+# Tests whether HEADER exists, giving a warning if it cannot be compiled using+# the include files in INCLUDES and setting the cache variable VAR+# accordingly.+ac_fn_cxx_check_header_mongrel ()+{+ as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack+ if eval \${$3+:} false; then :+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5+$as_echo_n "checking for $2... " >&6; }+if eval \${$3+:} false; then :+ $as_echo_n "(cached) " >&6+fi+eval ac_res=\$$3+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5+$as_echo "$ac_res" >&6; }+else+ # Is the header compilable?+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 usability" >&5+$as_echo_n "checking $2 usability... " >&6; }+cat confdefs.h - <<_ACEOF >conftest.$ac_ext+/* end confdefs.h. */+$4+#include <$2>+_ACEOF+if ac_fn_cxx_try_compile "$LINENO"; then :+ ac_header_compiler=yes+else+ ac_header_compiler=no+fi+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_compiler" >&5+$as_echo "$ac_header_compiler" >&6; }++# Is the header present?+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 presence" >&5+$as_echo_n "checking $2 presence... " >&6; }+cat confdefs.h - <<_ACEOF >conftest.$ac_ext+/* end confdefs.h. */+#include <$2>+_ACEOF+if ac_fn_cxx_try_cpp "$LINENO"; then :+ ac_header_preproc=yes+else+ ac_header_preproc=no+fi+rm -f conftest.err conftest.i conftest.$ac_ext+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_preproc" >&5+$as_echo "$ac_header_preproc" >&6; }++# So? What about this header?+case $ac_header_compiler:$ac_header_preproc:$ac_cxx_preproc_warn_flag in #((+ yes:no: )+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&5+$as_echo "$as_me: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&2;}+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5+$as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;}+ ;;+ no:yes:* )+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: present but cannot be compiled" >&5+$as_echo "$as_me: WARNING: $2: present but cannot be compiled" >&2;}+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: check for missing prerequisite headers?" >&5+$as_echo "$as_me: WARNING: $2: check for missing prerequisite headers?" >&2;}+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: see the Autoconf documentation" >&5+$as_echo "$as_me: WARNING: $2: see the Autoconf documentation" >&2;}+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: section \"Present But Cannot Be Compiled\"" >&5+$as_echo "$as_me: WARNING: $2: section \"Present But Cannot Be Compiled\"" >&2;}+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5+$as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;}+( $as_echo "## --------------------------------- ##+## Report this to bos@serpentine.com ##+## --------------------------------- ##"+ ) | sed "s/^/$as_me: WARNING: /" >&2+ ;;+esac+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5+$as_echo_n "checking for $2... " >&6; }+if eval \${$3+:} false; then :+ $as_echo_n "(cached) " >&6+else+ eval "$3=\$ac_header_compiler"+fi+eval ac_res=\$$3+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5+$as_echo "$ac_res" >&6; }+fi+ eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno++} # ac_fn_cxx_check_header_mongrel++# ac_fn_cxx_try_run LINENO+# ------------------------+# Try to link conftest.$ac_ext, and return whether this succeeded. Assumes+# that executables *can* be run.+ac_fn_cxx_try_run ()+{+ as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack+ if { { ac_try="$ac_link"+case "(($ac_try" in+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;+ *) ac_try_echo=$ac_try;;+esac+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""+$as_echo "$ac_try_echo"; } >&5+ (eval "$ac_link") 2>&5+ ac_status=$?+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5+ test $ac_status = 0; } && { ac_try='./conftest$ac_exeext'+ { { case "(($ac_try" in+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;+ *) ac_try_echo=$ac_try;;+esac+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""+$as_echo "$ac_try_echo"; } >&5+ (eval "$ac_try") 2>&5+ ac_status=$?+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5+ test $ac_status = 0; }; }; then :+ ac_retval=0+else+ $as_echo "$as_me: program exited with status $ac_status" >&5+ $as_echo "$as_me: failed program was:" >&5+sed 's/^/| /' conftest.$ac_ext >&5++ ac_retval=$ac_status+fi+ rm -rf conftest.dSYM conftest_ipa8_conftest.oo+ eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno+ as_fn_set_status $ac_retval++} # ac_fn_cxx_try_run++# ac_fn_cxx_check_header_compile LINENO HEADER VAR INCLUDES+# ---------------------------------------------------------+# Tests whether HEADER exists and can be compiled using the include files in+# INCLUDES, setting the cache variable VAR accordingly.+ac_fn_cxx_check_header_compile ()+{+ as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5+$as_echo_n "checking for $2... " >&6; }+if eval \${$3+:} false; then :+ $as_echo_n "(cached) " >&6+else+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext+/* end confdefs.h. */+$4+#include <$2>+_ACEOF+if ac_fn_cxx_try_compile "$LINENO"; then :+ eval "$3=yes"+else+ eval "$3=no"+fi+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext+fi+eval ac_res=\$$3+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5+$as_echo "$ac_res" >&6; }+ eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno++} # ac_fn_cxx_check_header_compile++# ac_fn_cxx_try_link LINENO+# -------------------------+# Try to link conftest.$ac_ext, and return whether this succeeded.+ac_fn_cxx_try_link ()+{+ as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack+ rm -f conftest.$ac_objext conftest$ac_exeext+ if { { ac_try="$ac_link"+case "(($ac_try" in+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;+ *) ac_try_echo=$ac_try;;+esac+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""+$as_echo "$ac_try_echo"; } >&5+ (eval "$ac_link") 2>conftest.err+ ac_status=$?+ if test -s conftest.err; then+ grep -v '^ *+' conftest.err >conftest.er1+ cat conftest.er1 >&5+ mv -f conftest.er1 conftest.err+ fi+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5+ test $ac_status = 0; } && {+ test -z "$ac_cxx_werror_flag" ||+ test ! -s conftest.err+ } && test -s conftest$ac_exeext && {+ test "$cross_compiling" = yes ||+ $as_test_x conftest$ac_exeext+ }; then :+ ac_retval=0+else+ $as_echo "$as_me: failed program was:" >&5+sed 's/^/| /' conftest.$ac_ext >&5++ ac_retval=1+fi+ # Delete the IPA/IPO (Inter Procedural Analysis/Optimization) information+ # created by the PGI compiler (conftest_ipa8_conftest.oo), as it would+ # interfere with the next link command; also delete a directory that is+ # left behind by Apple's compiler. We do this before executing the actions.+ rm -rf conftest.dSYM conftest_ipa8_conftest.oo+ eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno+ as_fn_set_status $ac_retval++} # ac_fn_cxx_try_link+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 FFI bindings $as_me 3.0.0.0, which was+generated by GNU Autoconf 2.68. Invocation command line was++ $ $0 $@++_ACEOF+exec 5>>config.log+{+cat <<_ASUNAME+## --------- ##+## Platform. ##+## --------- ##++hostname = `(hostname || uname -n) 2>/dev/null | sed 1q`+uname -m = `(uname -m) 2>/dev/null || echo unknown`+uname -r = `(uname -r) 2>/dev/null || echo unknown`+uname -s = `(uname -s) 2>/dev/null || echo unknown`+uname -v = `(uname -v) 2>/dev/null || echo unknown`++/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown`+/bin/uname -X = `(/bin/uname -X) 2>/dev/null || echo unknown`++/bin/arch = `(/bin/arch) 2>/dev/null || echo unknown`+/usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null || echo unknown`+/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown`+/usr/bin/hostinfo = `(/usr/bin/hostinfo) 2>/dev/null || echo unknown`+/bin/machine = `(/bin/machine) 2>/dev/null || echo unknown`+/usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null || echo unknown`+/bin/universe = `(/bin/universe) 2>/dev/null || echo unknown`++_ASUNAME++as_save_IFS=$IFS; IFS=$PATH_SEPARATOR+for as_dir in $PATH+do+ IFS=$as_save_IFS+ test -z "$as_dir" && as_dir=.+ $as_echo "PATH: $as_dir"+ done+IFS=$as_save_IFS++} >&5++cat >&5 <<_ACEOF+++## ----------- ##+## Core tests. ##+## ----------- ##++_ACEOF+++# Keep a trace of the command line.+# Strip out --no-create and --no-recursion so they do not pile up.+# Strip out --silent because we don't want to record it for future runs.+# Also quote any args containing shell meta-characters.+# Make two passes to allow for proper duplicate-argument suppression.+ac_configure_args=+ac_configure_args0=+ac_configure_args1=+ac_must_keep_next=false+for ac_pass in 1 2+do+ for ac_arg+ do+ case $ac_arg in+ -no-create | --no-c* | -n | -no-recursion | --no-r*) continue ;;+ -q | -quiet | --quiet | --quie | --qui | --qu | --q \+ | -silent | --silent | --silen | --sile | --sil)+ continue ;;+ *\'*)+ ac_arg=`$as_echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;;+ esac+ case $ac_pass in+ 1) as_fn_append ac_configure_args0 " '$ac_arg'" ;;+ 2)+ as_fn_append ac_configure_args1 " '$ac_arg'"+ if test $ac_must_keep_next = true; then+ ac_must_keep_next=false # Got value, back to normal.+ else+ case $ac_arg in+ *=* | --config-cache | -C | -disable-* | --disable-* \+ | -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \+ | -q | -quiet | --q* | -silent | --sil* | -v | -verb* \+ | -with-* | --with-* | -without-* | --without-* | --x)+ case "$ac_configure_args0 " in+ "$ac_configure_args1"*" '$ac_arg' "* ) continue ;;+ esac+ ;;+ -* ) ac_must_keep_next=true ;;+ esac+ fi+ as_fn_append ac_configure_args " '$ac_arg'"+ ;;+ esac+ done+done+{ ac_configure_args0=; unset ac_configure_args0;}+{ ac_configure_args1=; unset ac_configure_args1;}++# When interrupted or exit'd, cleanup temporary files, and complete+# config.log. We remove comments because anyway the quotes in there+# would cause problems or look ugly.+# WARNING: Use '\'' to represent an apostrophe within the trap.+# WARNING: Do not start the trap code with a newline, due to a FreeBSD 4.0 bug.+trap 'exit_status=$?+ # Save into config.log some information that might help in debugging.+ {+ echo++ $as_echo "## ---------------- ##+## Cache variables. ##+## ---------------- ##"+ echo+ # The following way of writing the cache mishandles newlines in values,+(+ for ac_var in `(set) 2>&1 | sed -n '\''s/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'\''`; do+ eval ac_val=\$$ac_var+ case $ac_val in #(+ *${as_nl}*)+ case $ac_var in #(+ *_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5+$as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;;+ esac+ case $ac_var in #(+ _ | IFS | as_nl) ;; #(+ BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #(+ *) { eval $ac_var=; unset $ac_var;} ;;+ esac ;;+ esac+ done+ (set) 2>&1 |+ case $as_nl`(ac_space='\'' '\''; set) 2>&1` in #(+ *${as_nl}ac_space=\ *)+ sed -n \+ "s/'\''/'\''\\\\'\'''\''/g;+ s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\''\\2'\''/p"+ ;; #(+ *)+ sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p"+ ;;+ esac |+ sort+)+ echo++ $as_echo "## ----------------- ##+## Output variables. ##+## ----------------- ##"+ echo+ for ac_var in $ac_subst_vars+ do+ eval ac_val=\$$ac_var+ case $ac_val in+ *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;;+ esac+ $as_echo "$ac_var='\''$ac_val'\''"+ done | sort+ echo++ if test -n "$ac_subst_files"; then+ $as_echo "## ------------------- ##+## File substitutions. ##+## ------------------- ##"+ echo+ for ac_var in $ac_subst_files+ do+ eval ac_val=\$$ac_var+ case $ac_val in+ *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;;+ esac+ $as_echo "$ac_var='\''$ac_val'\''"+ done | sort+ echo+ fi++ if test -s confdefs.h; then+ $as_echo "## ----------- ##+## confdefs.h. ##+## ----------- ##"+ echo+ cat confdefs.h+ echo+ fi+ test "$ac_signal" != 0 &&+ $as_echo "$as_me: caught signal $ac_signal"+ $as_echo "$as_me: exit $exit_status"+ } >&5+ rm -f core *.core core.conftest.* &&+ rm -f -r conftest* confdefs* conf$$* $ac_clean_files &&+ exit $exit_status+' 0+for ac_signal in 1 2 13 15; do+ trap 'ac_signal='$ac_signal'; as_fn_exit 1' $ac_signal+done+ac_signal=0++# confdefs.h avoids OS command line length limits that DEFS can exceed.+rm -f -r conftest* confdefs.h++$as_echo "/* confdefs.h */" > confdefs.h++# Predefined preprocessor variables.++cat >>confdefs.h <<_ACEOF+#define PACKAGE_NAME "$PACKAGE_NAME"+_ACEOF++cat >>confdefs.h <<_ACEOF+#define PACKAGE_TARNAME "$PACKAGE_TARNAME"+_ACEOF++cat >>confdefs.h <<_ACEOF+#define PACKAGE_VERSION "$PACKAGE_VERSION"+_ACEOF++cat >>confdefs.h <<_ACEOF+#define PACKAGE_STRING "$PACKAGE_STRING"+_ACEOF++cat >>confdefs.h <<_ACEOF+#define PACKAGE_BUGREPORT "$PACKAGE_BUGREPORT"+_ACEOF++cat >>confdefs.h <<_ACEOF+#define PACKAGE_URL "$PACKAGE_URL"+_ACEOF+++# Let the site file select an alternate cache file if it wants to.+# Prefer an explicitly selected file to automatically selected ones.+ac_site_file1=NONE+ac_site_file2=NONE+if test -n "$CONFIG_SITE"; then+ # We do not want a PATH search for config.site.+ case $CONFIG_SITE in #((+ -*) ac_site_file1=./$CONFIG_SITE;;+ */*) ac_site_file1=$CONFIG_SITE;;+ *) ac_site_file1=./$CONFIG_SITE;;+ esac+elif test "x$prefix" != xNONE; then+ ac_site_file1=$prefix/share/config.site+ ac_site_file2=$prefix/etc/config.site+else+ ac_site_file1=$ac_default_prefix/share/config.site+ ac_site_file2=$ac_default_prefix/etc/config.site+fi+for ac_site_file in "$ac_site_file1" "$ac_site_file2"+do+ test "x$ac_site_file" = xNONE && continue+ if test /dev/null != "$ac_site_file" && test -r "$ac_site_file"; then+ { $as_echo "$as_me:${as_lineno-$LINENO}: loading site script $ac_site_file" >&5+$as_echo "$as_me: loading site script $ac_site_file" >&6;}+ sed 's/^/| /' "$ac_site_file" >&5+ . "$ac_site_file" \+ || { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}+as_fn_error $? "failed to load site script $ac_site_file+See \`config.log' for more details" "$LINENO" 5; }+ fi+done++if test -r "$cache_file"; then+ # Some versions of bash will fail to source /dev/null (special files+ # actually), so we avoid doing that. DJGPP emulates it as a regular file.+ if test /dev/null != "$cache_file" && test -f "$cache_file"; then+ { $as_echo "$as_me:${as_lineno-$LINENO}: loading cache $cache_file" >&5+$as_echo "$as_me: loading cache $cache_file" >&6;}+ case $cache_file in+ [\\/]* | ?:[\\/]* ) . "$cache_file";;+ *) . "./$cache_file";;+ esac+ fi+else+ { $as_echo "$as_me:${as_lineno-$LINENO}: creating cache $cache_file" >&5+$as_echo "$as_me: creating cache $cache_file" >&6;}+ >$cache_file+fi++# Check that the precious variables saved in the cache have kept the same+# value.+ac_cache_corrupted=false+for ac_var in $ac_precious_vars; do+ eval ac_old_set=\$ac_cv_env_${ac_var}_set+ eval ac_new_set=\$ac_env_${ac_var}_set+ eval ac_old_val=\$ac_cv_env_${ac_var}_value+ eval ac_new_val=\$ac_env_${ac_var}_value+ case $ac_old_set,$ac_new_set in+ set,)+ { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5+$as_echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;}+ ac_cache_corrupted=: ;;+ ,set)+ { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was not set in the previous run" >&5+$as_echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;}+ ac_cache_corrupted=: ;;+ ,);;+ *)+ if test "x$ac_old_val" != "x$ac_new_val"; then+ # differences in whitespace do not lead to failure.+ ac_old_val_w=`echo x $ac_old_val`+ ac_new_val_w=`echo x $ac_new_val`+ if test "$ac_old_val_w" != "$ac_new_val_w"; then+ { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' has changed since the previous run:" >&5+$as_echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;}+ ac_cache_corrupted=:+ else+ { $as_echo "$as_me:${as_lineno-$LINENO}: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&5+$as_echo "$as_me: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&2;}+ eval $ac_var=\$ac_old_val+ fi+ { $as_echo "$as_me:${as_lineno-$LINENO}: former value: \`$ac_old_val'" >&5+$as_echo "$as_me: former value: \`$ac_old_val'" >&2;}+ { $as_echo "$as_me:${as_lineno-$LINENO}: current value: \`$ac_new_val'" >&5+$as_echo "$as_me: current value: \`$ac_new_val'" >&2;}+ fi;;+ esac+ # Pass precious variables to config.status.+ if test "$ac_new_set" = set; then+ case $ac_new_val in+ *\'*) ac_arg=$ac_var=`$as_echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;;+ *) ac_arg=$ac_var=$ac_new_val ;;+ esac+ case " $ac_configure_args " in+ *" '$ac_arg' "*) ;; # Avoid dups. Use of quotes ensures accuracy.+ *) as_fn_append ac_configure_args " '$ac_arg'" ;;+ esac+ fi+done+if $ac_cache_corrupted; then+ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}+ { $as_echo "$as_me:${as_lineno-$LINENO}: error: changes in the environment can compromise the build" >&5+$as_echo "$as_me: error: changes in the environment can compromise the build" >&2;}+ as_fn_error $? "run \`make distclean' and/or \`rm $cache_file' and start over" "$LINENO" 5+fi+## -------------------- ##+## Main body of script. ##+## -------------------- ##++ac_ext=c+ac_cpp='$CPP $CPPFLAGS'+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'+ac_compiler_gnu=$ac_cv_c_compiler_gnu++++++ac_config_files="$ac_config_files llvm-base.buildinfo"+++ac_config_headers="$ac_config_headers include/hs_llvm_config.h"+++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+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5+$as_echo_n "checking for $ac_word... " >&6; }+if ${ac_cv_prog_CXX+:} false; then :+ $as_echo_n "(cached) " >&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"+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5+ break 2+ fi+done+ done+IFS=$as_save_IFS++fi+fi+CXX=$ac_cv_prog_CXX+if test -n "$CXX"; then+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CXX" >&5+$as_echo "$CXX" >&6; }+else+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5+$as_echo "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+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5+$as_echo_n "checking for $ac_word... " >&6; }+if ${ac_cv_prog_ac_ct_CXX+:} false; then :+ $as_echo_n "(cached) " >&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"+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5+ break 2+ fi+done+ done+IFS=$as_save_IFS++fi+fi+ac_ct_CXX=$ac_cv_prog_ac_ct_CXX+if test -n "$ac_ct_CXX"; then+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CXX" >&5+$as_echo "$ac_ct_CXX" >&6; }+else+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5+$as_echo "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:)+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}+ac_tool_warned=yes ;;+esac+ CXX=$ac_ct_CXX+ fi+fi++ fi+fi+# Provide some information about the compiler.+$as_echo "$as_me:${as_lineno-$LINENO}: checking for C++ compiler version" >&5+set X $ac_compile+ac_compiler=$2+for ac_option in --version -v -V -qversion; do+ { { ac_try="$ac_compiler $ac_option >&5"+case "(($ac_try" in+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;+ *) ac_try_echo=$ac_try;;+esac+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""+$as_echo "$ac_try_echo"; } >&5+ (eval "$ac_compiler $ac_option >&5") 2>conftest.err+ ac_status=$?+ if test -s conftest.err; then+ sed '10a\+... rest of stderr output deleted ...+ 10q' conftest.err >conftest.er1+ cat conftest.er1 >&5+ fi+ rm -f conftest.er1 conftest.err+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5+ test $ac_status = 0; }+done++cat confdefs.h - <<_ACEOF >conftest.$ac_ext+/* end confdefs.h. */++int+main ()+{++ ;+ return 0;+}+_ACEOF+ac_clean_files_save=$ac_clean_files+ac_clean_files="$ac_clean_files a.out a.out.dSYM a.exe b.out"+# Try to create an executable without -o first, disregard a.out.+# It will help us diagnose broken compilers, and finding out an intuition+# of exeext.+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the C++ compiler works" >&5+$as_echo_n "checking whether the C++ compiler works... " >&6; }+ac_link_default=`$as_echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'`++# The possible output files:+ac_files="a.out conftest.exe conftest a.exe a_out.exe b.out conftest.*"++ac_rmfiles=+for ac_file in $ac_files+do+ case $ac_file in+ *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;;+ * ) ac_rmfiles="$ac_rmfiles $ac_file";;+ esac+done+rm -f $ac_rmfiles++if { { ac_try="$ac_link_default"+case "(($ac_try" in+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;+ *) ac_try_echo=$ac_try;;+esac+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""+$as_echo "$ac_try_echo"; } >&5+ (eval "$ac_link_default") 2>&5+ ac_status=$?+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5+ test $ac_status = 0; }; then :+ # Autoconf-2.13 could set the ac_cv_exeext variable to `no'.+# So ignore a value of `no', otherwise this would lead to `EXEEXT = no'+# in a Makefile. We should not override ac_cv_exeext if it was cached,+# so that the user can short-circuit this test for compilers unknown to+# Autoconf.+for ac_file in $ac_files ''+do+ test -f "$ac_file" || continue+ case $ac_file in+ *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj )+ ;;+ [ab].out )+ # We found the default executable, but exeext='' is most+ # certainly right.+ break;;+ *.* )+ if test "${ac_cv_exeext+set}" = set && test "$ac_cv_exeext" != no;+ then :; else+ ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'`+ fi+ # We set ac_cv_exeext here because the later test for it is not+ # safe: cross compilers may not add the suffix if given an `-o'+ # argument, so we may need to know it at that point already.+ # Even if this section looks crufty: it has the advantage of+ # actually working.+ break;;+ * )+ break;;+ esac+done+test "$ac_cv_exeext" = no && ac_cv_exeext=++else+ ac_file=''+fi+if test -z "$ac_file"; then :+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5+$as_echo "no" >&6; }+$as_echo "$as_me: failed program was:" >&5+sed 's/^/| /' conftest.$ac_ext >&5++{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}+as_fn_error 77 "C++ compiler cannot create executables+See \`config.log' for more details" "$LINENO" 5; }+else+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5+$as_echo "yes" >&6; }+fi+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for C++ compiler default output file name" >&5+$as_echo_n "checking for C++ compiler default output file name... " >&6; }+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_file" >&5+$as_echo "$ac_file" >&6; }+ac_exeext=$ac_cv_exeext++rm -f -r a.out a.out.dSYM a.exe conftest$ac_cv_exeext b.out+ac_clean_files=$ac_clean_files_save+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of executables" >&5+$as_echo_n "checking for suffix of executables... " >&6; }+if { { ac_try="$ac_link"+case "(($ac_try" in+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;+ *) ac_try_echo=$ac_try;;+esac+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""+$as_echo "$ac_try_echo"; } >&5+ (eval "$ac_link") 2>&5+ ac_status=$?+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5+ test $ac_status = 0; }; then :+ # If both `conftest.exe' and `conftest' are `present' (well, observable)+# catch `conftest.exe'. For instance with Cygwin, `ls conftest' will+# work properly (i.e., refer to `conftest.exe'), while it won't with+# `rm'.+for ac_file in conftest.exe conftest conftest.*; do+ test -f "$ac_file" || continue+ case $ac_file in+ *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;;+ *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'`+ break;;+ * ) break;;+ esac+done+else+ { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}+as_fn_error $? "cannot compute suffix of executables: cannot compile and link+See \`config.log' for more details" "$LINENO" 5; }+fi+rm -f conftest conftest$ac_cv_exeext+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_exeext" >&5+$as_echo "$ac_cv_exeext" >&6; }++rm -f conftest.$ac_ext+EXEEXT=$ac_cv_exeext+ac_exeext=$EXEEXT+cat confdefs.h - <<_ACEOF >conftest.$ac_ext+/* end confdefs.h. */+#include <stdio.h>+int+main ()+{+FILE *f = fopen ("conftest.out", "w");+ return ferror (f) || fclose (f) != 0;++ ;+ return 0;+}+_ACEOF+ac_clean_files="$ac_clean_files conftest.out"+# Check that the compiler produces executables we can run. If not, either+# the compiler is broken, or we cross compile.+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are cross compiling" >&5+$as_echo_n "checking whether we are cross compiling... " >&6; }+if test "$cross_compiling" != yes; then+ { { ac_try="$ac_link"+case "(($ac_try" in+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;+ *) ac_try_echo=$ac_try;;+esac+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""+$as_echo "$ac_try_echo"; } >&5+ (eval "$ac_link") 2>&5+ ac_status=$?+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5+ test $ac_status = 0; }+ if { ac_try='./conftest$ac_cv_exeext'+ { { case "(($ac_try" in+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;+ *) ac_try_echo=$ac_try;;+esac+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""+$as_echo "$ac_try_echo"; } >&5+ (eval "$ac_try") 2>&5+ ac_status=$?+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5+ test $ac_status = 0; }; }; then+ cross_compiling=no+ else+ if test "$cross_compiling" = maybe; then+ cross_compiling=yes+ else+ { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}+as_fn_error $? "cannot run C++ compiled programs.+If you meant to cross compile, use \`--host'.+See \`config.log' for more details" "$LINENO" 5; }+ fi+ fi+fi+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $cross_compiling" >&5+$as_echo "$cross_compiling" >&6; }++rm -f conftest.$ac_ext conftest$ac_cv_exeext conftest.out+ac_clean_files=$ac_clean_files_save+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of object files" >&5+$as_echo_n "checking for suffix of object files... " >&6; }+if ${ac_cv_objext+:} false; then :+ $as_echo_n "(cached) " >&6+else+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext+/* end confdefs.h. */++int+main ()+{++ ;+ return 0;+}+_ACEOF+rm -f conftest.o conftest.obj+if { { ac_try="$ac_compile"+case "(($ac_try" in+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;+ *) ac_try_echo=$ac_try;;+esac+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""+$as_echo "$ac_try_echo"; } >&5+ (eval "$ac_compile") 2>&5+ ac_status=$?+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5+ test $ac_status = 0; }; then :+ for ac_file in conftest.o conftest.obj conftest.*; do+ test -f "$ac_file" || continue;+ case $ac_file in+ *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM ) ;;+ *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'`+ break;;+ esac+done+else+ $as_echo "$as_me: failed program was:" >&5+sed 's/^/| /' conftest.$ac_ext >&5++{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}+as_fn_error $? "cannot compute suffix of object files: cannot compile+See \`config.log' for more details" "$LINENO" 5; }+fi+rm -f conftest.$ac_cv_objext conftest.$ac_ext+fi+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_objext" >&5+$as_echo "$ac_cv_objext" >&6; }+OBJEXT=$ac_cv_objext+ac_objext=$OBJEXT+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU C++ compiler" >&5+$as_echo_n "checking whether we are using the GNU C++ compiler... " >&6; }+if ${ac_cv_cxx_compiler_gnu+:} false; then :+ $as_echo_n "(cached) " >&6+else+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext+/* end confdefs.h. */++int+main ()+{+#ifndef __GNUC__+ choke me+#endif++ ;+ return 0;+}+_ACEOF+if ac_fn_cxx_try_compile "$LINENO"; then :+ ac_compiler_gnu=yes+else+ ac_compiler_gnu=no+fi+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext+ac_cv_cxx_compiler_gnu=$ac_compiler_gnu++fi+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_cxx_compiler_gnu" >&5+$as_echo "$ac_cv_cxx_compiler_gnu" >&6; }+if test $ac_compiler_gnu = yes; then+ GXX=yes+else+ GXX=+fi+ac_test_CXXFLAGS=${CXXFLAGS+set}+ac_save_CXXFLAGS=$CXXFLAGS+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CXX accepts -g" >&5+$as_echo_n "checking whether $CXX accepts -g... " >&6; }+if ${ac_cv_prog_cxx_g+:} false; then :+ $as_echo_n "(cached) " >&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 confdefs.h - <<_ACEOF >conftest.$ac_ext+/* end confdefs.h. */++int+main ()+{++ ;+ return 0;+}+_ACEOF+if ac_fn_cxx_try_compile "$LINENO"; then :+ ac_cv_prog_cxx_g=yes+else+ CXXFLAGS=""+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext+/* end confdefs.h. */++int+main ()+{++ ;+ return 0;+}+_ACEOF+if ac_fn_cxx_try_compile "$LINENO"; then :++else+ ac_cxx_werror_flag=$ac_save_cxx_werror_flag+ CXXFLAGS="-g"+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext+/* end confdefs.h. */++int+main ()+{++ ;+ return 0;+}+_ACEOF+if ac_fn_cxx_try_compile "$LINENO"; then :+ ac_cv_prog_cxx_g=yes+fi+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext+fi+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext+fi+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext+ ac_cxx_werror_flag=$ac_save_cxx_werror_flag+fi+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cxx_g" >&5+$as_echo "$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+++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++++# Check whether --with-compiler was given.+if test "${with_compiler+set}" = set; then :+ withval=$with_compiler; compiler="$withval"+else+ compiler=ghc+fi+++# 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="$prefix"+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++for ac_prog in llvm-config+do+ # Extract the first word of "$ac_prog", so it can be a program name with args.+set dummy $ac_prog; ac_word=$2+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5+$as_echo_n "checking for $ac_word... " >&6; }+if ${ac_cv_path_llvm_config+:} false; then :+ $as_echo_n "(cached) " >&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+as_dummy=""$llvm_bindir:$PATH""+for as_dir in $as_dummy+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"+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5+ break 2+ fi+done+ done+IFS=$as_save_IFS++ ;;+esac+fi+llvm_config=$ac_cv_path_llvm_config+if test -n "$llvm_config"; then+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $llvm_config" >&5+$as_echo "$llvm_config" >&6; }+else+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5+$as_echo "no" >&6; }+fi+++ test -n "$llvm_config" && break+done+test -n "$llvm_config" || llvm_config="as_fn_error $? "could not find llvm-config in $llvm_bindir" "$LINENO" 5"+++++if test "$target" = ""+then+ if test "${compiler}" != ""+ then+ target=`${compiler} +RTS --info | grep '^ ,("Target platform"' | sed -e 's/.*, "//' -e 's/")//' | tr -d '\r'`+ echo "Target platform inferred as: $target"+ else+ echo "Can't work out target platform"+ exit 1+ fi+fi++case $target in+i386-apple-darwin)+ TARGET_CPPFLAGS="-m32"+ TAGRET_LDFLAGS="-m32"+ ;;+x86_64-apple-darwin)+ TARGET_CPPFLAGS="-m64"+ TAGRET_LDFLAGS="-m64"+ ;;+esac++llvm_version="`$llvm_config --version`"+llvm_cppflags="`$llvm_config --cppflags`"+llvm_includedir="`$llvm_config --includedir`"+llvm_ldflags="`$llvm_config --ldflags`"++llvm_all_libs="`$llvm_config --libs all`"+llvm_target="`$llvm_config --libs engine | sed 's/.*LLVM\(.[^ ]*\)CodeGen.*/\1/'`"++llvm_extra_libs=""+llvm_extra_libdirs=""+llvm_extra_ghci_libs=""+llvm_ldoptions=""+for opt in $llvm_all_libs $llvm_ldflags; do+ case $opt in+ -l*) llvm_extra_libs="$llvm_extra_libs `echo $opt | sed 's/^-l//'`";;+ -L*) llvm_extra_libdirs="$llvm_extra_libdirs `echo $opt | sed 's/^-L//'`";;+ */lib*.so|*/lib*.dylib)+ llvm_extra_ghci_libs="$llvm_extra_ghci_libs `echo $opt | sed -e 's,^.*/lib\(^/*\),\1,' -e 's/\.so$//' -e 's/\.dylib$//'`";;+ *) llvm_ldoptions="$llvm_ldoptions $opt";;+ esac+done++CPPFLAGS="$llvm_cppflags $CPPFLAGS $TARGET_CPPFLAGS"+LDFLAGS="$llvm_ldflags $LDFLAGS $TARGET_LDFLAGS"+++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+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to run the C++ preprocessor" >&5+$as_echo_n "checking how to run the C++ preprocessor... " >&6; }+if test -z "$CXXCPP"; then+ if ${ac_cv_prog_CXXCPP+:} false; then :+ $as_echo_n "(cached) " >&6+else+ # Double quotes because CXXCPP needs to be expanded+ for CXXCPP in "$CXX -E" "/lib/cpp"+ do+ ac_preproc_ok=false+for ac_cxx_preproc_warn_flag in '' yes+do+ # Use a header file that comes with gcc, so configuring glibc+ # with a fresh cross-compiler works.+ # Prefer <limits.h> to <assert.h> if __STDC__ is defined, since+ # <limits.h> exists even on freestanding compilers.+ # On the NeXT, cc -E runs the code through the compiler's parser,+ # not just through cpp. "Syntax error" is here to catch this case.+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext+/* end confdefs.h. */+#ifdef __STDC__+# include <limits.h>+#else+# include <assert.h>+#endif+ Syntax error+_ACEOF+if ac_fn_cxx_try_cpp "$LINENO"; then :++else+ # Broken: fails on valid input.+continue+fi+rm -f conftest.err conftest.i conftest.$ac_ext++ # OK, works on sane cases. Now check whether nonexistent headers+ # can be detected and how.+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext+/* end confdefs.h. */+#include <ac_nonexistent.h>+_ACEOF+if ac_fn_cxx_try_cpp "$LINENO"; then :+ # Broken: success on invalid input.+continue+else+ # Passes both tests.+ac_preproc_ok=:+break+fi+rm -f conftest.err conftest.i conftest.$ac_ext++done+# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped.+rm -f conftest.i conftest.err conftest.$ac_ext+if $ac_preproc_ok; then :+ break+fi++ done+ ac_cv_prog_CXXCPP=$CXXCPP++fi+ CXXCPP=$ac_cv_prog_CXXCPP+else+ ac_cv_prog_CXXCPP=$CXXCPP+fi+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $CXXCPP" >&5+$as_echo "$CXXCPP" >&6; }+ac_preproc_ok=false+for ac_cxx_preproc_warn_flag in '' yes+do+ # Use a header file that comes with gcc, so configuring glibc+ # with a fresh cross-compiler works.+ # Prefer <limits.h> to <assert.h> if __STDC__ is defined, since+ # <limits.h> exists even on freestanding compilers.+ # On the NeXT, cc -E runs the code through the compiler's parser,+ # not just through cpp. "Syntax error" is here to catch this case.+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext+/* end confdefs.h. */+#ifdef __STDC__+# include <limits.h>+#else+# include <assert.h>+#endif+ Syntax error+_ACEOF+if ac_fn_cxx_try_cpp "$LINENO"; then :++else+ # Broken: fails on valid input.+continue+fi+rm -f conftest.err conftest.i conftest.$ac_ext++ # OK, works on sane cases. Now check whether nonexistent headers+ # can be detected and how.+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext+/* end confdefs.h. */+#include <ac_nonexistent.h>+_ACEOF+if ac_fn_cxx_try_cpp "$LINENO"; then :+ # Broken: success on invalid input.+continue+else+ # Passes both tests.+ac_preproc_ok=:+break+fi+rm -f conftest.err conftest.i conftest.$ac_ext++done+# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped.+rm -f conftest.i conftest.err conftest.$ac_ext+if $ac_preproc_ok; then :++else+ { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}+as_fn_error $? "C++ preprocessor \"$CXXCPP\" fails sanity check+See \`config.log' for more details" "$LINENO" 5; }+fi++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+++{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for grep that handles long lines and -e" >&5+$as_echo_n "checking for grep that handles long lines and -e... " >&6; }+if ${ac_cv_path_GREP+:} false; then :+ $as_echo_n "(cached) " >&6+else+ if test -z "$GREP"; then+ ac_path_GREP_found=false+ # Loop through the user's path and test for each of PROGNAME-LIST+ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR+for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin+do+ IFS=$as_save_IFS+ test -z "$as_dir" && as_dir=.+ for ac_prog in grep ggrep; do+ for ac_exec_ext in '' $ac_executable_extensions; do+ ac_path_GREP="$as_dir/$ac_prog$ac_exec_ext"+ { 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+ $as_echo_n 0123456789 >"conftest.in"+ while :+ do+ cat "conftest.in" "conftest.in" >"conftest.tmp"+ mv "conftest.tmp" "conftest.in"+ cp "conftest.in" "conftest.nl"+ $as_echo 'GREP' >> "conftest.nl"+ "$ac_path_GREP" -e 'GREP$' -e '-(cannot match)-' < "conftest.nl" >"conftest.out" 2>/dev/null || break+ diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break+ as_fn_arith $ac_count + 1 && ac_count=$as_val+ if test $ac_count -gt ${ac_path_GREP_max-0}; then+ # Best one so far, save it but keep looking for a better one+ ac_cv_path_GREP="$ac_path_GREP"+ ac_path_GREP_max=$ac_count+ fi+ # 10*(2^10) chars as input seems more than enough+ test $ac_count -gt 10 && break+ done+ rm -f conftest.in conftest.tmp conftest.nl conftest.out;;+esac++ $ac_path_GREP_found && break 3+ done+ done+ done+IFS=$as_save_IFS+ if test -z "$ac_cv_path_GREP"; then+ as_fn_error $? "no acceptable grep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5+ fi+else+ ac_cv_path_GREP=$GREP+fi++fi+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_GREP" >&5+$as_echo "$ac_cv_path_GREP" >&6; }+ GREP="$ac_cv_path_GREP"+++{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for egrep" >&5+$as_echo_n "checking for egrep... " >&6; }+if ${ac_cv_path_EGREP+:} false; then :+ $as_echo_n "(cached) " >&6+else+ if echo a | $GREP -E '(a|b)' >/dev/null 2>&1+ then ac_cv_path_EGREP="$GREP -E"+ else+ if test -z "$EGREP"; then+ ac_path_EGREP_found=false+ # Loop through the user's path and test for each of PROGNAME-LIST+ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR+for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin+do+ IFS=$as_save_IFS+ test -z "$as_dir" && as_dir=.+ for ac_prog in egrep; do+ for ac_exec_ext in '' $ac_executable_extensions; do+ ac_path_EGREP="$as_dir/$ac_prog$ac_exec_ext"+ { 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+ $as_echo_n 0123456789 >"conftest.in"+ while :+ do+ cat "conftest.in" "conftest.in" >"conftest.tmp"+ mv "conftest.tmp" "conftest.in"+ cp "conftest.in" "conftest.nl"+ $as_echo 'EGREP' >> "conftest.nl"+ "$ac_path_EGREP" 'EGREP$' < "conftest.nl" >"conftest.out" 2>/dev/null || break+ diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break+ as_fn_arith $ac_count + 1 && ac_count=$as_val+ if test $ac_count -gt ${ac_path_EGREP_max-0}; then+ # Best one so far, save it but keep looking for a better one+ ac_cv_path_EGREP="$ac_path_EGREP"+ ac_path_EGREP_max=$ac_count+ fi+ # 10*(2^10) chars as input seems more than enough+ test $ac_count -gt 10 && break+ done+ rm -f conftest.in conftest.tmp conftest.nl conftest.out;;+esac++ $ac_path_EGREP_found && break 3+ done+ done+ done+IFS=$as_save_IFS+ if test -z "$ac_cv_path_EGREP"; then+ as_fn_error $? "no acceptable egrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5+ fi+else+ ac_cv_path_EGREP=$EGREP+fi++ fi+fi+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_EGREP" >&5+$as_echo "$ac_cv_path_EGREP" >&6; }+ EGREP="$ac_cv_path_EGREP"+++{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ANSI C header files" >&5+$as_echo_n "checking for ANSI C header files... " >&6; }+if ${ac_cv_header_stdc+:} false; then :+ $as_echo_n "(cached) " >&6+else+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext+/* end confdefs.h. */+#include <stdlib.h>+#include <stdarg.h>+#include <string.h>+#include <float.h>++int+main ()+{++ ;+ return 0;+}+_ACEOF+if ac_fn_cxx_try_compile "$LINENO"; then :+ ac_cv_header_stdc=yes+else+ ac_cv_header_stdc=no+fi+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext++if test $ac_cv_header_stdc = yes; then+ # SunOS 4.x string.h does not declare mem*, contrary to ANSI.+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext+/* end confdefs.h. */+#include <string.h>++_ACEOF+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |+ $EGREP "memchr" >/dev/null 2>&1; then :++else+ ac_cv_header_stdc=no+fi+rm -f conftest*++fi++if test $ac_cv_header_stdc = yes; then+ # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI.+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext+/* end confdefs.h. */+#include <stdlib.h>++_ACEOF+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |+ $EGREP "free" >/dev/null 2>&1; then :++else+ ac_cv_header_stdc=no+fi+rm -f conftest*++fi++if test $ac_cv_header_stdc = yes; then+ # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi.+ if test "$cross_compiling" = yes; then :+ :+else+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext+/* end confdefs.h. */+#include <ctype.h>+#include <stdlib.h>+#if ((' ' & 0x0FF) == 0x020)+# define ISLOWER(c) ('a' <= (c) && (c) <= 'z')+# define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c))+#else+# define ISLOWER(c) \+ (('a' <= (c) && (c) <= 'i') \+ || ('j' <= (c) && (c) <= 'r') \+ || ('s' <= (c) && (c) <= 'z'))+# define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c))+#endif++#define XOR(e, f) (((e) && !(f)) || (!(e) && (f)))+int+main ()+{+ int i;+ for (i = 0; i < 256; i++)+ if (XOR (islower (i), ISLOWER (i))+ || toupper (i) != TOUPPER (i))+ return 2;+ return 0;+}+_ACEOF+if ac_fn_cxx_try_run "$LINENO"; then :++else+ ac_cv_header_stdc=no+fi+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \+ conftest.$ac_objext conftest.beam conftest.$ac_ext+fi++fi+fi+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_stdc" >&5+$as_echo "$ac_cv_header_stdc" >&6; }+if test $ac_cv_header_stdc = yes; then++$as_echo "#define STDC_HEADERS 1" >>confdefs.h++fi++# On IRIX 5.3, sys/types and inttypes.h are conflicting.+for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \+ inttypes.h stdint.h unistd.h+do :+ as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`+ac_fn_cxx_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default+"+if eval test \"x\$"$as_ac_Header"\" = x"yes"; then :+ cat >>confdefs.h <<_ACEOF+#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1+_ACEOF++fi++done+++for ac_header in llvm-c/Core.h+do :+ ac_fn_cxx_check_header_mongrel "$LINENO" "llvm-c/Core.h" "ac_cv_header_llvm_c_Core_h" "$ac_includes_default"+if test "x$ac_cv_header_llvm_c_Core_h" = xyes; then :+ cat >>confdefs.h <<_ACEOF+#define HAVE_LLVM_C_CORE_H 1+_ACEOF++else+ as_fn_error $? "could not find LLVM C bindings" "$LINENO" 5+fi++done+++for ac_header in llvm/ADT/StringRef.h+do :+ ac_fn_cxx_check_header_mongrel "$LINENO" "llvm/ADT/StringRef.h" "ac_cv_header_llvm_ADT_StringRef_h" "$ac_includes_default"+if test "x$ac_cv_header_llvm_ADT_StringRef_h" = xyes; then :+ cat >>confdefs.h <<_ACEOF+#define HAVE_LLVM_ADT_STRINGREF_H 1+_ACEOF++fi++done++for ac_header in llvm/Support/DynamicLibrary.h+do :+ ac_fn_cxx_check_header_compile "$LINENO" "llvm/Support/DynamicLibrary.h" "ac_cv_header_llvm_Support_DynamicLibrary_h" "#ifdef HAVE_LLVM_ADT_STRINGREF_H+# include <llvm/ADT/StringRef.h>+#endif+"+if test "x$ac_cv_header_llvm_Support_DynamicLibrary_h" = xyes; then :+ cat >>confdefs.h <<_ACEOF+#define HAVE_LLVM_SUPPORT_DYNAMICLIBRARY_H 1+_ACEOF++fi++done+++save_LIBS="$LIBS"+LIBS="-lLLVMSupport -lLLVMSystem -lpthread -ldl $LIBS"++{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for LLVMModuleCreateWithName in -lLLVMCore" >&5+$as_echo_n "checking for LLVMModuleCreateWithName in -lLLVMCore... " >&6; }+if ${ac_cv_lib_LLVMCore_LLVMModuleCreateWithName+:} false; then :+ $as_echo_n "(cached) " >&6+else+ ac_check_lib_save_LIBS=$LIBS+LIBS="-lLLVMCore $LIBS"+cat confdefs.h - <<_ACEOF >conftest.$ac_ext+/* end confdefs.h. */++/* Override any GCC internal prototype to avoid an error.+ Use char because int might match the return type of a GCC+ builtin and then its argument prototype would still apply. */+#ifdef __cplusplus+extern "C"+#endif+char LLVMModuleCreateWithName ();+int+main ()+{+return LLVMModuleCreateWithName ();+ ;+ return 0;+}+_ACEOF+if ac_fn_cxx_try_link "$LINENO"; then :+ ac_cv_lib_LLVMCore_LLVMModuleCreateWithName=yes+else+ ac_cv_lib_LLVMCore_LLVMModuleCreateWithName=no+fi+rm -f core conftest.err conftest.$ac_objext \+ conftest$ac_exeext conftest.$ac_ext+LIBS=$ac_check_lib_save_LIBS+fi+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_LLVMCore_LLVMModuleCreateWithName" >&5+$as_echo "$ac_cv_lib_LLVMCore_LLVMModuleCreateWithName" >&6; }+if test "x$ac_cv_lib_LLVMCore_LLVMModuleCreateWithName" = xyes; then :+ cat >>confdefs.h <<_ACEOF+#define HAVE_LIBLLVMCORE 1+_ACEOF++ LIBS="-lLLVMCore $LIBS"++fi++if test "$ac_cv_lib_LLVMCore_LLVMModuleCreateWithName" = "no"; then+ unset ac_cv_lib_LLVMCore_LLVMModuleCreateWithName+ LIBS="-lLLVMSupport $save_LIBS"+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for LLVMModuleCreateWithName in -lLLVMCore" >&5+$as_echo_n "checking for LLVMModuleCreateWithName in -lLLVMCore... " >&6; }+if ${ac_cv_lib_LLVMCore_LLVMModuleCreateWithName+:} false; then :+ $as_echo_n "(cached) " >&6+else+ ac_check_lib_save_LIBS=$LIBS+LIBS="-lLLVMCore $LIBS"+cat confdefs.h - <<_ACEOF >conftest.$ac_ext+/* end confdefs.h. */++/* Override any GCC internal prototype to avoid an error.+ Use char because int might match the return type of a GCC+ builtin and then its argument prototype would still apply. */+#ifdef __cplusplus+extern "C"+#endif+char LLVMModuleCreateWithName ();+int+main ()+{+return LLVMModuleCreateWithName ();+ ;+ return 0;+}+_ACEOF+if ac_fn_cxx_try_link "$LINENO"; then :+ ac_cv_lib_LLVMCore_LLVMModuleCreateWithName=yes+else+ ac_cv_lib_LLVMCore_LLVMModuleCreateWithName=no+fi+rm -f core conftest.err conftest.$ac_objext \+ conftest$ac_exeext conftest.$ac_ext+LIBS=$ac_check_lib_save_LIBS+fi+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_LLVMCore_LLVMModuleCreateWithName" >&5+$as_echo "$ac_cv_lib_LLVMCore_LLVMModuleCreateWithName" >&6; }+if test "x$ac_cv_lib_LLVMCore_LLVMModuleCreateWithName" = xyes; then :+ cat >>confdefs.h <<_ACEOF+#define HAVE_LIBLLVMCORE 1+_ACEOF++ LIBS="-lLLVMCore $LIBS"++else+ as_fn_error $? "could not find LLVM C bindings" "$LINENO" 5+fi++fi++llvm_num_version="`echo $llvm_version | tr . 0`"++cat >>confdefs.h <<_ACEOF+#define HS_LLVM_VERSION $llvm_num_version+_ACEOF++++++++++++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_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5+$as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;;+ esac+ case $ac_var in #(+ _ | IFS | as_nl) ;; #(+ BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #(+ *) { eval $ac_var=; unset $ac_var;} ;;+ esac ;;+ esac+ done++ (set) 2>&1 |+ case $as_nl`(ac_space=' '; set) 2>&1` in #(+ *${as_nl}ac_space=\ *)+ # `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+ if test "x$cache_file" != "x/dev/null"; then+ { $as_echo "$as_me:${as_lineno-$LINENO}: updating cache $cache_file" >&5+$as_echo "$as_me: updating cache $cache_file" >&6;}+ if test ! -f "$cache_file" || test -h "$cache_file"; then+ cat confcache >"$cache_file"+ else+ case $cache_file in #(+ */* | ?:*)+ mv -f confcache "$cache_file"$$ &&+ mv -f "$cache_file"$$ "$cache_file" ;; #(+ *)+ mv -f confcache "$cache_file" ;;+ esac+ fi+ fi+ else+ { $as_echo "$as_me:${as_lineno-$LINENO}: not updating unwritable cache $cache_file" >&5+$as_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}'++DEFS=-DHAVE_CONFIG_H++ac_libobjs=+ac_ltlibobjs=+U=+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=`$as_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.+ as_fn_append ac_libobjs " \${LIBOBJDIR}$ac_i\$U.$ac_objext"+ as_fn_append ac_ltlibobjs " \${LIBOBJDIR}$ac_i"'$U.lo'+done+LIBOBJS=$ac_libobjs++LTLIBOBJS=$ac_ltlibobjs++++: "${CONFIG_STATUS=./config.status}"+ac_write_fail=0+ac_clean_files_save=$ac_clean_files+ac_clean_files="$ac_clean_files $CONFIG_STATUS"+{ $as_echo "$as_me:${as_lineno-$LINENO}: creating $CONFIG_STATUS" >&5+$as_echo "$as_me: creating $CONFIG_STATUS" >&6;}+as_write_fail=0+cat >$CONFIG_STATUS <<_ASEOF || as_write_fail=1+#! $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}+export SHELL+_ASEOF+cat >>$CONFIG_STATUS <<\_ASEOF || as_write_fail=1+## -------------------- ##+## 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=:+ # Pre-4.2 versions of Zsh do 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_nl='+'+export as_nl+# Printing a long string crashes Solaris 7 /usr/bin/printf.+as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'+as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo+as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo+# Prefer a ksh shell builtin over an external printf program on Solaris,+# but without wasting forks for bash or zsh.+if test -z "$BASH_VERSION$ZSH_VERSION" \+ && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then+ as_echo='print -r --'+ as_echo_n='print -rn --'+elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then+ as_echo='printf %s\n'+ as_echo_n='printf %s'+else+ if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then+ as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"'+ as_echo_n='/usr/ucb/echo -n'+ else+ as_echo_body='eval expr "X$1" : "X\\(.*\\)"'+ as_echo_n_body='eval+ arg=$1;+ case $arg in #(+ *"$as_nl"*)+ expr "X$arg" : "X\\(.*\\)$as_nl";+ arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;;+ esac;+ expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl"+ '+ export as_echo_n_body+ as_echo_n='sh -c $as_echo_n_body as_echo'+ fi+ export as_echo_body+ as_echo='sh -c $as_echo_body as_echo'+fi++# The user is always right.+if test "${PATH_SEPARATOR+set}" != set; then+ PATH_SEPARATOR=:+ (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && {+ (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 ||+ PATH_SEPARATOR=';'+ }+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.)+IFS=" "" $as_nl"++# Find who we are. Look in the path if we contain no directory separator.+as_myself=+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+ $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2+ exit 1+fi++# Unset variables that we do not need and which cause bugs (e.g. in+# pre-3.0 UWIN ksh). But do not cause bugs in bash 2.01; the "|| exit 1"+# suppresses any "Segmentation fault" message there. '((' could+# trigger a bug in pdksh 5.2.14.+for as_var in BASH_ENV ENV MAIL MAILPATH+do eval test x\${$as_var+set} = xset \+ && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || :+done+PS1='$ '+PS2='> '+PS4='+ '++# NLS nuisances.+LC_ALL=C+export LC_ALL+LANGUAGE=C+export LANGUAGE++# CDPATH.+(unset CDPATH) >/dev/null 2>&1 && unset CDPATH+++# as_fn_error STATUS ERROR [LINENO LOG_FD]+# ----------------------------------------+# Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are+# provided, also output the error to LOG_FD, referencing LINENO. Then exit the+# script with STATUS, using 1 if that was 0.+as_fn_error ()+{+ as_status=$1; test $as_status -eq 0 && as_status=1+ if test "$4"; then+ as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack+ $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4+ fi+ $as_echo "$as_me: error: $2" >&2+ as_fn_exit $as_status+} # as_fn_error+++# as_fn_set_status STATUS+# -----------------------+# Set $? to STATUS, without forking.+as_fn_set_status ()+{+ return $1+} # as_fn_set_status++# as_fn_exit STATUS+# -----------------+# Exit the shell with STATUS, even in a "trap 0" or "set -e" context.+as_fn_exit ()+{+ set +e+ as_fn_set_status $1+ exit $1+} # as_fn_exit++# as_fn_unset VAR+# ---------------+# Portably unset VAR.+as_fn_unset ()+{+ { eval $1=; unset $1;}+}+as_unset=as_fn_unset+# as_fn_append VAR VALUE+# ----------------------+# Append the text in VALUE to the end of the definition contained in VAR. Take+# advantage of any shell optimizations that allow amortized linear growth over+# repeated appends, instead of the typical quadratic growth present in naive+# implementations.+if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then :+ eval 'as_fn_append ()+ {+ eval $1+=\$2+ }'+else+ as_fn_append ()+ {+ eval $1=\$$1\$2+ }+fi # as_fn_append++# as_fn_arith ARG...+# ------------------+# Perform arithmetic evaluation on the ARGs, and store the result in the+# global $as_val. Take advantage of shells that can avoid forks. The arguments+# must be portable across $(()) and expr.+if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then :+ eval 'as_fn_arith ()+ {+ as_val=$(( $* ))+ }'+else+ as_fn_arith ()+ {+ as_val=`expr "$@" || test $? -eq 1`+ }+fi # as_fn_arith+++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++if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then+ as_dirname=dirname+else+ as_dirname=false+fi++as_me=`$as_basename -- "$0" ||+$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \+ X"$0" : 'X\(//\)$' \| \+ X"$0" : 'X\(/\)' \| . 2>/dev/null ||+$as_echo X/"$0" |+ sed '/^.*\/\([^/][^/]*\)\/*$/{+ s//\1/+ q+ }+ /^X\/\(\/\/\)$/{+ s//\1/+ q+ }+ /^X\/\(\/\).*/{+ s//\1/+ q+ }+ s/.*/./; q'`++# 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++ECHO_C= ECHO_N= ECHO_T=+case `echo -n x` in #(((((+-n*)+ case `echo 'xy\c'` in+ *c*) ECHO_T=' ';; # ECHO_T is single tab character.+ xy) ECHO_C='\c';;+ *) echo `echo ksh88 bug on AIX 6.1` > /dev/null+ ECHO_T=' ';;+ esac;;+*)+ ECHO_N='-n';;+esac++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 2>/dev/null+fi+if (echo >conf$$.file) 2>/dev/null; then+ 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+else+ as_ln_s='cp -p'+fi+rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file+rmdir conf$$.dir 2>/dev/null+++# as_fn_mkdir_p+# -------------+# Create "$as_dir" as a directory, including parents if necessary.+as_fn_mkdir_p ()+{++ case $as_dir in #(+ -*) as_dir=./$as_dir;;+ esac+ test -d "$as_dir" || eval $as_mkdir_p || {+ as_dirs=+ while :; do+ case $as_dir in #(+ *\'*) as_qdir=`$as_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 ||+$as_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" || as_fn_error $? "cannot create directory $as_dir"+++} # as_fn_mkdir_p+if mkdir -p . 2>/dev/null; then+ as_mkdir_p='mkdir -p "$as_dir"'+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+## ----------------------------------- ##+## Main body of $CONFIG_STATUS script. ##+## ----------------------------------- ##+_ASEOF+test $as_write_fail = 0 && chmod +x $CONFIG_STATUS || ac_write_fail=1++cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=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 FFI bindings $as_me 3.0.0.0, which was+generated by GNU Autoconf 2.68. 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++case $ac_config_files in *"+"*) set x $ac_config_files; shift; ac_config_files=$*;;+esac++case $ac_config_headers in *"+"*) set x $ac_config_headers; shift; ac_config_headers=$*;;+esac+++cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1+# Files that config.status was made for.+config_files="$ac_config_files"+config_headers="$ac_config_headers"++_ACEOF++cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1+ac_cs_usage="\+\`$as_me' instantiates files and other configuration actions+from templates according to the current configuration. Unless the files+and actions are specified as TAGs, all are instantiated by default.++Usage: $0 [OPTION]... [TAG]...++ -h, --help print this help, then exit+ -V, --version print version number and configuration settings, then exit+ --config print configuration, then exit+ -q, --quiet, --silent+ 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+ --header=FILE[:TEMPLATE]+ instantiate the configuration header FILE++Configuration files:+$config_files++Configuration headers:+$config_headers++Report bugs to <bos@serpentine.com>."++_ACEOF+cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1+ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"+ac_cs_version="\\+Haskell LLVM FFI bindings config.status 3.0.0.0+configured by $0, generated by GNU Autoconf 2.68,+ with options \\"\$ac_cs_config\\"++Copyright (C) 2010 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'+test -n "\$AWK" || AWK=awk+_ACEOF++cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1+# The default lists apply if the user does not specify any file.+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=`expr "X$1" : 'X\([^=]*\)='`+ ac_optarg=+ 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 )+ $as_echo "$ac_cs_version"; exit ;;+ --config | --confi | --conf | --con | --co | --c )+ $as_echo "$ac_cs_config"; exit ;;+ --debug | --debu | --deb | --de | --d | -d )+ debug=: ;;+ --file | --fil | --fi | --f )+ $ac_shift+ case $ac_optarg in+ *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;;+ '') as_fn_error $? "missing file argument" ;;+ esac+ as_fn_append CONFIG_FILES " '$ac_optarg'"+ ac_need_defaults=false;;+ --header | --heade | --head | --hea )+ $ac_shift+ case $ac_optarg in+ *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;;+ esac+ as_fn_append CONFIG_HEADERS " '$ac_optarg'"+ ac_need_defaults=false;;+ --he | --h)+ # Conflict between --help and --header+ as_fn_error $? "ambiguous option: \`$1'+Try \`$0 --help' for more information.";;+ --help | --hel | -h )+ $as_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.+ -*) as_fn_error $? "unrecognized option: \`$1'+Try \`$0 --help' for more information." ;;++ *) as_fn_append 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 || ac_write_fail=1+if \$ac_cs_recheck; then+ set X '$SHELL' '$0' $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion+ shift+ \$as_echo "running CONFIG_SHELL=$SHELL \$*" >&6+ CONFIG_SHELL='$SHELL'+ export CONFIG_SHELL+ exec "\$@"+fi++_ACEOF+cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1+exec 5>>config.log+{+ echo+ sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX+## Running $as_me. ##+_ASBOX+ $as_echo "$ac_log"+} >&5++_ACEOF+cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1+_ACEOF++cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1++# Handling of arguments.+for ac_config_target in $ac_config_targets+do+ case $ac_config_target in+ "llvm-base.buildinfo") CONFIG_FILES="$CONFIG_FILES llvm-base.buildinfo" ;;+ "include/hs_llvm_config.h") CONFIG_HEADERS="$CONFIG_HEADERS include/hs_llvm_config.h" ;;++ *) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5;;+ 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+ test "${CONFIG_HEADERS+set}" = set || CONFIG_HEADERS=$config_headers+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= ac_tmp=+ trap 'exit_status=$?+ : "${ac_tmp:=$tmp}"+ { test ! -d "$ac_tmp" || rm -fr "$ac_tmp"; } && exit $exit_status+' 0+ trap 'as_fn_exit 1' 1 2 13 15+}+# Create a (secure) tmp directory for tmp files.++{+ tmp=`(umask 077 && mktemp -d "./confXXXXXX") 2>/dev/null` &&+ test -d "$tmp"+} ||+{+ tmp=./conf$$-$RANDOM+ (umask 077 && mkdir "$tmp")+} || as_fn_error $? "cannot create a temporary directory in ." "$LINENO" 5+ac_tmp=$tmp++# Set up the scripts for CONFIG_FILES section.+# No need to generate them if there are no CONFIG_FILES.+# This happens for instance with `./config.status config.h'.+if test -n "$CONFIG_FILES"; then+++ac_cr=`echo X | tr X '\015'`+# On cygwin, bash can eat \r inside `` if the user requested igncr.+# But we know of no other shell where ac_cr would be empty at this+# point, so we can use a bashism as a fallback.+if test "x$ac_cr" = x; then+ eval ac_cr=\$\'\\r\'+fi+ac_cs_awk_cr=`$AWK 'BEGIN { print "a\rb" }' </dev/null 2>/dev/null`+if test "$ac_cs_awk_cr" = "a${ac_cr}b"; then+ ac_cs_awk_cr='\\r'+else+ ac_cs_awk_cr=$ac_cr+fi++echo 'BEGIN {' >"$ac_tmp/subs1.awk" &&+_ACEOF+++{+ echo "cat >conf$$subs.awk <<_ACEOF" &&+ echo "$ac_subst_vars" | sed 's/.*/&!$&$ac_delim/' &&+ echo "_ACEOF"+} >conf$$subs.sh ||+ as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5+ac_delim_num=`echo "$ac_subst_vars" | grep -c '^'`+ac_delim='%!_!# '+for ac_last_try in false false false false false :; do+ . ./conf$$subs.sh ||+ as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5++ ac_delim_n=`sed -n "s/.*$ac_delim\$/X/p" conf$$subs.awk | grep -c X`+ if test $ac_delim_n = $ac_delim_num; then+ break+ elif $ac_last_try; then+ as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5+ else+ ac_delim="$ac_delim!$ac_delim _$ac_delim!! "+ fi+done+rm -f conf$$subs.sh++cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1+cat >>"\$ac_tmp/subs1.awk" <<\\_ACAWK &&+_ACEOF+sed -n '+h+s/^/S["/; s/!.*/"]=/+p+g+s/^[^!]*!//+:repl+t repl+s/'"$ac_delim"'$//+t delim+:nl+h+s/\(.\{148\}\)..*/\1/+t more1+s/["\\]/\\&/g; s/^/"/; s/$/\\n"\\/+p+n+b repl+:more1+s/["\\]/\\&/g; s/^/"/; s/$/"\\/+p+g+s/.\{148\}//+t nl+:delim+h+s/\(.\{148\}\)..*/\1/+t more2+s/["\\]/\\&/g; s/^/"/; s/$/"/+p+b+:more2+s/["\\]/\\&/g; s/^/"/; s/$/"\\/+p+g+s/.\{148\}//+t delim+' <conf$$subs.awk | sed '+/^[^""]/{+ N+ s/\n//+}+' >>$CONFIG_STATUS || ac_write_fail=1+rm -f conf$$subs.awk+cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1+_ACAWK+cat >>"\$ac_tmp/subs1.awk" <<_ACAWK &&+ for (key in S) S_is_set[key] = 1+ FS = ""++}+{+ line = $ 0+ nfields = split(line, field, "@")+ substed = 0+ len = length(field[1])+ for (i = 2; i < nfields; i++) {+ key = field[i]+ keylen = length(key)+ if (S_is_set[key]) {+ value = S[key]+ line = substr(line, 1, len) "" value "" substr(line, len + keylen + 3)+ len += length(value) + length(field[++i])+ substed = 1+ } else+ len += 1 + keylen+ }++ print line+}++_ACAWK+_ACEOF+cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1+if sed "s/$ac_cr//" < /dev/null > /dev/null 2>&1; then+ sed "s/$ac_cr\$//; s/$ac_cr/$ac_cs_awk_cr/g"+else+ cat+fi < "$ac_tmp/subs1.awk" > "$ac_tmp/subs.awk" \+ || as_fn_error $? "could not setup config files machinery" "$LINENO" 5+_ACEOF++# VPATH may cause trouble with some makes, so we remove sole $(srcdir),+# ${srcdir} and @srcdir@ entries 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[ ]*=[ ]*/{+h+s///+s/^/:/+s/[ ]*$/:/+s/:\$(srcdir):/:/g+s/:\${srcdir}:/:/g+s/:@srcdir@:/:/g+s/^:*//+s/:*$//+x+s/\(=[ ]*\).*/\1/+G+s/\n//+s/^[^=]*=[ ]*$//+}'+fi++cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1+fi # test -n "$CONFIG_FILES"++# Set up the scripts for CONFIG_HEADERS section.+# No need to generate them if there are no CONFIG_HEADERS.+# This happens for instance with `./config.status Makefile'.+if test -n "$CONFIG_HEADERS"; then+cat >"$ac_tmp/defines.awk" <<\_ACAWK ||+BEGIN {+_ACEOF++# Transform confdefs.h into an awk script `defines.awk', embedded as+# here-document in config.status, that substitutes the proper values into+# config.h.in to produce config.h.++# Create a delimiter string that does not exist in confdefs.h, to ease+# handling of long lines.+ac_delim='%!_!# '+for ac_last_try in false false :; do+ ac_tt=`sed -n "/$ac_delim/p" confdefs.h`+ if test -z "$ac_tt"; then+ break+ elif $ac_last_try; then+ as_fn_error $? "could not make $CONFIG_HEADERS" "$LINENO" 5+ else+ ac_delim="$ac_delim!$ac_delim _$ac_delim!! "+ fi+done++# For the awk script, D is an array of macro values keyed by name,+# likewise P contains macro parameters if any. Preserve backslash+# newline sequences.++ac_word_re=[_$as_cr_Letters][_$as_cr_alnum]*+sed -n '+s/.\{148\}/&'"$ac_delim"'/g+t rset+:rset+s/^[ ]*#[ ]*define[ ][ ]*/ /+t def+d+:def+s/\\$//+t bsnl+s/["\\]/\\&/g+s/^ \('"$ac_word_re"'\)\(([^()]*)\)[ ]*\(.*\)/P["\1"]="\2"\+D["\1"]=" \3"/p+s/^ \('"$ac_word_re"'\)[ ]*\(.*\)/D["\1"]=" \2"/p+d+:bsnl+s/["\\]/\\&/g+s/^ \('"$ac_word_re"'\)\(([^()]*)\)[ ]*\(.*\)/P["\1"]="\2"\+D["\1"]=" \3\\\\\\n"\\/p+t cont+s/^ \('"$ac_word_re"'\)[ ]*\(.*\)/D["\1"]=" \2\\\\\\n"\\/p+t cont+d+:cont+n+s/.\{148\}/&'"$ac_delim"'/g+t clear+:clear+s/\\$//+t bsnlc+s/["\\]/\\&/g; s/^/"/; s/$/"/p+d+:bsnlc+s/["\\]/\\&/g; s/^/"/; s/$/\\\\\\n"\\/p+b cont+' <confdefs.h | sed '+s/'"$ac_delim"'/"\\\+"/g' >>$CONFIG_STATUS || ac_write_fail=1++cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1+ for (key in D) D_is_set[key] = 1+ FS = ""+}+/^[\t ]*#[\t ]*(define|undef)[\t ]+$ac_word_re([\t (]|\$)/ {+ line = \$ 0+ split(line, arg, " ")+ if (arg[1] == "#") {+ defundef = arg[2]+ mac1 = arg[3]+ } else {+ defundef = substr(arg[1], 2)+ mac1 = arg[2]+ }+ split(mac1, mac2, "(") #)+ macro = mac2[1]+ prefix = substr(line, 1, index(line, defundef) - 1)+ if (D_is_set[macro]) {+ # Preserve the white space surrounding the "#".+ print prefix "define", macro P[macro] D[macro]+ next+ } else {+ # Replace #undef with comments. This is necessary, for example,+ # in the case of _POSIX_SOURCE, which is predefined and required+ # on some systems where configure will not decide to define it.+ if (defundef == "undef") {+ print "/*", prefix defundef, macro, "*/"+ next+ }+ }+}+{ print }+_ACAWK+_ACEOF+cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1+ as_fn_error $? "could not setup config headers machinery" "$LINENO" 5+fi # test -n "$CONFIG_HEADERS"+++eval set X " :F $CONFIG_FILES :H $CONFIG_HEADERS "+shift+for ac_tag+do+ case $ac_tag in+ :[FHLC]) ac_mode=$ac_tag; continue;;+ esac+ case $ac_mode$ac_tag in+ :[FHL]*:*);;+ :L* | :C*:*) as_fn_error $? "invalid tag \`$ac_tag'" "$LINENO" 5;;+ :[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="$ac_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 ||+ as_fn_error 1 "cannot find input file: \`$ac_f'" "$LINENO" 5;;+ esac+ case $ac_f in *\'*) ac_f=`$as_echo "$ac_f" | sed "s/'/'\\\\\\\\''/g"`;; esac+ as_fn_append 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 '`+ $as_echo "$*" | sed 's|^[^:]*/||;s|:[^:]*/|, |g'+ `' by configure.'+ if test x"$ac_file" != x-; then+ configure_input="$ac_file. $configure_input"+ { $as_echo "$as_me:${as_lineno-$LINENO}: creating $ac_file" >&5+$as_echo "$as_me: creating $ac_file" >&6;}+ fi+ # Neutralize special characters interpreted by sed in replacement strings.+ case $configure_input in #(+ *\&* | *\|* | *\\* )+ ac_sed_conf_input=`$as_echo "$configure_input" |+ sed 's/[\\\\&|]/\\\\&/g'`;; #(+ *) ac_sed_conf_input=$configure_input;;+ esac++ case $ac_tag in+ *:-:* | *:-) cat >"$ac_tmp/stdin" \+ || as_fn_error $? "could not create $ac_file" "$LINENO" 5 ;;+ 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 ||+$as_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"; as_fn_mkdir_p+ ac_builddir=.++case "$ac_dir" in+.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;;+*)+ ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'`+ # A ".." for each directory in $ac_dir_suffix.+ ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'`+ case $ac_top_builddir_sub in+ "") ac_top_builddir_sub=. ac_top_build_prefix= ;;+ *) ac_top_build_prefix=$ac_top_builddir_sub/ ;;+ esac ;;+esac+ac_abs_top_builddir=$ac_pwd+ac_abs_builddir=$ac_pwd$ac_dir_suffix+# for backward compatibility:+ac_top_builddir=$ac_top_build_prefix++case $srcdir in+ .) # We are building in place.+ ac_srcdir=.+ ac_top_srcdir=$ac_top_builddir_sub+ ac_abs_top_srcdir=$ac_pwd ;;+ [\\/]* | ?:[\\/]* ) # Absolute name.+ ac_srcdir=$srcdir$ac_dir_suffix;+ ac_top_srcdir=$srcdir+ ac_abs_top_srcdir=$srcdir ;;+ *) # Relative name.+ ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix+ ac_top_srcdir=$ac_top_build_prefix$srcdir+ ac_abs_top_srcdir=$ac_pwd/$srcdir ;;+esac+ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix+++ case $ac_mode in+ :F)+ #+ # CONFIG_FILE+ #++_ACEOF++cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1+# 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=+ac_sed_dataroot='+/datarootdir/ {+ p+ q+}+/@datadir@/p+/@docdir@/p+/@infodir@/p+/@localedir@/p+/@mandir@/p'+case `eval "sed -n \"\$ac_sed_dataroot\" $ac_file_inputs"` in+*datarootdir*) ac_datarootdir_seen=yes;;+*@datadir@*|*@docdir@*|*@infodir@*|*@localedir@*|*@mandir@*)+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&5+$as_echo "$as_me: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&2;}+_ACEOF+cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1+ 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 || ac_write_fail=1+ac_sed_extra="$ac_vpsub+$extrasub+_ACEOF+cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1+:t+/@[a-zA-Z_][a-zA-Z_0-9]*@/!b+s|@configure_input@|$ac_sed_conf_input|;t t+s&@top_builddir@&$ac_top_builddir_sub&;t t+s&@top_build_prefix@&$ac_top_build_prefix&;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+"+eval sed \"\$ac_sed_extra\" "$ac_file_inputs" | $AWK -f "$ac_tmp/subs.awk" \+ >$ac_tmp/out || as_fn_error $? "could not create $ac_file" "$LINENO" 5++test -z "$ac_datarootdir_hack$ac_datarootdir_seen" &&+ { ac_out=`sed -n '/\${datarootdir}/p' "$ac_tmp/out"`; test -n "$ac_out"; } &&+ { ac_out=`sed -n '/^[ ]*datarootdir[ ]*:*=/p' \+ "$ac_tmp/out"`; test -z "$ac_out"; } &&+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file contains a reference to the variable \`datarootdir'+which seems to be undefined. Please make sure it is defined" >&5+$as_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 "$ac_tmp/stdin"+ case $ac_file in+ -) cat "$ac_tmp/out" && rm -f "$ac_tmp/out";;+ *) rm -f "$ac_file" && mv "$ac_tmp/out" "$ac_file";;+ esac \+ || as_fn_error $? "could not create $ac_file" "$LINENO" 5+ ;;+ :H)+ #+ # CONFIG_HEADER+ #+ if test x"$ac_file" != x-; then+ {+ $as_echo "/* $configure_input */" \+ && eval '$AWK -f "$ac_tmp/defines.awk"' "$ac_file_inputs"+ } >"$ac_tmp/config.h" \+ || as_fn_error $? "could not create $ac_file" "$LINENO" 5+ if diff "$ac_file" "$ac_tmp/config.h" >/dev/null 2>&1; then+ { $as_echo "$as_me:${as_lineno-$LINENO}: $ac_file is unchanged" >&5+$as_echo "$as_me: $ac_file is unchanged" >&6;}+ else+ rm -f "$ac_file"+ mv "$ac_tmp/config.h" "$ac_file" \+ || as_fn_error $? "could not create $ac_file" "$LINENO" 5+ fi+ else+ $as_echo "/* $configure_input */" \+ && eval '$AWK -f "$ac_tmp/defines.awk"' "$ac_file_inputs" \+ || as_fn_error $? "could not create -" "$LINENO" 5+ fi+ ;;+++ esac++done # for ac_tag+++as_fn_exit 0+_ACEOF+ac_clean_files=$ac_clean_files_save++test $ac_write_fail = 0 ||+ as_fn_error $? "write failure creating $CONFIG_STATUS" "$LINENO" 5+++# 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 || as_fn_exit 1+fi+if test -n "$ac_unrecognized_opts" && test "$enable_option_checking" != no; then+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: unrecognized options: $ac_unrecognized_opts" >&5+$as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2;}+fi+
+ configure.ac view
@@ -0,0 +1,134 @@+AC_INIT([Haskell LLVM FFI bindings], [3.0.0.0], [bos@serpentine.com], [llvm-base])++AC_CONFIG_SRCDIR([LLVM/FFI/Core.hsc])++AC_CONFIG_FILES([llvm-base.buildinfo])++AC_CONFIG_HEADERS([include/hs_llvm_config.h])++AC_PROG_CXX++AC_LANG(C++)++AC_ARG_WITH(compiler,+ [AS_HELP_STRING([--with-compiler],+ [use the given Haskell compiler])],+ compiler="$withval",+ compiler=ghc)dnl++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="$prefix")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_PROGS(llvm_config, [llvm-config],+ [AC_MSG_ERROR(could not find llvm-config in $llvm_bindir)],+ ["$llvm_bindir:$PATH"])+ +dnl * Choose target platform+dnl+dnl We don't use the standard autoconf macros for this, but instead+dnl ask GHC what platform it is for. Why? We need to generate a library+dnl matching the compiler.+dnl NB: This code is from GHC's configure (where the corresponding code for+dnl guessing host and build variables can be found, too)++dnl Guess target platform if necessary.+m4_divert_once([HELP_CANON],+[[+System types:+ --target=TARGET configure for building compilers for TARGET [guessed]]])dnl++if test "$target" = ""+then+ if test "${compiler}" != ""+ then+ target=`${compiler} +RTS --info | grep '^ ,("Target platform"' | sed -e 's/.*, "//' -e 's/")//' | tr -d '\r'`+ echo "Target platform inferred as: $target"+ else+ echo "Can't work out target platform"+ exit 1+ fi+fi++dnl Determine target-specific options+dnl This is important as Snow Leopard (Mac OS X 10.6) defaults to generating+dnl 64-bit code.+case $target in+i386-apple-darwin)+ TARGET_CPPFLAGS="-m32"+ TAGRET_LDFLAGS="-m32"+ ;;+x86_64-apple-darwin)+ TARGET_CPPFLAGS="-m64"+ TAGRET_LDFLAGS="-m64"+ ;;+esac++llvm_version="`$llvm_config --version`"+llvm_cppflags="`$llvm_config --cppflags`"+llvm_includedir="`$llvm_config --includedir`"+llvm_ldflags="`$llvm_config --ldflags`"++llvm_all_libs="`$llvm_config --libs all`"+llvm_target="`$llvm_config --libs engine | sed 's/.*LLVM\(.[[^ ]]*\)CodeGen.*/\1/'`"++dnl We need to separate libraries that need to be linked from other linker options.+llvm_extra_libs=""+llvm_extra_libdirs=""+llvm_extra_ghci_libs=""+llvm_ldoptions=""+for opt in $llvm_all_libs $llvm_ldflags; do+ case $opt in+ -l*) llvm_extra_libs="$llvm_extra_libs `echo $opt | sed 's/^-l//'`";;+ -L*) llvm_extra_libdirs="$llvm_extra_libdirs `echo $opt | sed 's/^-L//'`";;+ */lib*.so|*/lib*.dylib)+ llvm_extra_ghci_libs="$llvm_extra_ghci_libs `echo $opt | sed -e 's,^.*/lib\([^/]*\),\1,' -e 's/\.so$//' -e 's/\.dylib$//'`";;+ *) llvm_ldoptions="$llvm_ldoptions $opt";;+ esac+done++CPPFLAGS="$llvm_cppflags $CPPFLAGS $TARGET_CPPFLAGS"+LDFLAGS="$llvm_ldflags $LDFLAGS $TARGET_LDFLAGS"++AC_CHECK_HEADERS([llvm-c/Core.h], [],+ [AC_MSG_ERROR(could not find LLVM C bindings)])++AC_CHECK_HEADERS([llvm/ADT/StringRef.h])+AC_CHECK_HEADERS([llvm/Support/DynamicLibrary.h], [], [],+[#ifdef HAVE_LLVM_ADT_STRINGREF_H+# include <llvm/ADT/StringRef.h>+#endif])++save_LIBS="$LIBS"+LIBS="-lLLVMSupport -lLLVMSystem -lpthread -ldl $LIBS"++AC_CHECK_LIB(LLVMCore, LLVMModuleCreateWithName, [], [])+if test "$ac_cv_lib_LLVMCore_LLVMModuleCreateWithName" = "no"; then+ unset ac_cv_lib_LLVMCore_LLVMModuleCreateWithName+ LIBS="-lLLVMSupport $save_LIBS"+ AC_CHECK_LIB(LLVMCore, LLVMModuleCreateWithName, [],+ [AC_MSG_ERROR(could not find LLVM C bindings)])+fi++llvm_num_version="`echo $llvm_version | tr . 0`"+AC_DEFINE_UNQUOTED([HS_LLVM_VERSION], [$llvm_num_version],+ [Define to the version of LLVM, e.g. 209 for 2.9.])++AC_SUBST([llvm_version])+AC_SUBST([llvm_cppflags])+AC_SUBST([llvm_extra_libs])+AC_SUBST([llvm_extra_libdirs])+AC_SUBST([llvm_extra_ghci_libs])+AC_SUBST([llvm_target])+AC_SUBST([llvm_includedir])+AC_SUBST([llvm_ldoptions])++AC_OUTPUT
+ include/extra.h view
@@ -0,0 +1,248 @@+/*+ * Copyright (c) 2008-10, Mahadevan R All rights reserved.+ *+ * Redistribution and use in source and binary forms, with or without+ * modification, are permitted provided that the following conditions are met:+ *+ * * Redistributions of source code must retain the above copyright notice,+ * this list of conditions and the following disclaimer.+ *+ * * Redistributions in binary form must reproduce the above copyright notice,+ * this list of conditions and the following disclaimer in the documentation+ * and/or other materials provided with the distribution.+ *+ * * Neither the name of this software, nor the names of its + * contributors may be used to endorse or promote products derived from+ * this software without specific prior written permission.+ *+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.+ */++/**+ * These are some "extra" functions not available in the standard LLVM-C+ * bindings, but are required / good-to-have inorder to implement the+ * Python bindings.+ */++#ifndef LLVM_PY_EXTRA_H+#define LLVM_PY_EXTRA_H++#ifdef __cplusplus+extern "C" {+#endif++/* Notes:+ * - Some returned strings must be disposed of by LLVMDisposeMessage. These are+ * indicated in the comments. Where it is not indicated, DO NOT call dispose.+ */++/* Wraps llvm::Module::print(). Dispose the returned string after use, via+ * LLVMDisposeMessage(). */+char *LLVMDumpModuleToString(LLVMModuleRef module);++/* Wraps llvm::Type::print(). Dispose the returned string after use, via+ * LLVMDisposeMessage(). */+char *LLVMDumpTypeToString(LLVMTypeRef type);++/* Wraps llvm::Value::print(). Dispose the returned string after use, via+ * LLVMDisposeMessage(). */+char *LLVMDumpValueToString(LLVMValueRef Val);++/* Wraps llvm::IRBuilder::CreateRet(). */+LLVMValueRef LLVMBuildRetMultiple(LLVMBuilderRef bulder, LLVMValueRef *values,+ unsigned n_values);++/* Wraps llvm::IRBuilder::CreateGetResult(). */+LLVMValueRef LLVMBuildGetResult(LLVMBuilderRef builder, LLVMValueRef value,+ unsigned index, const char *name);++/* Wraps llvm::Value::getValueID(). */+unsigned LLVMValueGetID(LLVMValueRef value);++/* Wraps llvm::Value::getNumUses(). */+unsigned LLVMValueGetNumUses(LLVMValueRef value);++/* Wraps llvm::Value::use_{begin,end}. Allocates LLVMValueRef's as+ * required. Number of objects are returned as return value. If that is+ * greater than zero, the pointer given out must be freed by a+ * subsequent call to LLVMDisposeValueRefArray(). */+unsigned LLVMValueGetUses(LLVMValueRef value, LLVMValueRef **refs);++/* Wraps llvm::Value::isUsedInBasicBlock(). */+unsigned LLVMValueIsUsedInBasicBlock(LLVMValueRef value, LLVMBasicBlockRef bb);+/* See above. */+void LLVMDisposeValueRefArray(LLVMValueRef *refs);++/* Wraps llvm:User::getNumOperands(). */+unsigned LLVMUserGetNumOperands(LLVMValueRef user);++/* Wraps llvm:User::getOperand(). */+LLVMValueRef LLVMUserGetOperand(LLVMValueRef user, unsigned idx);++/* Wraps llvm::ConstantExpr::getVICmp(). */+LLVMValueRef LLVMConstVICmp(LLVMIntPredicate predicate, LLVMValueRef lhs,+ LLVMValueRef rhs);++/* Wraps llvm::ConstantExpr::getVFCmp(). */+LLVMValueRef LLVMConstVFCmp(LLVMRealPredicate predicate, LLVMValueRef lhs,+ LLVMValueRef rhs);++/* Wraps llvm::IRBuilder::CreateVICmp(). */ +LLVMValueRef LLVMBuildVICmp(LLVMBuilderRef builder, LLVMIntPredicate predicate,+ LLVMValueRef lhs, LLVMValueRef rhs, const char *name);++/* Wraps llvm::IRBuilder::CreateVFCmp(). */ +LLVMValueRef LLVMBuildVFCmp(LLVMBuilderRef builder, LLVMRealPredicate predicate,+ LLVMValueRef lhs, LLVMValueRef rhs, const char *name);+ +/* Wraps llvm::Intrinsic::getDeclaration(). */+LLVMValueRef LLVMGetIntrinsic(LLVMModuleRef builder, int id,+ LLVMTypeRef *types, unsigned n_types);++/* Wraps llvm::Function::doesNotThrow(). */+unsigned LLVMGetDoesNotThrow(LLVMValueRef fn);++/* Wraps llvm::Function::setDoesNotThrow(). */+void LLVMSetDoesNotThrow(LLVMValueRef fn, int DoesNotThrow);++/* Wraps llvm::Module::getPointerSize(). */+unsigned LLVMModuleGetPointerSize(LLVMModuleRef module);++/* Wraps llvm::Module::getOrInsertFunction(). */+LLVMValueRef LLVMModuleGetOrInsertFunction(LLVMModuleRef module, + const char *name, LLVMTypeRef function_type);++/* Wraps llvm::GlobalVariable::hasInitializer(). */ +int LLVMHasInitializer(LLVMValueRef global_var);+ +/* The following functions wrap various llvm::Instruction::isXXX() functions.+ * All of them take an instruction and return 0 (isXXX returned false) or 1+ * (isXXX returned false). */+unsigned LLVMInstIsTerminator (LLVMValueRef inst);+unsigned LLVMInstIsBinaryOp (LLVMValueRef inst);+unsigned LLVMInstIsShift (LLVMValueRef inst);+unsigned LLVMInstIsCast (LLVMValueRef inst);+unsigned LLVMInstIsLogicalShift (LLVMValueRef inst);+unsigned LLVMInstIsArithmeticShift (LLVMValueRef inst);+unsigned LLVMInstIsAssociative (LLVMValueRef inst);+unsigned LLVMInstIsCommutative (LLVMValueRef inst);+unsigned LLVMInstIsTrapping (LLVMValueRef inst);++/* As above, but these are wrap methods from subclasses of Instruction. */+unsigned LLVMInstIsVolatile (LLVMValueRef inst);++/* Wraps llvm::Instruction::getOpcodeName(). */+const char *LLVMInstGetOpcodeName(LLVMValueRef inst);++/* Wraps llvm::Instruction::getOpcode(). */+unsigned LLVMInstGetOpcode(LLVMValueRef inst);++/* Wraps llvm::CmpInst::getPredicate(). */+unsigned LLVMCmpInstGetPredicate(LLVMValueRef cmpinst);++/* Wraps llvm::ParseAssemblyString(). Returns a module reference or NULL (with+ * `out' pointing to an error message). Dispose error message after use, via+ * LLVMDisposeMessage(). */+LLVMModuleRef LLVMGetModuleFromAssembly(const char *asmtxt, unsigned txten,+ char **out);++/* Wraps llvm::ParseBitcodeFile(). Returns a module reference or NULL (with+ * `out' pointing to an error message). Dispose error message after use, via+ * LLVMDisposeMessage(). */+LLVMModuleRef LLVMGetModuleFromBitcode(const char *bc, unsigned bclen,+ char **out);++/* Wraps llvm::Linker::LinkModules(). Returns 0 on failure (with errmsg+ * filled in) and 1 on success. Dispose error message after use with+ * LLVMDisposeMessage(). */+unsigned LLVMLinkModules(LLVMModuleRef dest, LLVMModuleRef src,+ unsigned mode, char **errmsg);++/* Returns pointer to a heap-allocated block of `*len' bytes containing bit code+ * for the given module. NULL on error. */+unsigned char *LLVMGetBitcodeFromModule(LLVMModuleRef module, unsigned *len);++/* Wraps llvm::sys::DynamicLibrary::LoadLibraryPermanently(). Returns 0 on+ * failure (with errmsg filled in) and 1 on success. Dispose error message after+ * use, via LLVMDisposeMessage(). */+unsigned LLVMLoadLibraryPermanently(const char* filename, char **errmsg);++/* Wraps llvm::ExecutionEngine::getPointerToFunction(). Returns a pointer + * to the JITted function. */+void *LLVMGetPointerToFunction(LLVMExecutionEngineRef ee, LLVMValueRef fn);++/* Wraps llvm::InlineFunction(). Inlines a function. C is the call + * instruction, created by LLVMBuildCall. Even if it fails, the Function + * containing the call is still in a proper state (not changed). */+int LLVMInlineFunction(LLVMValueRef call);++/* Passes. Some passes are used directly from LLVM-C, rest are declared+ * here. */++#define declare_pass(P) \+ void LLVMAdd ## P ## Pass (LLVMPassManagerRef PM);++declare_pass( AAEval )+declare_pass( AliasAnalysisCounter )+declare_pass( AlwaysInliner )+declare_pass( BasicAliasAnalysis )+declare_pass( BlockPlacement )+declare_pass( BreakCriticalEdges )+declare_pass( CodeGenPrepare )+declare_pass( DbgInfoPrinter )+declare_pass( DeadCodeElimination )+declare_pass( DeadInstElimination )+declare_pass( DemoteRegisterToMemory )+declare_pass( DomOnlyPrinter )+declare_pass( DomOnlyViewer )+declare_pass( DomPrinter )+declare_pass( DomViewer )+declare_pass( EdgeProfiler )+declare_pass( GlobalsModRef )+declare_pass( InstCount )+declare_pass( InstructionNamer )+declare_pass( LazyValueInfo )+declare_pass( LCSSA )+declare_pass( LoopDependenceAnalysis )+declare_pass( LoopExtractor )+declare_pass( LoopSimplify )+declare_pass( LoopStrengthReduce )+declare_pass( LowerInvoke )+declare_pass( LowerSwitch )+declare_pass( MergeFunctions )+declare_pass( NoAA )+declare_pass( NoProfileInfo )+declare_pass( OptimalEdgeProfiler )+declare_pass( PartialInlining )+declare_pass( PostDomOnlyPrinter )+declare_pass( PostDomOnlyViewer )+declare_pass( PostDomPrinter )+declare_pass( PostDomViewer )+declare_pass( ProfileEstimator )+declare_pass( ProfileLoader )+declare_pass( ProfileVerifier )+declare_pass( ScalarEvolutionAliasAnalysis )+declare_pass( SingleLoopExtractor )+declare_pass( StripNonDebugSymbols )+declare_pass( StructRetPromotion )+declare_pass( TailDuplication )+declare_pass( UnifyFunctionExitNodes )++declare_pass( Internalize2 )++#ifdef __cplusplus+} /* extern "C" */+#endif++#endif /* LLVM_PY_EXTRA_H */+
+ include/hs_llvm_config.h.in view
@@ -0,0 +1,64 @@+/* include/hs_llvm_config.h.in. Generated from configure.ac by autoheader. */++/* Define to 1 if you have the <inttypes.h> header file. */+#undef HAVE_INTTYPES_H++/* Define to 1 if you have the `LLVMCore' library (-lLLVMCore). */+#undef HAVE_LIBLLVMCORE++/* Define to 1 if you have the <llvm/ADT/StringRef.h> header file. */+#undef HAVE_LLVM_ADT_STRINGREF_H++/* Define to 1 if you have the <llvm-c/Core.h> header file. */+#undef HAVE_LLVM_C_CORE_H++/* Define to 1 if you have the <llvm/Support/DynamicLibrary.h> header file. */+#undef HAVE_LLVM_SUPPORT_DYNAMICLIBRARY_H++/* Define to 1 if you have the <memory.h> header file. */+#undef HAVE_MEMORY_H++/* Define to 1 if you have the <stdint.h> header file. */+#undef HAVE_STDINT_H++/* Define to 1 if you have the <stdlib.h> header file. */+#undef HAVE_STDLIB_H++/* Define to 1 if you have the <strings.h> header file. */+#undef HAVE_STRINGS_H++/* Define to 1 if you have the <string.h> header file. */+#undef HAVE_STRING_H++/* Define to 1 if you have the <sys/stat.h> header file. */+#undef HAVE_SYS_STAT_H++/* Define to 1 if you have the <sys/types.h> header file. */+#undef HAVE_SYS_TYPES_H++/* Define to 1 if you have the <unistd.h> header file. */+#undef HAVE_UNISTD_H++/* Define to the version of LLVM, e.g. 209 for 2.9. */+#undef HS_LLVM_VERSION++/* Define to the address where bug reports for this package should be sent. */+#undef PACKAGE_BUGREPORT++/* Define to the full name of this package. */+#undef PACKAGE_NAME++/* Define to the full name and version of this package. */+#undef PACKAGE_STRING++/* Define to the one symbol short name of this package. */+#undef PACKAGE_TARNAME++/* Define to the home page for this package. */+#undef PACKAGE_URL++/* Define to the version of this package. */+#undef PACKAGE_VERSION++/* Define to 1 if you have the ANSI C header files. */+#undef STDC_HEADERS
+ include/support.h view
@@ -0,0 +1,24 @@+#ifndef LLVM_HS_SUPPORT_H+#define LLVM_HS_SUPPORT_H++#ifdef __cplusplus+extern "C" {+#endif++void LLVMCreateStandardFunctionPasses(LLVMPassManagerRef PM,+ unsigned OptimizationLevel);++void LLVMCreateStandardModulePasses(LLVMPassManagerRef PM,+ unsigned OptimizationLevel,+ int OptimizeSize,+ int UnitAtATime,+ int UnrollLoops,+ int SimplifyLibCalls,+ int HaveExceptions,+ int DisableInlining);++#ifdef __cplusplus+} /* extern "C" */+#endif++#endif /* LLVM_HS_SUPPORT_H */
+ llvm-base.buildinfo.in view
@@ -0,0 +1,7 @@+cpp-options: @llvm_cppflags@ -DTARGET=@llvm_target@+ghc-options: -pgml @CXX@+extra-libraries: @llvm_extra_libs@ stdc+++extra-lib-dirs: @llvm_extra_libdirs@+x-extra-ghci-libraries: @llvm_extra_ghci_libs@+ld-options: @llvm_ldoptions@+include-dirs: @llvm_includedir@
+ llvm-base.buildinfo.windows.in view
@@ -0,0 +1,4 @@+cpp-options: -D_DEBUG -D_GNU_SOURCE -D__STDC_CONSTANT_MACROS -DTARGET=X86+ghc-options: -I@llvm_path@/include -pgml g+++ld-options: -L@llvm_path@/lib -lLLVMXCoreAsmPrinter -lLLVMXCoreCodeGen -lLLVMXCoreInfo -lLLVMSystemZAsmPrinter -lLLVMSystemZCodeGen -lLLVMSystemZInfo -lLLVMSparcAsmPrinter -lLLVMSparcCodeGen -lLLVMSparcInfo -lLLVMPowerPCAsmPrinter -lLLVMPowerPCCodeGen -lLLVMPowerPCInfo -lLLVMPIC16AsmPrinter -lLLVMPIC16CodeGen -lLLVMPIC16Info -lLLVMMSP430AsmPrinter -lLLVMMSP430CodeGen -lLLVMMSP430Info -lLLVMMSIL -lLLVMMSILInfo -lLLVMMipsAsmPrinter -lLLVMMipsCodeGen -lLLVMMipsInfo -lLLVMLinker -lLLVMipo -lLLVMInterpreter -lLLVMInstrumentation -lLLVMJIT -lLLVMExecutionEngine -lLLVMDebugger -lLLVMCppBackend -lLLVMCppBackendInfo -lLLVMCellSPUAsmPrinter -lLLVMCellSPUCodeGen -lLLVMCellSPUInfo -lLLVMCBackend -lLLVMCBackendInfo -lLLVMBlackfinAsmPrinter -lLLVMBlackfinCodeGen -lLLVMBlackfinInfo -lLLVMBitWriter -lLLVMX86AsmParser -lLLVMX86AsmPrinter -lLLVMX86CodeGen -lLLVMX86Info -lLLVMAsmParser -lLLVMARMAsmPrinter -lLLVMARMCodeGen -lLLVMARMInfo -lLLVMArchive -lLLVMBitReader -lLLVMAlphaAsmPrinter -lLLVMAlphaCodeGen -lLLVMSelectionDAG -lLLVMAsmPrinter -lLLVMCodeGen -lLLVMScalarOpts -lLLVMTransformUtils -lLLVMipa -lLLVMAnalysis -lLLVMTarget -lLLVMMC -lLLVMCore -lLLVMAlphaInfo -lLLVMSupport -lLLVMSystem -lpsapi -limagehlp -lstdc++ -lmingwex+include-dirs: @llvm_path@/include
+ llvm-base.cabal view
@@ -0,0 +1,106 @@+name: llvm-base+version: 3.0.0.0+license: BSD3+license-file: LICENSE+synopsis: FFI bindings to the LLVM compiler toolkit.+description:+ FFI bindings to the LLVM compiler toolkit.+ .+ We try to stay up to date with LLVM releases. The current version+ of this package is compatible with LLVM 3.0 and 2.9. Please+ understand that the package may or may not work against older LLVM+ releases; we don't have the time or resources to test across+ multiple releases.+ .+ * New in 3.0: Builds against LLVM 3.0.+ .+ * New in 0.9.1.1: Builds against LLVM 2.9.+ .+ * New in 0.9.1.0: Util.Memory for memory related intrinsics.+ .+ * New in 0.9.0.0: Adapted to LLVM 2.8 (removed support for Union types).+author: Bryan O'Sullivan, Lennart Augustsson+maintainer: Bryan O'Sullivan <bos@serpentine.com>, Lennart Augustsson <lennart@augustsson.net>+homepage: https://github.com/bos/llvm+bug-reports: https://github.com/bos/llvm/issues+stability: experimental+category: Compilers/Interpreters, Code Generation+tested-with: GHC == 6.12.3, GHC == 7.0.3, GHC == 7.2.2+cabal-version: >= 1.6+build-type: Custom++extra-source-files:+ *.md+ configure.ac+ configure+ include/extra.h+ include/hs_llvm_config.h.in+ include/support.h+ llvm-base.buildinfo.in+ llvm-base.buildinfo.windows.in+ tools/*.hs+ tools/Makefile++extra-tmp-files:+ autom4te.cache+ config.log+ config.status+ configure+ include/hs_llvm_config.h+ llvm-base.buildinfo++flag developer+ description: operate in developer mode+ default: False++library+ build-depends:+ base >= 3 && < 5++ ghc-options: -Wall++ if flag(developer)+ ghc-options: -Werror++ exposed-modules:+ LLVM.FFI.Analysis+ LLVM.FFI.BitReader+ LLVM.FFI.BitWriter+ LLVM.FFI.Core+ LLVM.FFI.ExecutionEngine+ LLVM.FFI.Support+ LLVM.FFI.Target+ LLVM.FFI.Transforms.IPO+ LLVM.FFI.Transforms.Scalar+ LLVM.Target.Native++ other-modules:+ LLVM.Target.ARM+ LLVM.Target.Alpha+ LLVM.Target.Blackfin+ LLVM.Target.CBackend+ LLVM.Target.CellSPU+ LLVM.Target.CppBackend+ LLVM.Target.MSP430+ LLVM.Target.Mips+ LLVM.Target.PIC16+ LLVM.Target.PowerPC+ LLVM.Target.Sparc+ LLVM.Target.SystemZ+ LLVM.Target.X86+ LLVM.Target.XCore++ include-dirs: include+ C-Sources:+ cbits/extra.cpp+ cbits/free.c+ cbits/malloc.c+ cbits/support.cpp++source-repository head+ type: git+ location: git://github.com/bos/llvm.git++source-repository head+ type: mercurial+ location: https://bitbucket.org/bos/llvm/
+ tools/DiffFFI.hs view
@@ -0,0 +1,39 @@+module DiffFFI (main) where++import Control.Monad (forM_)+import Data.List (foldl')+import qualified Data.Map as M+import System.Environment (getArgs)+import System.Exit (exitFailure)+import System.IO (hPutStrLn, stderr)+import Text.Regex.Posix ((=~))++import FunctionMangulation (pattern, rewriteFunction)++cFunctions :: String -> M.Map String String+cFunctions s = foldl' go M.empty (s =~ pattern)+ where go m (_:ret:name:params:_) =+ M.insert ("LLVM" ++ name) (rewriteFunction ret name params) m+ go m _ = m++hsFunctions :: String -> M.Map String String+hsFunctions s = foldl' go M.empty (s =~ pat)+ where pat = "\"([a-zA-Z0-9_]+)\"[ \t\n]+([a-zA-Z0-9_']+)"+ go m (_:cname:hsname:_) = M.insert cname hsname m+ go m _ = m++main :: IO ()+main = do+ args <- getArgs+ case args of+ [cFile, hsFile] -> do+ c <- cFunctions `fmap` readFile cFile+ hs <- hsFunctions `fmap` readFile hsFile+ putStrLn "In C, not Haskell:"+ forM_ (M.toAscList $ M.difference c hs) $ \(_, hsfunc) ->+ putStrLn hsfunc+ putStrLn "In Haskell, not C:"+ forM_ (M.keys $ M.difference hs c) $ putStrLn . (" "++)+ _ -> do+ hPutStrLn stderr "Usage: DiffFFI cFile hsFile"+ exitFailure
+ tools/FunctionMangler.hs view
@@ -0,0 +1,8 @@+module FunctionMangler (main) where++import Data.List (intercalate)++import FunctionMangulation (rewrite)++main :: IO ()+main = interact (intercalate "\n\n" . concat . rewrite) >> putStr "\n"
+ tools/FunctionMangulation.hs view
@@ -0,0 +1,65 @@+module FunctionMangulation+ (+ pattern+ , rewrite+ , rewriteFunction+ ) where++import Control.Monad (forM)+import Data.Char (isSpace, toLower)+import Data.List (intercalate, isPrefixOf, isSuffixOf)+import Text.Regex.Posix ((=~), (=~~))++pattern :: String+pattern = "^([A-Za-z0-9_ ]+ ?\\*?)[ \t\n]*" +++ "LLVM([A-Za-z0-9_]+)\\(([a-zA-Z0-9_*, \t\n]+)\\);"++dropSpace :: String -> String+dropSpace = dropWhile isSpace++renameType :: String -> String+renameType t | "LLVM" `isPrefixOf` t = rename' (drop 4 t)+ | otherwise = rename' t+ where rename' "int" = "CInt"+ rename' "unsigned" = "CUInt"+ rename' "long long" = "CLLong"+ rename' "unsigned long long" = "CULLong"+ rename' "void" = "()"+ rename' "const char *" = "CString"+ rename' "char *" = "CString"+ rename' s | "*" `isSuffixOf` s = pointer s+ | otherwise = strip s+ pointer p = case reverse p of+ ('*':ps) -> "(Ptr " ++ rename' (reverse ps) ++ ")"+ _ -> p++split :: (a -> Bool) -> [a] -> [[a]]+split p xs = case break p xs of+ (h,(_:t)) -> h : split p t+ (s,_) -> [s]++strip :: String -> String+strip = reverse . dropWhile isSpace . reverse . dropSpace++dropName :: String -> String+dropName s =+ case s =~ "^((const )?[A-Za-z0-9_]+( \\*+)?) ?[A-Za-z0-9]*$" of+ ((_:typ:_):_) -> typ+ _ -> "{- oops! -} " ++ s++rewriteFunction :: String -> String -> String -> String+rewriteFunction cret cname cparams =+ let ret = "IO " ++ renameType (strip cret)+ params = map renameParam . split (==',') $ cparams+ params' = if params == ["()"] then [] else params+ name = let (n:ame) = cname in toLower n : ame+ in foreign ++ "\"LLVM" ++ cname ++ "\" " ++ name +++ "\n :: " ++ intercalate " -> " (params' ++ [ret])+ where renameParam = renameType . dropName . strip+ foreign = "foreign import ccall unsafe "+ +rewrite :: Monad m => String -> m [String]+rewrite s = do+ matches <- s =~~ pattern+ forM matches $ \(_:cret:cname:cparams:_) ->+ return (rewriteFunction cret cname cparams)
+ tools/IntrinsicMangler.hs view
@@ -0,0 +1,22 @@+module IntrinsicMangler (main) where++import Control.Monad (forM_)+import qualified Data.ByteString.Char8 as C+import Data.Maybe (catMaybes)+import Text.Regex.Posix ((=~~))++maybeName :: C.ByteString -> Maybe C.ByteString+maybeName line = do+ ((_:name:_):_) <- line =~~ "^[ \t]*([a-z0-9_]+),[ \t]*//[ \t]*llvm\\."+ return name++main :: IO ()+main = do+ input <- (catMaybes . map maybeName . C.lines) `fmap` C.getContents++ putStrLn "-- automatically generated file - do not edit!"+ putStrLn "module LLVM.Core.Intrinsics (Intrinsic(..)) where"+ putStrLn "data Intrinsic ="+ putStrLn " NotIntrinsic"+ forM_ input $ C.putStrLn . (C.append (C.pack " | I_"))+ putStrLn " deriving (Eq, Ord, Enum, Show)"
+ tools/Makefile view
@@ -0,0 +1,11 @@+ghc := ghc+ghcflags := -O -Wall -Werror+tools := DiffFFI FunctionMangler IntrinsicMangler++all: $(tools)++%: %.hs+ $(ghc) $(ghcflags) --make -o $@ -main-is $(basename $<).main $<++clean:+ -rm -f *.o *.hi $(tools) *.exe