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