-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathconfigure
executable file
·148 lines (130 loc) · 2.74 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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
#!/bin/bash
# Re-invoke the configure script
# and keep the output at bay.
if [ "$1" != "quiet" ];
then
$0 "quiet" $@ > /dev/null
exit $?
fi
shift
set -o errexit
set -o nounset
# Determine system
uname_linux=0
uname_cygwin=0
uname_osx=0
uname=$(uname)
if [ "$uname" = "Linux" ];
then
uname_linux=1
elif [ "$uname" = "Darwin" ];
then
uname_osx=1
elif [ "$(uname -o)" = "Cygwin" ];
then
uname_cygwin=1
else
echo "Invalid uname ($uname): unsuppported platform" 1>&2
exit 1
fi
log() { echo "$@" 1>&2; }
log_start() { printf "$@" 1>&2; }
log_end() { echo "$@" 1>&2; }
log_exit() { echo "$@" 1>&2; exit 1; }
project=jest
log "Configuring ${project}"
prefix=/usr/local
includedir="$prefix/include"
threads=4
cxx_platform_flags=
ld_platform_libs=
# Project-specific flags
if [ "1" -eq "$uname_linux" ];
then
log "Platform: Linux"
elif [ "1" -eq "$uname_osx" ];
then
log "Platform: OS X"
cxx_platform_flags="-stdlib=libc++ -I/opt/local/include"
ld_platform_libs="-lc++"
elif [ "1" -eq "$uname_cygwin" ];
then
log "Platform: Cygwin (NOT TESTED)"
fi
function show_help
{
log "Usage: $0 [OPTION...]"
log
log "General:"
log " -h, --help Show this help message"
log " --prefix=[/usr/local] Set installation prefix"
log " --includedir=[/usr/local/include] Set include prefix"
log " --threads=[4] Set number of threads to use"
log
exit 0
}
# Parse params
for i in "$@"
do
case $i in
--prefix)
shift
prefix="$1"
includedir=$prefix/include
shift
;;
--prefix=*)
prefix="${i#*=}"
includedir=$prefix/include
shift
;;
--includedir)
shift
includedir="$1"
shift
;;
--includedir=*)
includedir="${i#*=}"
shift
;;
--threads)
shift
threads=$1
shift
;;
--threads=*)
threads=${i#*=}
shift
;;
-h)
show_help
;;
--help*)
show_help
;;
*)
# Unknown option
;;
esac
done
# Update after params
log
log "Install prefix: $prefix"
log "Install include prefix: $includedir"
log "Compilation threads: $threads"
log
# Configure the makefile
log_start "Populating Makefile..."
rm -f Makefile
sed "s#%CXX_PLATFORM_FLAGS%#${cxx_platform_flags}#" ./Makefile.in |\
sed "s#%LD_PLATFORM_LIBS%#${ld_platform_libs}#" |\
sed "s#%PREFIX%#${prefix}#" |\
sed "s#%INCLUDEDIR%#${includedir}#" |\
sed "s#%PROJECT%#${project}#" |\
sed "s#%THREADS%#${threads}#" > Makefile
log_end " done"
log "Done configuring ${project}"
# Describe next steps
log
log "To run tests, use \`make && make test\`"
log "To install headers, use \`make install\` with the appropriate permissions for your prefix"