diff --git a/conf/FindLLVM.cmake b/conf/FindLLVM.cmake
index 32d32b4..19a3934 100644
--- a/conf/FindLLVM.cmake
+++ b/conf/FindLLVM.cmake
@@ -156,6 +156,15 @@ else (LLVM_INCLUDE_DIR)
   IF(HAVE_SUPPORT_TARGETSELECT_H)
     ADD_DEFINITIONS(-DHAVE_SUPPORT_TARGETSELECT_H)
   ENDIF(HAVE_SUPPORT_TARGETSELECT_H)
+
+  set(CMAKE_REQUIRED_INCLUDES ${LLVM_INCLUDE_DIR})
+  set(CMAKE_REQUIRED_DEFINITIONS -D__STDC_LIMIT_MACROS=1 -D__STDC_CONSTANT_MACROS=1)
+  check_include_file_cxx("llvm/IRBuilder.h" HAVE_IRBUILDER_H)
+  unset(CMAKE_REQUIRED_INCLUDES)
+  MESSAGE(STATUS "HAVE_IRBUILDER_H: " ${HAVE_IRBUILDER_H})
+  IF(HAVE_IRBUILDER_H)
+    ADD_DEFINITIONS(-DHAVE_IRBUILDER_H)
+  ENDIF(HAVE_IRBUILDER_H)
   
   exec_program(${LLVM_CONFIG_EXECUTABLE} ARGS --cxxflags  OUTPUT_VARIABLE LLVM_COMPILE_FLAGS )
   MESSAGE(STATUS "LLVM CXX flags: " ${LLVM_COMPILE_FLAGS})
diff --git a/src/scripting/abc_codesynt.cpp b/src/scripting/abc_codesynt.cpp
index d00521b..2648bbf 100644
--- a/src/scripting/abc_codesynt.cpp
+++ b/src/scripting/abc_codesynt.cpp
@@ -29,8 +29,12 @@
 #include <llvm/DerivedTypes.h>
 #include <llvm/ExecutionEngine/ExecutionEngine.h>
 #include <llvm/PassManager.h>
-#include <llvm/Constants.h> 
-#include <llvm/Support/IRBuilder.h> 
+#include <llvm/Constants.h>
+#ifdef HAVE_IRBUILDER_H
+#  include <llvm/IRBuilder.h>
+#else
+#  include <llvm/Support/IRBuilder.h>
+#endif
 #include <llvm/LLVMContext.h>
 #include <llvm/Target/TargetData.h>
 #include <sstream>
