changeset 17202:bc20614022aa

build: Redo LLVM macros to disable JIT rather than stop build if headers not found. * configure.ac: Move functionality for OCTAVE_LLVM_IR_DIR, OCTAVE_LLVM_IRBUILDER_HEADER, OCTAVE_LLVM_DATALAYOUT_HEADER macros from acinclude.m4 to configure.ac. * m4/acinclude.m4: Delete OCTAVE_LLVM_IR_DIR, OCTAVE_LLVM_IRBUILDER_HEADER, OCTAVE_LLVM_DATALAYOUT_HEADER macros. Eliminate unnecessary else clause of OCTAVE_LLVM_FUNCTION_ADDATTRIBUTE_API, OCTAVE_LLVM_FUNCTION_ADDFNATTR_API, OTAVE_LLVM_CALLINST_ADDATTRIBUTE_API macros.
author Rik <rik@octave.org>
date Wed, 07 Aug 2013 12:03:31 -0700
parents 2899d110c178
children fbee0d312af5
files configure.ac m4/acinclude.m4
diffstat 2 files changed, 21 insertions(+), 114 deletions(-) [+]
line wrap: on
line diff
--- a/configure.ac
+++ b/configure.ac
@@ -766,9 +766,26 @@
     AC_CHECK_HEADER([llvm/Support/TargetSelect.h], [
       warn_llvm=
       XTRA_CXXFLAGS="$XTRA_CXXFLAGS $LLVM_CXXFLAGS $LLVM_CPPFLAGS"])
-    OCTAVE_LLVM_IR_DIR
-    OCTAVE_LLVM_IRBUILDER_HEADER
-    OCTAVE_LLVM_DATALAYOUT_HEADER
+
+    have_function_h=no
+    AC_CHECK_HEADERS([llvm/IR/Function.h llvm/Function.h],
+                     [have_function_h=yes; break])
+    if test $have_function_h = no; then
+      warn_llvm="Missing LLVM file Function.h.  JIT compiler is disabled."
+    fi
+    have_irbuilder_h=no
+    AC_CHECK_HEADERS([llvm/Support/IRBuilder.h llvm/IR/IRBuilder.h \
+                      llvm/IRBuilder.h], [have_irbuilder_h=yes; break])
+    if test $have_irbuilder_h = no; then
+      warn_llvm="Missing LLVM file IRBuilder.h.  JIT compiler is disabled."
+    fi
+    have_llvm_data_h=no
+    AC_CHECK_HEADERS([llvm/Target/TargetData.h llvm/IR/DataLayout.h \
+                      llvm/DataLayout.h], [have_llvm_data_h=yes; break])
+    if test $have_llvm_data_h = no; then
+      warn_llvm="Missing LLVM file TargetData.h.  JIT compiler is disabled."
+    fi
+
     OCTAVE_LLVM_FUNCTION_ADDATTRIBUTE_API
     OCTAVE_LLVM_FUNCTION_ADDFNATTR_API
     OCTAVE_LLVM_CALLINST_ADDATTRIBUTE_API
@@ -1934,7 +1951,7 @@
 AC_CHECK_HEADERS([curses.h direct.h dlfcn.h floatingpoint.h fpu_control.h])
 AC_CHECK_HEADERS([grp.h ieeefp.h inttypes.h locale.h memory.h ncurses.h])
 AC_CHECK_HEADERS([poll.h pthread.h pwd.h sunmath.h sys/ioctl.h])
-AC_CHECK_HEADERS([sys/param.h sys/poll.h sys/resource.h ])
+AC_CHECK_HEADERS([sys/param.h sys/poll.h sys/resource.h])
 AC_CHECK_HEADERS([sys/select.h sys/utsname.h termcap.h])
 
 ## C++ headers
--- a/m4/acinclude.m4
+++ b/m4/acinclude.m4
@@ -1453,43 +1453,6 @@
   if test $octave_cv_callinst_addattribute_arg_is_attributes = yes; then
     AC_DEFINE(CALLINST_ADDATTRIBUTE_ARG_IS_ATTRIBUTES, 1,
       [Define to 1 if llvm::CallInst:addAttribute arg type is llvm::Attributes.])
-  else
-    AC_CACHE_CHECK([check LLVM::CallInst::addAttribute arg type is llvm::Attribute],
-      [octave_cv_callinst_addattribute_arg_is_attribute],
-      [AC_LANG_PUSH(C++)
-        AC_COMPILE_IFELSE(
-          [AC_LANG_PROGRAM([[
-#ifdef HAVE_LLVM_IR_FUNCTION_H
-            #include <llvm/IR/Instructions.h>
-            #include <llvm/IR/Attributes.h>
-#else
-            #include <llvm/Instructions.h>
-            #include <llvm/Attributes.h>
-#endif
-            ]], [[
-            llvm::CallInst *callinst;
-            callinst->addAttribute (1, llvm::Attribute::StructRet);
-          ]])],
-          octave_cv_callinst_addattribute_arg_is_attribute=yes,
-          octave_cv_callinst_addattribute_arg_is_attribute=no)
-      AC_LANG_POP(C++)
-    ])
-    if test $octave_cv_callinst_addattribute_arg_is_attribute = no; then
-      AC_MSG_ERROR([llvm::CallInst::addAttribute is required.])
-    fi
-  fi
-])
-dnl
-dnl Detect TargetData.h or DataLayout.h.
-dnl
-AC_DEFUN([OCTAVE_LLVM_DATALAYOUT_HEADER], [
-  OCTAVE_LLVM_DATALAYOUT_HEADER_FOUND=no
-  AC_CHECK_HEADERS([llvm/Target/TargetData.h llvm/IR/DataLayout.h llvm/DataLayout.h], [
-    OCTAVE_LLVM_DATALAYOUT_HEADER_FOUND=yes
-    break
-  ])
-  if test OCTAVE_LLVM_DATALAYOUT_HEADER_FOUND = no; then
-    AC_MSG_ERROR([DataLayout.h or TargetLayout.h is required.])
   fi
 ])
 dnl
