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