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