[proof-new] Optimizing sat proof (#6324)
[cvc5.git] / configure.sh
1 #!/bin/bash
2 #--------------------------------------------------------------------------#
3
4 set -e -o pipefail
5
6 usage () {
7 cat <<EOF
8 Usage: $0 [<build type>] [<option> ...]
9
10 Build types:
11 production
12 debug
13 testing
14 competition
15 competition-inc
16
17
18 General options;
19 -h, --help display this help and exit
20 --prefix=STR install directory
21 --program-prefix=STR prefix of binaries prepended on make install
22 --name=STR use custom build directory name (optionally: +path)
23 --best turn on dependencies known to give best performance
24 --gpl permit GPL dependencies, if available
25 --arm64 cross-compile for Linux ARM 64 bit
26 --win64 cross-compile for Windows 64 bit
27 --ninja use Ninja build system
28 --docs build Api documentation
29
30
31 Features:
32 The following flags enable optional features (disable with --no-<option name>).
33 --static build static libraries and binaries [default=no]
34 --static-binary statically link against system libraries
35 (must be disabled for static macOS builds) [default=yes]
36 --debug-symbols include debug symbols
37 --valgrind Valgrind instrumentation
38 --debug-context-mm use the debug context memory manager
39 --statistics include statistics
40 --assertions turn on assertions
41 --tracing include tracing code
42 --dumping include dumping code
43 --muzzle complete silence (no non-result output)
44 --coverage support for gcov coverage testing
45 --profiling support for gprof profiling
46 --unit-testing support for unit testing
47 --python2 force Python 2 (deprecated)
48 --python-bindings build Python bindings based on new C++ API
49 --java-bindings build Java bindings based on new C++ API
50 --all-bindings build bindings for all supported languages
51 --asan build with ASan instrumentation
52 --ubsan build with UBSan instrumentation
53 --tsan build with TSan instrumentation
54 --werror build with -Werror
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 --kissat use the Kissat SAT solver
64 --poly use the LibPoly library
65 --symfpu use SymFPU for floating point solver
66 --editline support the editline library
67
68 Optional Path to Optional Packages:
69 --abc-dir=PATH path to top level of ABC source tree
70 --cadical-dir=PATH path to top level of CaDiCaL source tree
71 --cryptominisat-dir=PATH path to top level of CryptoMiniSat source tree
72 --glpk-dir=PATH path to top level of GLPK installation
73 --gmp-dir=PATH path to top level of GMP installation
74 --kissat-dir=PATH path to top level of Kissat source tree
75 --poly-dir=PATH path to top level of LibPoly source tree
76 --symfpu-dir=PATH path to top level of SymFPU source tree
77
78 Build limitations:
79 --lib-only only build the library, but not the executable or
80 the parser (default: off)
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 assertions=default
114 cadical=default
115 cln=default
116 comp_inc=default
117 coverage=default
118 cryptominisat=default
119 debug_context_mm=default
120 debug_symbols=default
121 docs=default
122 dumping=default
123 glpk=default
124 gpl=default
125 kissat=default
126 poly=default
127 muzzle=default
128 ninja=default
129 profiling=default
130 python2=default
131 python_bindings=default
132 java_bindings=default
133 editline=default
134 shared=default
135 static_binary=default
136 statistics=default
137 symfpu=default
138 tracing=default
139 tsan=default
140 ubsan=default
141 unit_testing=default
142 valgrind=default
143 win64=default
144 arm64=default
145 werror=default
146
147 abc_dir=default
148 cadical_dir=default
149 cryptominisat_dir=default
150 glpk_dir=default
151 gmp_dir=default
152 kissat_dir=default
153 poly_dir=default
154 symfpu_dir=default
155
156 lib_only=default
157
158 #--------------------------------------------------------------------------#
159
160 while [ $# -gt 0 ]
161 do
162 case $1 in
163
164 -h|--help) usage;;
165
166 --abc) abc=ON;;
167 --no-abc) abc=OFF;;
168
169 --asan) asan=ON;;
170 --no-asan) asan=OFF;;
171
172 --ubsan) ubsan=ON;;
173 --no-ubsan) ubsan=OFF;;
174
175 --tsan) tsan=ON;;
176 --no-tsan) tsan=OFF;;
177
178 --werror) werror=ON;;
179
180 --assertions) assertions=ON;;
181 --no-assertions) assertions=OFF;;
182
183 # Best configuration
184 --best)
185 abc=ON
186 cadical=ON
187 cln=ON
188 cryptominisat=ON
189 glpk=ON
190 editline=ON
191 ;;
192
193 --prefix) die "missing argument to $1 (try -h)" ;;
194 --prefix=*)
195 install_prefix=${1##*=}
196 # Check if install_prefix is an absolute path and if not, make it
197 # absolute.
198 case $install_prefix in
199 /*) ;; # absolute path
200 *) install_prefix=$(pwd)/$install_prefix ;; # make absolute path
201 esac
202 ;;
203
204 --program-prefix) die "missing argument to $1 (try -h)" ;;
205 --program-prefix=*) program_prefix=${1##*=} ;;
206
207 --name) die "missing argument to $1 (try -h)" ;;
208 --name=*) build_dir=${1##*=} ;;
209
210 --cadical) cadical=ON;;
211 --no-cadical) cadical=OFF;;
212
213 --cln) cln=ON;;
214 --no-cln) cln=OFF;;
215
216 --coverage) coverage=ON;;
217 --no-coverage) coverage=OFF;;
218
219 --cryptominisat) cryptominisat=ON;;
220 --no-cryptominisat) cryptominisat=OFF;;
221
222 --debug-symbols) debug_symbols=ON;;
223 --no-debug-symbols) debug_symbols=OFF;;
224
225 --debug-context-mm) debug_context_mm=ON;;
226 --no-debug-context-mm) debug_context_mm=OFF;;
227
228 --dumping) dumping=ON;;
229 --no-dumping) dumping=OFF;;
230
231 --gpl) gpl=ON;;
232 --no-gpl) gpl=OFF;;
233
234 --kissat) kissat=ON;;
235 --no-kissat) kissat=OFF;;
236
237 --win64) win64=ON;;
238
239 --arm64) arm64=ON;;
240
241 --ninja) ninja=ON;;
242
243 --docs) docs=ON;;
244 --no-docs) docs=OFF;;
245
246 --glpk) glpk=ON;;
247 --no-glpk) glpk=OFF;;
248
249 --poly) poly=ON;;
250 --no-poly) poly=OFF;;
251
252 --muzzle) muzzle=ON;;
253 --no-muzzle) muzzle=OFF;;
254
255 --static) shared=OFF; static_binary=ON;;
256 --no-static) shared=ON;;
257
258 --static-binary) static_binary=ON;;
259 --no-static-binary) static_binary=OFF;;
260
261 --statistics) statistics=ON;;
262 --no-statistics) statistics=OFF;;
263
264 --symfpu) symfpu=ON;;
265 --no-symfpu) symfpu=OFF;;
266
267 --tracing) tracing=ON;;
268 --no-tracing) tracing=OFF;;
269
270 --unit-testing) unit_testing=ON;;
271 --no-unit-testing) unit_testing=OFF;;
272
273 --python2) python2=ON;;
274 --no-python2) python2=OFF;;
275
276 --python-bindings) python_bindings=ON;;
277 --no-python-bindings) python_bindings=OFF;;
278
279 --java-bindings) java_bindings=ON;;
280 --no-java-bindings) java_bindings=OFF;;
281
282 --all-bindings)
283 python_bindings=ON
284 java_bindings=ON;;
285
286 --valgrind) valgrind=ON;;
287 --no-valgrind) valgrind=OFF;;
288
289 --profiling) profiling=ON;;
290 --no-profiling) profiling=OFF;;
291
292 --editline) editline=ON;;
293 --no-editline) editline=OFF;;
294
295 --abc-dir) die "missing argument to $1 (try -h)" ;;
296 --abc-dir=*) abc_dir=${1##*=} ;;
297
298 --cadical-dir) die "missing argument to $1 (try -h)" ;;
299 --cadical-dir=*) cadical_dir=${1##*=} ;;
300
301 --cryptominisat-dir) die "missing argument to $1 (try -h)" ;;
302 --cryptominisat-dir=*) cryptominisat_dir=${1##*=} ;;
303
304 --glpk-dir) die "missing argument to $1 (try -h)" ;;
305 --glpk-dir=*) glpk_dir=${1##*=} ;;
306
307 --gmp-dir) die "missing argument to $1 (try -h)" ;;
308 --gmp-dir=*) gmp_dir=${1##*=} ;;
309
310 --kissat-dir) die "missing argument to $1 (try -h)" ;;
311 --kissat-dir=*) kissat_dir=${1##*=} ;;
312
313 --poly-dir) die "missing argument to $1 (try -h)" ;;
314 --poly-dir=*) poly_dir=${1##*=} ;;
315
316 --symfpu-dir) die "missing argument to $1 (try -h)" ;;
317 --symfpu-dir=*) symfpu_dir=${1##*=} ;;
318
319 --lib-only) lib_only=ON ;;
320
321 -*) die "invalid option '$1' (try -h)";;
322
323 *) case $1 in
324 production) buildtype=Production;;
325 debug) buildtype=Debug;;
326 testing) buildtype=Testing;;
327 competition) buildtype=Competition;;
328 competition-inc) buildtype=Competition; comp_inc=ON;;
329 *) die "invalid build type (try -h)";;
330 esac
331 ;;
332 esac
333 shift
334 done
335
336 #--------------------------------------------------------------------------#
337
338 if [ $werror != default ]; then
339 export CFLAGS=-Werror
340 export CXXFLAGS=-Werror
341 fi
342
343 cmake_opts=""
344
345 [ $buildtype != default ] \
346 && cmake_opts="$cmake_opts -DCMAKE_BUILD_TYPE=$buildtype"
347
348 [ $asan != default ] \
349 && cmake_opts="$cmake_opts -DENABLE_ASAN=$asan"
350 [ $ubsan != default ] \
351 && cmake_opts="$cmake_opts -DENABLE_UBSAN=$ubsan"
352 [ $tsan != default ] \
353 && cmake_opts="$cmake_opts -DENABLE_TSAN=$tsan"
354 [ $assertions != default ] \
355 && cmake_opts="$cmake_opts -DENABLE_ASSERTIONS=$assertions"
356 [ $comp_inc != default ] \
357 && cmake_opts="$cmake_opts -DENABLE_COMP_INC_TRACK=$comp_inc"
358 [ $coverage != default ] \
359 && cmake_opts="$cmake_opts -DENABLE_COVERAGE=$coverage"
360 [ $debug_symbols != default ] \
361 && cmake_opts="$cmake_opts -DENABLE_DEBUG_SYMBOLS=$debug_symbols"
362 [ $debug_context_mm != default ] \
363 && cmake_opts="$cmake_opts -DENABLE_DEBUG_CONTEXT_MM=$debug_context_mm"
364 [ $dumping != default ] \
365 && cmake_opts="$cmake_opts -DENABLE_DUMPING=$dumping"
366 [ $gpl != default ] \
367 && cmake_opts="$cmake_opts -DENABLE_GPL=$gpl"
368 [ $win64 != default ] \
369 && cmake_opts="$cmake_opts -DCMAKE_TOOLCHAIN_FILE=../cmake/Toolchain-mingw64.cmake"
370 [ $arm64 != default ] \
371 && cmake_opts="$cmake_opts -DCMAKE_TOOLCHAIN_FILE=../cmake/Toolchain-aarch64.cmake"
372 [ $ninja != default ] && cmake_opts="$cmake_opts -G Ninja"
373 [ $muzzle != default ] \
374 && cmake_opts="$cmake_opts -DENABLE_MUZZLE=$muzzle"
375 [ $shared != default ] \
376 && cmake_opts="$cmake_opts -DENABLE_SHARED=$shared"
377 [ $static_binary != default ] \
378 && cmake_opts="$cmake_opts -DENABLE_STATIC_BINARY=$static_binary"
379 [ $statistics != default ] \
380 && cmake_opts="$cmake_opts -DENABLE_STATISTICS=$statistics"
381 [ $tracing != default ] \
382 && cmake_opts="$cmake_opts -DENABLE_TRACING=$tracing"
383 [ $unit_testing != default ] \
384 && cmake_opts="$cmake_opts -DENABLE_UNIT_TESTING=$unit_testing"
385 [ $python2 != default ] \
386 && cmake_opts="$cmake_opts -DUSE_PYTHON2=$python2"
387 [ $docs != default ] \
388 && cmake_opts="$cmake_opts -DBUILD_DOCS=$docs"
389 [ $python_bindings != default ] \
390 && cmake_opts="$cmake_opts -DBUILD_BINDINGS_PYTHON=$python_bindings"
391 [ $java_bindings != default ] \
392 && cmake_opts="$cmake_opts -DBUILD_BINDINGS_JAVA=$java_bindings"
393 [ $valgrind != default ] \
394 && cmake_opts="$cmake_opts -DENABLE_VALGRIND=$valgrind"
395 [ $profiling != default ] \
396 && cmake_opts="$cmake_opts -DENABLE_PROFILING=$profiling"
397 [ $editline != default ] \
398 && cmake_opts="$cmake_opts -DUSE_EDITLINE=$editline"
399 [ $abc != default ] \
400 && cmake_opts="$cmake_opts -DUSE_ABC=$abc"
401 [ $cadical != default ] \
402 && cmake_opts="$cmake_opts -DUSE_CADICAL=$cadical"
403 [ $cln != default ] \
404 && cmake_opts="$cmake_opts -DUSE_CLN=$cln"
405 [ $cryptominisat != default ] \
406 && cmake_opts="$cmake_opts -DUSE_CRYPTOMINISAT=$cryptominisat"
407 [ $glpk != default ] \
408 && cmake_opts="$cmake_opts -DUSE_GLPK=$glpk"
409 [ $kissat != default ] \
410 && cmake_opts="$cmake_opts -DUSE_KISSAT=$kissat"
411 [ $poly != default ] \
412 && cmake_opts="$cmake_opts -DUSE_POLY=$poly"
413 [ $symfpu != default ] \
414 && cmake_opts="$cmake_opts -DUSE_SYMFPU=$symfpu"
415 [ "$abc_dir" != default ] \
416 && cmake_opts="$cmake_opts -DABC_DIR=$abc_dir"
417 [ "$cadical_dir" != default ] \
418 && cmake_opts="$cmake_opts -DCADICAL_DIR=$cadical_dir"
419 [ "$cryptominisat_dir" != default ] \
420 && cmake_opts="$cmake_opts -DCRYPTOMINISAT_DIR=$cryptominisat_dir"
421 [ "$glpk_dir" != default ] \
422 && cmake_opts="$cmake_opts -DGLPK_DIR=$glpk_dir"
423 [ "$gmp_dir" != default ] \
424 && cmake_opts="$cmake_opts -DGMP_DIR=$gmp_dir"
425 [ "$kissat_dir" != default ] \
426 && cmake_opts="$cmake_opts -DKISSAT=$kissat_dir"
427 [ "$poly_dir" != default ] \
428 && cmake_opts="$cmake_opts -DPOLY_DIR=$poly_dir"
429 [ "$symfpu_dir" != default ] \
430 && cmake_opts="$cmake_opts -DSYMFPU_DIR=$symfpu_dir"
431 [ "$lib_only" != default ] \
432 && cmake_opts="$cmake_opts -DBUILD_LIB_ONLY=$lib_only"
433 [ "$install_prefix" != default ] \
434 && cmake_opts="$cmake_opts -DCMAKE_INSTALL_PREFIX=$install_prefix"
435 [ -n "$program_prefix" ] \
436 && cmake_opts="$cmake_opts -DPROGRAM_PREFIX=$program_prefix"
437
438 root_dir=$(pwd)
439
440 # The cmake toolchain can't be changed once it is configured in $build_dir.
441 # Thus, remove $build_dir and create an empty directory.
442 [ $win64 = ON ] && [ -e "$build_dir" ] && rm -r "$build_dir"
443 [ $arm64 = ON ] && [ -e "$build_dir" ] && rm -r "$build_dir"
444 mkdir -p "$build_dir"
445
446 cd "$build_dir"
447
448 [ -e CMakeCache.txt ] && rm CMakeCache.txt
449 build_dir_escaped=$(echo "$build_dir" | sed 's/\//\\\//g')
450 cmake "$root_dir" $cmake_opts 2>&1 | \
451 sed "s/^Now just/Now change to '$build_dir_escaped' and/"