@@ -1524,30 +1487,6 @@
   if test $octave_cv_function_addattribute_arg_is_attributes = yes; then
     AC_DEFINE(FUNCTION_ADDATTRIBUTE_ARG_IS_ATTRIBUTES, 1,
       [Define to 1 if llvm::Function:addAttribute arg type is llvm::Attributes.])
-  else
-    AC_CACHE_CHECK([check llvm::Function::addAttribute arg type is llvm::Attribute],
-      [octave_cv_function_addattribute_arg_is_attribute],
-      [AC_LANG_PUSH(C++)
-        AC_COMPILE_IFELSE(
-          [AC_LANG_PROGRAM([[
-#ifdef HAVE_LLVM_IR_FUNCTION_H
-            #include <llvm/IR/Function.h>
-            #include <llvm/IR/Attributes.h>
-#else
-            #include <llvm/Function.h>
-            #include <llvm/Attributes.h>
-#endif
-            ]], [[
-            llvm::Function *llvm_function;
-            llvm_function->addAttribute (1, llvm::Attribute::StructRet);
-          ]])],
-          octave_cv_function_addattribute_arg_is_attribute=yes,
-          octave_cv_function_addattribute_arg_is_attribute=no)
-      AC_LANG_POP(C++)
-    ])
-    if test $octave_cv_function_addattribute_arg_is_attribute = no; then
-      AC_MSG_ERROR([llvm::Function::addAttribute is required.])
-    fi
   fi
 ])
 dnl
@@ -1577,55 +1516,6 @@
   if test $octave_cv_function_addfnattr_arg_is_attributes = yes; then
     AC_DEFINE(FUNCTION_ADDFNATTR_ARG_IS_ATTRIBUTES, 1,
       [Define to 1 if llvm::Function:addFnAttr arg type is llvm::Attributes.])
-  else
-    AC_CACHE_CHECK([check llvm::Function::addFnAttr arg type is llvm::Attribute],
-      [octave_cv_function_addfnattr_arg_is_attribute],
-      [AC_LANG_PUSH(C++)
-        AC_COMPILE_IFELSE(
-          [AC_LANG_PROGRAM([[
-#ifdef HAVE_LLVM_IR_FUNCTION_H
-            #include <llvm/IR/Function.h>
-            #include <llvm/IR/Attributes.h>
-#else
-            #include <llvm/Function.h>
-            #include <llvm/Attributes.h>
-#endif
-            ]], [[
-            llvm::Function *llvm_function;
-            llvm_function->addFnAttr (llvm::Attribute::AlwaysInline);
-          ]])],
-          octave_cv_function_addfnattr_arg_is_attribute=yes,
-          octave_cv_function_addfnattr_arg_is_attribute=no)
-      AC_LANG_POP(C++)
-    ])
-    if test $octave_cv_function_addfnattr_arg_is_attribute = no; then
-      AC_MSG_ERROR([llvm::Function::addFnAttr is required.])
-    fi
-  fi
-])
-dnl
-dnl Check whether IRBuilder.h is in llvm/Support, llvm/IR, or llvm directory.
-dnl
-AC_DEFUN([OCTAVE_LLVM_IRBUILDER_HEADER], [
-  OCTAVE_LLVM_IRBUILDER_HEADER_FOUND=no
-  AC_CHECK_HEADERS([llvm/Support/IRBuilder.h llvm/IR/IRBuilder.h llvm/IRBuilder.h], [
-    OCTAVE_LLVM_IRBUILDER_HEADER_FOUND=yes
-    break
-  ])
-
-  if test OCTAVE_LLVM_IRBUILDER_HEADER_FOUND = no; then
-    AC_MSG_ERROR([Could not find IRBuilder.h])
-  fi
-])
-AC_DEFUN([OCTAVE_LLVM_IR_DIR], [
-  OCTAVE_LLVM_FUNCTION_FOUNDR=no
-  AC_CHECK_HEADERS([llvm/IR/Function.h llvm/Function.h], [
-    OCTAVE_LLVM_FUNCTION_FOUNDR=yes
-    break
-  ])
-
-  if test OCTAVE_LLVM_FUNCTION_FOUNDR = no; then
-    AC_MSG_ERROR([Could not find Function.h])
   fi
 ])
 dnl