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