-
Notifications
You must be signed in to change notification settings - Fork 3
/
configure
executable file
·67 lines (61 loc) · 2.64 KB
/
configure
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
#!/usr/bin/env bash
set -e
# Contains find_program() and find_file()
source dev/etc/configure-util.sh
case $(get_pfm) in
Darwin)
cxx=$(find_program "c++ compiler" "clang++ g++")
cxxflags="-std=c++11 -g -Wall -D_XOPEN_SOURCE"
ldflags="-lpthread"
if ! [ -e dev/ext/include/clang-c ]; then
(
echo "Downloading clang headers..."
set -e
mkdir -p dev/ext/include
cd dev/ext/include
svn export http://llvm.org/svn/llvm-project/cfe/trunk/include/clang-c/
echo "Downloading clang headers...OK"
)
else
echo "Found clang headers."
fi
clang_include="-I$PWD/dev/ext/include"
clang_lib_dir="`xcode-select --print-path`/Toolchains/XcodeDefault.xctoolchain/usr/lib"
clang_lib="-rpath ${clang_lib_dir} -L${clang_lib_dir} -lclang"
ast_cxxincludes=""
;;
Cygwin)
cxx=$(find_program "c++ compiler" "g++")
cxxflags="-std=c++11 -g -Wall"
ldflags="-lrt -lpthread"
clang_index_h=$(find_file "libclang headers" "clang-c/Index.h" "/usr/include" "/usr")
clang_include="-I$(dirname $(dirname ${clang_index_h}))"
clang_lib=$(find_file "libclang library" "libclang.dll.a" "/usr/lib" "/usr")
path_gcc_home=$(dirname $(gcc -print-libgcc-file-name))
path_cxx_cmath=$(find_file "C++ cmath header" "c++/cmath" "" "${path_gcc_home}")
path_cxx_config=$(find_file "C++ config header" "bits/c++config.h" "" "${path_gcc_home}")
path_c_stddef=$(find_file "C stddef.h" "stddef.h" "" "${path_gcc_home}")
ast_cxxincludes="-I$(dirname ${path_cxx_cmath}) -I$(dirname $(dirname ${path_cxx_config})) -I$(dirname ${path_c_stddef})"
;;
*)
cxx=$(find_program "c++ compiler" "g++ clang++")
cxxflags="-std=c++11 -g -Wall"
ldflags="-lrt -lpthread"
clang_index_h=$(find_file "libclang headers" "clang-c/Index.h" "/usr/include" "/usr")
clang_include="-I$(dirname $(dirname ${clang_index_h}))"
clang_lib=$(find_file "libclang library" "libclang.so" "/usr/lib" "/usr")
ast_cxxincludes=""
;;
esac
printf "generating Makefile.conf..."
sed -e "s|__configure_cxx__|$cxx|" \
-e "s|__configure_cxxflags__|$cxxflags|" \
-e "s|__configure_ldflags__|$ldflags|" \
-e "s|__configure_clang_include__|$clang_include|" \
-e "s|__configure_clang_lib__|$clang_lib|" \
-e "s|__configure_ast_cxxincludes__|$ast_cxxincludes|" \
dev/etc/Makefile.conf.in > Makefile.conf
printf "OK\n"
echo "==="
echo "=== Configure completed successfully"
echo "==="