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