add system regression testing infrastructure
[cvc5.git] / configure.ac
1 # -*- Autoconf -*-
2 # Process this file with autoconf to produce a configure script.
3
4 CVC4_AC_INIT
5
6 AC_PREREQ(2.64)
7 AC_INIT
8 AC_CONFIG_SRCDIR([src/include/cvc4_config.h])
9 AC_CONFIG_AUX_DIR([config])
10 AC_CONFIG_MACRO_DIR([config])
11
12 CVC4_RELEASE=prerelease
13 CVC4_LIBRARY_RELEASE_CODE=0:0:0
14 CVC4_LIBRARY_VERSION=0:0:0
15 CVC4_PARSER_LIBRARY_VERSION=0:0:0
16
17 # really irritating: AC_CANONICAL_* bash $@
18 config_cmdline="$@"
19
20 # turn off static lib building by default
21 AC_ENABLE_SHARED
22 AC_DISABLE_STATIC
23
24 AC_CANONICAL_BUILD
25 AC_CANONICAL_HOST
26 AC_CANONICAL_TARGET
27
28 # Features requested by the user
29 AC_MSG_CHECKING([for requested build profile])
30 AC_ARG_WITH([build], [AS_HELP_STRING([--with-build=profile], [for profile in {production,debug,default,competition}])])
31 if test -z "${with_build+set}" -o "$with_build" = default; then
32 with_build=default
33 fi
34 if test -z "${enable_optimized+set}" -a -z "${enable_debug_symbols+set}" -a -z "${enable_assertions+set}" -a -z "${enable_tracing+set}" -a -z "${enable_muzzle+set}" -a -z "${enable_coverage+set}" -a -z "${enable_profiling+set}"; then
35 non_standard_build_profile=no
36 else
37 non_standard_build_profile=yes
38 fi
39 btargs=
40 if test -n "${enable_optimized+set}"; then
41 if test "$enable_optimized" = yes; then
42 btargs="$btargs opt"
43 else
44 btargs="$btargs noopt"
45 fi
46 fi
47 if test -n "${enable_debug_symbols+set}"; then
48 if test "$enable_debug_symbols" = yes; then
49 btargs="$btargs dsy"
50 else
51 btargs="$btargs nodsy"
52 fi
53 fi
54 if test -n "${enable_assertions+set}"; then
55 if test "$enable_assertions" = yes; then
56 btargs="$btargs ass"
57 else
58 btargs="$btargs noass"
59 fi
60 fi
61 if test -n "${enable_tracing+set}"; then
62 if test "$enable_tracing" = yes; then
63 btargs="$btargs trc"
64 else
65 btargs="$btargs notrc"
66 fi
67 fi
68 if test -n "${enable_muzzle+set}"; then
69 if test "$enable_muzzle" = yes; then
70 btargs="$btargs mzl"
71 else
72 btargs="$btargs nomzl"
73 fi
74 fi
75 if test -n "${enable_coverage+set}"; then
76 if test "$enable_coverage" = yes; then
77 btargs="$btargs cvg"
78 else
79 btargs="$btargs nocvg"
80 fi
81 fi
82 if test -n "${enable_profiling+set}"; then
83 if test "$enable_profiling" = yes; then
84 btargs="$btargs prf"
85 else
86 btargs="$btargs noprf"
87 fi
88 fi
89 AC_MSG_RESULT([$with_build])
90
91 AC_MSG_CHECKING([for appropriate build string])
92 build_type=`$ac_confdir/config/build-type $with_build $btargs`
93 if test "$non_standard_build_profile" = yes; then
94 if test "$with_build" = default; then
95 build_type=`$ac_confdir/config/build-type custom $btargs`
96 fi
97 fi
98 AC_MSG_RESULT($build_type)
99
100 # require building in target and build-specific build directory
101 AC_MSG_CHECKING([what dir to configure])
102 if test "$CVC4_CONFIGURE_IN_BUILDS" = yes; then
103 AC_MSG_RESULT([this one (in builds/)])
104 elif test -e src/include/cvc4_config.h; then
105 AC_MSG_RESULT([builds/$target/$build_type])
106 echo
107 if test -z "$ac_srcdir"; then
108 mkbuilddir=./config/mkbuilddir
109 else
110 mkbuilddir=$ac_srcdir/config/mkbuilddir
111 fi
112 echo $mkbuilddir "$target" "$build_type"
113 $mkbuilddir "$target" "$build_type"
114 echo cd "builds/$target/$build_type"
115 cd "builds/$target/$build_type"
116 CVC4_CONFIGURE_IN_BUILDS=yes; export CVC4_CONFIGURE_IN_BUILDS
117 echo ../../../configure $config_cmdline
118 exec ../../../configure $config_cmdline
119 else
120 AC_MSG_RESULT([this one (user-specified)])
121 fi
122
123 case "$with_build" in
124 production)
125 CVC4CPPFLAGS=
126 CVC4CXXFLAGS=-O3
127 CVC4LDFLAGS=
128 if test -z "${enable_assertions+set}"; then enable_assertions=no ; fi
129 if test -z "${enable_tracing+set}" ; then enable_tracing=no ; fi
130 if test -z "${enable_muzzle+set}" ; then enable_muzzle=no ; fi
131 ;;
132 debug)
133 CVC4CPPFLAGS=-DCVC4_DEBUG
134 CVC4CXXFLAGS='-O0 -fno-inline -ggdb3'
135 CVC4LDFLAGS=
136 if test -z "${enable_assertions+set}"; then enable_assertions=yes ; fi
137 if test -z "${enable_tracing+set}" ; then enable_tracing=yes ; fi
138 if test -z "${enable_muzzle+set}" ; then enable_muzzle=no ; fi
139 ;;
140 default)
141 CVC4CPPFLAGS=
142 CVC4CXXFLAGS=-O2
143 CVC4LDFLAGS=
144 if test -z "${enable_assertions+set}"; then enable_assertions=yes ; fi
145 if test -z "${enable_tracing+set}" ; then enable_tracing=yes ; fi
146 if test -z "${enable_muzzle+set}" ; then enable_muzzle=no ; fi
147 ;;
148 competition)
149 CVC4CPPFLAGS=
150 CVC4CXXFLAGS='-O9 -funroll-all-loops -fexpensive-optimizations -fno-enforce-eh-specs'
151 CVC4LDFLAGS=
152 if test -z "${enable_assertions+set}"; then enable_assertions=no ; fi
153 if test -z "${enable_tracing+set}" ; then enable_tracing=no ; fi
154 if test -z "${enable_muzzle+set}" ; then enable_muzzle=yes ; fi
155 ;;
156 *)
157 AC_MSG_FAILURE([unknown build profile: $with_build])
158 ;;
159 esac
160
161 AC_MSG_CHECKING([whether to optimize libcvc4])
162 AC_ARG_ENABLE([optimized], [AS_HELP_STRING([--enable-optimized], [optimize the build])])
163 if test -z "${enable_optimized+set}"; then
164 enable_optimized=no
165 fi
166 AC_MSG_RESULT([$enable_optimized])
167 if test "$enable_optimized" = yes; then
168 CVC4CXXFLAGS="$CVC4CXXFLAGS -O3"
169 fi
170
171 AC_MSG_CHECKING([whether to include debugging symbols in libcvc4])
172 AC_ARG_ENABLE([debug-symbols], [AS_HELP_STRING([--disable-debug-symbols], [do not include debug symbols in libcvc4])])
173 if test -z "${enable_debug_symbols+set}"; then
174 enable_debug_symbols=yes
175 fi
176 AC_MSG_RESULT([$enable_debug_symbols])
177 if test "$enable_debug_symbols" = yes; then
178 CVC4CXXFLAGS="$CVC4CXXFLAGS -ggdb3"
179 fi
180
181 AC_MSG_CHECKING([whether to include assertions in build])
182 AC_ARG_ENABLE([assertions], [AS_HELP_STRING([--disable-assertions], [turn off assertions in build])])
183 if test -z "${enable_assertions+set}"; then
184 enable_assertions=yes
185 fi
186 AC_MSG_RESULT([$enable_assertions])
187 if test "$enable_assertions" = yes; then
188 CVC4CPPFLAGS="$CVC4CPPFLAGS -DCVC4_ASSERTIONS"
189 fi
190
191 AC_MSG_CHECKING([whether to do a traceable build of CVC4])
192 AC_ARG_ENABLE([tracing], [AS_HELP_STRING([--disable-tracing], [remove all tracing code from CVC4])])
193 if test -z "${enable_tracing+set}"; then
194 enable_tracing=yes
195 fi
196 AC_MSG_RESULT([$enable_tracing])
197 if test "$enable_tracing" = yes; then
198 CVC4CPPFLAGS="$CVC4CPPFLAGS -DCVC4_TRACING"
199 fi
200
201 AC_MSG_CHECKING([whether to do a muzzled build of CVC4])
202 AC_ARG_ENABLE([muzzle], [AS_HELP_STRING([--enable-muzzle], [completely silence CVC4; remove ALL non-result output from build])])
203 if test -z "${enable_muzzle+set}"; then
204 enable_muzzle=no
205 fi
206 AC_MSG_RESULT([$enable_muzzle])
207 if test "$enable_muzzle" = yes; then
208 CVC4CPPFLAGS="$CVC4CPPFLAGS -DCVC4_MUZZLE"
209 fi
210
211 AC_MSG_CHECKING([whether to do a gcov-enabled build of CVC4])
212 AC_ARG_ENABLE([coverage], [AS_HELP_STRING([--enable-coverage], [build with support for gcov coverage testing])])
213 if test -z "${enable_coverage+set}"; then
214 enable_coverage=no
215 fi
216 AC_MSG_RESULT([$enable_coverage])
217 if test "$enable_coverage" = yes; then
218 CVC4CXXFLAGS="$CVC4CXXFLAGS --coverage"
219 CVC4LDFLAGS="$CVC4LDFLAGS --coverage"
220 fi
221
222 AC_MSG_CHECKING([whether to do a profiling-enabled build of CVC4])
223 AC_ARG_ENABLE([profiling], [AS_HELP_STRING([--enable-profiling], [build with support for gprof profiling])])
224 if test -z "${enable_profiling+set}"; then
225 enable_profiling=no
226 fi
227 AC_MSG_RESULT([$enable_profiling])
228 if test "$enable_profiling" = yes; then
229 CVC4CXXFLAGS="$CVC4CXXFLAGS -pg"
230 CVC4LDFLAGS="$CVC4LDFLAGS -pg"
231 fi
232
233 AM_INIT_AUTOMAKE(cvc4, $CVC4_RELEASE)
234 AC_CONFIG_HEADERS([config.h])
235
236 # keep track of whether the user set these (check here, because
237 # autoconf might set a default later)
238 AC_MSG_CHECKING([for user CPPFLAGS])
239 if test -z "${CPPFLAGS+set}"; then user_cppflags=no; else user_cppflags=yes; fi
240 AC_MSG_RESULT([${CPPFLAGS-none}])
241 AC_MSG_CHECKING([for user CXXFLAGS])
242 if test -z "${CXXFLAGS+set}"; then user_cxxflags=no; else user_cxxflags=yes; fi
243 AC_MSG_RESULT([${CXXFLAGS-none}])
244 AC_MSG_CHECKING([for user LDFLAGS])
245 if test -z "${LDFLAGS+set}" ; then user_ldflags=no ; else user_ldflags=yes ; fi
246 AC_MSG_RESULT([${LDFLAGS-none}])
247
248 _LT_SET_OPTION([LT_INIT],[win32-dll])
249 LT_INIT
250
251
252 # Checks for programs.
253 AC_PROG_CC
254 AC_PROG_CXX
255 AC_PROG_INSTALL
256 # Check for ANTLR runantlr script (defined in config/antlr.m4)
257 AC_PROG_ANTLR
258
259 AC_CHECK_PROG(DOXYGEN, doxygen, doxygen, [])
260 if test -z "$DOXYGEN"; then
261 AC_MSG_WARN([documentation targets require doxygen. Set your PATH appropriately or set DOXYGEN to point to a valid doxygen binary.])
262 fi
263 AC_ARG_VAR(DOXYGEN, [location of doxygen binary])
264
265 AC_SUBST([CXXTEST])
266 AC_ARG_WITH([cxxtest-dir],
267 [AS_HELP_STRING([--with-cxxtest-dir=DIR], [path to CxxTest installation])],
268 [CXXTEST="$withval"])
269
270 dnl AC_ARG_VAR(CXXTEST, [path to cxxtest installation])
271 CXXTESTGEN=
272 AC_PATH_PROG(CXXTESTGEN, cxxtestgen.pl, [], [$CXXTEST:$PATH])
273 if test -z "$CXXTESTGEN"; then
274 AC_MSG_NOTICE([unit tests disabled, cxxtestgen.pl not found.])
275 elif test -z "$CXXTEST"; then
276 CXXTEST=$(dirname "$CXXTESTGEN")
277 AC_MSG_CHECKING([for location of CxxTest headers])
278 if test -e "$CXXTEST/cxxtest/TestRunner.h"; then
279 AC_MSG_RESULT([$CXXTEST])
280 else
281 AC_MSG_RESULT([not found])
282 AC_MSG_WARN([unit tests disabled, CxxTest headers not found.])
283 CXXTESTGEN=
284 CXXTEST=
285 fi
286 fi
287 AM_CONDITIONAL([HAVE_CXXTESTGEN], [test -n "$CXXTESTGEN"])
288
289 AC_ARG_VAR(TEST_CPPFLAGS, [CXXFLAGS to use when testing (default=$CPPFLAGS)])
290 AC_ARG_VAR(TEST_CXXFLAGS, [CXXFLAGS to use when testing (default=$CXXFLAGS)])
291 AC_ARG_VAR(TEST_LDFLAGS, [LDFLAGS to use when testing (default=$LDFLAGS)])
292
293 if test -n "$CXXTEST"; then
294 AC_CHECK_PROG(PERL, perl, perl, [])
295 if test -z "$PERL"; then
296 AC_MSG_WARN([unit tests disabled, perl not found.])
297 CXXTESTGEN=
298 CXXTEST=
299 fi
300 fi
301
302 # Checks for libraries.
303 AC_CHECK_LIB(gmp, __gmpz_init, , [AC_MSG_ERROR([GNU MP not found, see http://gmplib.org/])])
304 # Check for antlr C++ runtime (defined in config/antlr.m4)
305 AC_LIB_ANTLR
306
307
308 # Checks for header files.
309 AC_CHECK_HEADERS([getopt.h unistd.h])
310
311 # Checks for typedefs, structures, and compiler characteristics.
312 AC_HEADER_STDBOOL
313 AC_TYPE_UINT16_T
314 AC_TYPE_UINT32_T
315 AC_TYPE_UINT64_T
316 AC_TYPE_SIZE_T
317
318 # Checks for library functions.
319
320 # Some definitions for config.h
321
322 # Prepare configure output
323
324 AC_SUBST(CVC4_LIBRARY_RELEASE_CODE)
325 AC_SUBST(CVC4_LIBRARY_VERSION)
326 AC_SUBST(CVC4_PARSER_LIBRARY_VERSION)
327 if test "$user_cppflags" = no; then
328 CPPFLAGS="$CVC4CPPFLAGS"
329 fi
330 if test "$user_cxxflags" = no; then
331 CXXFLAGS="$CVC4CXXFLAGS"
332 fi
333 if test "$user_ldflags" = no; then
334 LDFLAGS="$CVC4LDFLAGS"
335 fi
336
337 mk_include=include
338 AC_SUBST(mk_include)
339
340 AC_CONFIG_FILES([
341 Makefile.builds
342 Makefile
343 contrib/Makefile
344 doc/Makefile
345 src/Makefile
346 src/expr/Makefile
347 src/smt/Makefile
348 src/main/Makefile
349 src/prop/minisat/Makefile
350 src/prop/Makefile
351 src/util/Makefile
352 src/context/Makefile
353 src/parser/Makefile
354 src/parser/cvc/Makefile
355 src/parser/smt/Makefile
356 src/theory/Makefile
357 src/theory/uf/Makefile
358 test/Makefile
359 test/regress/Makefile
360 test/system/Makefile
361 test/unit/Makefile
362 ])
363
364 AC_OUTPUT
365
366 # Final information to the user
367
368 non_standard=
369 if test "$non_standard_build_profile" = yes; then
370 if test "$with_build" = default; then
371 with_build=custom
372 else
373 AC_MSG_WARN([])
374 AC_MSG_WARN([This is a non-standard $with_build build profile.])
375 AC_MSG_WARN([])
376 non_standard=-custom
377 fi
378 fi
379
380 support_unit_tests='cxxtest not found; unit tests not supported'
381 if test -n "$CXXTEST"; then
382 support_unit_tests='unit testing infrastructure enabled in build directory'
383 fi
384
385 cat <<EOF
386
387 CVC4 $VERSION
388
389 Build profile: $with_build$non_standard
390 Build ID : $build_type
391 Optimized : $enable_optimized
392 Debug symbols: $enable_debug_symbols
393 Assertions : $enable_assertions
394 Tracing : $enable_tracing
395 Muzzle : $enable_muzzle
396 gcov support : $enable_coverage
397 gprof support: $enable_profiling
398 unit tests : $support_unit_tests
399
400 CPPFLAGS : $CPPFLAGS
401 CXXFLAGS : $CXXFLAGS
402 LDFLAGS : $LDFLAGS
403
404 Library releases : $CVC4_LIBRARY_RELEASE_CODE
405 libcvc4 version : $CVC4_LIBRARY_VERSION
406 libcvc4parser version: $CVC4_PARSER_LIBRARY_VERSION
407
408 Now just type make, followed by make check or make install, as you like.
409
410 You can use 'make <build_profile>' to reconfig/build a different profile.
411 Build profiles: production optimized default competition
412
413 EOF
414
415 if test "$user_cppflags" = yes; then
416 AC_MSG_WARN([])
417 AC_MSG_WARN([I won't override your CPPFLAGS setting. But some of your build options to configure may not be honored.])
418 AC_MSG_WARN([To support your options to configure, I would like to set CPPFLAGS to:])
419 AC_MSG_WARN([ $CVC4CPPFLAGS])
420 AC_MSG_WARN([])
421 fi
422 if test "$user_cxxflags" = yes; then
423 AC_MSG_WARN([])
424 AC_MSG_WARN([I won't override your CXXFLAGS setting. But some of your build options to configure may not be honored.])
425 AC_MSG_WARN([To support your options to configure, I would like to set CXXFLAGS to:])
426 AC_MSG_WARN([ $CVC4CXXFLAGS])
427 AC_MSG_WARN([])
428 fi
429 if test "$user_ldflags" = yes; then
430 AC_MSG_WARN([])
431 AC_MSG_WARN([I won't override your LDFLAGS setting. But some of your build options to configure may not be honored.])
432 AC_MSG_WARN([To support your options to configure, I would like to set LDFLAGS to:])
433 AC_MSG_WARN([ $CVC4LDFLAGS])
434 AC_MSG_WARN([])
435 fi
436
437 if test "$non_standard_build_profile" = yes; then
438 if test "$with_build" = default; then :; else
439 AC_MSG_WARN([])
440 AC_MSG_WARN([This is a non-standard $with_build build profile.])
441 AC_MSG_WARN([])
442 fi
443 fi