1 | dnl $Id: configure.in,v 1.8 1997-09-10 13:50:44 schmidt Exp $ |
---|
2 | |
---|
3 | dnl |
---|
4 | dnl configure.in - process this file with autoconf to generate |
---|
5 | dnl a configure script. |
---|
6 | dnl |
---|
7 | dnl See the INSTALL file for information on how the configure script |
---|
8 | dnl works. |
---|
9 | dnl |
---|
10 | |
---|
11 | # |
---|
12 | # - initialisation. |
---|
13 | # |
---|
14 | AC_REVISION($Id: configure.in,v 1.8 1997-09-10 13:50:44 schmidt Exp $) |
---|
15 | AC_INIT(canonicalform.cc) |
---|
16 | AC_CONFIG_HEADER(config.h) |
---|
17 | AC_CONFIG_AUX_DIR(bin) |
---|
18 | |
---|
19 | # |
---|
20 | # Do not change version here!!! |
---|
21 | # |
---|
22 | dnl |
---|
23 | dnl Change version here, do not believe the comment in the |
---|
24 | dnl preceding lines. |
---|
25 | dnl |
---|
26 | factory_version="1.3a" |
---|
27 | |
---|
28 | # |
---|
29 | # - check withs and enables. |
---|
30 | # |
---|
31 | AC_ARG_WITH( |
---|
32 | memman, |
---|
33 | [ --with-memman(=<memman>) specify Factory memory manager. |
---|
34 | <memman> is either 'old' (default), 'new', or 'no'.], |
---|
35 | , |
---|
36 | [ if test "x$with_Singular" = xyes; then |
---|
37 | with_memman=no |
---|
38 | else |
---|
39 | with_memman=old |
---|
40 | fi ]) |
---|
41 | |
---|
42 | AC_ARG_WITH( |
---|
43 | gmp, |
---|
44 | [ --with-gmp(=<gmp_inc_path>(,<gmp_lib_path>)) |
---|
45 | specify where to find gmp library.]) |
---|
46 | |
---|
47 | AC_ARG_WITH( |
---|
48 | Singular, |
---|
49 | [ --with-Singular build for use with computer algebra system Singular.], |
---|
50 | , |
---|
51 | with_Singular=no) |
---|
52 | |
---|
53 | AC_ARG_ENABLE( |
---|
54 | streamio, |
---|
55 | [ --disable-streamio build Factory without stream IO], |
---|
56 | , |
---|
57 | [ if test "x$with_Singular" = xyes; then |
---|
58 | enable_streamio=no |
---|
59 | else |
---|
60 | enable_streamio=yes |
---|
61 | fi ]) |
---|
62 | |
---|
63 | AC_ARG_ENABLE( |
---|
64 | memdebug, |
---|
65 | [ --enable-memdebug=<level> switch on memory management debugging. Meaningful |
---|
66 | with --with-memman=new only. <level> may be either |
---|
67 | 'no' (default), 'normal', or 'full'.], |
---|
68 | , |
---|
69 | enable_memdebug=no) |
---|
70 | |
---|
71 | AC_ARG_ENABLE( |
---|
72 | assertions, |
---|
73 | [ --enable-assertions build Factory with assertions activated], |
---|
74 | , |
---|
75 | enable_assertions=no) |
---|
76 | |
---|
77 | AC_ARG_ENABLE( |
---|
78 | timing, |
---|
79 | [ --enable-timing build Factory so it will print timing information], |
---|
80 | , |
---|
81 | enable_timing=no) |
---|
82 | |
---|
83 | AC_ARG_ENABLE( |
---|
84 | debugoutput, |
---|
85 | [ --enable-debugoutput build Factory so it will print debugging information], |
---|
86 | , |
---|
87 | enable_debugoutput=no) |
---|
88 | |
---|
89 | # an ugly tribute to Singular |
---|
90 | AC_ARG_ENABLE( |
---|
91 | gmp, |
---|
92 | [ --enable-gmp together with --with-Singular means: installation |
---|
93 | in process, be graceful when there is no gmp.h], |
---|
94 | [ if test "x$with_Singular" = xyes && test "x$enable_gmp" != xno; then |
---|
95 | with_gmp='$(includedir)' |
---|
96 | fi ]) |
---|
97 | |
---|
98 | # |
---|
99 | # - check the results of --with-gmp. |
---|
100 | # |
---|
101 | case "$with_gmp" in |
---|
102 | yes|no|"") |
---|
103 | gmp_in_installation=no ;; |
---|
104 | '$(includedir)'|'${includedir}') |
---|
105 | gmp_in_installation=yes ;; |
---|
106 | *,*) |
---|
107 | saveIFS="$IFS"; IFS="${IFS}," |
---|
108 | set dummy $with_gmp |
---|
109 | IFS="$saveIFS" |
---|
110 | CPPFLAGS="-I$2 $CPPFLAGS" |
---|
111 | LDFLAGS="-L$3 $LDFLAGS" |
---|
112 | gmp_in_installation=no ;; |
---|
113 | *) |
---|
114 | CPPFLAGS="-I$with_gmp $CPPFLAGS" |
---|
115 | LDFLAGS="-L$with_gmp/../lib $LDFLAGS" |
---|
116 | gmp_in_installation=no ;; |
---|
117 | esac |
---|
118 | |
---|
119 | # |
---|
120 | # - check for CC and CXX but be careful about CFLAGS. |
---|
121 | # |
---|
122 | test "${CFLAGS+set}" = set || cflags_expl_set=no |
---|
123 | AC_PROG_CC |
---|
124 | test "${CXXFLAGS+set}" = set || cxxflags_expl_set=no |
---|
125 | AC_PROG_CXX |
---|
126 | if test "x$GCC" != xyes && test "x$GXX" != xyes; then |
---|
127 | AC_MSG_WARN(you better use gcc to compile Factory) |
---|
128 | else |
---|
129 | if test "x$GXX" = xyes && test "x$cxxflags_expl_set" = xno; then |
---|
130 | AC_MSG_WARN([we will use '-O2 -fomit-frame-pointer' as default for CXXFLAGS |
---|
131 | (instead of the configure default '-g -O')]) |
---|
132 | fi |
---|
133 | if test "x$GCC" = xyes && test "x$cflags_expl_set" = xno; then |
---|
134 | AC_MSG_WARN([we will use '-O2 -fomit-frame-pointer' as default for CFLAGS |
---|
135 | (instead of the configure default '-g -O')]) |
---|
136 | fi |
---|
137 | fi |
---|
138 | |
---|
139 | # |
---|
140 | # - check for some other programs. |
---|
141 | # |
---|
142 | AC_PROG_CPP |
---|
143 | AC_PROG_CXXCPP |
---|
144 | AC_PROG_INSTALL |
---|
145 | AC_PROG_RANLIB |
---|
146 | AC_PROG_MAKE_SET |
---|
147 | AC_CHECK_PROG(AR, ar, ar, where-is-your-ar) |
---|
148 | AC_CHECK_PROG(BISON, bison, bison, where-is-your-bison) |
---|
149 | |
---|
150 | # get absolute path of srcdir to avoid some funny problems when |
---|
151 | # feeding our results to other peoples configure via cache |
---|
152 | if echo "$srcdir" | grep '^/' > /dev/null 2> /dev/null; then |
---|
153 | abssrcdir="$srcdir" |
---|
154 | else |
---|
155 | abssrcdir="`pwd`/$srcdir" |
---|
156 | fi |
---|
157 | AC_PATH_PROG(MKINSTALLDIRS, mkinstalldirs, -mkdir, $PATH:$abssrcdir/bin) |
---|
158 | AC_PATH_PROG(MAKEHEADER, makeheader, , $abssrcdir/bin:$PATH) |
---|
159 | |
---|
160 | # |
---|
161 | # - check for libraries. |
---|
162 | # |
---|
163 | if test "x$gmp_in_installation" != xyes; then |
---|
164 | AC_CHECK_LIB(gmp, mpz_init) |
---|
165 | fi |
---|
166 | AC_CHECK_LIB(m, sqrt) |
---|
167 | |
---|
168 | # |
---|
169 | # - check for header files. |
---|
170 | # |
---|
171 | AC_LANG_CPLUSPLUS |
---|
172 | |
---|
173 | if test "x$gmp_in_installation" != xyes; then |
---|
174 | AC_CHECK_HEADERS(gmp.h, , |
---|
175 | [ AC_MSG_ERROR(gmp.h not found. Use option --with-gmp to specify path) ]) |
---|
176 | fi |
---|
177 | |
---|
178 | AC_CHECK_HEADERS(stdio.h stdlib.h string.h time.h math.h, , |
---|
179 | [ AC_MSG_ERROR(standard C header files not found) ]) |
---|
180 | |
---|
181 | if test "x$enable_streamio" != xno; then |
---|
182 | AC_CHECK_HEADERS(iostream.h strstream.h fstream.h, , |
---|
183 | [ AC_MSG_ERROR(C++ header files not found) ]) |
---|
184 | AC_CHECK_HEADERS(ctype.h, , [ AC_MSG_ERROR(standard C header files not found) ]) |
---|
185 | fi |
---|
186 | |
---|
187 | if test "x$enable_timing" != xno; then |
---|
188 | AC_CHECK_HEADERS(sys/param.h sys/times.h, , |
---|
189 | [ AC_MSG_ERROR(sys/times.h or sys/param.h not found. Try |
---|
190 | configure --disable-timing) ]) |
---|
191 | fi |
---|
192 | |
---|
193 | # |
---|
194 | # - check for compiler characteristics. |
---|
195 | # |
---|
196 | |
---|
197 | # use C to check compiler characteristics instead of C++. On |
---|
198 | # nextstep, checking with C++ may fail. |
---|
199 | AC_LANG_C |
---|
200 | |
---|
201 | # cross-compiling ?! |
---|
202 | AC_C_CROSS |
---|
203 | if test "x$cross_compiling" = xyes; then |
---|
204 | AC_MSG_WARN([you better specify a cache file to get the values for |
---|
205 | cross-compiling right (call configure --cache-file=target.cache)]) |
---|
206 | fi |
---|
207 | |
---|
208 | AC_C_CONST |
---|
209 | AC_C_INLINE |
---|
210 | |
---|
211 | # arithmetic shift |
---|
212 | AC_MSG_CHECKING(whether your compiler does arithmetic shifts) |
---|
213 | AC_CACHE_VAL(ac_cv_shift, |
---|
214 | [ AC_TRY_RUN( |
---|
215 | [ int main() { if (-2 >> 1 == -1) exit(0); else exit(1); } ], |
---|
216 | ac_cv_shift=yes, ac_cv_shift=no, ac_cv_shift=no) ]) |
---|
217 | if test "x$ac_cv_shift" = xyes; then |
---|
218 | AC_MSG_RESULT(yes) |
---|
219 | else |
---|
220 | AC_MSG_RESULT(no) |
---|
221 | fi |
---|
222 | |
---|
223 | # |
---|
224 | # - paths. |
---|
225 | # |
---|
226 | |
---|
227 | # we have to get datadir explicitely for config.h |
---|
228 | save_prefix="$prefix" |
---|
229 | test "x$prefix" = xNONE && prefix="$ac_default_prefix" |
---|
230 | expl_datadir=`eval echo "$datadir"` |
---|
231 | prefix="$save_prefix" |
---|
232 | # get absolute path of expl_datadir |
---|
233 | if echo "$expl_datadir" | grep -v '^/' > /dev/null 2> /dev/null; then |
---|
234 | expl_datadir="`pwd`/$expl_datadir" |
---|
235 | fi |
---|
236 | |
---|
237 | if test "x$with_Singular" = xyes; then |
---|
238 | gftabledir='${datadir}/Singular/gftables' |
---|
239 | expl_gftabledir="$expl_datadir/Singular/gftables" |
---|
240 | templatedir='${includedir}/templates' |
---|
241 | else |
---|
242 | gftabledir='${datadir}/factory/gftables' |
---|
243 | expl_gftabledir="$expl_datadir/factory/gftables" |
---|
244 | templatedir='${includedir}/templates' |
---|
245 | fi |
---|
246 | |
---|
247 | # |
---|
248 | # - the name of the game and the targets to create. |
---|
249 | # |
---|
250 | if test "x$with_Singular" = xyes; then |
---|
251 | libfactory=libsingcf.a |
---|
252 | |
---|
253 | factorysrc='$(basefactorysrc) $(singfactorysrc)' |
---|
254 | factoryincl='$(basefactoryincl) $(singfactoryincl)' |
---|
255 | memmansrc= |
---|
256 | memmanincl= |
---|
257 | |
---|
258 | alltargets=cf |
---|
259 | installtargets=installcf |
---|
260 | uninstalltargets=uninstallcf |
---|
261 | else |
---|
262 | libfactory=libcf.a |
---|
263 | |
---|
264 | factorysrc='$(basefactorysrc)' |
---|
265 | factoryincl='$(basefactoryincl)' |
---|
266 | memmansrc='$(basememmansrc)' |
---|
267 | memmanincl= |
---|
268 | |
---|
269 | alltargets=cf |
---|
270 | installtargets=installcf |
---|
271 | uninstalltargets=uninstallcf |
---|
272 | fi |
---|
273 | |
---|
274 | # |
---|
275 | # - set defines and variables according to our tests. |
---|
276 | # |
---|
277 | |
---|
278 | # CFLAGS |
---|
279 | if test "x$GCC" = xyes && test "x$cflags_expl_set" = xno; then |
---|
280 | CFLAGS="-O2 -fomit-frame-pointer" |
---|
281 | fi |
---|
282 | |
---|
283 | # CXXFLAGS |
---|
284 | if test "x$GXX" = xyes && test "x$cxxflags_expl_set" = xno; then |
---|
285 | CXXFLAGS="-O2 -fomit-frame-pointer" |
---|
286 | fi |
---|
287 | |
---|
288 | # ARFLAGS |
---|
289 | test "${ARFLAGS+set}" = set || ARFLAGS=cr |
---|
290 | |
---|
291 | # Singular |
---|
292 | if test "x$with_Singular" = xyes; then |
---|
293 | AC_DEFINE(SINGULAR) |
---|
294 | fi |
---|
295 | |
---|
296 | # arithmetic shift |
---|
297 | if test "x$ac_cv_shift" = xyes; then |
---|
298 | AC_DEFINE(HAS_ARITHMETIC_SHIFT) |
---|
299 | fi |
---|
300 | |
---|
301 | # gmp-stuff. we must not set these flags before the tests |
---|
302 | # are finished! |
---|
303 | if test "x$gmp_in_installation" = xyes; then |
---|
304 | CPPFLAGS="-I\$(includedir) $CPPFLAGS" |
---|
305 | LDFLAGS="-L\$(libdir) -lgmp $LDFLAGS" |
---|
306 | fi |
---|
307 | |
---|
308 | # memory manager |
---|
309 | if test "x$with_memman" != xno; then |
---|
310 | alltargets="$alltargets mem" |
---|
311 | installtargets="$installtargets installmem" |
---|
312 | uninstalltargets="$uninstalltargets uninstallmem" |
---|
313 | AC_DEFINE(USE_MEMUTIL) |
---|
314 | |
---|
315 | if test "x$with_memman" != xnew; then |
---|
316 | memmansrc="$memmansrc \$(oldmemmansrc)" |
---|
317 | memmanincl='$(oldmemmanincl)' |
---|
318 | AC_DEFINE(USE_OLD_MEMMAN) |
---|
319 | else |
---|
320 | memmansrc="$memmansrc \$(newmemmansrc)" |
---|
321 | memmanincl='$(newmemmanincl)' |
---|
322 | |
---|
323 | if test "x$enable_memdebug" = xfull; then |
---|
324 | AC_DEFINE(MDEBUG, 1) |
---|
325 | elif test "x$enable_memdebug" != xno; then |
---|
326 | AC_DEFINE(MDEBUG, 0) |
---|
327 | fi |
---|
328 | fi |
---|
329 | fi |
---|
330 | |
---|
331 | # iostream |
---|
332 | if test "x$enable_streamio" = xno; then |
---|
333 | AC_DEFINE(NOSTREAMIO) |
---|
334 | else |
---|
335 | factorysrc="$factorysrc \$(useiofactorysrc)" |
---|
336 | factoryincl="$factoryincl \$(useiofactoryincl)" |
---|
337 | fi |
---|
338 | |
---|
339 | # assertions |
---|
340 | if test "x$enable_assertions" = xno; then |
---|
341 | AC_DEFINE(NOASSERT) |
---|
342 | fi |
---|
343 | |
---|
344 | # |
---|
345 | # - debugoutput and timing magic. |
---|
346 | # |
---|
347 | # For those who do not like this: As long as you do not specify |
---|
348 | # --enable-timing or --enable-debugoutput the following code will |
---|
349 | # not be executed. |
---|
350 | # |
---|
351 | timingtargets=/dev/null |
---|
352 | debouttargets=/dev/null |
---|
353 | debtimingtargets=/dev/null |
---|
354 | enhanceddebtime=no |
---|
355 | |
---|
356 | # timing |
---|
357 | if test "x$enable_timing" != xno; then |
---|
358 | if test "x$enable_timing" = xyes; then |
---|
359 | AC_DEFINE(TIMING) |
---|
360 | else |
---|
361 | echo "$enable_timing" | tr ',' '\n' | sed 's/\..*$//' | sort > conftest.time |
---|
362 | timingtargets=conftest.time |
---|
363 | enhanceddebtime=yes |
---|
364 | fi |
---|
365 | fi |
---|
366 | |
---|
367 | # debugoutput |
---|
368 | if test "x$enable_debugoutput" != xno; then |
---|
369 | if test "x$enable_debugoutput" = xyes; then |
---|
370 | AC_DEFINE(DEBUGOUTPUT) |
---|
371 | else |
---|
372 | echo "$enable_debugoutput" | tr ',' '\n' | sed 's/\..*$//' | sort > conftest.debout |
---|
373 | debouttargets=conftest.debout |
---|
374 | enhanceddebtime=yes |
---|
375 | fi |
---|
376 | fi |
---|
377 | |
---|
378 | # create makefile fragments |
---|
379 | if test "x$enhanceddebtime" = xyes; then |
---|
380 | # get the intersection of timingtargets and debouttargets |
---|
381 | sort "$timingtargets" "$debouttargets" | uniq -d > conftest.debtime |
---|
382 | if test -s conftest.debtime; then |
---|
383 | debtimingtargets=conftest.debtime |
---|
384 | fi |
---|
385 | if test "x$timingtargets" != x/dev/null; then |
---|
386 | # get difference of timingtargets and debtimingtargets |
---|
387 | sort "$timingtargets" "$debtimingtargets" | uniq -u | |
---|
388 | while read line; do |
---|
389 | echo "$line.o: $line.cc config.h;" '$(CXX) -c $< -DTIMING $(LIBCXXFLAGS) -o $@' |
---|
390 | done > conftest.tmp |
---|
391 | mv conftest.tmp "$timingtargets" |
---|
392 | fi |
---|
393 | if test "x$debouttargets" != x/dev/null; then |
---|
394 | # get difference of debouttargets and debtimingtargets |
---|
395 | sort "$debouttargets" "$debtimingtargets" | uniq -u | |
---|
396 | while read line; do |
---|
397 | echo "$line.o: $line.cc config.h;" '$(CXX) -c $< -DDEBUGOUTPUT $(LIBCXXFLAGS) -o $@' |
---|
398 | done > conftest.tmp |
---|
399 | mv conftest.tmp "$debouttargets" |
---|
400 | fi |
---|
401 | if test "x$debtimingtargets" != x/dev/null; then |
---|
402 | while read line; do |
---|
403 | echo "$line.o: $line.cc config.h;" '$(CXX) -c $< -DTIMING -DDEBUGOUTPUT $(LIBCXXFLAGS) -o $@' |
---|
404 | done < "$debtimingtargets" > conftest.tmp |
---|
405 | mv conftest.tmp "$debtimingtargets" |
---|
406 | fi |
---|
407 | fi |
---|
408 | |
---|
409 | # |
---|
410 | # - complete and substitute variables, defines. |
---|
411 | # |
---|
412 | AC_SUBST(gftabledir) |
---|
413 | AC_SUBST(templatedir) |
---|
414 | |
---|
415 | AC_SUBST(factory_version) |
---|
416 | |
---|
417 | AC_SUBST(libfactory) |
---|
418 | |
---|
419 | AC_SUBST(ARFLAGS) |
---|
420 | AC_SUBST(MAKEHEADERFLAGS) |
---|
421 | |
---|
422 | AC_SUBST(factorysrc) |
---|
423 | AC_SUBST(factoryincl) |
---|
424 | AC_SUBST(memmansrc) |
---|
425 | AC_SUBST(memmanincl) |
---|
426 | |
---|
427 | AC_SUBST(alltargets) |
---|
428 | AC_SUBST(installtargets) |
---|
429 | AC_SUBST(uninstalltargets) |
---|
430 | |
---|
431 | AC_SUBST_FILE(timingtargets) |
---|
432 | AC_SUBST_FILE(debouttargets) |
---|
433 | AC_SUBST_FILE(debtimingtargets) |
---|
434 | |
---|
435 | AC_DEFINE_UNQUOTED(FACTORYVERSION, "$factory_version") |
---|
436 | AC_DEFINE_UNQUOTED(GFTABLEDIR, "$expl_gftabledir") |
---|
437 | |
---|
438 | AC_OUTPUT(GNUmakefile) |
---|