diff --git a/LLVM/FFI/Core.hsc b/LLVM/FFI/Core.hsc
--- a/LLVM/FFI/Core.hsc
+++ b/LLVM/FFI/Core.hsc
@@ -1,4 +1,4 @@
-{-# LANGUAGE ForeignFunctionInterface, EmptyDataDecls, DeriveDataTypeable #-}
+{-# LANGUAGE ForeignFunctionInterface, EmptyDataDecls, DeriveDataTypeable, CPP #-}
 
 -- |
 -- Module:      LLVM.FFI.Core
@@ -35,9 +35,10 @@
     -- * Types
     , Type
     , TypeRef
+#if HS_LLVM_VERSION < 300
     , addTypeName
     , deleteTypeName
-
+#endif
     , getTypeKind
     , TypeKind(..)
 
@@ -67,7 +68,9 @@
     -- ** Other types
     , voidType
     , labelType
+#if HS_LLVM_VERSION < 300
     , opaqueType
+#endif
 
     -- ** Array, pointer, and vector types
     , arrayType
@@ -83,13 +86,20 @@
     , countStructElementTypes
     , getStructElementTypes
     , isPackedStruct
+#if HS_LLVM_VERSION >= 300
+    , structCreateNamed
+    , getStructName
+    , structSetBody
+#endif
 
     -- * Type handles
+#if HS_LLVM_VERSION < 300
     , TypeHandleRef
     , createTypeHandle
     , refineType
     , resolveTypeHandle
     , disposeTypeHandle
+#endif
 
     -- * Values
     , Value
@@ -288,9 +298,18 @@
     , buildCondBr
     , buildSwitch
     , buildInvoke
+#if HS_LLVM_VERSION < 300
     , buildUnwind
+#endif
     , buildUnreachable
 
+#if HS_LLVM_VERSION >= 300
+    -- ** Landing pad
+    , buildLandingPad
+    , addClause
+    , setCleanup
+#endif
+
     -- ** Arithmetic
     , buildAdd
     , buildSub
@@ -460,7 +479,9 @@
     , int8TypeInContext
     , intTypeInContext
     , labelTypeInContext
+#if HS_LLVM_VERSION < 300
     , opaqueTypeInContext
+#endif
     , pPCFP128TypeInContext
     , structTypeInContext
     , voidTypeInContext
@@ -638,11 +659,13 @@
     -> CUInt                    -- ^ element count
     -> TypeRef
 
+#if HS_LLVM_VERSION < 300
 foreign import ccall unsafe "LLVMAddTypeName" addTypeName
     :: ModuleRef -> CString -> TypeRef -> IO CInt
 
 foreign import ccall unsafe "LLVMDeleteTypeName" deleteTypeName
     :: ModuleRef -> CString -> IO ()
+#endif
 
 -- | Get the type of a sequential type's elements.
 foreign import ccall unsafe "LLVMGetElementType" getElementType
@@ -1084,11 +1107,24 @@
 foreign import ccall unsafe "LLVMBuildInvoke" buildInvoke
     :: BuilderRef -> ValueRef -> Ptr ValueRef -> CUInt
     -> BasicBlockRef -> BasicBlockRef -> CString -> IO ValueRef
+#if HS_LLVM_VERSION < 300
 foreign import ccall unsafe "LLVMBuildUnwind" buildUnwind
     :: BuilderRef -> IO ValueRef
+#endif
+
 foreign import ccall unsafe "LLVMBuildUnreachable" buildUnreachable
     :: BuilderRef -> IO ValueRef
 
+#if HS_LLVM_VERSION >= 300
+-- New landing pad instructions for LLVM 3.0
+foreign import ccall unsafe "LLVMBuildLandingPad" buildLandingPad
+    :: BuilderRef -> TypeRef -> ValueRef -> CUInt -> CString -> IO ValueRef
+foreign import ccall unsafe "LLVMAddClause" addClause
+    :: ValueRef -> ValueRef -> IO ()
+foreign import ccall unsafe "LLVMSetCleanup" setCleanup
+    :: ValueRef -> CUInt -> IO ()
+#endif
+
 foreign import ccall unsafe "LLVMBuildAdd" buildAdd
     :: BuilderRef -> ValueRef -> ValueRef -> CString -> IO ValueRef
 foreign import ccall unsafe "LLVMBuildSub" buildSub
@@ -1221,9 +1257,11 @@
     deriving (Typeable)
 type MemoryBufferRef = Ptr MemoryBuffer
 
+#if HS_LLVM_VERSION < 300
 data TypeHandle
     deriving (Typeable)
 type TypeHandleRef = Ptr TypeHandle
+#endif
 
 data TypeKind
     = VoidTypeKind
@@ -1249,14 +1287,10 @@
     :: 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
@@ -1269,15 +1303,29 @@
     :: 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
 
+#if HS_LLVM_VERSION < 300
+foreign import ccall unsafe "LLVMCreateTypeHandle" createTypeHandle
+    :: TypeRef -> IO TypeHandleRef
+foreign import ccall unsafe "LLVMDisposeTypeHandle" disposeTypeHandle
+    :: TypeHandleRef -> IO ()
+foreign import ccall unsafe "LLVMRefineType" refineType
+    :: TypeRef -> TypeRef -> IO ()
+foreign import ccall unsafe "LLVMResolveTypeHandle" resolveTypeHandle
+    :: TypeHandleRef -> IO TypeRef
+#else
+foreign import ccall unsafe "LLVMStructCreateNamed" structCreateNamed
+    :: ContextRef -> CString -> IO TypeRef
+foreign import ccall unsafe "LLVMGetStructName" getStructName
+    :: TypeRef -> IO CString
+foreign import ccall unsafe "LLVMStructSetBody" structSetBody
+    :: TypeRef -> Ptr TypeRef -> CUInt -> CUInt -> IO ()
+#endif
+
 data Attribute
     = ZExtAttribute
     | SExtAttribute
@@ -1424,8 +1472,6 @@
     :: 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
@@ -1437,7 +1483,14 @@
 foreign import ccall unsafe "LLVMSetParamAlignment" setParamAlignment
     :: ValueRef -> CUInt -> IO ()
 
+#if HS_LLVM_VERSION < 300
+foreign import ccall unsafe "LLVMOpaqueType" opaqueType
+    :: TypeRef
+foreign import ccall unsafe "LLVMOpaqueTypeInContext" opaqueTypeInContext
+    :: ContextRef -> IO TypeRef
+#endif
 
+
 data Context
     deriving (Typeable)
 type ContextRef = Ptr Context
@@ -1570,8 +1623,6 @@
     :: 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
diff --git a/LLVM/FFI/Target.hsc b/LLVM/FFI/Target.hsc
--- a/LLVM/FFI/Target.hsc
+++ b/LLVM/FFI/Target.hsc
@@ -39,8 +39,9 @@
     :: TargetDataRef -> TypeRef -> CULLong -> CUInt
 foreign import ccall unsafe "LLVMIntPtrType" intPtrType
     :: TargetDataRef -> TypeRef
-foreign import ccall unsafe "LLVMInvalidateStructLayout" invalidateStructLayout
-    :: TargetDataRef -> TypeRef -> IO ()
+-- Removed in LLVM_3.0 ?
+-- 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
diff --git a/LLVM/Target/Native.hs b/LLVM/Target/Native.hs
--- a/LLVM/Target/Native.hs
+++ b/LLVM/Target/Native.hs
@@ -1,18 +1,23 @@
-{-# LANGUAGE CPP #-}
+{-# LANGUAGE CPP, ForeignFunctionInterface #-}
 module LLVM.Target.Native(initializeNativeTarget) where
 import Control.Monad
 import Control.Concurrent.MVar
 import System.IO.Unsafe
 
+import Foreign.C.Types
+
 -- TARGET is expanded by CPP to the native target architecture.
 import LLVM.Target.TARGET
 
+foreign import ccall unsafe "LLVMInitNativeTarget" 
+        llvmInitializeNativeTarget :: IO CUInt
+
 -- | Initialize jitter to the native target.
 -- The operation is idempotent.
 initializeNativeTarget :: IO ()
 initializeNativeTarget = do
     done <- takeMVar refDone
-    when (not done) initializeTarget
+    when (not done) (llvmInitializeNativeTarget >> return ()) -- initializeTarget
     putMVar refDone True
 
 -- UNSAFE: global variable to keep track of initialization state.
diff --git a/Setup.hs b/Setup.hs
--- a/Setup.hs
+++ b/Setup.hs
@@ -5,6 +5,7 @@
 import System.FilePath
 import System.Info
 import Control.Monad
+import Data.Char ( isSpace )
 import Data.List
 import Data.Maybe
 import Distribution.Simple
@@ -90,8 +91,8 @@
                            verbosity pkg lib lbi clbi inplace distPref
 
     let ghciLibraries    = case lookup "x-extra-ghci-libraries" (customFieldsBI (libBuildInfo lib)) of
-                             Nothing -> []
-                             Just s  -> [s]
+                             Just s | not (all isSpace s) -> [s]
+                             _                            -> []
         installedPkgInfo = installedPkgInfoRaw {
                                 extraGHCiLibraries = ghciLibraries }
 
diff --git a/cbits/extra.cpp b/cbits/extra.cpp
--- a/cbits/extra.cpp
+++ b/cbits/extra.cpp
@@ -89,6 +89,11 @@
 
 //using namespace llvm;
 
+unsigned LLVMInitNativeTarget()
+{
+    return LLVMInitializeNativeTarget();
+}
+
 char *LLVMDumpModuleToString(LLVMModuleRef module)
 {
     std::string s;
@@ -516,7 +521,8 @@
 define_pass( AAEval )
 define_pass( AliasAnalysisCounter )
 define_pass( AlwaysInliner )
-define_pass( BasicAliasAnalysis )
+// Name conflicts with those in LLVM proper, have a safer prefix?
+// define_pass( BasicAliasAnalysis )
 define_pass( BlockPlacement )
 define_pass( BreakCriticalEdges )
 define_pass( CodeGenPrepare )
diff --git a/configure b/configure
--- a/configure
+++ b/configure
@@ -612,6 +612,7 @@
 llvm_extra_libs
 llvm_cppflags
 llvm_version
+llvm_num_version
 EGREP
 GREP
 CXXCPP
@@ -1423,6 +1424,52 @@
 
 } # ac_fn_cxx_try_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
+
 # ac_fn_cxx_try_cpp LINENO
 # ------------------------
 # Try to preprocess conftest.$ac_ext, and return whether this succeeded.
@@ -1623,52 +1670,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.
@@ -2650,24 +2651,86 @@
 llvm_all_libs="`$llvm_config --libs all`"
 llvm_target="`$llvm_config --libs engine | sed 's/.*LLVM\(.[^ ]*\)CodeGen.*/\1/'`"
 
+CPPFLAGS="$llvm_cppflags $CPPFLAGS $TARGET_CPPFLAGS"
+LDFLAGS="$llvm_ldflags $LDFLAGS $TARGET_LDFLAGS"
+
+llvm_extra_ghci_libs=""
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing LLVMModuleCreateWithName" >&5
+$as_echo_n "checking for library containing LLVMModuleCreateWithName... " >&6; }
+if ${ac_cv_search_LLVMModuleCreateWithName+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  ac_func_search_save_LIBS=$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
+for ac_lib in '' LLVM-2.7 LLVM-2.8 LLVM-2.9 LLVM-3.0; do
+  if test -z "$ac_lib"; then
+    ac_res="none required"
+  else
+    ac_res=-l$ac_lib
+    LIBS="-l$ac_lib  $ac_func_search_save_LIBS"
+  fi
+  if ac_fn_cxx_try_link "$LINENO"; then :
+  ac_cv_search_LLVMModuleCreateWithName=$ac_res
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext
+  if ${ac_cv_search_LLVMModuleCreateWithName+:} false; then :
+  break
+fi
+done
+if ${ac_cv_search_LLVMModuleCreateWithName+:} false; then :
+
+else
+  ac_cv_search_LLVMModuleCreateWithName=no
+fi
+rm conftest.$ac_ext
+LIBS=$ac_func_search_save_LIBS
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_LLVMModuleCreateWithName" >&5
+$as_echo "$ac_cv_search_LLVMModuleCreateWithName" >&6; }
+ac_res=$ac_cv_search_LLVMModuleCreateWithName
+if test "$ac_res" != no; then :
+  test "$ac_res" = "none required" || LIBS="$ac_res $LIBS"
+
+fi
+
+if test "$ac_cv_search_LLVMModuleCreateWithName" = "no"; then
+   llvm_all_libs="`$llvm_config --libs all`"
+else
+   llvm_extra_ghci_libs="LLVM-$llvm_version"
+   llvm_all_libs="$LIBS"
+fi
+
 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'
@@ -3105,7 +3168,7 @@
 
 
 save_LIBS="$LIBS"
-LIBS="-lLLVMSupport -lLLVMSystem -lpthread -ldl $LIBS"
+LIBS="-lLLVMSupport -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; }
@@ -3209,6 +3272,7 @@
 cat >>confdefs.h <<_ACEOF
 #define HS_LLVM_VERSION $llvm_num_version
 _ACEOF
+
 
 
 
diff --git a/configure.ac b/configure.ac
--- a/configure.ac
+++ b/configure.ac
@@ -80,24 +80,31 @@
 llvm_all_libs="`$llvm_config --libs all`"
 llvm_target="`$llvm_config --libs engine | sed 's/.*LLVM\(.[[^ ]]*\)CodeGen.*/\1/'`"
 
+CPPFLAGS="$llvm_cppflags $CPPFLAGS $TARGET_CPPFLAGS"
+LDFLAGS="$llvm_ldflags $LDFLAGS $TARGET_LDFLAGS"
+
+llvm_extra_ghci_libs=""
+
+AC_SEARCH_LIBS([LLVMModuleCreateWithName],[LLVM-2.7 LLVM-2.8 LLVM-2.9 LLVM-3.0]) 
+if test "$ac_cv_search_LLVMModuleCreateWithName" = "no"; then
+   llvm_all_libs="`$llvm_config --libs all`"
+else
+   llvm_extra_ghci_libs="LLVM-$llvm_version"
+   llvm_all_libs="$LIBS"
+fi
+
 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)])
 
