Remove regress for real to int (#4071)
[cvc5.git] / configure.sh
1 #!/bin/sh
2 #--------------------------------------------------------------------------#
3
4 usage () {
5 cat <<EOF
6 Usage: $0 [<build type>] [<option> ...]
7
8 Build types:
9 production
10 debug
11 testing
12 competition
13 competition-inc
14
15
16 General options;
17 -h, --help display this help and exit
18 --prefix=STR install directory
19 --program-prefix=STR prefix of binaries prepended on make install
20 --name=STR use custom build directory name (optionally: +path)
21 --best turn on dependencies known to give best performance
22 --gpl permit GPL dependencies, if available
23 --win64 cross-compile for Windows 64 bit
24 --ninja use Ninja build system
25
26
27 Features:
28 The following flags enable optional features (disable with --no-<option name>).
29 --static build static libraries and binaries [default=no]
30 --static-binary enable/disable static binaries
31 --proofs support for proof generation
32 --optimized optimize the build
33 --debug-symbols include debug symbols
34 --valgrind Valgrind instrumentation
35 --debug-context-mm use the debug context memory manager
36 --statistics include statistics
37 --replay turn on the replay feature
38 --assertions turn on assertions
39 --tracing include tracing code
40 --dumping include dumping code
41 --muzzle complete silence (no non-result output)
42 --coverage support for gcov coverage testing
43 --profiling support for gprof profiling
44 --unit-testing support for unit testing
45 --python2 prefer using Python 2 (also for Python bindings)
46 --python3 prefer using Python 3 (also for Python bindings)
47 --python-bindings build Python bindings based on new C++ API
48 --asan build with ASan instrumentation
49 --ubsan build with UBSan instrumentation
50 --tsan build with TSan instrumentation
51
52 The following options configure parameterized features.
53
54 --language-bindings[=java,python,all]
55 specify language bindings to build
56
57 Optional Packages:
58 The following flags enable optional packages (disable with --no-<option name>).
59 --cln use CLN instead of GMP
60 --glpk use GLPK simplex solver
61 --abc use the ABC AIG library
62 --cadical use the CaDiCaL SAT solver
63 --cryptominisat use the CryptoMiniSat SAT solver
64 --drat2er use drat2er (required for eager BV proofs)
65 --lfsc use the LFSC proof checker
66 --symfpu use SymFPU for floating point solver
67 --readline support the readline library
68
69 Optional Path to Optional Packages:
70 --abc-dir=PATH path to top level of ABC source tree
71 --antlr-dir=PATH path to ANTLR C headers and libraries
72 --cadical-dir=PATH path to top level of CaDiCaL source tree
73 --cryptominisat-dir=PATH path to top level of CryptoMiniSat source tree
74 --drat2er-dir=PATH path to the top level of the drat2er installation
75 --cxxtest-dir=PATH path to CxxTest installation
76 --glpk-dir=PATH path to top level of GLPK installation
77 --gmp-dir=PATH path to top level of GMP installation
78 --lfsc-dir=PATH path to top level of LFSC source tree
79 --symfpu-dir=PATH path to top level of SymFPU source tree
80
81 EOF
82 exit 0
83 }
84
85 #--------------------------------------------------------------------------#
86
87 die () {
88 echo "*** configure.sh: $*" 1>&2
89 exit 1
90 }
91
92 msg () {
93 echo "[configure.sh] $*"
94 }
95
96 #--------------------------------------------------------------------------#
97
98 [ ! -e src/theory ] && die "$0 not called from CVC4 base directory"
99
100 #--------------------------------------------------------------------------#
101
102 build_dir=build
103 install_prefix=default
104 program_prefix=""
105
106 #--------------------------------------------------------------------------#
107
108 buildtype=default
109
110 abc=default
111 asan=default
112 ubsan=default
113 tsan=default
114 assertions=default
115 best=default
116 cadical=default
117 cln=default
118 comp_inc=default
119 coverage=default
120 cryptominisat=default
121 debug_symbols=default
122 debug_context_mm=default
123 drat2er=default
124 dumping=default
125 gpl=default
126 win64=default
127 ninja=default
128 glpk=default
129 lfsc=default
130 muzzle=default
131 optimized=default
132 proofs=default
133 replay=default
134 shared=default
135 static_binary=default
136 statistics=default
137 symfpu=default
138 tracing=default
139 unit_testing=default
140 python2=default
141 python3=default
142 python_bindings=default
143 valgrind=default
144 profiling=default
145 readline=default
146
147 language_bindings_java=default
148 language_bindings_python=default
149
150 abc_dir=default
151 antlr_dir=default
152 cadical_dir=default
153 cryptominisat_dir=default
154 drat2er_dir=default
155 cxxtest_dir=default
156 glpk_dir=default
157 gmp_dir=default
158 lfsc_dir=default
159 symfpu_dir=default
160
161 #--------------------------------------------------------------------------#
162
163 while [ $# -gt 0 ]
164 do
165 case $1 in
166
167 -h|--help) usage;;
168
169 --abc) abc=ON;;
170 --no-abc) abc=OFF;;
171
172 --asan) asan=ON;;
173 --no-asan) asan=OFF;;
174
175 --ubsan) ubsan=ON;;
176 --no-ubsan) ubsan=OFF;;
177
178 --tsan) tsan=ON;;
179 --no-tsan) tsan=OFF;;
180
181 --assertions) assertions=ON;;
182 --no-assertions) assertions=OFF;;
183
184 --best) best=ON;;
185 --no-best) best=OFF;;
186
187 --prefix) die "missing argument to $1 (try -h)" ;;
188 --prefix=*)
189 install_prefix=${1##*=}
190 # Check if install_prefix is an absolute path and if not, make it
191 # absolute.
192 case $install_prefix in
193 /*) ;; # absolute path
194 *) install_prefix=$(pwd)/$install_prefix ;; # make absolute path
195 esac
196 ;;
197
198 --program-prefix) die "missing argument to $1 (try -h)" ;;
199 --program-prefix=*) program_prefix=${1##*=} ;;
200
201 --name) die "missing argument to $1 (try -h)" ;;
202 --name=*) build_dir=${1##*=} ;;
203
204 --cadical) cadical=ON;;
205 --no-cadical) cadical=OFF;;
206
207 --cln) cln=ON;;
208 --no-cln) cln=OFF;;
209
210 --coverage) coverage=ON;;
211 --no-coverage) coverage=OFF;;
212
213 --cryptominisat) cryptominisat=ON;;
214 --no-cryptominisat) cryptominisat=OFF;;
215
216 --debug-symbols) debug_symbols=ON;;
217 --no-debug-symbols) debug_symbols=OFF;;
218
219 --debug-context-mm) debug_context_mm=ON;;
220 --no-debug-context-mm) debug_context_mm=OFF;;
221
222 --drat2er) drat2er=ON;;
223 --no-drat2er) drat2er=OFF;;
224
225 --dumping) dumping=ON;;
226 --no-dumping) dumping=OFF;;
227
228 --gpl) gpl=ON;;
229 --no-gpl) gpl=OFF;;
230
231 --win64) win64=ON;;
232 --no-win64) win64=OFF;;
233
234 --ninja) ninja=ON;;
235
236 --glpk) glpk=ON;;
237 --no-glpk) glpk=OFF;;
238
239 --lfsc) lfsc=ON;;
240 --no-lfsc) lfsc=OFF;;
241
242 --muzzle) muzzle=ON;;
243 --no-muzzle) muzzle=OFF;;
244
245 --optimized) optimized=ON;;
246 --no-optimized) optimized=OFF;;
247
248 --proofs) proofs=ON;;
249 --no-proofs) proofs=OFF;;
250
251 --replay) replay=ON;;
252 --no-replay) replay=OFF;;
253
254 --static) shared=OFF; static_binary=ON;;
255 --no-static) shared=ON;;
256
257 --static-binary) static_binary=ON;;
258 --no-static-binary) static_binary=OFF;;
259
260 --statistics) statistics=ON;;
261 --no-statistics) statistics=OFF;;
262
263 --symfpu) symfpu=ON;;
264 --no-symfpu) symfpu=OFF;;
265
266 --tracing) tracing=ON;;
267 --no-tracing) tracing=OFF;;
268
269 --unit-testing) unit_testing=ON;;
270 --no-unit-testing) unit_testing=OFF;;
271
272 --python2) python2=ON;;
273 --no-python2) python2=OFF;;
274
275 --python3) python3=ON;;
276 --no-python3) python3=OFF;;
277
278 --python-bindings) python_bindings=ON;;
279 --no-python-bindings) python_bindings=OFF;;
280
281 --valgrind) valgrind=ON;;
282 --no-valgrind) valgrind=OFF;;
283
284 --profiling) profiling=ON;;
285 --no-profiling) profiling=OFF;;
286
287 --readline) readline=ON;;
288 --no-readline) readline=OFF;;
289
290 --language-bindings) die "missing argument to $1 (try -h)" ;;
291 --language-bindings=*)
292 lang="${1##*=}"
293 IFS=','
294 for l in $lang; do
295 case $l in
296 java) language_bindings_java=ON ;;
297 python) language_bindings_python=ON ;;
298 all)
299 language_bindings_python=ON
300 language_bindings_java=ON ;;
301 *) die "invalid language binding '$l' specified (try -h)" ;;
302 esac
303 done
304 unset IFS
305 ;;
306
307 --abc-dir) die "missing argument to $1 (try -h)" ;;
308 --abc-dir=*) abc_dir=${1##*=} ;;
309
310 --antlr-dir) die "missing argument to $1 (try -h)" ;;
311 --antlr-dir=*) antlr_dir=${1##*=} ;;
312
313 --cadical-dir) die "missing argument to $1 (try -h)" ;;
314 --cadical-dir=*) cadical_dir=${1##*=} ;;
315
316 --cryptominisat-dir) die "missing argument to $1 (try -h)" ;;
317 --cryptominisat-dir=*) cryptominisat_dir=${1##*=} ;;
318
319 --cxxtest-dir) die "missing argument to $1 (try -h)" ;;
320 --cxxtest-dir=*) cxxtest_dir=${1##*=} ;;
321
322 --drat2er-dir) die "missing argument to $1 (try -h)" ;;
323 --drat2er-dir=*) drat2er_dir=${1##*=} ;;
324
325 --glpk-dir) die "missing argument to $1 (try -h)" ;;
326 --glpk-dir=*) glpk_dir=${1##*=} ;;
327
328 --gmp-dir) die "missing argument to $1 (try -h)" ;;
329 --gmp-dir=*) gmp_dir=${1##*=} ;;
330
331 --lfsc-dir) die "missing argument to $1 (try -h)" ;;
332 --lfsc-dir=*) lfsc_dir=${1##*=} ;;
333
334 --symfpu-dir) die "missing argument to $1 (try -h)" ;;
335 --symfpu-dir=*) symfpu_dir=${1##*=} ;;
336
337 -*) die "invalid option '$1' (try -h)";;
338
339 *) case $1 in
340 production) buildtype=Production;;
341 debug) buildtype=Debug;;
342 testing) buildtype=Testing;;
343 competition) buildtype=Competition;;
344 competition-inc) buildtype=Competition; comp_inc=ON;;
345 *) die "invalid build type (try -h)";;
346 esac
347 ;;
348 esac
349 shift
350 done
351
352 #--------------------------------------------------------------------------#
353
354 cmake_opts=""
355
356 [ $buildtype != default ] \
357 && cmake_opts="$cmake_opts -DCMAKE_BUILD_TYPE=$buildtype"
358
359 [ $asan != default ] \
360 && cmake_opts="$cmake_opts -DENABLE_ASAN=$asan"
361 [ $ubsan != default ] \
362 && cmake_opts="$cmake_opts -DENABLE_UBSAN=$ubsan"
363 [ $tsan != default ] \
364 && cmake_opts="$cmake_opts -DENABLE_TSAN=$tsan"
365 [ $assertions != default ] \
366 && cmake_opts="$cmake_opts -DENABLE_ASSERTIONS=$assertions"
367 [ $best != default ] \
368 && cmake_opts="$cmake_opts -DENABLE_BEST=$best"
369 [ $comp_inc != default ] \
370 && cmake_opts="$cmake_opts -DENABLE_COMP_INC_TRACK=$comp_inc"
371 [ $coverage != default ] \
372 && cmake_opts="$cmake_opts -DENABLE_COVERAGE=$coverage"
373 [ $debug_symbols != default ] \
374 && cmake_opts="$cmake_opts -DENABLE_DEBUG_SYMBOLS=$debug_symbols"
375 [ $debug_context_mm != default ] \
376 && cmake_opts="$cmake_opts -DENABLE_DEBUG_CONTEXT_MM=$debug_context_mm"
377 [ $dumping != default ] \
378 && cmake_opts="$cmake_opts -DENABLE_DUMPING=$dumping"
379 [ $gpl != default ] \
380 && cmake_opts="$cmake_opts -DENABLE_GPL=$gpl"
381 [ $win64 != default ] \
382 && cmake_opts="$cmake_opts -DCMAKE_TOOLCHAIN_FILE=../cmake/Toolchain-mingw64.cmake"
383 [ $ninja != default ] && cmake_opts="$cmake_opts -G Ninja"
384 [ $muzzle != default ] \
385 && cmake_opts="$cmake_opts -DENABLE_MUZZLE=$muzzle"
386 [ $optimized != default ] \
387 && cmake_opts="$cmake_opts -DENABLE_OPTIMIZED=$optimized"
388 [ $proofs != default ] \
389 && cmake_opts="$cmake_opts -DENABLE_PROOFS=$proofs"
390 [ $replay != default ] \
391 && cmake_opts="$cmake_opts -DENABLE_REPLAY=$replay"
392 [ $shared != default ] \
393 && cmake_opts="$cmake_opts -DENABLE_SHARED=$shared"
394 [ $static_binary != default ] \
395 && cmake_opts="$cmake_opts -DENABLE_STATIC_BINARY=$static_binary"
396 [ $statistics != default ] \
397 && cmake_opts="$cmake_opts -DENABLE_STATISTICS=$statistics"
398 [ $tracing != default ] \
399 && cmake_opts="$cmake_opts -DENABLE_TRACING=$tracing"
400 [ $unit_testing != default ] \
401 && cmake_opts="$cmake_opts -DENABLE_UNIT_TESTING=$unit_testing"
402 [ $python2 != default ] \
403 && cmake_opts="$cmake_opts -DUSE_PYTHON2=$python2"
404 [ $python3 != default ] \
405 && cmake_opts="$cmake_opts -DUSE_PYTHON3=$python3"
406 [ $python_bindings != default ] \
407 && cmake_opts="$cmake_opts -DBUILD_BINDINGS_PYTHON=$python_bindings"
408 [ $valgrind != default ] \
409 && cmake_opts="$cmake_opts -DENABLE_VALGRIND=$valgrind"
410 [ $profiling != default ] \
411 && cmake_opts="$cmake_opts -DENABLE_PROFILING=$profiling"
412 [ $readline != default ] \
413 && cmake_opts="$cmake_opts -DUSE_READLINE=$readline"
414 [ $abc != default ] \
415 && cmake_opts="$cmake_opts -DUSE_ABC=$abc"
416 [ $cadical != default ] \
417 && cmake_opts="$cmake_opts -DUSE_CADICAL=$cadical"
418 [ $cln != default ] \
419 && cmake_opts="$cmake_opts -DUSE_CLN=$cln"
420 [ $cryptominisat != default ] \
421 && cmake_opts="$cmake_opts -DUSE_CRYPTOMINISAT=$cryptominisat"
422 [ $drat2er != default ] \
423 && cmake_opts="$cmake_opts -DUSE_DRAT2ER=$drat2er"
424 [ $glpk != default ] \
425 && cmake_opts="$cmake_opts -DUSE_GLPK=$glpk"
426 [ $lfsc != default ] \
427 && cmake_opts="$cmake_opts -DUSE_LFSC=$lfsc"
428 [ $symfpu != default ] \
429 && cmake_opts="$cmake_opts -DUSE_SYMFPU=$symfpu"
430
431 [ $language_bindings_java != default ] \
432 && cmake_opts="$cmake_opts -DBUILD_SWIG_BINDINGS_JAVA=$language_bindings_java"
433 [ $language_bindings_python != default ] \
434 && cmake_opts="$cmake_opts -DBUILD_SWIG_BINDINGS_PYTHON=$language_bindings_python"
435
436 [ "$abc_dir" != default ] \
437 && cmake_opts="$cmake_opts -DABC_DIR=$abc_dir"
438 [ "$antlr_dir" != default ] \
439 && cmake_opts="$cmake_opts -DANTLR_DIR=$antlr_dir"
440 [ "$cadical_dir" != default ] \
441 && cmake_opts="$cmake_opts -DCADICAL_DIR=$cadical_dir"
442 [ "$cryptominisat_dir" != default ] \
443 && cmake_opts="$cmake_opts -DCRYPTOMINISAT_DIR=$cryptominisat_dir"
444 [ "$cxxtest_dir" != default ] \
445 && cmake_opts="$cmake_opts -DCXXTEST_DIR=$cxxtest_dir"
446 [ "$drat2er_dir" != default ] \
447 && cmake_opts="$cmake_opts -DDRAT2ER_DIR=$drat2er_dir"
448 [ "$glpk_dir" != default ] \
449 && cmake_opts="$cmake_opts -DGLPK_DIR=$glpk_dir"
450 [ "$gmp_dir" != default ] \
451 && cmake_opts="$cmake_opts -DGMP_DIR=$gmp_dir"
452 [ "$lfsc_dir" != default ] \
453 && cmake_opts="$cmake_opts -DLFSC_DIR=$lfsc_dir"
454 [ "$symfpu_dir" != default ] \
455 && cmake_opts="$cmake_opts -DSYMFPU_DIR=$symfpu_dir"
456 [ "$install_prefix" != default ] \
457 && cmake_opts="$cmake_opts -DCMAKE_INSTALL_PREFIX=$install_prefix"
458 [ -n "$program_prefix" ] \
459 && cmake_opts="$cmake_opts -DPROGRAM_PREFIX=$program_prefix"
460
461 root_dir=$(pwd)
462
463 # The cmake toolchain can't be changed once it is configured in $build_dir.
464 # Thus, remove $build_dir and create an empty directory.
465 [ $win64 = ON ] && [ -e "$build_dir" ] && rm -r "$build_dir"
466 mkdir -p "$build_dir"
467
468 cd "$build_dir" || exit 1
469
470 [ -e CMakeCache.txt ] && rm CMakeCache.txt
471 build_dir_escaped=$(echo "$build_dir" | sed 's/\//\\\//g')
472 cmake "$root_dir" $cmake_opts 2>&1 | \
473 sed "s/^Now just/Now change to '$build_dir_escaped' and/"