comparison configure.ac @ 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
comparison
equal deleted inserted replaced
15302:a8cfbc1911e4 15305:df7ab06ff541
670 OCTAVE_CHECK_LIB(z, ZLIB, 670 OCTAVE_CHECK_LIB(z, ZLIB,
671 [ZLIB library not found. Octave will not be able to save or load compressed data files or HDF5 files.], 671 [ZLIB library not found. Octave will not be able to save or load compressed data files or HDF5 files.],
672 [zlib.h], [gzclearerr]) 672 [zlib.h], [gzclearerr])
673 673
674 ### Check for the LLVM library 674 ### Check for the LLVM library
675 dnl 675
676 dnl LLVM is odd and has its own pkg-config like script. We should probably 676 build_jit=true
677 dnl check for existence and ???. 677 AC_ARG_ENABLE([jit],
678 dnl 678 [AS_HELP_STRING([--disable-jit],
679 save_CPPFLAGS="$CPPFLAGS" 679 [disable JIT compiler, some performance loss for code with loops])],
680 save_CXXFLAGS="$CXXFLAGS" 680 [if test "$enableval" = no; then
681 save_LIBS="$LIBS" 681 build_jit=false
682 save_LDFLAGS="$LDFLAGS" 682 fi],
683 683 [])
684 AC_ARG_VAR(LLVM_CONFIG, [path to llvm-config utility])
685
686 AC_ARG_ENABLE([jit-debug],
687 AS_HELP_STRING([--enable-jit-debug], [enable debug printing of JIT IRs]))
688
689 AS_IF([test "x$enable_jit_debug" = "xyes"], [
690 AC_DEFINE(OCTAVE_JIT_DEBUG, 1, [Define to 1 for JIT debug printing.])
691 ])
692 684
693 LLVM_CXXFLAGS= 685 LLVM_CXXFLAGS=
694 LLVM_CPPFLAGS= 686 LLVM_CPPFLAGS=
695 LLVM_LDFLAGS= 687 LLVM_LDFLAGS=
696 LLVM_LIBS= 688 LLVM_LIBS=
697 689
698 if test "x$ac_cv_env_LLVM_CONFIG_set" = "xset"; then 690 if test $build_jit = true; then
699 warn_llvm="LLVM was not found or is to old. JIT is disabled." 691
700 692 ## Find llvm-config program from environment variable or by searching
701 ## We use -isystem if available because we do not want to see warnings in LLVM 693 AC_ARG_VAR(LLVM_CONFIG, [path to llvm-config utility])
702 LLVM_INCLUDE_FLAG=-I 694 AC_CHECK_PROG(LLVM_CONFIG, llvm-config, llvm-config, [])
703 OCTAVE_CC_FLAG(-isystem ., [ 695
704 LLVM_INCLUDE_FLAG=-isystem 696 AC_ARG_ENABLE([jit-debug],
705 AC_MSG_NOTICE([using -isystem for llvm headers])]) 697 [AS_HELP_STRING([--enable-jit-debug], [enable debug printing of JIT IRs])])
706 698
707 LLVM_LDFLAGS="-L`$LLVM_CONFIG --libdir`" 699 if test x$enable_jit_debug = "xyes"; then
708 LLVM_LIBS=`$LLVM_CONFIG --libs` 700 AC_DEFINE(OCTAVE_JIT_DEBUG, 1, [Define to 1 for JIT debug printing.])
709 dnl Use -isystem so we don't get warnings from llvm headers 701 fi
710 LLVM_CPPFLAGS="$LLVM_INCLUDE_FLAG `$LLVM_CONFIG --includedir`" 702
711 LLVM_CXXFLAGS= 703 if test -z "$LLVM_CONFIG"; then
712 704 warn_llvm="llvm-config utility not found. JIT compiler is disabled."
713 dnl 705 else
714 dnl We define some extra flags that LLVM requires in order to include headers. 706 ## Preset warning message in case compile fails
715 dnl Ideally we should get these from llvm-config, but llvm-config isn't very 707 warn_llvm="LLVM was not found or is to old. JIT compiler is disabled."
716 dnl helpful. 708
717 dnl 709 save_CPPFLAGS="$CPPFLAGS"
718 CPPFLAGS="-D__STDC_CONSTANT_MACROS -D__STDC_LIMIT_MACROS $LLVM_CPPFLAGS $CPPFLAGS" 710 save_CXXFLAGS="$CXXFLAGS"
719 CXXFLAGS="$LLVM_CXXFLAGS $CXXFLAGS" 711 save_LIBS="$LIBS"
720 LIBS="$LLVM_LIBS $LIBS" 712 save_LDFLAGS="$LDFLAGS"
721 LDFLAGS="$LLVM_LDFLAGS $LDFLAGS" 713
722 714 ## Use -isystem if available because we don't want to see warnings in LLVM
723 AC_LANG_PUSH(C++) 715 LLVM_INCLUDE_FLAG=-I
724 AC_CHECK_HEADERS([llvm/LLVMContext.h, llvm/Support/TargetSelect.h], [ 716 OCTAVE_CC_FLAG(-isystem ., [
717 LLVM_INCLUDE_FLAG=-isystem
718 AC_MSG_NOTICE([using -isystem for LLVM headers])])
719
720 LLVM_LDFLAGS="-L`$LLVM_CONFIG --libdir`"
721 LLVM_LIBS=`$LLVM_CONFIG --libs`
722 dnl Use -isystem so we don't get warnings from llvm headers
723 LLVM_CPPFLAGS="$LLVM_INCLUDE_FLAG `$LLVM_CONFIG --includedir`"
724 LLVM_CXXFLAGS=
725
726 dnl
727 dnl Define some extra flags that LLVM requires in order to include headers.
728 dnl Ideally we should get these from llvm-config, but llvm-config isn't
729 dnl very helpful.
730 dnl
731 CPPFLAGS="-D__STDC_CONSTANT_MACROS -D__STDC_LIMIT_MACROS $LLVM_CPPFLAGS $CPPFLAGS"
732 CXXFLAGS="$LLVM_CXXFLAGS $CXXFLAGS"
733 LIBS="$LLVM_LIBS $LIBS"
734 LDFLAGS="$LLVM_LDFLAGS $LDFLAGS"
735
736 AC_LANG_PUSH(C++)
737 AC_CHECK_HEADERS([llvm/LLVMContext.h llvm/Support/TargetSelect.h], [
725 AC_MSG_CHECKING([for llvm::getGlobalContext in llvm/LLVMContext.h]) 738 AC_MSG_CHECKING([for llvm::getGlobalContext in llvm/LLVMContext.h])
726 AC_COMPILE_IFELSE( 739 AC_COMPILE_IFELSE(
727 [AC_LANG_PROGRAM([[ 740 [AC_LANG_PROGRAM([[
728 #include <llvm/LLVMContext.h> 741 #include <llvm/LLVMContext.h>
729 ]], [[ 742 ]], [[
733 warn_llvm= 746 warn_llvm=
734 XTRA_CXXFLAGS="$XTRA_CXXFLAGS $LLVM_CXXFLAGS $LLVM_CPPFLAGS"], 747 XTRA_CXXFLAGS="$XTRA_CXXFLAGS $LLVM_CXXFLAGS $LLVM_CPPFLAGS"],
735 [AC_MSG_RESULT([no]) 748 [AC_MSG_RESULT([no])
736 ]) 749 ])
737 ]) 750 ])
738 AC_LANG_POP(C++) 751 AC_LANG_POP(C++)
739 752 CPPFLAGS="$save_CPPFLAGS"
753 CXXFLAGS="$save_CXXFLAGS"
754 LIBS="$save_LIBS"
755 LDFLAGS="$save_LDFLAGS"
756 fi
757
758 if test -z "$warn_llvm"; then
759 AC_DEFINE(HAVE_LLVM, 1, [Define to 1 if LLVM is available.])
760 else
761 build_jit=false
762 LLVM_CPPFLAGS=
763 LLVM_CXXFLAGS=
764 LLVM_LDFLAGS=
765 LLVM_LIBS=
766 OCTAVE_CONFIGURE_WARNING([warn_llvm])
767 fi
768
740 else 769 else
741 warn_llvm="LLVM_CONFIG not set. The experiential JIT feature is disabled." 770 ## JIT build disabled
742 fi 771 warn_llvm="JIT compiler disabled, some performance loss for code with loops"
743
744 if test -z "$warn_llvm"; then
745 AC_DEFINE(HAVE_LLVM, 1, [Define to 1 if LLVM is available.])
746 else
747 LLVM_CXXFLAGS=
748 LLVM_CPPFLAGS=
749 LLVM_LDFLAGS=
750 LLVM_LIBS=
751 OCTAVE_CONFIGURE_WARNING([warn_llvm]) 772 OCTAVE_CONFIGURE_WARNING([warn_llvm])
752 fi 773 fi
753 774
775 AC_SUBST(LLVM_CPPFLAGS)
754 AC_SUBST(LLVM_CXXFLAGS) 776 AC_SUBST(LLVM_CXXFLAGS)
755 AC_SUBST(LLVM_CPPFLAGS)
756 AC_SUBST(LLVM_LDFLAGS) 777 AC_SUBST(LLVM_LDFLAGS)
757 AC_SUBST(LLVM_LIBS) 778 AC_SUBST(LLVM_LIBS)
758
759 CPPFLAGS="$save_CPPFLAGS"
760 CXXFLAGS="$save_CXXFLAGS"
761 LIBS="$save_LIBS"
762 LDFLAGS="$save_LDFLAGS"
763 779
764 ### Check for HDF5 library. 780 ### Check for HDF5 library.
765 781
766 save_CPPFLAGS="$CPPFLAGS" 782 save_CPPFLAGS="$CPPFLAGS"
767 CPPFLAGS="$Z_CPPFLAGS $CPPFLAGS" 783 CPPFLAGS="$Z_CPPFLAGS $CPPFLAGS"
2543 Z libraries: $Z_LIBS 2559 Z libraries: $Z_LIBS
2544 2560
2545 Default pager: $DEFAULT_PAGER 2561 Default pager: $DEFAULT_PAGER
2546 gnuplot: $GNUPLOT 2562 gnuplot: $GNUPLOT
2547 2563
2564 Build Octave GUI: $build_gui
2565 JIT compiler for loops: $build_jit
2548 Do internal array bounds checking: $BOUNDS_CHECKING 2566 Do internal array bounds checking: $BOUNDS_CHECKING
2549 Use octave_allocator: $USE_OCTAVE_ALLOCATOR 2567 Use octave_allocator: $USE_OCTAVE_ALLOCATOR
2550 Build static libraries: $STATIC_LIBS 2568 Build static libraries: $STATIC_LIBS
2551 Build shared libraries: $SHARED_LIBS 2569 Build shared libraries: $SHARED_LIBS
2552 Dynamic Linking: $ENABLE_DYNAMIC_LINKING $DL_API_MSG 2570 Dynamic Linking: $ENABLE_DYNAMIC_LINKING $DL_API_MSG