1 | dnl # emacs edit mode for this file is -*- sh -*- |
---|
2 | dnl # $Id$ |
---|
3 | |
---|
4 | dnl # |
---|
5 | dnl # configure.in - process this file with `autoconf' to generate |
---|
6 | dnl # a `configure' script. |
---|
7 | dnl # |
---|
8 | dnl # See the `INSTALL' file for information on how the `configure' |
---|
9 | dnl # script works. |
---|
10 | dnl # |
---|
11 | |
---|
12 | # |
---|
13 | # - initialisation. |
---|
14 | # |
---|
15 | AC_INIT([factory], [3.1.2.sw]) |
---|
16 | AC_CONFIG_SRCDIR(canonicalform.cc) |
---|
17 | AC_CONFIG_MACRO_DIR([../m4]) |
---|
18 | AC_CONFIG_AUX_DIR([.]) |
---|
19 | AC_CONFIG_HEADER(config.h) |
---|
20 | AM_MAINTAINER_MODE |
---|
21 | AM_INIT_AUTOMAKE |
---|
22 | |
---|
23 | AC_PROG_YACC |
---|
24 | |
---|
25 | # |
---|
26 | # Do not change version here!!! |
---|
27 | # |
---|
28 | dnl # |
---|
29 | dnl # Change version here, do not believe the comment in the |
---|
30 | dnl # preceding lines. |
---|
31 | dnl # |
---|
32 | factory_version="3.1.3" |
---|
33 | factory_configuration="'$ac_configure_args' in `pwd`" |
---|
34 | |
---|
35 | # |
---|
36 | # - check withs and enables. |
---|
37 | # |
---|
38 | AC_ARG_WITH( |
---|
39 | Singular, |
---|
40 | [AS_HELP_STRING([--without-Singular],[build NOT for the use with CAS Singular.])], |
---|
41 | , |
---|
42 | [with_Singular=yes]) |
---|
43 | |
---|
44 | |
---|
45 | AC_ARG_WITH( |
---|
46 | omalloc, |
---|
47 | [AS_HELP_STRING([--with-omalloc],[build for use with omalloc])]) |
---|
48 | |
---|
49 | |
---|
50 | AC_ARG_ENABLE( |
---|
51 | cf-inline, |
---|
52 | [AS_HELP_STRING([--enable-cf-inline],[build Factory with \"configurable inline methods\" enabled.])], |
---|
53 | [enable_cf_inline=$enableval], |
---|
54 | [enable_cf_inline=no]) |
---|
55 | |
---|
56 | AC_ARG_ENABLE( |
---|
57 | streamio, |
---|
58 | [AS_HELP_STRING([--enable-streamio],[build Factory with stream IO])], |
---|
59 | , |
---|
60 | [enable_streamio=no]) |
---|
61 | |
---|
62 | AC_ARG_ENABLE( |
---|
63 | assertions, |
---|
64 | [AS_HELP_STRING([--enable-assertions],[build Factory with assertions activated])], |
---|
65 | , |
---|
66 | enable_assertions=no) |
---|
67 | |
---|
68 | AC_ARG_ENABLE( |
---|
69 | timing, |
---|
70 | [AS_HELP_STRING([--enable-timing],[build Factory so it will print timing information])], |
---|
71 | , |
---|
72 | enable_timing=no) |
---|
73 | |
---|
74 | AC_ARG_ENABLE( |
---|
75 | debugoutput, |
---|
76 | [AS_HELP_STRING([--enable-debugoutput],[build Factory so it will print debugging information])], |
---|
77 | , |
---|
78 | enable_debugoutput=no) |
---|
79 | |
---|
80 | # |
---|
81 | # - check for CC and CXX but be careful about CFLAGS. |
---|
82 | # |
---|
83 | test "${CFLAGS+set}" = set || cflags_expl_set=no |
---|
84 | AC_PROG_CC |
---|
85 | test "${CXXFLAGS+set}" = set || cxxflags_expl_set=no |
---|
86 | AC_PROG_CXX |
---|
87 | if test "x$GCC" != xyes && test "x$GXX" != xyes; then |
---|
88 | AC_MSG_WARN(you better use gcc to compile Factory) |
---|
89 | else |
---|
90 | if test "x$GXX" = xyes && test "x$cxxflags_expl_set" = xno; then |
---|
91 | AC_MSG_WARN([we use \`' as default for \`CXXFLAGS' |
---|
92 | (instead of the configure default \`-g -O')]) |
---|
93 | fi |
---|
94 | if test "x$GCC" = xyes && test "x$cflags_expl_set" = xno; then |
---|
95 | AC_MSG_WARN([we use \`' as default for \`CFLAGS' |
---|
96 | (instead of the configure default \`-g -O')]) |
---|
97 | fi |
---|
98 | fi |
---|
99 | |
---|
100 | # |
---|
101 | # - check for some other programs. |
---|
102 | # |
---|
103 | AC_PROG_CPP |
---|
104 | AC_PROG_CXXCPP |
---|
105 | AC_PROG_LN_S |
---|
106 | AC_PROG_INSTALL |
---|
107 | AC_PROG_RANLIB |
---|
108 | AC_PROG_MAKE_SET |
---|
109 | AC_CHECK_PROG(AR, ar, ar, where-is-your-ar) |
---|
110 | AC_CHECK_PROG(M4, m4, m4, where-is-your-m4) |
---|
111 | AC_CHECK_PROG(BISON, bison, bison, where-is-your-bison) |
---|
112 | DX_INIT_DOXYGEN($PACKAGE_NAME, MYDOXYGENCONFIG) |
---|
113 | |
---|
114 | # do not use `MKINSTALLDIRS' and `MAKEHEADER' since there may be |
---|
115 | # name clashes with other peoples configure scripts via |
---|
116 | # `config.cache'. Furthermore, we do not use cache at all to |
---|
117 | # avoid some nasty problems with our own development environment. |
---|
118 | unset ac_cv_path_FACTORY_MKINSTALLDIRS |
---|
119 | unset ac_cv_path_FACTORY_MAKEHEADER |
---|
120 | save_path="$PATH" |
---|
121 | PATH="$PATH:$srcdir/bin" |
---|
122 | AC_PATH_PROG(FACTORY_MKINSTALLDIRS, mkinstalldirs, -mkdir) |
---|
123 | PATH="$srcdir/bin:$save_path" |
---|
124 | AC_PATH_PROG(FACTORY_MAKEHEADER, makeheader) |
---|
125 | PATH="$save_path" |
---|
126 | |
---|
127 | # |
---|
128 | # - expand paths. |
---|
129 | # |
---|
130 | |
---|
131 | AC_MSG_CHECKING(and generating explicit install paths) |
---|
132 | |
---|
133 | # generate Makefile |
---|
134 | save_prefix="$prefix" |
---|
135 | save_exec_prefix="$exec_prefix" |
---|
136 | test "x$prefix" = xNONE && prefix=$ac_default_prefix |
---|
137 | test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' |
---|
138 | for dir in prefix exec_prefix bindir sbindir libexecdir \ |
---|
139 | datadir sysconfdir sharedstatedir localstatedir libdir \ |
---|
140 | includedir oldincludedir infodir mandir; do |
---|
141 | eval "dir_value=\$$dir" |
---|
142 | cat >> ./conftest.mk << EXPLPATHEOT |
---|
143 | $dir=$dir_value |
---|
144 | explicit_$dir: |
---|
145 | @ echo \$($dir) |
---|
146 | @ if echo \$($dir) | grep '^/'; \\ |
---|
147 | then echo \$($dir) > ./conftest.dir; \\ |
---|
148 | else echo \`pwd\`/\$($dir) > ./conftest.dir; fi |
---|
149 | EXPLPATHEOT |
---|
150 | done |
---|
151 | prefix="$save_prefix" |
---|
152 | exec_prefix="$save_exec_prefix" |
---|
153 | |
---|
154 | # generate the explicit paths |
---|
155 | make >&5 2>&1 -f ./conftest.mk explicit_datadir |
---|
156 | explicit_datadir=`cat ./conftest.dir` |
---|
157 | make >&5 2>&1 -f ./conftest.mk explicit_libdir |
---|
158 | explicit_libdir=`cat ./conftest.dir` |
---|
159 | make >&5 2>&1 -f ./conftest.mk explicit_includedir |
---|
160 | explicit_includedir=`cat ./conftest.dir` |
---|
161 | |
---|
162 | # clean up |
---|
163 | rm -f ./conftest.mk ./conftest.dir |
---|
164 | |
---|
165 | AC_MSG_RESULT(done) |
---|
166 | |
---|
167 | # |
---|
168 | # - check for libraries. |
---|
169 | # |
---|
170 | AC_CHECK_LIB(m, atof, , [ AC_MSG_ERROR(libm.a not found) ]) |
---|
171 | |
---|
172 | LB_CHECK_GMP(3.1.1,,AC_MSG_ERROR([Unable to find GMP on your machine: please use --with-gmp=PATH_TO_DIR_CONTAINING_LIB_AND_INCLUDE (see also ./configure --help if you do not understand what we are talking about)])) |
---|
173 | |
---|
174 | LB_CHECK_NTL(5.0,,AC_MSG_WARN([Unable to find NTL (which is strongly recommended) on your machine: please use --with-ntl=PATH_TO_DIR_CONTAINING_LIB_AND_INCLUDE (see also ./configure --help if you do not understand what we are talking about)])) |
---|
175 | |
---|
176 | # arithmetic shift |
---|
177 | #AC_MSG_CHECKING(whether your compiler does arithmetic shifts) |
---|
178 | #AC_CACHE_VAL(ac_cv_shift, |
---|
179 | # [ LDFLAGS="-L$explicit_libdir $LDFLAGS" |
---|
180 | # AC_TRY_RUN( |
---|
181 | # [ int main() { if (-2 >> 1 == -1) return(0); else return(1); } ], |
---|
182 | # ac_cv_shift=yes, ac_cv_shift=no, ac_cv_shift=yes) ]) |
---|
183 | #if test "x$ac_cv_shift" = xyes; then |
---|
184 | # AC_MSG_RESULT(yes) |
---|
185 | #else |
---|
186 | # AC_MSG_RESULT(no) |
---|
187 | #fi |
---|
188 | |
---|
189 | # |
---|
190 | # - check for header files. |
---|
191 | # |
---|
192 | AC_LANG_CPLUSPLUS |
---|
193 | |
---|
194 | AC_CHECK_HEADERS(stdio.h stdlib.h string.h time.h math.h, , |
---|
195 | [ AC_MSG_ERROR(C header files not found) ]) |
---|
196 | AC_CHECK_HEADERS(cstdio) |
---|
197 | |
---|
198 | if test "x$enable_streamio" != xno; then |
---|
199 | AC_CHECK_HEADERS(iostream.h strstream.h fstream.h iostream string fstream) |
---|
200 | AC_CHECK_HEADERS(ctype.h, , [ AC_MSG_ERROR(standard C header files not found) ]) |
---|
201 | |
---|
202 | # since the FTE will compile only with stream IO enabled we will not |
---|
203 | # check for the necessary header files if stream IO is disabled |
---|
204 | AC_CHECK_HEADERS(stdarg.h signal.h errno.h unistd.h, , |
---|
205 | [ AC_MSG_WARN(C/C++ header files not found. |
---|
206 | You will not be able to build the Factory Test Environment |
---|
207 | (though Factory itself should compile)) ]) |
---|
208 | fi |
---|
209 | |
---|
210 | if test "x$enable_timing" != xno; then |
---|
211 | AC_CHECK_HEADERS(sys/param.h sys/times.h, , |
---|
212 | [ AC_MSG_ERROR(\`sys/times.h' or \`sys/param.h' not found. Try |
---|
213 | \`configure --disable-timing') ]) |
---|
214 | fi |
---|
215 | |
---|
216 | AC_CHECK_HEADERS(omalloc.h,,) |
---|
217 | |
---|
218 | # font-lock-trick: ' |
---|
219 | |
---|
220 | # |
---|
221 | # - check for compiler characteristics. |
---|
222 | # |
---|
223 | |
---|
224 | # use C to check compiler characteristics instead of C++. On |
---|
225 | # nextstep, checking with C++ may fail. |
---|
226 | AC_LANG_C |
---|
227 | |
---|
228 | # cross-compiling ?! |
---|
229 | #AC_C_CROSS |
---|
230 | #if test "x$cross_compiling" = xyes; then |
---|
231 | # AC_MSG_WARN([you better specify a cache file to get the values for |
---|
232 | # cross-compiling right (e.g., call \`configure |
---|
233 | # --cache-file=yourTarget.cache'). In particular, you |
---|
234 | # should make sure that your target machine supports |
---|
235 | # arithmetic shift.]) |
---|
236 | #fi |
---|
237 | |
---|
238 | # font-lock-trick: ' |
---|
239 | |
---|
240 | # |
---|
241 | # - paths. |
---|
242 | # |
---|
243 | |
---|
244 | # note that Singular has its own mechanism to search the tables, |
---|
245 | # hence we do not need to mind it here |
---|
246 | gftabledir='${datadir}/factory/gftables' |
---|
247 | explicit_gftabledir="$explicit_datadir/gftables" |
---|
248 | |
---|
249 | # for installation of the templates |
---|
250 | templatedir='${includedir}/templates' |
---|
251 | |
---|
252 | # |
---|
253 | # - the name of the game and the targets to create. |
---|
254 | # |
---|
255 | if test "x$with_Singular" = xyes; then |
---|
256 | libfactory=libfactory.a |
---|
257 | |
---|
258 | factorysrc='$(basefactorysrc) $(singfactorysrc)' |
---|
259 | factoryincl='$(basefactoryincl) $(singfactoryincl)' |
---|
260 | |
---|
261 | alltargets=cf |
---|
262 | installtargets=installcf |
---|
263 | uninstalltargets=uninstallcf |
---|
264 | else |
---|
265 | libfactory=libcf.a |
---|
266 | |
---|
267 | factorysrc='$(basefactorysrc)' |
---|
268 | factoryincl='$(basefactoryincl)' |
---|
269 | |
---|
270 | alltargets=cf |
---|
271 | installtargets=installcf |
---|
272 | uninstalltargets=uninstallcf |
---|
273 | fi |
---|
274 | |
---|
275 | # |
---|
276 | # - set defines and variables according to our tests. |
---|
277 | # |
---|
278 | |
---|
279 | # CFLAGS |
---|
280 | if test "x$GCC" = xyes && test "x$cflags_expl_set" = xno; then |
---|
281 | CFLAGS="" |
---|
282 | fi |
---|
283 | |
---|
284 | # CXXFLAGS |
---|
285 | if test "x$GXX" = xyes && test "x$cxxflags_expl_set" = xno; then |
---|
286 | CXXFLAGS="" |
---|
287 | |
---|
288 | AC_LANG_SAVE |
---|
289 | AC_LANG_CPLUSPLUS |
---|
290 | # check whether CXX accepts -fno-rtti |
---|
291 | AC_MSG_CHECKING(whether gcc accepts -fno-rtti) |
---|
292 | tmp_flags=${CXXFLAGS} |
---|
293 | CXXFLAGS="${CXXFLAGS}" |
---|
294 | AC_CACHE_VAL(ac_cv_cxx_have_rtti, |
---|
295 | AC_TRY_COMPILE(,,ac_cv_cxx_have_rtti=yes,ac_cv_cxx_have_rtti=no) |
---|
296 | ) |
---|
297 | AC_MSG_RESULT(${ac_cv_cxx_have_rtti}) |
---|
298 | CXXFLAGS=$tmp_flags |
---|
299 | if test "${ac_cv_cxx_have_rtti}" = yes; then |
---|
300 | CXXFLAGS="$CXXFLAGS" |
---|
301 | fi |
---|
302 | |
---|
303 | AC_MSG_CHECKING(whether gcc accepts -fno-exceptions) |
---|
304 | tmp_flags=${CXXFLAGS} |
---|
305 | CXXFLAGS="${CXXFLAGS} -fno-exceptions" |
---|
306 | AC_CACHE_VAL(ac_cv_cxx_have_exceptions, |
---|
307 | AC_TRY_LINK(,,ac_cv_cxx_have_exceptions=yes,ac_cv_cxx_have_exceptions=no) |
---|
308 | ) |
---|
309 | AC_MSG_RESULT(${ac_cv_cxx_have_exceptions}) |
---|
310 | CXXFLAGS=$tmp_flags |
---|
311 | if test "${ac_cv_cxx_have_exceptions}" = yes; then |
---|
312 | CXXFLAGS="$CXXFLAGS -fno-exceptions" |
---|
313 | fi |
---|
314 | AC_LANG_RESTORE |
---|
315 | |
---|
316 | fi |
---|
317 | |
---|
318 | # ARFLAGS |
---|
319 | test "${ARFLAGS+set}" = set || ARFLAGS=cr |
---|
320 | |
---|
321 | # M4FLAGS |
---|
322 | test "${M4FLAGS+set}" = set || M4FLAGS= |
---|
323 | |
---|
324 | # Singular |
---|
325 | if test "x$with_Singular" = xyes; then |
---|
326 | AC_DEFINE([SINGULAR],[1],[SINGULAR]) |
---|
327 | AC_DEFINE([DISABLE_GMP_CPP],[1],[DISABLE_GMP_CPP]) |
---|
328 | AC_DEFINE([NOSTREAMIO],[1],[DISABLE_GMP_CPP]) |
---|
329 | fi |
---|
330 | |
---|
331 | # arithmetic shift |
---|
332 | #if test "x$ac_cv_shift" = xyes; then |
---|
333 | # AC_DEFINE([HAS_ARITHMETIC_SHIFT],[1],[HAS_ARITHMETIC_SHIFT]) |
---|
334 | #fi |
---|
335 | |
---|
336 | AC_MSG_CHECKING(whether to use omalloc) |
---|
337 | |
---|
338 | if test "$with_omalloc" = yes; then |
---|
339 | if test "$ac_cv_header_omalloc_h" != yes; then |
---|
340 | if test "$enable_omalloc" = yes; then |
---|
341 | warn_omalloc=yes |
---|
342 | else |
---|
343 | with_omalloc=no |
---|
344 | fi |
---|
345 | fi |
---|
346 | else |
---|
347 | if test "$with_omalloc" != no; then |
---|
348 | if test "$enable_omalloc" = yes; then |
---|
349 | if test "$ac_cv_header_omalloc_h" != yes; then |
---|
350 | warn_omalloc=yes |
---|
351 | fi |
---|
352 | with_omalloc=yes |
---|
353 | else |
---|
354 | with_omalloc=no |
---|
355 | fi |
---|
356 | fi |
---|
357 | fi |
---|
358 | if test "$with_omalloc" = yes; then |
---|
359 | AC_DEFINE([HAVE_OMALLOC],[1],[HAVE_OMALLOC]) |
---|
360 | fi |
---|
361 | AC_MSG_RESULT($with_omalloc) |
---|
362 | if test "$warn_omalloc" = yes; then |
---|
363 | AC_MSG_WARN(did not find omalloc.h -- install before compiling) |
---|
364 | fi |
---|
365 | |
---|
366 | |
---|
367 | # "configurable inline methods" |
---|
368 | if test "x$enable_cf_inline" != xno; then |
---|
369 | AC_DEFINE([CF_USE_INLINE],[1],[CF_USE_INLINE]) |
---|
370 | fi |
---|
371 | |
---|
372 | # iostream |
---|
373 | if test "x$enable_streamio" = xno; then |
---|
374 | AC_DEFINE([NOSTREAMIO],[1],[NOSTREAMIO]) |
---|
375 | else |
---|
376 | factorysrc="$factorysrc \$(useiofactorysrc)" |
---|
377 | factoryincl="$factoryincl \$(useiofactoryincl)" |
---|
378 | fi |
---|
379 | |
---|
380 | # assertions |
---|
381 | if test "x$enable_assertions" = xno; then |
---|
382 | AC_DEFINE([NOASSERT],[1],[NOASSERT]) |
---|
383 | fi |
---|
384 | |
---|
385 | # timing |
---|
386 | if test "x$enable_timing" != xno; then |
---|
387 | AC_DEFINE([TIMING],[1],[TIMING]) |
---|
388 | fi |
---|
389 | |
---|
390 | # debugoutput |
---|
391 | if test "x$enable_debugoutput" != xno; then |
---|
392 | AC_DEFINE([DEBUGOUTPUT],[1],[DEBUGOUTPUT]) |
---|
393 | fi |
---|
394 | |
---|
395 | # |
---|
396 | # - complete and substitute variables, defines. |
---|
397 | # |
---|
398 | AC_SUBST(gftabledir) |
---|
399 | AC_SUBST(templatedir) |
---|
400 | |
---|
401 | AC_SUBST(factory_version) |
---|
402 | |
---|
403 | AC_SUBST(libfactory) |
---|
404 | |
---|
405 | AC_SUBST(ARFLAGS) |
---|
406 | AC_SUBST(M4FLAGS) |
---|
407 | AC_SUBST(MAKEHEADERFLAGS) |
---|
408 | |
---|
409 | AC_SUBST(factorysrc) |
---|
410 | AC_SUBST(factoryincl) |
---|
411 | |
---|
412 | AC_SUBST(alltargets) |
---|
413 | AC_SUBST(installtargets) |
---|
414 | AC_SUBST(uninstalltargets) |
---|
415 | |
---|
416 | AC_DEFINE_UNQUOTED([FACTORYVERSION], "$factory_version", [FACTORYVERSION]) |
---|
417 | AC_DEFINE_UNQUOTED([FACTORYCONFIGURATION], "$factory_configuration", [FACTORYCONFIGURATION]) |
---|
418 | AC_DEFINE_UNQUOTED([GFTABLEDIR], "$explicit_gftabledir", [GFTABLEDIR]) |
---|
419 | |
---|
420 | AM_CONDITIONAL( |
---|
421 | [WITH_PARSER_FOR_CANONICAL_FORM], |
---|
422 | [test x$with_Singular != xyes && test x$enable_streamio != xno]) |
---|
423 | |
---|
424 | AC_CONFIG_FILES([Makefile ftest/GNUmakefile]) |
---|
425 | AC_OUTPUT |
---|
426 | |
---|