source: git/Singular/configure.in @ 6e7af3a

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