1 | dnl Process this file with autoconf to produce a configure script. |
---|
2 | AC_INIT(matpol.h) |
---|
3 | AC_CONFIG_HEADER(mod2.h) |
---|
4 | |
---|
5 | dnl |
---|
6 | dnl set the version here |
---|
7 | dnl |
---|
8 | SINGULAR_MAJOR_VERSION=1 |
---|
9 | SINGULAR_MINOR_VERSION=1 |
---|
10 | SINGULAR_SUB_VERSION=0 |
---|
11 | VERSION_DATE="June 1997" |
---|
12 | AC_SUBST(SINGULAR_MAJOR_VERSION) |
---|
13 | AC_SUBST(SINGULAR_MINOR_VERSION) |
---|
14 | AC_SUBST(SINGULAR_SUB_VERSION) |
---|
15 | AC_DEFINE_UNQUOTED(SINGULAR_MAJOR_VERSION, ${SINGULAR_MAJOR_VERSION}) |
---|
16 | AC_DEFINE_UNQUOTED(SINGULAR_MINOR_VERSION, ${SINGULAR_MINOR_VERSION}) |
---|
17 | AC_DEFINE_UNQUOTED(S_VERSION1, "version: ${SINGULAR_MAJOR_VERSION}.${SINGULAR_MINOR_VERSION}.${SINGULAR_SUB_VERSION}") |
---|
18 | AC_DEFINE_UNQUOTED(S_VERSION2, "${VERSION_DATE}") |
---|
19 | |
---|
20 | dnl |
---|
21 | dnl paths stuff |
---|
22 | dnl |
---|
23 | AC_PREFIX_DEFAULT(`pwd`/..) |
---|
24 | |
---|
25 | dnl |
---|
26 | if test "x$datadir" = 'x${prefix}/share'; then |
---|
27 | if test "x${prefix}" = xNONE; then |
---|
28 | singulardatadir=${ac_default_prefix}/share/Singular; |
---|
29 | else |
---|
30 | singulardatadir=${prefix}/share/Singular; |
---|
31 | fi |
---|
32 | else |
---|
33 | singulardatadir=${datadir}/Singular; |
---|
34 | fi |
---|
35 | |
---|
36 | if test "x$infodir" = 'x${prefix}/info'; then |
---|
37 | if test "x${prefix}" = xNONE; then |
---|
38 | singularinfodir=${ac_default_prefix}/info; |
---|
39 | else |
---|
40 | singularinfodir=${prefix}/info; |
---|
41 | fi |
---|
42 | else |
---|
43 | singularinfodir=$infodir; |
---|
44 | fi |
---|
45 | AC_DEFINE_UNQUOTED(SINGULAR_DATADIR, "${singulardatadir}") |
---|
46 | AC_DEFINE_UNQUOTED(SINGULAR_INFODIR, "${singularinfodir}") |
---|
47 | |
---|
48 | AC_SUBST(singulardatadir) |
---|
49 | |
---|
50 | dnl |
---|
51 | dnl Checks for programs. |
---|
52 | dnl |
---|
53 | |
---|
54 | dnl compiler stuff |
---|
55 | dnl we do not want to have "-g -O" for CFLAGS |
---|
56 | if test "${CXXFLAGS+set}" != set; then |
---|
57 | ac_cxxflags_set=no |
---|
58 | CXXFLAGS="-O" |
---|
59 | fi |
---|
60 | if test "${CFLAGS+set}" != set; then |
---|
61 | CFLAGS="-O" |
---|
62 | ac_cflags_set=no |
---|
63 | fi |
---|
64 | |
---|
65 | AC_PROG_CC |
---|
66 | AC_PROG_CPP |
---|
67 | AC_PROG_CXX |
---|
68 | AC_SET_MAKE |
---|
69 | |
---|
70 | dnl we prefer using gcc for compiling C++ files |
---|
71 | if test ${GXX} = yes; then |
---|
72 | CXX=gcc |
---|
73 | fi |
---|
74 | |
---|
75 | dnl and add to -I to CPPFLAGS and and -Lto LDFLAGS, just to be sure |
---|
76 | if test "$libdir" = '${exec_prefix}/lib'; then |
---|
77 | if test "x$exec_prefix" = xNONE; then |
---|
78 | if test "x$prefix" = xNONE; then |
---|
79 | LDFLAGS="-L${ac_default_prefix}/lib ${LDFLAGS}" |
---|
80 | else |
---|
81 | LDFLAGS="-L${prefix}/lib ${LDFLAGS}" |
---|
82 | fi |
---|
83 | else |
---|
84 | LDFLAGS="-L${exec_prefix}/lib ${LDFLAGS}" |
---|
85 | fi |
---|
86 | else |
---|
87 | LDFLAGS="-L${libdir} ${LDFLAGS}" |
---|
88 | fi |
---|
89 | |
---|
90 | if test "$includedir" = '${prefix}/include'; then |
---|
91 | if test "x$prefix" = xNONE; then |
---|
92 | CPPFLAGS="-I${ac_default_prefix}/include ${CPPFLAGS}" |
---|
93 | else |
---|
94 | CPPFLAGS="-I${prefix}/include ${CPPFLAGS}" |
---|
95 | fi |
---|
96 | else |
---|
97 | CPPFLAGS="-I${includedir} ${CPPFLAGS}" |
---|
98 | fi |
---|
99 | |
---|
100 | dnl programs to built the grammar/parser |
---|
101 | dnl check for info |
---|
102 | if test "$with_info" != no; then |
---|
103 | AC_CHECK_PROG(INFO, info, info) |
---|
104 | if test -n "$INFO"; then |
---|
105 | AC_DEFINE(HAVE_INFO) |
---|
106 | fi |
---|
107 | fi |
---|
108 | |
---|
109 | |
---|
110 | dnl |
---|
111 | dnl CHECK --without arguments |
---|
112 | dnl |
---|
113 | AC_ARG_WITH( |
---|
114 | readline, |
---|
115 | [ --without-readline do not use readline for fancy display]) |
---|
116 | |
---|
117 | AC_ARG_WITH( |
---|
118 | gmp, |
---|
119 | [ --without-gmp do not use gmp library]) |
---|
120 | |
---|
121 | AC_ARG_WITH( |
---|
122 | MP, |
---|
123 | [ --without-MP do not use MP (disables MP links)]) |
---|
124 | |
---|
125 | AC_ARG_WITH( |
---|
126 | dbm, |
---|
127 | [ --without-dbm do not use dbm (disables DBM links)]) |
---|
128 | AC_ARG_WITH( |
---|
129 | info, |
---|
130 | [ --without-info do not use info for help (use buildin help, instead)]) |
---|
131 | AC_ARG_WITH( |
---|
132 | dld, |
---|
133 | [ --without-dld do not use dld (disables dynamic linking)]) |
---|
134 | |
---|
135 | AC_ARG_WITH( |
---|
136 | factory, |
---|
137 | [ --without-factory do not use factory (disables poly factorization)]) |
---|
138 | |
---|
139 | AC_ARG_WITH( |
---|
140 | libfac, |
---|
141 | [ --without-libfac do not use libfac (disables primary decompositions)]) |
---|
142 | |
---|
143 | dnl without info ! |
---|
144 | |
---|
145 | dnl |
---|
146 | dnl CHECK VARIOUS LIBRARIES |
---|
147 | dnl for gmp, MP, factory and libfac, we built them in, even if the libs |
---|
148 | dnl and headers were not found under the condition that the respective |
---|
149 | dnl --enable argument was given |
---|
150 | dnl |
---|
151 | |
---|
152 | AC_CHECK_LIB(m, atof) |
---|
153 | AC_CHECK_LIB(bsd, socket) |
---|
154 | AC_CHECK_LIB(socket, listen) |
---|
155 | AC_CHECK_LIB(nsl, gethostbyname) |
---|
156 | |
---|
157 | dnl Check -lreadline |
---|
158 | if test "$with_readline" != no; then |
---|
159 | AC_CHECK_LIB(ncurses,tgetent,,\ |
---|
160 | AC_CHECK_LIB(curses,tgetent,,\ |
---|
161 | AC_CHECK_LIB(termcap,tgetent))) |
---|
162 | AC_CHECK_LIB(readline, rl_abort) |
---|
163 | if test "$ac_cv_lib_readline_rl_abort" = yes; then |
---|
164 | AC_CHECK_HEADERS(readline/readline.h readline/history.h sys/file.h,ac_readline_ok=yes,ac_readline_ok=no; break) |
---|
165 | fi |
---|
166 | if test "$ac_readline_ok" = yes; then |
---|
167 | AC_DEFINE(HAVE_READLINE) |
---|
168 | else |
---|
169 | AC_MSG_WARN(building without readline: disabling fancy display); |
---|
170 | AC_DEFINE(HAVE_FEREAD) |
---|
171 | fi |
---|
172 | else |
---|
173 | AC_DEFINE(HAVE_FEREAD) |
---|
174 | fi |
---|
175 | |
---|
176 | dnl Check dbm |
---|
177 | if test "$with_dbm" != no; then |
---|
178 | AC_CHECK_LIB( |
---|
179 | dbm, |
---|
180 | dbminit, |
---|
181 | AC_DEFINE(HAVE_DBM) LIBS="-ldbm $LIBS", |
---|
182 | AC_CHECK_LIB( |
---|
183 | gdbm, |
---|
184 | dbminit, |
---|
185 | AC_DEFINE(HAVE_DBM) LIBS="-lgdbm $LIBS", |
---|
186 | AC_MSG_WARN(building without dbm: disabling DBM links))) |
---|
187 | fi |
---|
188 | |
---|
189 | dnl Check dld |
---|
190 | if test "$with_dld" = yes; then |
---|
191 | AC_CHECK_LIB(dld, dld_init,\ |
---|
192 | AC_MSG_WARN(building without dld: disabling dynamic linking)) |
---|
193 | fi |
---|
194 | |
---|
195 | NEED_LIBS=$LIBS |
---|
196 | |
---|
197 | dnl Check gmp |
---|
198 | if test "$with_builtingmp" = yes; then |
---|
199 | AC_DEFINE(HAVE_BUILTIN_GMP) |
---|
200 | AC_DEFINE(HAVE_GMP) |
---|
201 | ac_gmp_ok=yes |
---|
202 | elif test "$with_gmp" != no; then |
---|
203 | AC_CHECK_LIB(gmp, mpz_init) |
---|
204 | AC_CHECK_HEADER(gmp.h) |
---|
205 | if test "$ac_cv_lib_gmp_mpz_init" = yes && \ |
---|
206 | test "$ac_cv_header_gmp_h" = yes; then |
---|
207 | AC_DEFINE(HAVE_GMP) |
---|
208 | NEED_LIBS="-lgmp ${NEED_LIBS}" |
---|
209 | ac_gmp_ok=yes |
---|
210 | elif test "$enable_gmp" = yes; then |
---|
211 | AC_DEFINE(HAVE_GMP) |
---|
212 | NEED_LIBS="-lgmp ${NEED_LIBS}" |
---|
213 | ac_gmp_ok=yes |
---|
214 | AC_MSG_WARN(install gmp before making Singular or configure --without-gmp) |
---|
215 | else |
---|
216 | AC_MSG_WARN(building without gmp: using build-in rational arithmetic) |
---|
217 | fi |
---|
218 | fi |
---|
219 | |
---|
220 | dnl Check MP |
---|
221 | WITH_MP=no |
---|
222 | if test "$with_MP" != no; then |
---|
223 | if test "$ac_gmp_ok" != yes; then |
---|
224 | AC_MSG_WARN(building without MP: can not use MP without gmp) |
---|
225 | else |
---|
226 | if test "$ac_cv_lib_gmp_mpz_init"=yes; then |
---|
227 | AC_CHECK_LIB(MP, IMP_PutGmpInt) |
---|
228 | AC_CHECK_LIB(MPT, MPT_GetTree) |
---|
229 | fi |
---|
230 | AC_CHECK_HEADERS(MP.h MPT.h) |
---|
231 | if test "$ac_cv_lib_MPT_MPT_GetTree" = yes && \ |
---|
232 | test "$ac_cv_header_MP_h" = yes && \ |
---|
233 | test "$ac_cv_lib_MP_IMP_PutGmpInt" = yes && \ |
---|
234 | test "$ac_cv_header_MPT_h" = yes; then |
---|
235 | AC_DEFINE(HAVE_MPSR) |
---|
236 | NEED_LIBS="-lMPT -lMP ${NEED_LIBS}" |
---|
237 | WITH_MP=yes |
---|
238 | elif test "$enable_MP" = yes; then |
---|
239 | AC_DEFINE(HAVE_MPSR) |
---|
240 | NEED_LIBS="-lMPT -lMP ${NEED_LIBS}" |
---|
241 | WITH_MP=yes |
---|
242 | AC_MSG_WARN(install MP before making Singular or configure --without-MP) |
---|
243 | else |
---|
244 | AC_MSG_WARN(building without MP: disabling MP links) |
---|
245 | fi |
---|
246 | fi |
---|
247 | fi |
---|
248 | AC_SUBST(WITH_MP) |
---|
249 | |
---|
250 | dnl Check factory |
---|
251 | WITH_FACTORY=no |
---|
252 | if test "$with_factory" != no; then |
---|
253 | if test "$ac_gmp_ok" != yes; then |
---|
254 | AC_MSG_WARN(building without factory: can not use factory without gmp) |
---|
255 | else |
---|
256 | if test "$ac_cv_lib_gmp_mpz_init"=yes;then |
---|
257 | AC_CHECK_LIB(singcf,atof) |
---|
258 | fi |
---|
259 | AC_CHECK_HEADERS(factory.h) |
---|
260 | if test "$ac_cv_lib_singcf_atof" = yes && \ |
---|
261 | test "$ac_cv_header_factory_h" = yes; then |
---|
262 | AC_DEFINE(HAVE_FACTORY) |
---|
263 | NEED_LIBS="-lsingcf ${NEED_LIBS}" |
---|
264 | WITH_FACTORY=yes |
---|
265 | elif test "$enable_factory" = yes; then |
---|
266 | NEED_LIBS="-lsingcf ${NEED_LIBS}" |
---|
267 | AC_DEFINE(HAVE_FACTORY) |
---|
268 | WITH_FACTORY=yes |
---|
269 | AC_MSG_WARN(install factory before making Singular or configure --without-factory) |
---|
270 | else |
---|
271 | AC_MSG_WARN(building without factory: disabling poly factorization) |
---|
272 | fi |
---|
273 | fi |
---|
274 | fi |
---|
275 | AC_SUBST(WITH_FACTORY) |
---|
276 | |
---|
277 | dnl Check libfac |
---|
278 | WITH_LIBFAC=no |
---|
279 | if test "$with_libfac" != no; then |
---|
280 | if test "${WITH_FACTORY}" != yes; then |
---|
281 | AC_MSG_WARN(building without libfac: can not use libfac without factory) |
---|
282 | else |
---|
283 | if test "$ac_cv_lib_singcf_atof" = yes; then |
---|
284 | AC_CHECK_LIB(singfac,atof) |
---|
285 | fi |
---|
286 | AC_CHECK_HEADERS(factor.h) |
---|
287 | if test "$ac_cv_lib_singfac_atof" = yes && \ |
---|
288 | test "$ac_cv_header_factor_h" = yes; then |
---|
289 | NEED_LIBS="-lsingfac ${NEED_LIBS}" |
---|
290 | AC_DEFINE(HAVE_LIBFAC_P) |
---|
291 | WITH_LIBFAC=yes |
---|
292 | elif test "$enable_libfac" = yes; then |
---|
293 | NEED_LIBS="-lsingfac ${NEED_LIBS}" |
---|
294 | AC_DEFINE(HAVE_LIBFAC_P) |
---|
295 | WITH_LIBFAC=yes |
---|
296 | AC_MSG_WARN(install libfac before making Singular or configure --without-libfac) |
---|
297 | else |
---|
298 | AC_MSG_WARN(building without libfac: disabling char series) |
---|
299 | fi |
---|
300 | fi |
---|
301 | fi |
---|
302 | AC_SUBST(WITH_LIBFAC) |
---|
303 | |
---|
304 | AC_SUBST(NEED_LIBS) |
---|
305 | |
---|
306 | dnl |
---|
307 | dnl CHECKS FOR HEADER FILES. |
---|
308 | dnl |
---|
309 | |
---|
310 | AC_HEADER_STDC |
---|
311 | |
---|
312 | AC_CHECK_HEADERS(limits.h unistd.h,, |
---|
313 | AC_MSG_ERROR(Can not compile without limits.h unistd.h)) |
---|
314 | |
---|
315 | AC_CHECK_HEADERS(sys/file.h sys/ioctl.h sys/time.h sys/times.h) |
---|
316 | |
---|
317 | dnl |
---|
318 | dnl Checks for typedefs, structures, and compiler characteristics. |
---|
319 | dnl |
---|
320 | AC_C_CONST |
---|
321 | AC_C_INLINE |
---|
322 | AC_TYPE_SIZE_T |
---|
323 | AC_HEADER_TIME |
---|
324 | AC_STRUCT_TM |
---|
325 | |
---|
326 | dnl |
---|
327 | dnl Checks for library functions. |
---|
328 | dnl |
---|
329 | AC_FUNC_ALLOCA |
---|
330 | AC_PROG_GCC_TRADITIONAL |
---|
331 | AC_FUNC_MMAP |
---|
332 | AC_TYPE_SIGNAL |
---|
333 | AC_FUNC_VPRINTF |
---|
334 | AC_CHECK_FUNCS(gettimeofday strstr strtod strtol atexit) |
---|
335 | |
---|
336 | dnl |
---|
337 | dnl System specific tests |
---|
338 | dnl |
---|
339 | |
---|
340 | dnl arithmetic shifts |
---|
341 | AC_MSG_CHECKING(whether your machine has correct arithmetic shifts) |
---|
342 | AC_CACHE_VAL(ac_cv_shift, AC_TRY_RUN( |
---|
343 | [ int main() { if (-2 >> 1 == -1) exit(0); else exit(1); } ], |
---|
344 | ac_cv_shift=yes, |
---|
345 | ac_cv_shift=no, |
---|
346 | 1)) |
---|
347 | if test "$ac_cv_shift" = yes; then |
---|
348 | AC_MSG_RESULT(yes) |
---|
349 | else |
---|
350 | AC_MSG_RESULT(no) |
---|
351 | AC_MSG_ERROR(need -2 >> 1 == -1) |
---|
352 | fi |
---|
353 | |
---|
354 | |
---|
355 | dnl sizeof(int) == 4 |
---|
356 | AC_MSG_CHECKING(whether sizeof int is four bytes) |
---|
357 | AC_CACHE_VAL(ac_cv_sizeof_int_equals_four, AC_TRY_RUN( |
---|
358 | [ int main() {if (sizeof(int) == 4) exit(0); else exit(1); } ], |
---|
359 | ac_cv_sizeof_int_equals_four=yes, |
---|
360 | ac_cv_sizeof_int_equals_four=no, |
---|
361 | 1)) |
---|
362 | |
---|
363 | if test "$ac_cv_sizeof_int_equals_four" = yes; then |
---|
364 | AC_MSG_RESULT(yes) |
---|
365 | else |
---|
366 | AC_MSG_RESULT(no) |
---|
367 | AC_MSG_ERROR(need int to be four bytes long) |
---|
368 | fi |
---|
369 | |
---|
370 | dnl sizeof(long) == sizeof (void *) |
---|
371 | AC_MSG_CHECKING(whether sizeof long equals sizeof void*) |
---|
372 | AC_CACHE_VAL(ac_cv_sizeof_long_equals_voidp, AC_TRY_RUN( |
---|
373 | [ int main() {if (sizeof(long) == sizeof(void*)) exit(0); else exit(1); }], |
---|
374 | ac_cv_sizeof_long_equals_voidp=yes, |
---|
375 | ac_cv_sizeof_long_equals_voidp=no, |
---|
376 | 1)) |
---|
377 | if test "$ac_cv_sizeof_long_equals_voidp" = yes; then |
---|
378 | AC_MSG_RESULT(yes) |
---|
379 | else |
---|
380 | AC_MSG_RESULT(no) |
---|
381 | AC_MSG_ERROR(need equal sizes for long and void*) |
---|
382 | fi |
---|
383 | |
---|
384 | dnl sprintf returns number of printed chars |
---|
385 | AC_MSG_CHECKING(whether vsprintf returns number of printed chars) |
---|
386 | AC_CACHE_VAL(ac_cv_returns_n_of_chars, AC_TRY_RUN( |
---|
387 | [#include <stdio.h> |
---|
388 | main() { char *str=(char*)malloc(20); if (((int) sprintf(str,"123456789")) == 9) exit(0); else exit(1); }], |
---|
389 | ac_cv_returns_n_of_chars=yes, |
---|
390 | ac_cv_returns_n_of_chars=no, |
---|
391 | 1)) |
---|
392 | if test "$ac_cv_returns_n_of_chars" = yes; then |
---|
393 | AC_MSG_RESULT(yes) |
---|
394 | else |
---|
395 | AC_MSG_RESULT(no) |
---|
396 | AC_DEFINE(BSD_SPRINTF) |
---|
397 | fi |
---|
398 | |
---|
399 | dnl determine ALIGN_8 |
---|
400 | AC_CHECK_SIZEOF(void*,4) |
---|
401 | |
---|
402 | |
---|
403 | dnl |
---|
404 | dnl Last, but not least, customize CFLAGS |
---|
405 | dnl |
---|
406 | AC_MSG_CHECKING(whether _AIX is defined) |
---|
407 | AC_CACHE_VAL(ac_cv_is_aix, |
---|
408 | AC_EGREP_CPP(yes, |
---|
409 | [#ifdef _AIX |
---|
410 | yes |
---|
411 | #endif |
---|
412 | ], ac_cv_is_aix=yes, ac_cv_is_aix=no, 1)) |
---|
413 | if test "$ac_cv_is_aix" = yes; then |
---|
414 | AC_MSG_RESULT(yes) |
---|
415 | else |
---|
416 | AC_MSG_RESULT(no) |
---|
417 | fi |
---|
418 | |
---|
419 | |
---|
420 | if test ${GXX} = yes; then |
---|
421 | if test "$ac_cxxflags_set" = no; then |
---|
422 | CXXFLAGS="-O3 -w -fomit-frame-pointer" |
---|
423 | fi |
---|
424 | CXXTEMPLFLAGS="-fno-implicit-templates" |
---|
425 | if test "$ac_cv_is_aix" = yes; then |
---|
426 | CXXNOOPTFLAGS="-w" |
---|
427 | else |
---|
428 | CXXNOOPTFLAGS=$CXXFLAGS |
---|
429 | fi |
---|
430 | else |
---|
431 | CXXTEMPFLAGS="" |
---|
432 | CXXNOOPTFLAGS=$CXXFLAGS |
---|
433 | fi |
---|
434 | AC_SUBST(CXXTEMPLFLAGS) |
---|
435 | AC_SUBST(CXXNOOPTFLAGS) |
---|
436 | |
---|
437 | if test ${GCC} = yes && test "$ac_cflags_set" = no ; then |
---|
438 | CFLAGS="-O3 -w -fomit-frame-pointer" |
---|
439 | fi |
---|
440 | |
---|
441 | AC_OUTPUT(Makefile doc/Makefile, \ |
---|
442 | if test "$CONFIG_HEADERS"; then echo timestamp > stamp-h; fi) |
---|