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