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 | MAJOR_VERSION=1 |
---|
9 | MINOR_VERSION=0 |
---|
10 | SUB_VERSION=0 |
---|
11 | VERSION_DATE="April 1997" |
---|
12 | AC_SUBST(MAJOR_VERSION) |
---|
13 | AC_SUBST(MINOR_VERSION) |
---|
14 | AC_SUBST(SUB_VERSION) |
---|
15 | AC_DEFINE_UNQUOTED(MAJOR_VERSION, ${MAJOR_VERSION}) |
---|
16 | AC_DEFINE_UNQUOTED(MINOR_VERSION, ${MINOR_VERSION}) |
---|
17 | AC_DEFINE_UNQUOTED(S_VERSION1, "version: ${MAJOR_VERSION}.${MINOR_VERSION}.${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 | if test "x$datadir" = 'x${prefix}/share'; then |
---|
26 | if test "x${prefix}" = xNONE; then |
---|
27 | singulardatadir=${ac_default_prefix}/share/Singular; |
---|
28 | else |
---|
29 | singulardatadir=${prefix}/share/Singular; |
---|
30 | fi |
---|
31 | else |
---|
32 | singulardatadir=${datadir}/Singular; |
---|
33 | fi |
---|
34 | |
---|
35 | AC_DEFINE_UNQUOTED(SINGULAR_DATADIR, "${singulardatadir}") |
---|
36 | |
---|
37 | AC_SUBST(singulardatadir) |
---|
38 | |
---|
39 | dnl |
---|
40 | dnl Checks for programs. |
---|
41 | dnl |
---|
42 | |
---|
43 | dnl compiler stuff |
---|
44 | dnl we do not want to have "-g -O" for CFLAGS |
---|
45 | if test "${CXXFLAGS+set}" != set; then |
---|
46 | CXXFLAGS="-O" |
---|
47 | fi |
---|
48 | if test "${CFLAGS+set}" != set; then |
---|
49 | CFLAGS="-O" |
---|
50 | fi |
---|
51 | |
---|
52 | AC_PROG_CC |
---|
53 | AC_PROG_CXX |
---|
54 | |
---|
55 | dnl we prefer using gcc for compiling C++ files |
---|
56 | if test ${GXX} = yes; then |
---|
57 | CXX=gcc |
---|
58 | fi |
---|
59 | |
---|
60 | dnl and add to -I to CPPFLAGS and and -Lto LDFLAGS, just to be sure |
---|
61 | LDFLAGS="-L${libdir} ${LDFLAGS}" |
---|
62 | CPPFLAGS="-I${includedir} ${CPPFLAGS}" |
---|
63 | |
---|
64 | dnl programs to built the grammar/parser |
---|
65 | AC_PROG_LEX |
---|
66 | AC_CHECK_PROG(BISON, bison, bison) |
---|
67 | if test -z ${BISON}; then |
---|
68 | AC_MSG_ERROR(install bison before Singular) |
---|
69 | fi |
---|
70 | |
---|
71 | dnl check for info |
---|
72 | AC_CHECK_PROG(INFO, info, info) |
---|
73 | if test -n "$INFO"; then |
---|
74 | AC_DEFINE(HAVE_INFO) |
---|
75 | fi |
---|
76 | |
---|
77 | dnl programs for installation |
---|
78 | ac_save_path=${PATH} |
---|
79 | PATH="$PATH:.." |
---|
80 | AC_PROG_INSTALL |
---|
81 | AC_PATH_PROG(MKINSTALLDIRS, mkinstalldirs, -mkdir) |
---|
82 | PATH="$ac_save_path" |
---|
83 | |
---|
84 | |
---|
85 | dnl |
---|
86 | dnl CHECK --without arguments |
---|
87 | dnl |
---|
88 | AC_ARG_WITH( |
---|
89 | readline, |
---|
90 | [ --without-readline do not use readline for fancy display]) |
---|
91 | |
---|
92 | AC_ARG_WITH( |
---|
93 | gmp, |
---|
94 | [ --without-gmp do not use gmp library]) |
---|
95 | |
---|
96 | AC_ARG_WITH( |
---|
97 | MP, |
---|
98 | [ --without-MP do not use MP (disables MP links)]) |
---|
99 | |
---|
100 | AC_ARG_WITH( |
---|
101 | dbm, |
---|
102 | [ --without-dbm do not use dbm (disables DBM links)]) |
---|
103 | |
---|
104 | AC_ARG_WITH( |
---|
105 | dld, |
---|
106 | [ --without-dld do not use dld (disables dynamic linking)]) |
---|
107 | |
---|
108 | AC_ARG_WITH( |
---|
109 | factory, |
---|
110 | [ --without-factory do not use factory (disables poly factorization)]) |
---|
111 | |
---|
112 | AC_ARG_WITH( |
---|
113 | libfac, |
---|
114 | [ --without-libfac do not use libfac (disables primary decompositions)]) |
---|
115 | |
---|
116 | dnl |
---|
117 | dnl CHECK VARIOUS LIBRARIES |
---|
118 | dnl for gmp, MP, factory and libfac, we built them in, even if the libs |
---|
119 | dnl and headers were not found under the condition that the respective |
---|
120 | dnl --enable argument was given |
---|
121 | dnl |
---|
122 | |
---|
123 | LIBS="-lm $LIBS" |
---|
124 | |
---|
125 | dnl Check -lbsd |
---|
126 | AC_CHECK_LIB( |
---|
127 | bsd, |
---|
128 | bzero, |
---|
129 | LIBS="-lbsd $LIBS" |
---|
130 | ) |
---|
131 | |
---|
132 | dnl Check -lreadline |
---|
133 | if test "$with_readline" != no; then |
---|
134 | AC_CHECK_LIB(ncurses,tgetent,,\ |
---|
135 | AC_CHECK_LIB(curses,tgetent,,\ |
---|
136 | AC_CHECK_LIB(termcap,tgetent))) |
---|
137 | AC_CHECK_LIB(readline, rl_abort) |
---|
138 | if test "$ac_cv_lib_readline_rl_abort" = yes; then |
---|
139 | AC_CHECK_HEADERS(readline/readline.h readline/history.h sys/file.h,ac_readline_ok=yes,ac_readline_ok=no; break) |
---|
140 | fi |
---|
141 | if test "$ac_readline_ok" = yes; then |
---|
142 | AC_DEFINE(HAVE_READLINE) |
---|
143 | else |
---|
144 | AC_MSG_WARN(building without readline: disabling fancy display); |
---|
145 | AC_DEFINE(HAVE_FEREAD) |
---|
146 | fi |
---|
147 | else |
---|
148 | AC_DEFINE(HAVE_FEREAD) |
---|
149 | fi |
---|
150 | |
---|
151 | dnl Check dbm |
---|
152 | if test "$with_dbm" != no; then |
---|
153 | AC_CHECK_LIB( |
---|
154 | dbm, |
---|
155 | dbminit, |
---|
156 | AC_DEFINE(HAVE_DBM) LIBS="-ldbm $LIBS", |
---|
157 | AC_CHECK_LIB( |
---|
158 | gbm, |
---|
159 | dbminit, |
---|
160 | AC_DEFINE(HAVE_DBM) LIBS="-lgdbm $LIBS", |
---|
161 | AC_MSG_WARN(building without dbm: disabling DBM links))) |
---|
162 | fi |
---|
163 | |
---|
164 | dnl Check dld |
---|
165 | if test "$with_dld" = yes; then |
---|
166 | AC_CHECK_LIB(dld, dld_init,\ |
---|
167 | AC_MSG_WARN(building without dld: disabling dynamic linking)) |
---|
168 | fi |
---|
169 | |
---|
170 | NEED_LIBS=$LIBS |
---|
171 | |
---|
172 | dnl Check gmp |
---|
173 | if test "$with_gmp" != no; then |
---|
174 | AC_CHECK_LIB(gmp, mpz_init) |
---|
175 | AC_CHECK_HEADERS(gmp.h) |
---|
176 | if test "$ac_cv_lib_gmp_mpz_init" = yes && \ |
---|
177 | test "$ac_cv_header_gmp_h" = yes; then |
---|
178 | AC_DEFINE(HAVE_GMP) |
---|
179 | NEED_LIBS="-lgmp ${NEED_LIBS}" |
---|
180 | ac_gmp_ok=yes |
---|
181 | elif test "$enable_gmp" = yes; then |
---|
182 | AC_DEFINE(HAVE_GMP) |
---|
183 | NEED_LIBS="-lgmp ${NEED_LIBS}" |
---|
184 | ac_gmp_ok=yes |
---|
185 | AC_MSG_WARN(install gmp before making Singular or configure --without-gmp) |
---|
186 | else |
---|
187 | AC_MSG_WARN(building without gmp: using build-in rational arithmetic) |
---|
188 | fi |
---|
189 | fi |
---|
190 | |
---|
191 | dnl Check MP |
---|
192 | if test "$with_MP" != no; then |
---|
193 | if test "$ac_gmp_ok" != yes; then |
---|
194 | AC_MSG_WARN(building without MP: can not use MP without gmp) |
---|
195 | else |
---|
196 | if test "$ac_cv_lib_gmp_mpz_init"=yes; then |
---|
197 | AC_CHECK_LIB(MPT, MPT_GetTree,,,-lMP) |
---|
198 | fi |
---|
199 | AC_CHECK_HEADERS(MP.h) |
---|
200 | if test "$ac_cv_lib_MPT_MPT_GetTree" = yes && \ |
---|
201 | test "$ac_cv_header_MP_h"=yes; then |
---|
202 | AC_DEFINE(HAVE_MPSR) |
---|
203 | NEED_LIBS="-lMPT -lMP ${NEED_LIBS}" |
---|
204 | elif test "$enable_MP" = yes; then |
---|
205 | AC_DEFINE(HAVE_MPSR) |
---|
206 | NEED_LIBS="-lMPT -lMP ${NEED_LIBS}" |
---|
207 | AC_MSG_WARN(install MP before making Singular or configure --without-MP) |
---|
208 | else |
---|
209 | AC_MSG_WARN(building without MP: disabling MP links) |
---|
210 | fi |
---|
211 | fi |
---|
212 | fi |
---|
213 | |
---|
214 | dnl Check factory |
---|
215 | if test "$with_factory" != no; then |
---|
216 | if test "$ac_gmp_ok" != yes; then |
---|
217 | AC_MSG_WARN(building without factory: can not use factory without gmp) |
---|
218 | else |
---|
219 | if test "$ac_cv_lib_gmp_mpz_init"=yes;then |
---|
220 | AC_CHECK_LIB(singcf,initCanonicalForm) |
---|
221 | fi |
---|
222 | AC_CHECK_HEADERS(factory.h) |
---|
223 | if test "$ac_cv_lib_singcf_initCanonicalForm" = yes && \ |
---|
224 | test "$ac_cv_header_factory_h" = yes; then |
---|
225 | AC_DEFINE(HAVE_FACTORY) |
---|
226 | NEED_LIBS="-lsingcf ${NEED_LIBS}" |
---|
227 | ac_factory_ok=yes |
---|
228 | elif test "$enable_factory" = yes; then |
---|
229 | NEED_LIBS="-lsingcf ${NEED_LIBS}" |
---|
230 | AC_DEFINE(HAVE_FACTORY) |
---|
231 | ac_factory_ok=yes |
---|
232 | AC_MSG_WARN(install factory before making Singular or configure --without-factory) |
---|
233 | else |
---|
234 | AC_MSG_WARN(building without factory: disabling poly factorization) |
---|
235 | fi |
---|
236 | fi |
---|
237 | fi |
---|
238 | |
---|
239 | dnl Check libfac |
---|
240 | if test "$with_libfac" != no; then |
---|
241 | if test "$ac_factory_ok" != yes; then |
---|
242 | AC_MSG_WARN(building without libfac: can not use libfac without factory) |
---|
243 | else |
---|
244 | if test "$ac_cv_lib_singcf_initCanonicalForm" = yes; then |
---|
245 | AC_CHECK_LIB(singlibfac,IrrCharSeries) |
---|
246 | fi |
---|
247 | AC_CHECK_HEADERS(factor.h) |
---|
248 | if test "$ac_cv_lib_singlibfac_IrrCharSeries" = yes && \ |
---|
249 | test "$ac_cv_header_factor_h" = yes; then |
---|
250 | NEED_LIBS="-lsinglibfac ${NEED_LIBS}" |
---|
251 | AC_DEFINE(HAVE_LIBFAC_P) |
---|
252 | elif test "$enable_libfac" = yes; then |
---|
253 | NEED_LIBS="-lsinglibfac ${NEED_LIBS}" |
---|
254 | AC_DEFINE(HAVE_LIBFAC_P) |
---|
255 | AC_MSG_WARN(install libfac before making Singular or configure --without-libfac) |
---|
256 | else |
---|
257 | AC_MSG_WARN(building without libfac: disabling char series) |
---|
258 | fi |
---|
259 | fi |
---|
260 | fi |
---|
261 | |
---|
262 | AC_SUBST(NEED_LIBS) |
---|
263 | |
---|
264 | dnl |
---|
265 | dnl CHECKS FOR HEADER FILES. |
---|
266 | dnl |
---|
267 | |
---|
268 | AC_HEADER_STDC |
---|
269 | |
---|
270 | AC_CHECK_HEADERS(limits.h unistd.h,, |
---|
271 | AC_MSG_ERROR(Can not compile without limits.h unistd.h)) |
---|
272 | |
---|
273 | AC_CHECK_HEADERS(sys/file.h sys/ioctl.h sys/time.h) |
---|
274 | |
---|
275 | dnl |
---|
276 | dnl Checks for typedefs, structures, and compiler characteristics. |
---|
277 | dnl |
---|
278 | AC_C_CONST |
---|
279 | AC_C_INLINE |
---|
280 | AC_TYPE_SIZE_T |
---|
281 | AC_HEADER_TIME |
---|
282 | AC_STRUCT_TM |
---|
283 | |
---|
284 | dnl |
---|
285 | dnl Checks for library functions. |
---|
286 | dnl |
---|
287 | AC_FUNC_ALLOCA |
---|
288 | AC_PROG_GCC_TRADITIONAL |
---|
289 | AC_FUNC_MMAP |
---|
290 | AC_TYPE_SIGNAL |
---|
291 | AC_FUNC_VPRINTF |
---|
292 | AC_CHECK_FUNCS(gettimeofday strstr strtod strtol atexit) |
---|
293 | |
---|
294 | dnl |
---|
295 | dnl System specific tests |
---|
296 | dnl |
---|
297 | |
---|
298 | dnl arithmetic shifts |
---|
299 | AC_MSG_CHECKING(whether your machine has correct arithmetic shifts) |
---|
300 | AC_CACHE_VAL(ac_cv_shift, AC_TRY_RUN( |
---|
301 | [ int main() { if (-2 >> 1 == -1) exit(0); else exit(1); } ], |
---|
302 | ac_cv_shift=yes, |
---|
303 | ac_cv_shift=no, |
---|
304 | 1)) |
---|
305 | if test "$ac_cv_shift" = yes; then |
---|
306 | AC_MSG_RESULT(yes) |
---|
307 | else |
---|
308 | AC_MSG_RESULT(no) |
---|
309 | AC_MSG_ERROR(need -2 >> 1 == -1) |
---|
310 | fi |
---|
311 | |
---|
312 | |
---|
313 | dnl sizeof(int) == 4 |
---|
314 | AC_MSG_CHECKING(whether sizeof int is four bytes) |
---|
315 | AC_CACHE_VAL(ac_cv_sizeof_int_equals_four, AC_TRY_RUN( |
---|
316 | [ int main() {if (sizeof(int) == 4) exit(0); else exit(1); } ], |
---|
317 | ac_cv_sizeof_int_equals_four=yes, |
---|
318 | ac_cv_sizeof_int_equals_four=no, |
---|
319 | 1)) |
---|
320 | |
---|
321 | if test "$ac_cv_sizeof_int_equals_four" = yes; then |
---|
322 | AC_MSG_RESULT(yes) |
---|
323 | else |
---|
324 | AC_MSG_RESULT(no) |
---|
325 | AC_MSG_ERROR(need int to be four bytes long) |
---|
326 | fi |
---|
327 | |
---|
328 | dnl sizeof(long) == sizeof (void *) |
---|
329 | AC_MSG_CHECKING(whether sizeof long equals sizeof void*) |
---|
330 | AC_CACHE_VAL(ac_cv_sizeof_long_equals_voidp, AC_TRY_RUN( |
---|
331 | [ int main() {if (sizeof(long) == sizeof(void*)) exit(0); else exit(1); }], |
---|
332 | ac_cv_sizeof_long_equals_voidp=yes, |
---|
333 | ac_cv_sizeof_long_equals_voidp=no, |
---|
334 | 1)) |
---|
335 | if test "$ac_cv_sizeof_long_equals_voidp" = yes; then |
---|
336 | AC_MSG_RESULT(yes) |
---|
337 | else |
---|
338 | AC_MSG_RESULT(no) |
---|
339 | AC_MSG_ERROR(need equal sizes for long and void*) |
---|
340 | fi |
---|
341 | |
---|
342 | dnl sprintf returns number of printed chars |
---|
343 | AC_MSG_CHECKING(whether vsprintf returns number of printed chars) |
---|
344 | AC_CACHE_VAL(ac_cv_returns_n_of_chars, AC_TRY_RUN( |
---|
345 | [#include <stdio.h> |
---|
346 | main() { char str[21]; if (((int) sprintf(str,"123456789")) == 9) exit(0); else exit(1); }], |
---|
347 | ac_cv_returns_n_of_chars=yes, |
---|
348 | ac_cv_returns_n_of_chars=no, |
---|
349 | 1)) |
---|
350 | if test "$ac_cv_returns_n_of_chars" = yes; then |
---|
351 | AC_MSG_RESULT(yes) |
---|
352 | else |
---|
353 | AC_MSG_RESULT(no) |
---|
354 | AC_DEFINE(BSD_SPRINTF) |
---|
355 | fi |
---|
356 | |
---|
357 | dnl determine ALIGN_8 |
---|
358 | AC_CHECK_SIZEOF(void*,4) |
---|
359 | |
---|
360 | |
---|
361 | dnl |
---|
362 | dnl Last, but not least, customize CFLAGS |
---|
363 | dnl |
---|
364 | if test ${GXX} = yes; then |
---|
365 | CXXFLAGS="-O3 -w -fomit-frame-pointer -fstrength-reduce" |
---|
366 | CXXTEMPLFLAGS="-fno-implicit-templates" |
---|
367 | else |
---|
368 | CXXTEMPFLAGS="" |
---|
369 | fi |
---|
370 | AC_SUBST(CXXTEMPLFLAGS) |
---|
371 | |
---|
372 | if test ${GCC} = yes; then |
---|
373 | CFLAGS="-O3 -w -fomit-frame-pointer -fstrength-reduce" |
---|
374 | fi |
---|
375 | |
---|
376 | AC_SUBST(ac_configure_args) |
---|
377 | |
---|
378 | AC_OUTPUT(Makefile) |
---|