1 | dnl Process this file with autoconf to produce a configure script. |
---|
2 | AC_INIT(mmalloc.cc) |
---|
3 | AC_CONFIG_HEADER(mod2.h) |
---|
4 | AC_CONFIG_HEADER(../kernel/mod2.h) |
---|
5 | |
---|
6 | dnl lllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllll |
---|
7 | dnl determine singuname |
---|
8 | dnl |
---|
9 | |
---|
10 | AC_MSG_CHECKING(uname for singular) |
---|
11 | AC_CACHE_VAL(ac_cv_singuname, |
---|
12 | ac_cv_singuname="unknown" |
---|
13 | if test -r "singuname.sh"; then |
---|
14 | if (/bin/sh singuname.sh >/dev/null 2>&1) then |
---|
15 | ac_cv_singuname=`/bin/sh singuname.sh` |
---|
16 | fi |
---|
17 | fi |
---|
18 | if test "$ac_cv_singuname" = unknown && test -r "../singuname.sh"; then |
---|
19 | if (/bin/sh ../singuname.sh >/dev/null 2>&1) then |
---|
20 | ac_cv_singuname=`/bin/sh ../singuname.sh` |
---|
21 | fi |
---|
22 | fi |
---|
23 | ) |
---|
24 | AC_MSG_RESULT($ac_cv_singuname) |
---|
25 | if test "$ac_cv_singuname" = unknown; then |
---|
26 | AC_MSG_WARN(Unknown architecture: Check singuname.sh) |
---|
27 | ac_cv_singuname="unknown" |
---|
28 | fi |
---|
29 | AC_DEFINE_UNQUOTED(S_UNAME, "$ac_cv_singuname") |
---|
30 | SINGUNAME=$ac_cv_singuname |
---|
31 | AC_SUBST(SINGUNAME) |
---|
32 | |
---|
33 | if test "$ac_cv_singuname" = ix86-Win; then |
---|
34 | EXEC_EXT=".exe" |
---|
35 | fi |
---|
36 | AC_SUBST(EXEC_EXT) |
---|
37 | |
---|
38 | SING_UNAME=`echo $SINGUNAME | tr '-' '_' ` |
---|
39 | AC_SUBST(SING_UNAME) |
---|
40 | |
---|
41 | # stupid Win programs do not like dots in their pathnames |
---|
42 | VERSION_SEP="-" |
---|
43 | |
---|
44 | dnl llllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllll |
---|
45 | dnl version stuff -- should be set in ../configure.in |
---|
46 | dnl |
---|
47 | dnl here are some defaults |
---|
48 | |
---|
49 | SINGULAR_MAJOR_VERSION=${SINGULAR_MAJOR_VERSION:-2} |
---|
50 | SINGULAR_MINOR_VERSION=${SINGULAR_MINOR_VERSION:-1} |
---|
51 | SINGULAR_SUB_VERSION=${SINGULAR_SUB_VERSION:-99} |
---|
52 | SINGULAR_VERSION="${SINGULAR_VERSION:-$SINGULAR_MAJOR_VERSION${VERSION_SEP}$SINGULAR_MINOR_VERSION${VERSION_SEP}$SINGULAR_SUB_VERSION}" |
---|
53 | VERSION_DATE=${VERSION_DATE:-"February 2005"} |
---|
54 | |
---|
55 | dnl pass them on into the Makefiles |
---|
56 | AC_SUBST(SINGULAR_VERSION) |
---|
57 | AC_SUBST(VERSION_DATE) |
---|
58 | AC_SUBST(SINGULAR_MAJOR_VERSION) |
---|
59 | AC_SUBST(SINGULAR_MINOR_VERSION) |
---|
60 | AC_SUBST(SINGULAR_SUB_VERSION) |
---|
61 | AC_DEFINE_UNQUOTED(SINGULAR_MAJOR_VERSION, ${SINGULAR_MAJOR_VERSION}) |
---|
62 | AC_DEFINE_UNQUOTED(SINGULAR_MINOR_VERSION, ${SINGULAR_MINOR_VERSION}) |
---|
63 | AC_DEFINE_UNQUOTED(SINGULAR_SUB_VERSION, ${SINGULAR_SUB_VERSION}) |
---|
64 | AC_DEFINE_UNQUOTED(S_VERSION1, "${SINGULAR_MAJOR_VERSION}${VERSION_SEP}${SINGULAR_MINOR_VERSION}${VERSION_SEP}${SINGULAR_SUB_VERSION}") |
---|
65 | AC_DEFINE_UNQUOTED(S_VERSION2, "${VERSION_DATE}") |
---|
66 | AC_DEFINE_UNQUOTED(SINGULAR_SUB_VERSION, ${SINGULAR_SUB_VERSION}) |
---|
67 | |
---|
68 | |
---|
69 | dnl lllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllll |
---|
70 | dnl compiler stuff |
---|
71 | dnl is needed to check for libs and headers, later on |
---|
72 | dnl |
---|
73 | dnl we do not want to have "-g -O" for CFLAGS |
---|
74 | if test "${CXXFLAGS+set}" != set; then |
---|
75 | ac_cxxflags_set=no |
---|
76 | CXXFLAGS="-O" |
---|
77 | fi |
---|
78 | if test "${CFLAGS+set}" != set; then |
---|
79 | CFLAGS="-O" |
---|
80 | ac_cflags_set=no |
---|
81 | fi |
---|
82 | |
---|
83 | # check whether CXX was set by user as env variable |
---|
84 | if test "${CXX+set}" != set; then |
---|
85 | ac_cxx_set=no |
---|
86 | else |
---|
87 | ac_cxx_set=yes |
---|
88 | fi |
---|
89 | AC_PROG_CC |
---|
90 | AC_PROG_CPP |
---|
91 | AC_PROG_CXX |
---|
92 | AC_PROG_INSTALL |
---|
93 | AC_AIX |
---|
94 | |
---|
95 | # test for gcc-version: gcc2: prefer CC=gcc, CXX=gcc |
---|
96 | # gcc3: CC=gcc CXX=g++ |
---|
97 | # other: CC=cc CXX=c++ |
---|
98 | AC_MSG_CHECKING(gcc version) |
---|
99 | AC_CACHE_VAL(ac_cv_c_cpp, |
---|
100 | ac_cv_c_cp="unknown" |
---|
101 | if test -r "gccversion.sh"; then |
---|
102 | ac_cv_c_cpp=`/bin/sh gccversion.sh` |
---|
103 | fi |
---|
104 | ) |
---|
105 | AC_MSG_RESULT($ac_cv_c_cpp) |
---|
106 | |
---|
107 | # we prefer using gcc for compiling C++ files, provided the user did |
---|
108 | # not overwrite it explicitely |
---|
109 | if test "${GXX}" = yes && test "${ac_cxx_set}" = no; then |
---|
110 | if test "${ac_cv_c_cpp}" = gcc2; then |
---|
111 | CXX=gcc |
---|
112 | elif test "${ac_cv_c_cpp}" = gcc3; then |
---|
113 | CXX=g++ |
---|
114 | fi |
---|
115 | temp_cflags=${CXXFLAGS} |
---|
116 | AC_LANG_SAVE |
---|
117 | AC_LANG_CPLUSPLUS |
---|
118 | # check whether gcc accepts --no-rtti |
---|
119 | AC_MSG_CHECKING(whether gcc accepts --no-rtti) |
---|
120 | CXXFLAGS="${CXXFLAGS} --no-rtti" |
---|
121 | AC_CACHE_VAL(ac_cv_cxx_have_rtti, |
---|
122 | AC_TRY_COMPILE(,,ac_cv_cxx_have_rtti=yes,ac_cv_cxx_have_rtti=no) |
---|
123 | ) |
---|
124 | AC_MSG_RESULT(${ac_cv_cxx_have_rtti}) |
---|
125 | if test "${ac_cv_cxx_have_rtti}" != yes; then |
---|
126 | CXXFLAGS=$temp_flags |
---|
127 | else |
---|
128 | CXX="${CXX} --no-rtti" |
---|
129 | fi |
---|
130 | |
---|
131 | # check whether gcc accepts --no-exceptions |
---|
132 | AC_MSG_CHECKING(whether gcc accepts --no-exceptions) |
---|
133 | CXXFLAGS="${CXXFLAGS} --no-exceptions" |
---|
134 | AC_CACHE_VAL(ac_cv_cxx_have_exceptions, |
---|
135 | AC_TRY_LINK(,,ac_cv_cxx_have_exceptions=yes,ac_cv_cxx_have_exceptions=no) |
---|
136 | ) |
---|
137 | AC_MSG_RESULT(${ac_cv_cxx_have_exceptions}) |
---|
138 | if test "${ac_cv_cxx_have_exceptions}" != yes; then |
---|
139 | CXXFLAGS=$temp_flags |
---|
140 | else |
---|
141 | CXX="${CXX} --no-exceptions" |
---|
142 | fi |
---|
143 | |
---|
144 | AC_LANG_RESTORE |
---|
145 | #CXXFLAGS=$temp_flags |
---|
146 | #here is broking something |
---|
147 | #uncommented breaks CXXFLAGS variable set |
---|
148 | #only pipes would remain then in CXXFLAGS |
---|
149 | fi |
---|
150 | |
---|
151 | # check whether the compiler accepts -pipe |
---|
152 | AC_MSG_CHECKING(whether compiler accepts -pipe) |
---|
153 | temp_cflags=${CFLAGS} |
---|
154 | CFLAGS="${CFLAGS} -pipe" |
---|
155 | AC_CACHE_VAL(ac_cv_cxx_have_pipe, |
---|
156 | AC_TRY_COMPILE(,,ac_cv_cxx_have_pipe=yes,ac_cv_cxx_have_pipe=no) |
---|
157 | ) |
---|
158 | AC_MSG_RESULT(${ac_cv_cxx_have_pipe}) |
---|
159 | CFLAGS=${temp_cflags} |
---|
160 | if test "${ac_cv_cxx_have_pipe}" != yes; then |
---|
161 | PIPE= |
---|
162 | else |
---|
163 | PIPE="-pipe" |
---|
164 | fi |
---|
165 | AC_SUBST(PIPE) |
---|
166 | |
---|
167 | # Customize CFLAGS |
---|
168 | AC_MSG_CHECKING(whether _AIX is defined) |
---|
169 | AC_CACHE_VAL(ac_cv_is_aix, |
---|
170 | AC_EGREP_CPP(yes, |
---|
171 | [#ifdef _AIX |
---|
172 | yes |
---|
173 | #endif |
---|
174 | ], ac_cv_is_aix=yes, ac_cv_is_aix=no, 1)) |
---|
175 | if test "$ac_cv_is_aix" = yes; then |
---|
176 | AC_MSG_RESULT(yes) |
---|
177 | else |
---|
178 | AC_MSG_RESULT(no) |
---|
179 | fi |
---|
180 | |
---|
181 | # we know best when compiling with gcc |
---|
182 | if test "${GXX}" = yes; then |
---|
183 | if test "$ac_cxxflags_set" = no; then |
---|
184 | CXXFLAGS="-O3 -w -fomit-frame-pointer" |
---|
185 | fi |
---|
186 | CXXTEMPLFLAGS="-fno-implicit-templates" |
---|
187 | if test "$ac_cv_is_aix" = yes; then |
---|
188 | CXXNOOPTFLAGS="-w" |
---|
189 | else |
---|
190 | CXXNOOPTFLAGS=$CXXFLAGS |
---|
191 | fi |
---|
192 | STATIC_LDFLAGS="-static" |
---|
193 | else |
---|
194 | CXXTEMPFLAGS="" |
---|
195 | CXXNOOPTFLAGS=$CXXFLAGS |
---|
196 | STATIC_LDFLAGS="" |
---|
197 | fi |
---|
198 | AC_SUBST(CXXTEMPLFLAGS) |
---|
199 | AC_SUBST(CXXNOOPTFLAGS) |
---|
200 | AC_SUBST(STATIC_LDFLAGS) |
---|
201 | |
---|
202 | if test "${GCC}" = yes && test "$ac_cflags_set" = no ; then |
---|
203 | CFLAGS="-O3 -w -fomit-frame-pointer" |
---|
204 | fi |
---|
205 | |
---|
206 | AC_PROG_MAKE_SET |
---|
207 | |
---|
208 | dnl lllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllll |
---|
209 | dnl path stuff |
---|
210 | dnl |
---|
211 | AC_PREFIX_DEFAULT(`pwd`/..) |
---|
212 | |
---|
213 | dnl set exec_prefix, bindir, libdir, includedir to some sensible values |
---|
214 | dnl if they are not yet already set |
---|
215 | |
---|
216 | # expand prefix |
---|
217 | test "x$prefix" = xNONE && prefix=$ac_default_prefix |
---|
218 | if test "${with_rootdir+set}" != set; then |
---|
219 | AC_DEFINE_UNQUOTED(S_ROOT_DIR, "${prefix}") |
---|
220 | else |
---|
221 | AC_DEFINE_UNQUOTED(S_ROOT_DIR, "${with_rootdir}") |
---|
222 | fi |
---|
223 | |
---|
224 | # expand exec_prefixad |
---|
225 | if test "x$exec_prefix" = xNONE; then |
---|
226 | exec_prefix=${prefix}/${ac_cv_singuname} |
---|
227 | fi |
---|
228 | |
---|
229 | # expand bindir |
---|
230 | test "x$bindir" = 'x${exec_prefix}/bin' && bindir="${exec_prefix}" |
---|
231 | SINGULAR=${SINGULAR:-$bindir/Singular-$SINGULAR_MAJOR_VERSION${VERSION_SEP}$SINGULAR_MINOR_VERSION${VERSION_SEP}$SINGULAR_SUB_VERSION} |
---|
232 | AC_SUBST(SINGULAR) |
---|
233 | AC_DEFINE_UNQUOTED(S_BIN_DIR, "${bindir}") |
---|
234 | |
---|
235 | # expand libdir |
---|
236 | test "x$libdir" = 'x${exec_prefix}/lib'&& libdir="${exec_prefix}/lib" |
---|
237 | |
---|
238 | # expand includedir |
---|
239 | test "x$includedir" = 'x${prefix}/include' && includedir="${exec_prefix}/include" |
---|
240 | |
---|
241 | # add to -I to CPPFLAGS and and -L to LDFLAGS, just to be sure |
---|
242 | if test "$ac_cv_c_cpp" = gcc3 ; then |
---|
243 | LDFLAGS="-L${libdir} ${LDFLAGS}" |
---|
244 | CPPFLAGS="-I${includedir} ${CPPFLAGS}" |
---|
245 | else |
---|
246 | LDFLAGS="-L${libdir} ${LDFLAGS} -L/usr/local/lib" |
---|
247 | CPPFLAGS="-I${includedir} ${CPPFLAGS} -I/usr/local/include" |
---|
248 | fi |
---|
249 | |
---|
250 | # this is a work-around to include the right term.h |
---|
251 | if test "$ac_cv_singuname" = SunOS-5; then |
---|
252 | CPPFLAGS="-I/usr/xpg4/include ${CPPFLAGS}" |
---|
253 | fi |
---|
254 | |
---|
255 | |
---|
256 | dnl lllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllll |
---|
257 | dnl Checks for programs. |
---|
258 | dnl |
---|
259 | |
---|
260 | # lex |
---|
261 | if test "${with_lex+set}" != set; then |
---|
262 | AC_MSG_CHECKING(for flex) |
---|
263 | changequote(<<,>>)dnl |
---|
264 | cmd="egrep [2-9]\.[5-9]" |
---|
265 | changequote([,])dnl |
---|
266 | AC_CACHE_VAL(ac_cv_prog_flex, |
---|
267 | if (flex --version >/dev/null 2>&1) |
---|
268 | then |
---|
269 | if (flex --version | $cmd >/dev/null 2>&1 ) |
---|
270 | then |
---|
271 | ac_cv_prog_flex=flex |
---|
272 | fi |
---|
273 | fi |
---|
274 | ) |
---|
275 | dnl changequote([,])dnl |
---|
276 | if test "${ac_cv_prog_flex+set}" = set; then |
---|
277 | AC_MSG_RESULT(flex) |
---|
278 | LEX=flex |
---|
279 | AC_SUBST(LEX) |
---|
280 | else |
---|
281 | AC_MSG_ERROR(can not find flex with version greater 2.4) |
---|
282 | fi |
---|
283 | elif test "${with_lex}" = no; then |
---|
284 | AC_MSG_WARN(building without lex -- make might fail) |
---|
285 | else |
---|
286 | unset LEX |
---|
287 | unset ac_cv_prog_LEX |
---|
288 | AC_CHECK_PROGS(LEX, ${with_lex}) |
---|
289 | if test "x${LEX}" = x; then |
---|
290 | AC_MSG_WARN(building without lex -- make might fail) |
---|
291 | fi |
---|
292 | fi |
---|
293 | |
---|
294 | # bison |
---|
295 | AC_CHECK_PROGS(BISON, bison) |
---|
296 | if test "${BISON+set}" != set; then |
---|
297 | AC_MSG_WARN(did not find bison -- make might fail) |
---|
298 | fi |
---|
299 | |
---|
300 | # ln -s |
---|
301 | AC_PROG_LN_S |
---|
302 | |
---|
303 | AC_CHECK_PROGS(PERL, perl5 perl) |
---|
304 | |
---|
305 | dnl llllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllll |
---|
306 | dnl check for general libraries, header files, typedefs, etc |
---|
307 | dnl |
---|
308 | # lib checks |
---|
309 | # under cygwin, we should not explicitly link with -lm, except for |
---|
310 | # it really is the last thing to link with |
---|
311 | if test "$ac_cv_singuname" != ix86-Win; then |
---|
312 | AC_CHECK_LIB(m, atof) |
---|
313 | fi |
---|
314 | SAVE_LIBS=${LIBS} |
---|
315 | LIBS= |
---|
316 | |
---|
317 | dnl I'm not sure what they are for |
---|
318 | dnl AC_CHECK_LIB(bsd, socket) |
---|
319 | dnl AC_CHECK_LIB(socket, listen) |
---|
320 | dnl AC_CHECK_LIB(nsl, gethostbyname) |
---|
321 | dnl AC_CHECK_LIB(ucb, index) |
---|
322 | dnl MP_LIBS=${LIBS} |
---|
323 | # check for dl lib |
---|
324 | case "$ac_cv_singuname" in |
---|
325 | HPUX*) |
---|
326 | AC_CHECK_LIB(dld, shl_load) |
---|
327 | if test "$ac_cv_lib_dld_shl_load" = yes; then |
---|
328 | LD_DYN_FLAGS="-ldld -Xlinker -E" |
---|
329 | SFLAGS="-fpic -fPIC -DPIC" |
---|
330 | SLDFLAGS="-fPIC -DPIC -shared" |
---|
331 | LD=gcc |
---|
332 | ac_lib_dl=yes |
---|
333 | fi |
---|
334 | ;; |
---|
335 | *Linux*) |
---|
336 | AC_CHECK_LIB(dl, dlopen) |
---|
337 | if test "$ac_cv_lib_dl_dlopen" = yes; then |
---|
338 | LD_DYN_FLAGS="-ldl -rdynamic" |
---|
339 | SFLAGS="-fpic -DPIC" |
---|
340 | SLDFLAGS=-shared |
---|
341 | LD=ld |
---|
342 | ac_lib_dl=yes |
---|
343 | fi |
---|
344 | ;; |
---|
345 | IRIX-6) |
---|
346 | LD_DYN_FLAGS="-lc" |
---|
347 | SFLAGS="-fPIC -DPIC" |
---|
348 | SLDFLAGS="-w -no_unresolved -_SYSTYPE_SVR4 -n32 -shared" |
---|
349 | LD=ld |
---|
350 | ac_lib_dl=yes |
---|
351 | ;; |
---|
352 | SunOS-5) |
---|
353 | AC_CHECK_LIB(dl, dlopen) |
---|
354 | if test "$ac_cv_lib_dl_dlopen" = yes; then |
---|
355 | LD_DYN_FLAGS="-ldl -Xlinker -E" |
---|
356 | SFLAGS="-fpic -DPIC" |
---|
357 | SLDFLAGS=-shared |
---|
358 | LD=ld |
---|
359 | ac_lib_dl=yes |
---|
360 | fi |
---|
361 | ;; |
---|
362 | esac |
---|
363 | AC_SUBST(LD_DYN_FLAGS) |
---|
364 | AC_SUBST(SFLAGS) |
---|
365 | AC_SUBST(SLDFLAGS) |
---|
366 | AC_SUBST(LD) |
---|
367 | LIBS=${SAVE_LIBS} |
---|
368 | |
---|
369 | |
---|
370 | # heder file checks |
---|
371 | AC_HEADER_STDC |
---|
372 | AC_CHECK_HEADERS(limits.h unistd.h,, |
---|
373 | AC_MSG_ERROR(Can not compile without limits.h unistd.h)) |
---|
374 | |
---|
375 | AC_CHECK_HEADERS(sys/file.h sys/ioctl.h sys/time.h sys/times.h sys/types.h \ |
---|
376 | sys/stat.h fcntl.h sys/param.h pwd.h asm/sigcontext.h pwd.h termcap.h \ |
---|
377 | termios.h term.h readline/readline.h) |
---|
378 | |
---|
379 | # typedefs, structures |
---|
380 | AC_C_CONST |
---|
381 | AC_C_INLINE |
---|
382 | AC_TYPE_SIZE_T |
---|
383 | AC_STRUCT_TM |
---|
384 | AC_HEADER_TIME |
---|
385 | |
---|
386 | # library functions. |
---|
387 | AC_FUNC_ALLOCA |
---|
388 | AC_PROG_GCC_TRADITIONAL |
---|
389 | AC_FUNC_MMAP |
---|
390 | AC_TYPE_SIGNAL |
---|
391 | AC_FUNC_VPRINTF |
---|
392 | AC_SEARCH_LIBS(setenv, bsd) |
---|
393 | AC_CHECK_FUNCS(gettimeofday atexit bcopy getcwd getwd vsnprintf readlink \ |
---|
394 | sleep usleep getpwnam popen setenv siginterrupt) |
---|
395 | |
---|
396 | |
---|
397 | dnl llllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllll |
---|
398 | dnl Find out more about particularity of the system |
---|
399 | dnl |
---|
400 | |
---|
401 | # arithmetic shifts |
---|
402 | AC_MSG_CHECKING(whether your machine has correct arithmetic shifts) |
---|
403 | AC_CACHE_VAL(ac_cv_shift, AC_TRY_RUN( |
---|
404 | [ int main() { if (-2 >> 1 == -1) return(0); else return(1); } ], |
---|
405 | ac_cv_shift=yes, |
---|
406 | ac_cv_shift=no, |
---|
407 | if test "$ac_c_cross_dos" = yes; then |
---|
408 | ac_cv_shift=yes; |
---|
409 | else |
---|
410 | AC_MSG_RESULT(no) |
---|
411 | AC_MSG_ERROR(cross compilation without default value) |
---|
412 | fi)) |
---|
413 | |
---|
414 | if test "$ac_cv_shift" = yes; then |
---|
415 | AC_MSG_RESULT(yes) |
---|
416 | else |
---|
417 | AC_MSG_RESULT(no) |
---|
418 | AC_MSG_ERROR(need -2 >> 1 == -1) |
---|
419 | fi |
---|
420 | |
---|
421 | |
---|
422 | # check for a peculiar constructor initialization |
---|
423 | AC_MSG_CHECKING(whether explicit C++ constructor calls are allowed) |
---|
424 | AC_LANG_SAVE |
---|
425 | AC_LANG_CPLUSPLUS |
---|
426 | AC_CACHE_VAL(ac_cv_explicit_const,AC_TRY_COMPILE(, |
---|
427 | class testclass |
---|
428 | { |
---|
429 | public: |
---|
430 | int value; |
---|
431 | testclass() : value(0) {} |
---|
432 | testclass( int i ) : value(i) {} |
---|
433 | ~testclass() { value = 0; } |
---|
434 | }; |
---|
435 | |
---|
436 | testclass ptr; |
---|
437 | ptr.testclass(1); |
---|
438 | , ac_cv_explicit_const=yes, ac_cv_explicit_const=no)) |
---|
439 | AC_LANG_RESTORE |
---|
440 | AC_MSG_RESULT($ac_cv_explicit_const) |
---|
441 | if test "$ac_cv_explicit_const" = yes; then |
---|
442 | AC_DEFINE(HAVE_EXPLICIT_CONSTR) |
---|
443 | fi |
---|
444 | |
---|
445 | # sprintf returns number of printed chars |
---|
446 | AC_MSG_CHECKING(whether vsprintf returns number of printed chars) |
---|
447 | AC_CACHE_VAL(ac_cv_returns_n_of_chars, AC_TRY_RUN( |
---|
448 | [#include <stdio.h> |
---|
449 | main() { char *str=(char*)malloc(20); if (((int) sprintf(str,"123456789")) == 9) exit(0); else exit(1); }], |
---|
450 | ac_cv_returns_n_of_chars=yes, |
---|
451 | ac_cv_returns_n_of_chars=no, |
---|
452 | ac_cv_returns_n_of_chars=no)) |
---|
453 | if test "$ac_cv_returns_n_of_chars" = yes; then |
---|
454 | AC_MSG_RESULT(yes) |
---|
455 | else |
---|
456 | AC_MSG_RESULT(no) |
---|
457 | AC_DEFINE(BSD_SPRINTF) |
---|
458 | fi |
---|
459 | |
---|
460 | # determine ALIGN_8 |
---|
461 | AC_CHECK_SIZEOF(char,1) |
---|
462 | AC_CHECK_SIZEOF(short,2) |
---|
463 | AC_CHECK_SIZEOF(int,4) |
---|
464 | AC_CHECK_SIZEOF(long,4) |
---|
465 | AC_CHECK_SIZEOF(void*,4) |
---|
466 | AC_CHECK_SIZEOF(double, 8) |
---|
467 | AC_C_BIGENDIAN |
---|
468 | if test "$ac_cv_sizeof_int" != 4; then |
---|
469 | AC_MSG_ERROR(need int to be four bytes long) |
---|
470 | fi |
---|
471 | if test "$ac_cv_sizeof_long" != "$ac_cv_sizeof_voidp"; then |
---|
472 | AC_MSG_ERROR(need equal sizes for long and void*) |
---|
473 | fi |
---|
474 | if test "$ac_cv_sizeof_double" != 8; then |
---|
475 | AC_MSG_ERROR(need double to b 8 bytes long) |
---|
476 | fi |
---|
477 | if test "$ac_cv_sizeof_voidp" != 4 && test "$ac_cv_sizeof_voidp" != 8; then |
---|
478 | AC_MSG_ERROR(need void* to be 4 or 8 bytes long) |
---|
479 | fi |
---|
480 | if test "$ac_cv_sizeof_voidp" != 4; then |
---|
481 | DEFS="-UOM_NDEBUG" |
---|
482 | AC_SUBST(DEFS) |
---|
483 | fi |
---|
484 | |
---|
485 | dnl lllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllll |
---|
486 | dnl help for configure |
---|
487 | dnl |
---|
488 | AC_ARG_WITH( |
---|
489 | rootdir, |
---|
490 | [ --with-rootdir=DIR use DIR ass compiled-in root directory |
---|
491 | (default is PREFIX)]) |
---|
492 | AC_ARG_WITH( |
---|
493 | lex, |
---|
494 | [ --with-lex=[LEX,no] uses LEX as lex program, default is flex]) |
---|
495 | AC_ARG_WITH( |
---|
496 | readline, |
---|
497 | [ --with-readline=[dynamic,static,no] |
---|
498 | do use dynamic/static/no readline for fancy display]) |
---|
499 | AC_ARG_WITH( |
---|
500 | MP, |
---|
501 | [ --without-MP do not use MP (no MP links)]) |
---|
502 | AC_ARG_WITH( |
---|
503 | dbm, |
---|
504 | [ --without-dbm do not use dbm (no DBM links)]) |
---|
505 | AC_ARG_WITH( |
---|
506 | factory, |
---|
507 | [ --without-factory do not use factory (no poly factorization)]) |
---|
508 | AC_ARG_WITH( |
---|
509 | libfac, |
---|
510 | [ --without-libfac do not use libfac (no primary decompositions)]) |
---|
511 | AC_ARG_WITH( |
---|
512 | namespaces, |
---|
513 | [ --with-namespaces do compile namespace support]) |
---|
514 | AC_ARG_WITH( |
---|
515 | dl, |
---|
516 | [ --without-dl do not use dynamic linking, modules, and kernel]) |
---|
517 | AC_ARG_WITH( |
---|
518 | dynamic-modules, |
---|
519 | [ --with-dynamic-modules do compile with dynamic modules support]) |
---|
520 | AC_ARG_WITH( |
---|
521 | dynamic-kernel, |
---|
522 | [ --without-dynamic-kernel |
---|
523 | do not compile with dynamic kernel parts]) |
---|
524 | AC_ARG_WITH(apint, |
---|
525 | [ --with-apint=PACKAGE use PACKAGE for arbitary integer arithmetic]) |
---|
526 | AC_ARG_WITH( |
---|
527 | Plural, |
---|
528 | [ --with-Plural do compile with Plural support]) |
---|
529 | AC_ARG_WITH( |
---|
530 | NTL, |
---|
531 | [ --with-NTL build for use with NTL.], |
---|
532 | , |
---|
533 | with_NTL=yes) |
---|
534 | |
---|
535 | dnl llllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllll |
---|
536 | dnl check for packages we need |
---|
537 | dnl for gmp, MP, factory and libfac, we built them in, even if the libs |
---|
538 | dnl and headers were not found under the condition that the respective |
---|
539 | dnl --enable argument was given |
---|
540 | dnl |
---|
541 | |
---|
542 | |
---|
543 | AC_MSG_CHECKING(whether to use dynamic linking) |
---|
544 | if test "$with_dl" != no && test "$ac_lib_dl" = yes; then |
---|
545 | AC_DEFINE(HAVE_DL) |
---|
546 | ac_have_dl=yes |
---|
547 | AC_MSG_RESULT(yes) |
---|
548 | else |
---|
549 | AC_MSG_RESULT(no) |
---|
550 | fi |
---|
551 | |
---|
552 | AC_CHECK_LIB(ncurses,tgetent,,\ |
---|
553 | AC_CHECK_LIB(curses,tgetent,,\ |
---|
554 | AC_CHECK_LIB(termcap,tgetent))) |
---|
555 | |
---|
556 | # readline |
---|
557 | if test "$with_readline" = dynamic && test "$ac_have_dl" != yes; then |
---|
558 | AC_MSG_WARN(can not build dynamic readline without dynamic linking) |
---|
559 | with_readline=static |
---|
560 | fi |
---|
561 | |
---|
562 | |
---|
563 | if test "$with_readline" != dynamic && test "$with_readline" != no; then |
---|
564 | AC_LANG_SAVE |
---|
565 | AC_LANG_CPLUSPLUS |
---|
566 | AC_CHECK_LIB(readline, rl_abort) |
---|
567 | AC_CHECK_HEADERS(readline/readline.h readline/history.h) |
---|
568 | if test "$ac_cv_lib_readline_rl_abort" = yes && \ |
---|
569 | test "$ac_cv_header_readline_readline_h" = yes; then |
---|
570 | AC_MSG_CHECKING(whether readline.h is ok) |
---|
571 | AC_CACHE_VAL(ac_cv_header_readline_readline_h_ok, |
---|
572 | AC_TRY_LINK( |
---|
573 | #include<unistd.h> |
---|
574 | #include<stdio.h> |
---|
575 | #include<readline/readline.h> |
---|
576 | #ifdef HAVE_READLINE_HISTORY_H |
---|
577 | #include<readline/history.h> |
---|
578 | #endif |
---|
579 | , |
---|
580 | , |
---|
581 | ac_cv_header_readline_readline_h_ok="yes", |
---|
582 | ac_cv_header_readline_readline_h_ok="no", |
---|
583 | )) |
---|
584 | AC_MSG_RESULT($ac_cv_header_readline_readline_h_ok) |
---|
585 | if test "$ac_cv_header_readline_readline_h_ok" != yes; then |
---|
586 | #not ok -- try once more with explicitly declaring everything |
---|
587 | AC_MSG_CHECKING(whether or not we nevertheless can use readline) |
---|
588 | AC_CACHE_VAL(ac_cv_have_readline, |
---|
589 | AC_TRY_LINK( |
---|
590 | #include <stdio.h> |
---|
591 | extern "C" |
---|
592 | { |
---|
593 | extern char * rl_readline_name; |
---|
594 | extern char *rl_line_buffer; |
---|
595 | char *filename_completion_function(); |
---|
596 | typedef char **CPPFunction (); |
---|
597 | extern char ** completion_matches (); |
---|
598 | extern CPPFunction * rl_attempted_completion_function; |
---|
599 | extern FILE * rl_outstream; |
---|
600 | char * readline (); |
---|
601 | void add_history (); |
---|
602 | int write_history (); |
---|
603 | int read_history(); |
---|
604 | } |
---|
605 | #ifndef NULL |
---|
606 | #define NULL 0 |
---|
607 | #endif |
---|
608 | , |
---|
609 | rl_readline_name=NULL; |
---|
610 | *rl_line_buffer=1; |
---|
611 | completion_matches(NULL, filename_completion_function); |
---|
612 | rl_attempted_completion_function = (CPPFunction *) NULL; |
---|
613 | rl_outstream=NULL; |
---|
614 | readline(NULL); |
---|
615 | add_history(NULL); |
---|
616 | read_history(NULL); |
---|
617 | write_history(NULL); |
---|
618 | , |
---|
619 | ac_cv_have_readline="yes" |
---|
620 | , |
---|
621 | ac_cv_have_readline="no" |
---|
622 | )) |
---|
623 | AC_MSG_RESULT($ac_cv_have_readline) |
---|
624 | else |
---|
625 | AC_DEFINE(READLINE_READLINE_H_OK) |
---|
626 | ac_cv_have_readline="yes" |
---|
627 | fi |
---|
628 | fi |
---|
629 | if test "$ac_cv_have_readline" = yes; then |
---|
630 | AC_DEFINE(HAVE_READLINE) |
---|
631 | fi |
---|
632 | AC_LANG_RESTORE |
---|
633 | fi |
---|
634 | |
---|
635 | AC_MSG_CHECKING(which readline to use) |
---|
636 | if test "$ac_cv_with_readline" = dynamic; then |
---|
637 | AC_MSG_RESULT(dynamic) |
---|
638 | AC_DEFINE(HAVE_DYN_RL) |
---|
639 | elif test "$ac_cv_have_readline" = yes; then |
---|
640 | AC_MSG_RESULT(static) |
---|
641 | elif test "$ac_cv_singuname" = PowerMacintosh-darwin; then |
---|
642 | AC_MSG_ERROR(building without readline impossible on PowerMacintosh-darwin) |
---|
643 | else |
---|
644 | AC_MSG_RESULT(none) |
---|
645 | AC_MSG_WARN(building without readline: disabling fancy display) |
---|
646 | fi |
---|
647 | |
---|
648 | NEED_LIBS=$LIBS |
---|
649 | |
---|
650 | # gmp, smallgmp, MP, MPT, factory, libfac |
---|
651 | AC_CHECK_LIB(gmp, main) |
---|
652 | if test "ac_cv_lib_gmp_main" = yes && test "$with-apint" = smallgmp; then |
---|
653 | LIBS=${NEED_LIBS} |
---|
654 | fi |
---|
655 | AC_CHECK_LIB(smallgmp, main) |
---|
656 | SAVE_LIBS=$LIBS |
---|
657 | AC_CHECK_LIB(MP, IMP_PutGmpInt,,,$MP_LIBS) |
---|
658 | AC_CHECK_LIB(MPT, MPT_GetTree,,,$MP_LIBS) |
---|
659 | LIBS=$SAVE_LIBS |
---|
660 | AC_CHECK_LIB(singcf, atof) |
---|
661 | AC_CHECK_LIB(singfac, atof) |
---|
662 | AC_CHECK_LIB(omalloc, omTestAddr) |
---|
663 | AC_CHECK_LIB(omalloc_ndebug, main) |
---|
664 | AC_CHECK_LIB(ntl,main) |
---|
665 | |
---|
666 | AC_CHECK_HEADERS(gmp.h smallgmp.h MP.h MPT.h factory.h factor.h omalloc.h \ |
---|
667 | omalloc.c) |
---|
668 | |
---|
669 | if test "$ac_cv_lib_gmp_main" = yes && \ |
---|
670 | test "$ac_cv_header_gmp_h" = yes; then |
---|
671 | ac_gmp_ok=yes |
---|
672 | fi |
---|
673 | |
---|
674 | if test "$ac_cv_lib_smallgmp_main" = yes && \ |
---|
675 | test "$ac_cv_header_smallgmp_h" = yes && \ |
---|
676 | test "$ac_cv_header_gmp_h" = yes; then |
---|
677 | ac_smallgmp_ok=yes |
---|
678 | fi |
---|
679 | |
---|
680 | if test "$ac_cv_lib_MP_IMP_PutGmpInt" = yes && \ |
---|
681 | test "$ac_cv_lib_MPT_MPT_GetTree" && \ |
---|
682 | test "$ac_cv_header_MP_h" = yes && \ |
---|
683 | test "$ac_cv_header_MPT_h" = yes; then |
---|
684 | ac_MP_ok=yes |
---|
685 | fi |
---|
686 | |
---|
687 | if test "$ac_cv_lib_singcf_atof" = yes && \ |
---|
688 | test "$ac_cv_header_factory_h" = yes; then |
---|
689 | ac_factory_ok=yes |
---|
690 | fi |
---|
691 | |
---|
692 | if test "$ac_cv_lib_singfac_atof" = yes && \ |
---|
693 | test "$ac_cv_header_factor_h" = yes; then |
---|
694 | ac_libfac_ok=yes |
---|
695 | fi |
---|
696 | |
---|
697 | if test "$ac_cv_lib_omalloc_omTestAddr" = yes && \ |
---|
698 | test "$ac_cv_lib_omalloc_ndebug_main" = yes && \ |
---|
699 | test "$ac_cv_header_omalloc_c" = yes && \ |
---|
700 | test "$ac_cv_header_omalloc_h" = yes; then |
---|
701 | ac_cv_omalloc_ok=yes |
---|
702 | fi |
---|
703 | |
---|
704 | if test "$ac_cv_lib_ntl_main" = yes; then |
---|
705 | ac_cv_ntl_ok=yes |
---|
706 | fi |
---|
707 | |
---|
708 | # evaluate results |
---|
709 | dnl llllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllll |
---|
710 | dnl make sure that omalloc is there |
---|
711 | dnl |
---|
712 | if test "$ac_cv_omalloc_ok" != yes && test "$enable_omalloc" != yes; then |
---|
713 | AC_MSG_ERROR(can not build without omalloc) |
---|
714 | fi |
---|
715 | |
---|
716 | AC_MSG_CHECKING(which apint package to use) |
---|
717 | if test "${with_apint}" != gmp && test "${with_apint}" != smallgmp; then |
---|
718 | if test "$ac_gmp_ok" = yes || test "$enable_gmp" = yes; then |
---|
719 | AC_MSG_RESULT(gmp) |
---|
720 | will_have_gmp=yes |
---|
721 | NEED_LIBS="-lgmp ${NEED_LIBS}" |
---|
722 | elif test "ac_gmp_smallgmp_ok" = yes || test "$enable_smallgmp" = "yes"; then |
---|
723 | AC_MSG_RESULT(smallgmp) |
---|
724 | AC_DEFINE(HAVE_SMALLGMP) |
---|
725 | NEED_LIBS="-lsmallgmp ${NEED_LIBS}" |
---|
726 | else |
---|
727 | AC_MSG_RESULT(none) |
---|
728 | AC_MSG_ERROR(can not build without gmp or smallgmp) |
---|
729 | fi |
---|
730 | elif test "${with_apint}" = gmp; then |
---|
731 | if test "$ac_gmp_ok" = yes || test "$enable_gmp" = yes; then |
---|
732 | AC_MSG_RESULT(gmp) |
---|
733 | will_have_gmp=yes |
---|
734 | NEED_LIBS="-lgmp ${NEED_LIBS}" |
---|
735 | else |
---|
736 | AC_MSG_RESULT(none) |
---|
737 | AC_MSG_ERROR(can not build with gmp) |
---|
738 | fi |
---|
739 | else |
---|
740 | if test "ac_gmp_smallgmp_ok" = yes || test "$enable_smallgmp" = "yes"; then |
---|
741 | AC_MSG_RESULT(smallgmp) |
---|
742 | AC_DEFINE(HAVE_SMALLGMP) |
---|
743 | NEED_LIBS="-lsmallgmp ${NEED_LIBS}" |
---|
744 | else |
---|
745 | AC_MSG_RESULT(none) |
---|
746 | AC_MSG_ERROR(can not build with smallgmp) |
---|
747 | fi |
---|
748 | fi |
---|
749 | |
---|
750 | # |
---|
751 | AC_MSG_CHECKING(whether to have MP) |
---|
752 | if test "${with_MP}" != yes && test "${with_MP}" != no; then |
---|
753 | if (test "${will_have_gmp}" = yes) && \ |
---|
754 | (test "$ac_MP_ok" = yes || test "$enable_MP" = yes); then |
---|
755 | AC_MSG_RESULT(yes) |
---|
756 | AC_DEFINE(HAVE_MPSR) |
---|
757 | HAVE_MPSR=1 |
---|
758 | MP_LIBS="-lMPT -lMP ${MP_LIBS}" |
---|
759 | else |
---|
760 | AC_MSG_RESULT(no) |
---|
761 | fi |
---|
762 | elif test "${with_MP}" = yes; then |
---|
763 | if (test "${will_have_gmp}" = yes) && \ |
---|
764 | (test "$ac_MP_ok" = yes || test "$enable_MP" = yes); then |
---|
765 | AC_MSG_RESULT(yes) |
---|
766 | AC_DEFINE(HAVE_MPSR) |
---|
767 | HAVE_MPSR=1 |
---|
768 | MP_LIBS="-lMPT -lMP ${MP_LIBS}" |
---|
769 | else |
---|
770 | AC_MSG_RESULT(no) |
---|
771 | AC_MSG_ERROR(can not build with MP) |
---|
772 | fi |
---|
773 | else |
---|
774 | AC_MSG_RESULT(no) |
---|
775 | fi |
---|
776 | AC_SUBST(HAVE_MPSR) |
---|
777 | AC_SUBST(MP_LIBS) |
---|
778 | |
---|
779 | AC_MSG_CHECKING(whether to have NTL) |
---|
780 | if test "${with_NTL}" = yes ; then |
---|
781 | AC_MSG_RESULT(yes) |
---|
782 | NEED_LIBS="-lntl ${NEED_LIBS}" |
---|
783 | else |
---|
784 | AC_MSG_RESULT(no) |
---|
785 | fi |
---|
786 | |
---|
787 | AC_MSG_CHECKING(whether to have factory) |
---|
788 | if test "${with_factory}" != yes && test "${with_factory}" != no; then |
---|
789 | if test "$ac_factory_ok" = yes || test "$enable_factory" = yes; then |
---|
790 | AC_MSG_RESULT(yes) |
---|
791 | AC_DEFINE(HAVE_FACTORY) |
---|
792 | will_have_factory=yes |
---|
793 | NEED_LIBS="-lsingcf ${NEED_LIBS}" |
---|
794 | else |
---|
795 | AC_MSG_RESULT(no) |
---|
796 | fi |
---|
797 | elif test "${with_factory}" = yes; then |
---|
798 | if test "$ac_factory_ok" = yes || test "$enable_factory" = yes; then |
---|
799 | AC_MSG_RESULT(yes) |
---|
800 | AC_DEFINE(HAVE_FACTORY) |
---|
801 | will_have_factory=yes |
---|
802 | NEED_LIBS="-lsingcf ${NEED_LIBS}" |
---|
803 | else |
---|
804 | AC_MSG_RESULT(no) |
---|
805 | AC_MSG_ERROR(can not build with factory) |
---|
806 | fi |
---|
807 | else |
---|
808 | AC_MSG_RESULT(no) |
---|
809 | fi |
---|
810 | |
---|
811 | AC_MSG_CHECKING(whether to have libfac) |
---|
812 | if test "${with_libfac}" != yes && test "${with_libfac}" != no; then |
---|
813 | if (test "${will_have_factory}" = yes) && \ |
---|
814 | (test "$ac_libfac_ok" = yes || test "$enable_libfac" = yes); then |
---|
815 | AC_MSG_RESULT(yes) |
---|
816 | AC_DEFINE(HAVE_LIBFAC_P) |
---|
817 | NEED_LIBS="-lsingfac ${NEED_LIBS}" |
---|
818 | else |
---|
819 | AC_MSG_RESULT(no) |
---|
820 | fi |
---|
821 | elif test "${with_libfac}" = yes; then |
---|
822 | if (test "${will_have_factory}" = yes) && \ |
---|
823 | (test "$ac_libfac_ok" = yes || test "$enable_libfac" = yes); then |
---|
824 | AC_MSG_RESULT(yes) |
---|
825 | AC_DEFINE(HAVE_LIBFAC_P) |
---|
826 | NEED_LIBS="-lsingfac ${NEED_LIBS}" |
---|
827 | else |
---|
828 | AC_MSG_RESULT(no) |
---|
829 | AC_MSG_ERROR(can not build with libfac) |
---|
830 | fi |
---|
831 | else |
---|
832 | AC_MSG_RESULT(no) |
---|
833 | fi |
---|
834 | |
---|
835 | |
---|
836 | AC_SUBST(NEED_LIBS) |
---|
837 | |
---|
838 | AC_MSG_CHECKING(whether to have dbm links) |
---|
839 | if test "$with_dbm" != no; then |
---|
840 | AC_DEFINE(HAVE_DBM) |
---|
841 | AC_MSG_RESULT(yes) |
---|
842 | else |
---|
843 | AC_MSG_RESULT(no) |
---|
844 | fi |
---|
845 | |
---|
846 | AC_MSG_CHECKING(whether to have namespaces) |
---|
847 | if test "$with_namespaces" != no; then |
---|
848 | AC_MSG_RESULT(yes) |
---|
849 | AC_DEFINE(HAVE_NS) |
---|
850 | else |
---|
851 | AC_MSG_RESULT(no) |
---|
852 | fi |
---|
853 | |
---|
854 | AC_MSG_CHECKING(whether to have dynamic modules) |
---|
855 | if test "$with_dynamic_modules" = no || test "$ac_have_dl" != yes; then |
---|
856 | AC_MSG_RESULT(no) |
---|
857 | else |
---|
858 | AC_DEFINE(HAVE_DYNAMIC_LOADING) |
---|
859 | AC_MSG_RESULT(yes) |
---|
860 | fi |
---|
861 | |
---|
862 | AC_MSG_CHECKING(whether to have dynamic kernel) |
---|
863 | if test "$with_dynamic_kernel" != no && test "$ac_lib_dl" = yes; then |
---|
864 | DL_KERNEL=1 |
---|
865 | AC_SUBST(DL_KERNEL) |
---|
866 | AC_MSG_RESULT(yes) |
---|
867 | else |
---|
868 | AC_MSG_RESULT(no) |
---|
869 | fi |
---|
870 | |
---|
871 | AC_MSG_CHECKING(whether to have Plural) |
---|
872 | if test "$with_Plural" != yes && test "$enable_Plural" != yes; then |
---|
873 | AC_MSG_RESULT(no) |
---|
874 | else |
---|
875 | AC_DEFINE(HAVE_PLURAL) |
---|
876 | AC_MSG_RESULT(yes) |
---|
877 | PLURAL=1 |
---|
878 | AC_SUBST(PLURAL) |
---|
879 | fi |
---|
880 | |
---|
881 | |
---|
882 | OUTPUT_MAKEFILES="Makefile ../kernel/Makefile" |
---|
883 | |
---|
884 | if test "$ac_cv_singuname" = "ix86-Win"; then |
---|
885 | OUTPUT_MAKEFILES="${OUTPUT_MAKEFILES} Singular.rc" |
---|
886 | fi |
---|
887 | |
---|
888 | AC_OUTPUT(${OUTPUT_MAKEFILES}, \ |
---|
889 | cp mod2.h ../kernel/mod2.h; \ |
---|
890 | if test "$CONFIG_HEADERS"; then echo timestamp > stamp-h; fi) |
---|