Include build_llvm_config.sh in tarballs (Closes https://github.com/mono/mono/issues...
[mono-project.git] / llvm / build_llvm_config.sh
blobd6d06f269bd12040ef369119b18f3743da24708b
1 #!/bin/bash
3 llvm_config=$1
4 extra_libs="${@:2}"
6 llvm_api_version=`$llvm_config --mono-api-version` || "0"
7 with_llvm=`$llvm_config --prefix`
9 llvm_config_cflags=`$llvm_config --cflags`
11 if [[ $llvm_config_cflags = *"stdlib=libc++"* ]]; then
12 llvm_libc_c="-stdlib=libc++"
13 llvm_libc_link="-lc++"
14 else
15 llvm_libc_c=""
16 llvm_libc_link="-lstdc++"
19 # llvm-config --clfags adds warning and optimization flags we don't want
20 shared_llvm_cflags="-I$with_llvm/include -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -DLLVM_API_VERSION=$llvm_api_version $llvm_libc_c"
21 cxxflag_additions="-std=c++11 -fno-rtti -fexceptions"
23 ldflags="-L$with_llvm/lib"
25 llvm_system=`$llvm_config --system-libs`
29 llvm_core_components=`$llvm_config --libs analysis core bitwriter`
30 llvm_old_jit=`$llvm_config --libs mcjit jit 2>>/dev/null`
31 llvm_new_jit=`$llvm_config --libs orcjit 2>>/dev/null`
32 llvm_extra=`$llvm_config --libs $extra_libs`
33 llvm_lib_components="$llvm_core_components $llvm_old_jit $llvm_new_jit $llvm_extra"
35 echo "LLVM_CFLAGS_INTERNAL=$shared_llvm_cflags"
36 echo "LLVM_CXXFLAGS_INTERNAL=$shared_llvm_cflags $cxxflag_additions"
37 echo "LLVM_LDFLAGS_INTERNAL=$ldflags"
38 echo "LLVM_LIBS_INTERNAL=$llvm_lib_components $ldflags $llvm_system $llvm_libc_link"