first attempt at new build system
[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 AC_CANONICAL_BUILD
11 AC_CANONICAL_HOST
12 AC_CANONICAL_TARGET
13
14 # Features requested by the user
15 AC_MSG_CHECKING([for requested build profile])
16 AC_ARG_WITH([build], [AS_HELP_STRING([--with-build=profile], [for profile in {production,debug,default,competition}])])
17 if test -z "${with_build+set}" -o "$with_build" = default; then
18 with_build=default
19 fi
20 if test "$user_cppflags" = no -a "$user_cxxflags" = no -a "$user_ldflags" = no -a -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
21 non_standard_build_profile=no
22 else
23 non_standard_build_profile=yes
24 fi
25 build=
26 if test -n "${enable_optimized+set}"; then build=$build-opt; fi
27 if test -n "${enable_debug_symbols+set}"; then build=$build-dsy; fi
28 if test -n "${enable_assertions+set}"; then build=$build-ass; fi
29 if test -n "${enable_tracing+set}"; then build=$build-trc; fi
30 if test -n "${enable_muzzle+set}"; then build=$build-mzl; fi
31 if test -n "${enable_coverage+set}"; then build=$build-cvg; fi
32 if test -n "${enable_profiling+set}"; then build=$build-prf; fi
33 AC_MSG_RESULT([$with_build])
34
35 AC_MSG_CHECKING([for appropriate build string])
36 build_type=$with_build$build_type_suffix
37 AC_MSG_RESULT($build_type)
38
39 # require building in target and build-specific build directory
40 if test -e src/include/cvc4.h; then
41 if test "$non_standard_build_profile" = yes; then
42 if test "$with_build" = default; then
43 build_type=custom$build_type_suffix
44 fi
45 fi
46 rm -f config.log config.status confdefs.h
47 mkdir -p "builds/$target/$build_type"
48 test -e builds/Makefile || cp Makefile.builds builds/Makefile
49 echo "CURRENT_BUILD = $target/$build_type" > builds/current
50 echo
51 echo cd "builds/$target/$build_type"
52 cd "builds/$target/$build_type"
53 echo ../../../configure "$@"
54 exec ../../../configure "$@"
55 fi
56
57 case "$with_build" in
58 production)
59 CVC4CPPFLAGS=
60 CVC4CXXFLAGS=-O3
61 CVC4LDFLAGS=
62 if test -z "${enable_assertions+set}"; then enable_assertions=no ; fi
63 if test -z "${enable_tracing+set}" ; then enable_tracing=no ; fi
64 if test -z "${enable_muzzle+set}" ; then enable_muzzle=no ; fi
65 ;;
66 debug)
67 CVC4CPPFLAGS=-DCVC4_DEBUG
68 CVC4CXXFLAGS='-O0 -fno-inline -ggdb3'
69 CVC4LDFLAGS=
70 if test -z "${enable_assertions+set}"; then enable_assertions=yes ; fi
71 if test -z "${enable_tracing+set}" ; then enable_tracing=yes ; fi
72 if test -z "${enable_muzzle+set}" ; then enable_muzzle=no ; fi
73 ;;
74 default)
75 CVC4CPPFLAGS=
76 CVC4CXXFLAGS=-O2
77 CVC4LDFLAGS=
78 if test -z "${enable_assertions+set}"; then enable_assertions=yes ; fi
79 if test -z "${enable_tracing+set}" ; then enable_tracing=yes ; fi
80 if test -z "${enable_muzzle+set}" ; then enable_muzzle=no ; fi
81 ;;
82 competition)
83 CVC4CPPFLAGS=
84 CVC4CXXFLAGS='-O9 -funroll-all-loops -fexpensive-optimizations -fno-enforce-eh-specs'
85 CVC4LDFLAGS=
86 if test -z "${enable_assertions+set}"; then enable_assertions=no ; fi
87 if test -z "${enable_tracing+set}" ; then enable_tracing=no ; fi
88 if test -z "${enable_muzzle+set}" ; then enable_muzzle=yes ; fi
89 ;;
90 *)
91 AC_MSG_FAILURE([unknown build profile: $with_build])
92 ;;
93 esac
94
95 AC_MSG_CHECKING([whether to optimize libcvc4])
96 AC_ARG_ENABLE([optimized], [AS_HELP_STRING([--enable-optimized], [optimize the build])])
97 if test -z "${enable_optimized+set}"; then
98 enable_optimized=no
99 fi
100 AC_MSG_RESULT([$enable_optimized])
101 if test "$enable_optimized" = yes; then
102 CVC4CXXFLAGS="$CVC4CXXFLAGS -O3"
103 fi
104
105 AC_MSG_CHECKING([whether to include debugging symbols in libcvc4])
106 AC_ARG_ENABLE([debug-symbols], [AS_HELP_STRING([--disable-debug-symbols], [do not include debug symbols in libcvc4])])
107 if test -z "${enable_debug_symbols+set}"; then
108 enable_debug_symbols=yes
109 fi
110 AC_MSG_RESULT([$enable_debug_symbols])
111 if test "$enable_debug_symbols" = yes; then
112 CVC4CXXFLAGS="$CVC4CXXFLAGS -ggdb3"
113 fi
114
115 AC_MSG_CHECKING([whether to include assertions in build])
116 AC_ARG_ENABLE([assertions], [AS_HELP_STRING([--disable-assertions], [turn off assertions in build])])
117 if test -z "${enable_assertions+set}"; then
118 enable_assertions=yes
119 fi
120 AC_MSG_RESULT([$enable_assertions])
121 if test "$enable_assertions" = yes; then
122 CVC4CPPFLAGS="$CVC4CPPFLAGS -DCVC4_ASSERTIONS"
123 fi
124
125 AC_MSG_CHECKING([whether to do a traceable build of CVC4])
126 AC_ARG_ENABLE([tracing], [AS_HELP_STRING([--disable-tracing], [remove all tracing code from CVC4])])
127 if test -z "${enable_tracing+set}"; then
128 enable_tracing=yes
129 fi
130 AC_MSG_RESULT([$enable_tracing])
131 if test "$enable_tracing" = yes; then
132 CVC4CPPFLAGS="$CVC4CPPFLAGS -DCVC4_TRACING"
133 fi
134
135 AC_MSG_CHECKING([whether to do a muzzled build of CVC4])
136 AC_ARG_ENABLE([muzzle], [AS_HELP_STRING([--enable-muzzle], [completely silence CVC4; remove ALL non-result output from build])])
137 if test -z "${enable_muzzle+set}"; then
138 enable_muzzle=no
139 fi
140 AC_MSG_RESULT([$enable_muzzle])
141 if test "$enable_muzzle" = yes; then
142 CVC4CPPFLAGS="$CVC4CPPFLAGS -DCVC4_MUZZLE"
143 fi
144
145 AC_MSG_CHECKING([whether to do a gcov-enabled build of CVC4])
146 AC_ARG_ENABLE([coverage], [AS_HELP_STRING([--enable-coverage], [build with support for gcov coverage testing])])
147 if test -z "${enable_coverage+set}"; then
148 enable_coverage=no
149 fi
150 AC_MSG_RESULT([$enable_coverage])
151 if test "$enable_coverage" = yes; then
152 CVC4CXXFLAGS="$CVC4CXXFLAGS --coverage"
153 CVC4LDFLAGS="$CVC4LDFLAGS --coverage"
154 fi
155
156 AC_MSG_CHECKING([whether to do a profiling-enabled build of CVC4])
157 AC_ARG_ENABLE([profiling], [AS_HELP_STRING([--enable-profiling], [build with support for gprof profiling])])
158 if test -z "${enable_profiling+set}"; then
159 enable_profiling=no
160 fi
161 AC_MSG_RESULT([$enable_profiling])
162 if test "$enable_profiling" = yes; then
163 CVC4CXXFLAGS="$CVC4CXXFLAGS -pg"
164 CVC4LDFLAGS="$CVC4LDFLAGS -pg"
165 fi
166
167 AM_INIT_AUTOMAKE(cvc4, prerelease)
168 AC_CONFIG_HEADERS([config.h])
169
170 # keep track of whether the user set these (check here, because
171 # autoconf might set a default later)
172 AC_MSG_CHECKING([for user CPPFLAGS])
173 if test -z "${CPPFLAGS+set}"; then user_cppflags=no; else user_cppflags=yes; fi
174 AC_MSG_RESULT([${CPPFLAGS-none}])
175 AC_MSG_CHECKING([for user CXXFLAGS])
176 if test -z "${CXXFLAGS+set}"; then user_cxxflags=no; else user_cxxflags=yes; fi
177 AC_MSG_RESULT([${CXXFLAGS-none}])
178 AC_MSG_CHECKING([for user LDFLAGS])
179 if test -z "${LDFLAGS+set}" ; then user_ldflags=no ; else user_ldflags=yes ; fi
180 AC_MSG_RESULT([${LDFLAGS-none}])
181
182 LT_INIT
183
184 AC_LIBTOOL_WIN32_DLL
185
186
187
188
189
190 # Checks for programs.
191 AC_PROG_CC
192 AC_PROG_CXX
193
194 AC_PROG_INSTALL
195 AC_PROG_LIBTOOL
196 AM_PROG_LEX
197 AC_PROG_YACC
198
199 AC_CHECK_PROG(DOXYGEN, doxygen, doxygen, [])
200 if test -z "$DOXYGEN"; then
201 AC_MSG_WARN([documentation targets require doxygen. Set your PATH appropriately or set DOXYGEN to point to a valid doxygen binary.])
202 fi
203 AC_ARG_VAR(DOXYGEN, [location of doxygen binary])
204
205 CXXTESTGEN=
206 AC_PATH_PROG(CXXTESTGEN, cxxtestgen.pl, [], [$CXXTEST:$PATH])
207 if test -z "$CXXTESTGEN"; then
208 AC_MSG_NOTICE([unit tests disabled, cxxtestgen.pl not found.])
209 elif test -z "$CXXTEST"; then
210 CXXTEST=$(dirname "$CXXTESTGEN")
211 AC_MSG_CHECKING([for location of CxxTest headers])
212 if test -e "$CXXTEST/cxxtest/TestRunner.h"; then
213 AC_MSG_RESULT([$CXXTEST])
214 else
215 AC_MSG_RESULT([not found])
216 AC_MSG_WARN([unit tests disabled, CxxTest headers not found.])
217 CXXTESTGEN=
218 CXXTEST=
219 fi
220 fi
221 AC_ARG_VAR(CXXTEST, [path to CxxTest installation])
222 AM_CONDITIONAL([HAVE_CXXTESTGEN], [test -n "$CXXTESTGEN"])
223
224 AC_ARG_VAR(TEST_CPPFLAGS, [CXXFLAGS to use when testing (default=$CPPFLAGS)])
225 AC_ARG_VAR(TEST_CXXFLAGS, [CXXFLAGS to use when testing (default=$CXXFLAGS)])
226 AC_ARG_VAR(TEST_LDFLAGS, [LDFLAGS to use when testing (default=$LDFLAGS)])
227
228 if test -n "$CXXTEST"; then
229 AC_CHECK_PROG(PERL, perl, perl, [])
230 if test -z "$PERL"; then
231 AC_MSG_WARN([unit tests disabled, perl not found.])
232 CXXTESTGEN=
233 CXXTEST=
234 fi
235 fi
236
237 # Checks for libraries.
238 AC_CHECK_LIB(gmp, __gmpz_init, , [AC_MSG_ERROR([GNU MP not found, see http://gmplib.org/])])
239
240 # Checks for header files.
241 AC_CHECK_HEADERS([getopt.h unistd.h])
242
243 # Checks for typedefs, structures, and compiler characteristics.
244 AC_HEADER_STDBOOL
245 AC_TYPE_UINT16_T
246 AC_TYPE_UINT32_T
247 AC_TYPE_UINT64_T
248 AC_TYPE_SIZE_T
249
250 # Checks for library functions.
251
252 # Some definitions for config.h
253
254 # Prepare configure output
255
256 if test "$user_cppflags" = no; then
257 CPPFLAGS="$CVC4CPPFLAGS"
258 fi
259 if test "$user_cxxflags" = no; then
260 CXXFLAGS="$CVC4CXXFLAGS"
261 fi
262 if test "$user_ldflags" = no; then
263 LDFLAGS="$CVC4LDFLAGS"
264 fi
265
266 AC_CONFIG_FILES([
267 Makefile
268 contrib/Makefile
269 doc/Makefile
270 src/Makefile
271 src/expr/Makefile
272 src/smt/Makefile
273 src/main/Makefile
274 src/prop/minisat/Makefile
275 src/prop/Makefile
276 src/util/Makefile
277 src/context/Makefile
278 src/parser/Makefile
279 src/theory/Makefile
280 test/Makefile
281 test/regress/Makefile
282 test/unit/Makefile
283 ])
284
285 AC_OUTPUT
286
287 # Final information to the user
288
289 cat <<EOF
290
291 CVC4 $VERSION
292
293 Build profile: $with_build$non_standard
294 Optimized : $enable_optimized
295 Debug symbols: $enable_debug_symbols
296 Assertions : $enable_assertions
297 Tracing : $enable_tracing
298 Muzzle : $enable_muzzle
299 gcov support : $enable_coverage
300 gprof support: $enable_profiling
301
302 CPPFLAGS : $CPPFLAGS
303 CXXFLAGS : $CXXFLAGS
304 LDFLAGS : $LDFLAGS
305
306 Now just type make, followed by make check or make install, as you like.
307
308 You can use 'make <build_profile>' to reconfig/build a different profile.
309 Build profiles: production optimized default competition
310
311 EOF
312
313 if test "$user_cppflags" = yes; then
314 AC_MSG_WARN([])
315 AC_MSG_WARN([I won't override your CPPFLAGS setting. But some of your build options to configure may not be honored.])
316 AC_MSG_WARN([To support your options to configure, I would like to set CPPFLAGS to:])
317 AC_MSG_WARN([ $CVC4CPPFLAGS])
318 AC_MSG_WARN([])
319 fi
320 if test "$user_cxxflags" = yes; then
321 AC_MSG_WARN([])
322 AC_MSG_WARN([I won't override your CXXFLAGS setting. But some of your build options to configure may not be honored.])
323 AC_MSG_WARN([To support your options to configure, I would like to set CXXFLAGS to:])
324 AC_MSG_WARN([ $CVC4CXXFLAGS])
325 AC_MSG_WARN([])
326 fi
327 if test "$user_ldflags" = yes; then
328 AC_MSG_WARN([])
329 AC_MSG_WARN([I won't override your LDFLAGS setting. But some of your build options to configure may not be honored.])
330 AC_MSG_WARN([To support your options to configure, I would like to set LDFLAGS to:])
331 AC_MSG_WARN([ $CVC4LDFLAGS])
332 AC_MSG_WARN([])
333 fi
334
335 non_standard=
336 if test "$non_standard_build_profile" = yes; then
337 if test "$with_build" = default; then
338 with_build=custom
339 else
340 AC_MSG_WARN([])
341 AC_MSG_WARN([This is a non-standard $with_build build profile.])
342 AC_MSG_WARN([])
343 non_standard=-custom
344 fi
345 fi