Mercurial > hg > octave-lyh
changeset 15305:df7ab06ff541
build: Overhaul LLVM determination in configure.ac
Add --disable-jit option to configure.
Locate llvm-config either through environment variable or in PATH.
Fix incorrect use of AC_CHECK_HEADERS macro
* configure.ac: Add --disable-jit option to configure.
Locate llvm-config either through environment variable or in PATH.
Fix incorrect use of AC_CHECK_HEADERS macro.
author | Rik <rik@octave.org> |
---|---|
date | Wed, 05 Sep 2012 16:29:07 -0700 |
parents | a8cfbc1911e4 |
children | ec3a9ff6c375 |
files | configure.ac |
diffstat | 1 files changed, 74 insertions(+), 56 deletions(-) [+] |
line wrap: on
line diff
--- a/configure.ac +++ b/configure.ac @@ -672,56 +672,69 @@ [zlib.h], [gzclearerr]) ### Check for the LLVM library -dnl -dnl LLVM is odd and has its own pkg-config like script. We should probably -dnl check for existence and ???. -dnl -save_CPPFLAGS="$CPPFLAGS" -save_CXXFLAGS="$CXXFLAGS" -save_LIBS="$LIBS" -save_LDFLAGS="$LDFLAGS" -AC_ARG_VAR(LLVM_CONFIG, [path to llvm-config utility]) - -AC_ARG_ENABLE([jit-debug], - AS_HELP_STRING([--enable-jit-debug], [enable debug printing of JIT IRs])) - -AS_IF([test "x$enable_jit_debug" = "xyes"], [ - AC_DEFINE(OCTAVE_JIT_DEBUG, 1, [Define to 1 for JIT debug printing.]) -]) +build_jit=true +AC_ARG_ENABLE([jit], + [AS_HELP_STRING([--disable-jit], + [disable JIT compiler, some performance loss for code with loops])], + [if test "$enableval" = no; then + build_jit=false + fi], + []) LLVM_CXXFLAGS= LLVM_CPPFLAGS= LLVM_LDFLAGS= LLVM_LIBS= -if test "x$ac_cv_env_LLVM_CONFIG_set" = "xset"; then - warn_llvm="LLVM was not found or is to old. JIT is disabled." +if test $build_jit = true; then + + ## Find llvm-config program from environment variable or by searching + AC_ARG_VAR(LLVM_CONFIG, [path to llvm-config utility]) + AC_CHECK_PROG(LLVM_CONFIG, llvm-config, llvm-config, []) + + AC_ARG_ENABLE([jit-debug], + [AS_HELP_STRING([--enable-jit-debug], [enable debug printing of JIT IRs])]) - ## We use -isystem if available because we do not want to see warnings in LLVM - LLVM_INCLUDE_FLAG=-I - OCTAVE_CC_FLAG(-isystem ., [ - LLVM_INCLUDE_FLAG=-isystem - AC_MSG_NOTICE([using -isystem for llvm headers])]) + if test x$enable_jit_debug = "xyes"; then + AC_DEFINE(OCTAVE_JIT_DEBUG, 1, [Define to 1 for JIT debug printing.]) + fi + + if test -z "$LLVM_CONFIG"; then + warn_llvm="llvm-config utility not found. JIT compiler is disabled." + else + ## Preset warning message in case compile fails + warn_llvm="LLVM was not found or is to old. JIT compiler is disabled." + + save_CPPFLAGS="$CPPFLAGS" + save_CXXFLAGS="$CXXFLAGS" + save_LIBS="$LIBS" + save_LDFLAGS="$LDFLAGS" - LLVM_LDFLAGS="-L`$LLVM_CONFIG --libdir`" - LLVM_LIBS=`$LLVM_CONFIG --libs` - dnl Use -isystem so we don't get warnings from llvm headers - LLVM_CPPFLAGS="$LLVM_INCLUDE_FLAG `$LLVM_CONFIG --includedir`" - LLVM_CXXFLAGS= + ## Use -isystem if available because we don't want to see warnings in LLVM + LLVM_INCLUDE_FLAG=-I + OCTAVE_CC_FLAG(-isystem ., [ + LLVM_INCLUDE_FLAG=-isystem + AC_MSG_NOTICE([using -isystem for LLVM headers])]) + + LLVM_LDFLAGS="-L`$LLVM_CONFIG --libdir`" + LLVM_LIBS=`$LLVM_CONFIG --libs` + dnl Use -isystem so we don't get warnings from llvm headers + LLVM_CPPFLAGS="$LLVM_INCLUDE_FLAG `$LLVM_CONFIG --includedir`" + LLVM_CXXFLAGS= - dnl - dnl We define some extra flags that LLVM requires in order to include headers. - dnl Ideally we should get these from llvm-config, but llvm-config isn't very - dnl helpful. - dnl - CPPFLAGS="-D__STDC_CONSTANT_MACROS -D__STDC_LIMIT_MACROS $LLVM_CPPFLAGS $CPPFLAGS" - CXXFLAGS="$LLVM_CXXFLAGS $CXXFLAGS" - LIBS="$LLVM_LIBS $LIBS" - LDFLAGS="$LLVM_LDFLAGS $LDFLAGS" + dnl + dnl Define some extra flags that LLVM requires in order to include headers. + dnl Ideally we should get these from llvm-config, but llvm-config isn't + dnl very helpful. + dnl + CPPFLAGS="-D__STDC_CONSTANT_MACROS -D__STDC_LIMIT_MACROS $LLVM_CPPFLAGS $CPPFLAGS" + CXXFLAGS="$LLVM_CXXFLAGS $CXXFLAGS" + LIBS="$LLVM_LIBS $LIBS" + LDFLAGS="$LLVM_LDFLAGS $LDFLAGS" - AC_LANG_PUSH(C++) - AC_CHECK_HEADERS([llvm/LLVMContext.h, llvm/Support/TargetSelect.h], [ + AC_LANG_PUSH(C++) + AC_CHECK_HEADERS([llvm/LLVMContext.h llvm/Support/TargetSelect.h], [ AC_MSG_CHECKING([for llvm::getGlobalContext in llvm/LLVMContext.h]) AC_COMPILE_IFELSE( [AC_LANG_PROGRAM([[ @@ -735,32 +748,35 @@ [AC_MSG_RESULT([no]) ]) ]) - AC_LANG_POP(C++) - -else - warn_llvm="LLVM_CONFIG not set. The experiential JIT feature is disabled." -fi + AC_LANG_POP(C++) + CPPFLAGS="$save_CPPFLAGS" + CXXFLAGS="$save_CXXFLAGS" + LIBS="$save_LIBS" + LDFLAGS="$save_LDFLAGS" + fi -if test -z "$warn_llvm"; then - AC_DEFINE(HAVE_LLVM, 1, [Define to 1 if LLVM is available.]) + if test -z "$warn_llvm"; then + AC_DEFINE(HAVE_LLVM, 1, [Define to 1 if LLVM is available.]) + else + build_jit=false + LLVM_CPPFLAGS= + LLVM_CXXFLAGS= + LLVM_LDFLAGS= + LLVM_LIBS= + OCTAVE_CONFIGURE_WARNING([warn_llvm]) + fi + else - LLVM_CXXFLAGS= - LLVM_CPPFLAGS= - LLVM_LDFLAGS= - LLVM_LIBS= + ## JIT build disabled + warn_llvm="JIT compiler disabled, some performance loss for code with loops" OCTAVE_CONFIGURE_WARNING([warn_llvm]) fi +AC_SUBST(LLVM_CPPFLAGS) AC_SUBST(LLVM_CXXFLAGS) -AC_SUBST(LLVM_CPPFLAGS) AC_SUBST(LLVM_LDFLAGS) AC_SUBST(LLVM_LIBS) -CPPFLAGS="$save_CPPFLAGS" -CXXFLAGS="$save_CXXFLAGS" -LIBS="$save_LIBS" -LDFLAGS="$save_LDFLAGS" - ### Check for HDF5 library. save_CPPFLAGS="$CPPFLAGS" @@ -2545,6 +2561,8 @@ Default pager: $DEFAULT_PAGER gnuplot: $GNUPLOT + Build Octave GUI: $build_gui + JIT compiler for loops: $build_jit Do internal array bounds checking: $BOUNDS_CHECKING Use octave_allocator: $USE_OCTAVE_ALLOCATOR Build static libraries: $STATIC_LIBS