Fixed issue with build system. The build environment variables VMKIT_ALDADD,
[scilab.git] / scilab / m4 / vmkit.m4
1 AC_DEFUN([AC_VMKIT], [
2
3 ######
4 #### VMKIT disabled by default
5 ######
6
7 AC_ARG_WITH(vmkit,
8     AC_HELP_STRING([--with-vmkit],[Uses VMKIT infrastructure]))
9
10 AC_ARG_WITH(llvm-src,
11     AC_HELP_STRING([--with-llvm-src],[Directory containing the source code of LLVM. Needed with --with-vmkit]))
12
13 AC_ARG_WITH(llvm-bin,
14     AC_HELP_STRING([--with-llvm-bin],[Directory containing the binaries of LLVM. Default is llvm-src/Release+Asserts]))
15
16 AC_ARG_WITH(vmkit-src,
17     AC_HELP_STRING([--with-vmkit-src],[Directory containing the source code of VMKIT. Needed with --with-vmkit]))
18
19 AC_ARG_WITH(vmkit-bin,
20     AC_HELP_STRING([--with-vmkit-bin],[Directory containing the binaries of VMKIT. Default is vmkit-src/Release+Asserts]))
21
22 if test -n "$with_vmkit";then
23         if (test "$with_llvm_src" == "" || test "x$with_llvm_src" == "xyes");then
24                 AC_MSG_ERROR([Due the use of --with-vmkit, the use of --with-llvm-src=<dir> is needed])
25         fi
26
27         if (test "$with_vmkit_src" == ""|| test "x$with_vmkit_src" == "xyes");then
28                 AC_MSG_ERROR([Due the use of --with-vmkit, the use of --with-vmkit-src=<dir> is needed])a
29         fi
30
31         LLVM_SRC_DIR="$with_llvm_src"
32         VMKIT_SRC_DIR="$with_vmkit_src"
33         AC_SUBST([LLVM_SRC_DIR])
34         AC_SUBST([VMKIT_SRC_DIR])
35         AC_DEFINE([VMKIT_ENABLED],[],[VMKIT Enabled])
36 fi
37
38 if test -n "$with_llvm_bin";then
39         if (test "$with_llvm_bin" == "" || test "x$with_llvm_bin" == "xyes");then
40                 AC_MSG_ERROR([Use --with-llvm-bin=<dir>])
41         else
42                 LLVM_BIN_DIR="$with_llvm_bin"
43         fi
44 else
45         LLVM_BIN_DIR="$with_llvm_src/Release+Asserts"
46 fi
47 AC_SUBST([LLVM_BIN_DIR])
48
49 if test -n "$with_vmkit_bin";then
50         if (test "$with_vmkit_bin" == "" || test "x$with_vmkit_bin" == "xyes");then
51                 AC_MSG_ERROR([Use --with-vmkit-bin=<dir>])
52         else
53                 VMKIT_BIN_DIR="$with_vmkit_bin"
54         fi
55 else
56         VMKIT_BIN_DIR="$with_vmkit_src/Release+Asserts"
57 fi
58 AC_SUBST([VMKIT_BIN_DIR])
59
60 AM_CONDITIONAL(WITH_VMKIT, test -n "$with_vmkit")
61
62 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"
63 AC_SUBST([VMKIT_ACPPFLAGS])
64
65 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"
66 AC_SUBST([VMKIT_ALDFLAGS])
67
68
69 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"
70 AC_SUBST([VMKIT_ALDADD])
71
72 ])