Add the option --with-vmkit-package to use Debian packages instead of the llvm+vmkit...
[scilab.git] / scilab / m4 / vmkit.m4
index 6d3ecd8..4c8313c 100644 (file)
@@ -7,6 +7,9 @@ AC_DEFUN([AC_VMKIT], [
 AC_ARG_WITH(vmkit,
     AC_HELP_STRING([--with-vmkit],[Uses VMKIT infrastructure]))
 
+AC_ARG_WITH(vmkit-package,
+    AC_HELP_STRING([--with-vmkit-package],[Uses VMKIT infrastructure with the packages]))
+
 AC_ARG_WITH(llvm-src,
     AC_HELP_STRING([--with-llvm-src],[Directory containing the source code of LLVM. Needed with --with-vmkit]))
 
@@ -19,6 +22,22 @@ AC_ARG_WITH(vmkit-src,
 AC_ARG_WITH(vmkit-bin,
     AC_HELP_STRING([--with-vmkit-bin],[Directory containing the binaries of VMKIT. Default is vmkit-src/Release+Asserts]))
 
+AM_CONDITIONAL(WITH_VMKIT, test -n "$with_vmkit" -o -n "$with_vmkit_package")
+
+if test -n "$with_vmkit_package"; then
+   # Hardcode path for Debian and Ubuntu
+   # This will be improved by an automatic detection
+   LLVM_SRC_DIR="/usr/include/llvm-3.3/"
+   LLVM_BIN_DIR="/usr/lib/llvm-3.3/lib/"
+   VMKIT_SRC_DIR="/usr/include/vmkit/"
+   VMKIT_BIN_DIR="/usr/bin/"
+   VMKIT_ACPPFLAGS="-I$LLVM_SRC_DIR/ -I$VMKIT_SRC_DIR/ -I$VMKIT_SRC_DIR/MMTk/ -D_DEBUG -D_GNU_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -O3 -fomit-frame-pointer -fvisibility-inlines-hidden -fPIC -Woverloaded-virtual -Wcast-qual"
+   VMKIT_ALDFLAGS="-L$LLVM_BIN_DIR/ -lLLVMBitReader -lLLVMipo -lLLVMVectorize -lLLVMInstrumentation -lLLVMX86CodeGen -lLLVMX86Desc -lLLVMX86Info -lLLVMX86AsmPrinter -lLLVMX86Utils -lLLVMSelectionDAG -lLLVMAsmPrinter -lLLVMMCParser -lLLVMJIT -lLLVMRuntimeDyld -lLLVMExecutionEngine -lLLVMCodeGen -lLLVMScalarOpts -lLLVMInstCombine -lLLVMTransformUtils -lLLVMipa -lLLVMAnalysis -lLLVMTarget -lLLVMMC -lLLVMObject -lLLVMCore -lLLVMSupport"
+   VMKIT_ALDADD="$VMKIT_BIN_DIR/../lib/libFinalMMTk.a $VMKIT_BIN_DIR/../lib/libJ3.a $VMKIT_BIN_DIR/../lib/libClasspath.a $VMKIT_BIN_DIR/../lib/libVmkit.a $VMKIT_BIN_DIR/../lib/libVmkitCompiler.a $VMKIT_BIN_DIR/../lib/libCommonThread.a"
+   AC_DEFINE([VMKIT_ENABLED],[],[VMKIT Enabled])
+
+else
+
 if test -n "$with_vmkit";then
         if (test "$with_llvm_src" == "" || test "x$with_llvm_src" == "xyes");then
                 AC_MSG_ERROR([Due the use of --with-vmkit, the use of --with-llvm-src=<dir> is needed])
@@ -57,16 +76,17 @@ else
 fi
 AC_SUBST([VMKIT_BIN_DIR])
 
-AM_CONDITIONAL(WITH_VMKIT, test -n "$with_vmkit")
 
-VMKIT_ACPPFLAGS="-I$LLVM_SRC_DIR/include -I$VMKIT_SRC_DIR/include -I$VMKIT_SRC_DIR/lib/vmkit/MMTk/ -D_DEBUG -D_GNU_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -O3 -fomit-frame-pointer -fvisibility-inlines-hidden -fPIC -Woverloaded-virtual -Wcast-qual"
+VMKIT_ACPPFLAGS="-I$LLVM_SRC_DIR/include -I$LLVM_SRC_DIR/ -I$VMKIT_SRC_DIR/ -I$VMKIT_SRC_DIR/MMTk/ -D_DEBUG -D_GNU_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -O3 -fomit-frame-pointer -fvisibility-inlines-hidden -fPIC -Woverloaded-virtual -Wcast-qual"
 AC_SUBST([VMKIT_ACPPFLAGS])
 
 VMKIT_ALDFLAGS="-L$LLVM_BIN_DIR/lib -lLLVMBitReader -lLLVMipo -lLLVMVectorize -lLLVMInstrumentation -lLLVMX86CodeGen -lLLVMX86Desc -lLLVMX86Info -lLLVMX86AsmPrinter -lLLVMX86Utils -lLLVMSelectionDAG -lLLVMAsmPrinter -lLLVMMCParser -lLLVMJIT -lLLVMRuntimeDyld -lLLVMExecutionEngine -lLLVMCodeGen -lLLVMScalarOpts -lLLVMInstCombine -lLLVMTransformUtils -lLLVMipa -lLLVMAnalysis -lLLVMTarget -lLLVMMC -lLLVMObject -lLLVMCore -lLLVMSupport"
 AC_SUBST([VMKIT_ALDFLAGS])
 
 
-VMKIT_ALDADD="$VMKIT_BIN_DIR/lib/libFinalMMTk.a $VMKIT_BIN_DIR/lib/libJ3.a $VMKIT_BIN_DIR/lib/libClasspath.a $VMKIT_BIN_DIR/lib/libVmkit.a $VMKIT_BIN_DIR/lib/libVmkitCompiler.a $VMKIT_BIN_DIR/lib/libCommonThread.a"
+VMKIT_ALDADD="$VMKIT_BIN_DIR/../lib/libFinalMMTk.a $VMKIT_BIN_DIR/../lib/libJ3.a $VMKIT_BIN_DIR/../lib/libClasspath.a $VMKIT_BIN_DIR/../lib/libVmkit.a $VMKIT_BIN_DIR/../lib/libVmkitCompiler.a $VMKIT_BIN_DIR/../lib/libCommonThread.a"
 AC_SUBST([VMKIT_ALDADD])
 
+fi
+
 ])