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