@@ -108,7 +115,7 @@
 #endif])
 
 save_LIBS="$LIBS"
-LIBS="-lLLVMSupport -lLLVMSystem -lpthread -ldl $LIBS"
+LIBS="-lLLVMSupport -lpthread -ldl $LIBS"
 
 AC_CHECK_LIB(LLVMCore, LLVMModuleCreateWithName, [], [])
 if test "$ac_cv_lib_LLVMCore_LLVMModuleCreateWithName" = "no"; then
@@ -122,6 +129,7 @@
 AC_DEFINE_UNQUOTED([HS_LLVM_VERSION], [$llvm_num_version],
   [Define to the version of LLVM, e.g. 209 for 2.9.])
 
+AC_SUBST([llvm_num_version])
 AC_SUBST([llvm_version])
 AC_SUBST([llvm_cppflags])
 AC_SUBST([llvm_extra_libs])
diff --git a/include/extra.h b/include/extra.h
--- a/include/extra.h
+++ b/include/extra.h
@@ -46,6 +46,11 @@
  *    indicated in the comments. Where it is not indicated, DO NOT call dispose.
  */
 
+
+/* Wraps the LLVMInitializeTarget macro from Target.h */
+unsigned LLVMInitNativeTarget(void);
+
+
 /* Wraps llvm::Module::print(). Dispose the returned string after use, via
  * LLVMDisposeMessage(). */
 char *LLVMDumpModuleToString(LLVMModuleRef module);
diff --git a/llvm-base.buildinfo.in b/llvm-base.buildinfo.in
--- a/llvm-base.buildinfo.in
+++ b/llvm-base.buildinfo.in
@@ -1,4 +1,4 @@
-cpp-options: @llvm_cppflags@ -DTARGET=@llvm_target@
+cpp-options: @llvm_cppflags@ -DTARGET=@llvm_target@ -DHS_LLVM_VERSION=@llvm_num_version@
 ghc-options: -pgml @CXX@
 extra-libraries: @llvm_extra_libs@ stdc++
 extra-lib-dirs: @llvm_extra_libdirs@
diff --git a/llvm-base.cabal b/llvm-base.cabal
--- a/llvm-base.cabal
+++ b/llvm-base.cabal
@@ -1,5 +1,5 @@
 name:          llvm-base
-version:       3.0.0.0
+version:       3.0.1.0
 license:       BSD3
 license-file:  LICENSE
 synopsis:      FFI bindings to the LLVM compiler toolkit.
