source: git/Singular/configure.in @ 1cddd8

spielwiese
Last change on this file since 1cddd8 was 1cddd8, checked in by Hans Schönemann <hannes@…>, 18 years ago
*hannes: automatic BOOST test git-svn-id: file:///usr/local/Singular/svn/trunk@9199 2c84dea3-7e68-4137-9b89-c4e89433aadc
  • Property mode set to 100644
File size: 23.6 KB
Line 
1dnl Process this file with autoconf to produce a configure script.
2AC_INIT(tesths.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:-3}
50SINGULAR_MINOR_VERSION=${SINGULAR_MINOR_VERSION:-0}
51SINGULAR_SUB_VERSION=${SINGULAR_SUB_VERSION:-2}
52SINGULAR_VERSION="${SINGULAR_VERSION:-$SINGULAR_MAJOR_VERSION${VERSION_SEP}$SINGULAR_MINOR_VERSION${VERSION_SEP}$SINGULAR_SUB_VERSION}"
53VERSION_DATE=${VERSION_DATE:-"May 2006"}
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=g++
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
149fi
150
151# check whether the compiler accepts -pipe
152AC_MSG_CHECKING(whether compiler accepts -pipe)
153temp_cflags=${CFLAGS}
154CFLAGS="${CFLAGS} -pipe"
155AC_CACHE_VAL(ac_cv_cxx_have_pipe,
156AC_TRY_COMPILE(,,ac_cv_cxx_have_pipe=yes,ac_cv_cxx_have_pipe=no)
157)
158AC_MSG_RESULT(${ac_cv_cxx_have_pipe})
159CFLAGS=${temp_cflags}
160if test "${ac_cv_cxx_have_pipe}" != yes; then
161  PIPE=
162else
163  PIPE="-pipe"
164fi
165AC_SUBST(PIPE)
166
167# Customize CFLAGS
168AC_MSG_CHECKING(whether _AIX is defined)
169AC_CACHE_VAL(ac_cv_is_aix,
170AC_EGREP_CPP(yes,
171[#ifdef _AIX
172    yes
173#endif
174], ac_cv_is_aix=yes, ac_cv_is_aix=no, 1))
175if test "$ac_cv_is_aix" = yes; then
176  AC_MSG_RESULT(yes)
177else
178  AC_MSG_RESULT(no)
179fi
180
181# we know best when compiling with gcc
182if 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"
193else
194  CXXTEMPFLAGS=""
195  CXXNOOPTFLAGS=$CXXFLAGS
196  STATIC_LDFLAGS=""
197fi
198AC_SUBST(CXXTEMPLFLAGS)
199AC_SUBST(CXXNOOPTFLAGS)
200AC_SUBST(STATIC_LDFLAGS)
201
202if test "${GCC}" = yes && test "$ac_cflags_set" = no ; then
203  CFLAGS="-O3 -w -fomit-frame-pointer"
204fi
205
206AC_PROG_MAKE_SET
207
208dnl lllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllll
209dnl path stuff
210dnl
211AC_PREFIX_DEFAULT(`pwd`/..)
212
213dnl set exec_prefix, bindir, libdir, includedir to some sensible values
214dnl if they are not yet already set
215
216# expand prefix
217test "x$prefix" = xNONE && prefix=$ac_default_prefix
218if test "${with_rootdir+set}" != set; then
219  AC_DEFINE_UNQUOTED(S_ROOT_DIR, "${prefix}")
220else
221  AC_DEFINE_UNQUOTED(S_ROOT_DIR, "${with_rootdir}")
222fi
223
224# expand exec_prefixad
225if test "x$exec_prefix" = xNONE; then
226 exec_prefix=${prefix}/${ac_cv_singuname}
227fi
228
229# expand bindir
230test "x$bindir" = 'x${exec_prefix}/bin' && bindir="${exec_prefix}"
231SINGULAR=${SINGULAR:-$bindir/Singular-$SINGULAR_MAJOR_VERSION${VERSION_SEP}$SINGULAR_MINOR_VERSION${VERSION_SEP}$SINGULAR_SUB_VERSION}
232AC_SUBST(SINGULAR)
233AC_DEFINE_UNQUOTED(S_BIN_DIR, "${bindir}")
234
235# expand libdir
236test "x$libdir" = 'x${exec_prefix}/lib'&& libdir="${exec_prefix}/lib"
237
238# expand includedir
239test "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
242if test "$ac_cv_c_cpp" = gcc3 ; then
243  LDFLAGS="-L${libdir} ${LDFLAGS}"
244  CPPFLAGS="-I${includedir} ${CPPFLAGS}"
245else
246  LDFLAGS="-L${libdir} ${LDFLAGS} -L/usr/local/lib"
247  CPPFLAGS="-I${includedir} ${CPPFLAGS} -I/usr/local/include"
248fi
249
250# this is a work-around to include the right term.h
251if test "$ac_cv_singuname" = SunOS-5; then
252CPPFLAGS="-I/usr/xpg4/include ${CPPFLAGS}"
253fi
254
255
256dnl lllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllll
257dnl Checks for programs.
258dnl
259
260# lex
261if 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
283elif test "${with_lex}" = no; then
284  AC_MSG_WARN(building without lex -- make might fail)
285else
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
292fi
293
294# bison
295AC_CHECK_PROGS(BISON, bison)
296if test "${BISON+set}" != set; then
297  AC_MSG_WARN(did not find bison -- make might fail)
298fi
299
300# ln -s
301AC_PROG_LN_S
302
303AC_CHECK_PROGS(PERL, perl5 perl)
304
305dnl llllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllll
306dnl check for general libraries, header files, typedefs, etc
307dnl
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
311if test "$ac_cv_singuname" != ix86-Win; then
312AC_CHECK_LIB(m, atof)
313fi
314SAVE_LIBS=${LIBS}
315LIBS=
316
317dnl I'm not sure what they are for
318AC_CHECK_LIB(bsd, setenv)
319dnl AC_CHECK_LIB(socket, listen)
320dnl AC_CHECK_LIB(nsl, gethostbyname)
321dnl AC_CHECK_LIB(ucb, index)
322dnl MP_LIBS=${LIBS}
323# check for dl lib
324case "$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"
356                SFLAGS="-fpic -DPIC"
357                SLDFLAGS=-shared
358                LD=$CC
359                ac_lib_dl=yes
360          fi
361        ;;
362        #use export MACOSX_DEPLOYMENT_TARGET=10.3
363        ppcMac-darwin)
364          AC_CHECK_LIB(dl, dlopen)
365          if test "$ac_cv_lib_dl_dlopen" = yes; then
366                LD_DYN_FLAGS="-ldl -dynamic"
367                SFLAGS="-fpic -DPIC"
368                SLDFLAGS="-dynamic -twolevel_namespace -weak_reference_mismatches weak -undefined dynamic_lookup"
369                LD=libtool
370                ac_lib_dl=yes
371          fi
372        ;;
373        i386Mac-darwin)
374          AC_CHECK_LIB(dl, dlopen)
375          if test "$ac_cv_lib_dl_dlopen" = yes; then
376                LD_DYN_FLAGS="-ldl -dynamic"
377                SFLAGS="-fpic -DPIC"
378                SLDFLAGS="-dynamic -twolevel_namespace -weak_reference_mismatches weak -undefined dynamic_lookup"
379                LD=libtool
380                ac_lib_dl=yes
381          fi
382        ;;
383        ix86-freebsd)
384          AC_CHECK_LIB(c, dlopen)
385          if test "$ac_cv_lib_c_dlopen" = yes; then
386                LD_DYN_FLAGS="-Xlinker -E"
387                SFLAGS="-fpic -DPIC"
388                SLDFLAGS=-shared
389                LD=ld
390                ac_lib_dl=yes
391          fi
392        ;;
393esac
394AC_SUBST(LD_DYN_FLAGS)
395AC_SUBST(SFLAGS)
396AC_SUBST(SLDFLAGS)
397AC_SUBST(LD)
398LIBS=${SAVE_LIBS}
399
400
401# heder file checks
402AC_HEADER_STDC
403AC_CHECK_HEADERS(limits.h unistd.h,,
404  AC_MSG_ERROR(Can not compile without limits.h unistd.h))
405
406AC_CHECK_HEADERS(sys/file.h sys/ioctl.h sys/time.h sys/times.h sys/types.h \
407 sys/stat.h fcntl.h sys/param.h pwd.h asm/sigcontext.h pwd.h termcap.h \
408 termios.h term.h readline/readline.h)
409
410# typedefs, structures
411AC_C_CONST
412AC_C_INLINE
413AC_TYPE_SIZE_T
414AC_STRUCT_TM
415AC_HEADER_TIME
416
417# library functions.
418AC_FUNC_ALLOCA
419AC_PROG_GCC_TRADITIONAL
420AC_FUNC_MMAP
421AC_TYPE_SIGNAL
422AC_FUNC_VPRINTF
423AC_SEARCH_LIBS(setenv, bsd)
424AC_CHECK_FUNCS(gettimeofday atexit bcopy getcwd getwd vsnprintf readlink \
425 sleep usleep getpwnam popen setenv siginterrupt)
426
427
428dnl llllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllll
429dnl Find out more about particularity of the system
430dnl
431
432# arithmetic shifts
433AC_MSG_CHECKING(whether your machine has correct arithmetic shifts)
434AC_CACHE_VAL(ac_cv_shift, AC_TRY_RUN(
435  [ int main() { if (-2 >> 1 == -1) return(0); else return(1); } ],
436   ac_cv_shift=yes,
437   ac_cv_shift=no,
438   if test "$ac_c_cross_dos" = yes; then
439     ac_cv_shift=yes;
440   else
441     AC_MSG_RESULT(no)
442     AC_MSG_ERROR(cross compilation without default value)
443   fi))
444
445if test "$ac_cv_shift" = yes; then
446  AC_MSG_RESULT(yes)
447else
448  AC_MSG_RESULT(no)
449  AC_MSG_ERROR(need  -2 >> 1 == -1)
450fi
451
452
453# check for a peculiar constructor initialization
454AC_MSG_CHECKING(whether explicit C++ constructor calls are allowed)
455AC_LANG_SAVE
456AC_LANG_CPLUSPLUS
457AC_CACHE_VAL(ac_cv_explicit_const,AC_TRY_COMPILE(,
458  class testclass
459  {
460  public:
461    int value;
462    testclass() : value(0) {}
463    testclass( int i ) : value(i) {}
464    ~testclass() { value = 0; }
465  };
466
467  testclass ptr;
468  ptr.testclass(1);
469, ac_cv_explicit_const=yes, ac_cv_explicit_const=no))
470AC_LANG_RESTORE
471AC_MSG_RESULT($ac_cv_explicit_const)
472if test "$ac_cv_explicit_const" = yes; then
473  AC_DEFINE(HAVE_EXPLICIT_CONSTR)
474fi
475
476# sprintf returns number of printed chars
477AC_MSG_CHECKING(whether vsprintf returns number of printed chars)
478AC_CACHE_VAL(ac_cv_returns_n_of_chars, AC_TRY_RUN(
479 [#include <stdio.h>
480 main() { char *str=(char*)malloc(20); if (((int) sprintf(str,"123456789")) == 9) exit(0); else exit(1); }],
481   ac_cv_returns_n_of_chars=yes,
482   ac_cv_returns_n_of_chars=no,
483   ac_cv_returns_n_of_chars=no))
484if test "$ac_cv_returns_n_of_chars" = yes; then
485  AC_MSG_RESULT(yes)
486else
487  AC_MSG_RESULT(no)
488  AC_DEFINE(BSD_SPRINTF)
489fi
490
491# determine ALIGN_8
492AC_CHECK_SIZEOF(char,1)
493AC_CHECK_SIZEOF(short,2)
494AC_CHECK_SIZEOF(int,4)
495AC_CHECK_SIZEOF(long,4)
496AC_CHECK_SIZEOF(void*,4)
497AC_CHECK_SIZEOF(double, 8)
498AC_C_BIGENDIAN
499if test "$ac_cv_sizeof_int" != 4; then
500  AC_MSG_ERROR(need int to be four bytes long)
501fi
502if test "$ac_cv_sizeof_long" != "$ac_cv_sizeof_voidp"; then
503  AC_MSG_ERROR(need equal sizes for long and void*)
504fi
505if test "$ac_cv_sizeof_double" != 8; then
506  AC_MSG_ERROR(need double to b 8 bytes long)
507fi
508if test "$ac_cv_sizeof_voidp" != 4 && test "$ac_cv_sizeof_voidp" != 8; then
509  AC_MSG_ERROR(need void* to be 4 or 8 bytes long)
510fi
511if test "$ac_cv_sizeof_voidp" != 4; then
512  DEFS="-UOM_NDEBUG"
513  AC_SUBST(DEFS)
514fi
515
516dnl lllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllll
517dnl help for configure
518dnl
519AC_ARG_WITH(
520  rootdir,
521  [  --with-rootdir=DIR      use DIR ass compiled-in root directory
522                             (default is PREFIX)])
523AC_ARG_WITH(
524  lex,
525  [  --with-lex=[LEX,no]     uses LEX as lex program, default is flex])
526AC_ARG_WITH(
527  readline,
528  [  --with-readline=[dynamic,static,no]         
529                          do use dynamic/static/no readline for fancy display])
530AC_ARG_WITH(
531  MP,
532  [  --without-MP            do not use MP (no MP links)])
533AC_ARG_WITH(
534  dbm,
535  [  --without-dbm           do not use dbm (no DBM links)])
536AC_ARG_WITH(
537  factory,
538  [  --without-factory       do not use factory (no poly factorization)])
539AC_ARG_WITH(
540  libfac,
541  [  --without-libfac        do not use libfac (no primary decompositions)])
542AC_ARG_WITH(
543  namespaces,
544  [  --with-namespaces       do compile namespace support])
545AC_ARG_WITH(
546  dl,
547  [  --without-dl            do not use dynamic linking, modules, and kernel])
548AC_ARG_WITH(
549  dynamic-modules,
550  [  --with-dynamic-modules  do compile with dynamic modules support])
551AC_ARG_WITH(
552  dynamic-kernel,
553  [  --without-dynamic-kernel               
554                          do not compile with dynamic kernel parts])
555AC_ARG_WITH(apint,
556  [  --with-apint=PACKAGE    use PACKAGE for arbitary integer arithmetic])
557AC_ARG_WITH(
558  Plural,
559  [  --with-Plural           do compile with Plural support])
560AC_ARG_WITH(
561  NTL,
562  [  --with-NTL              build for use with NTL.],
563  ,
564  with_NTL=yes)
565
566dnl llllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllll
567dnl check for packages we need
568dnl for gmp, MP, factory and libfac, we built them in, even if the libs
569dnl and headers were not found under the condition that the respective
570dnl  --enable argument was given
571dnl
572
573
574AC_MSG_CHECKING(whether to use dynamic linking)
575if test "$with_dl" != no && test "$ac_lib_dl" = yes; then
576  AC_DEFINE(HAVE_DL)
577  ac_have_dl=yes
578  AC_MSG_RESULT(yes)
579else
580  AC_MSG_RESULT(no)
581fi
582
583AC_CHECK_LIB(ncurses,tgetent,,\
584 AC_CHECK_LIB(curses,tgetent,,\
585  AC_CHECK_LIB(termcap,tgetent)))
586
587# readline
588if test "$with_readline" = dynamic && test "$ac_have_dl" != yes; then
589  AC_MSG_WARN(can not build dynamic readline without dynamic linking)
590  with_readline=static
591fi
592
593
594if test "$with_readline" != dynamic && test "$with_readline" != no; then
595AC_LANG_SAVE
596AC_LANG_CPLUSPLUS
597   AC_CHECK_LIB(readline, rl_abort)
598   AC_CHECK_HEADERS(readline/readline.h readline/history.h)
599   if test "$ac_cv_lib_readline_rl_abort" = yes && \
600      test "$ac_cv_header_readline_readline_h" = yes; then
601     AC_MSG_CHECKING(whether readline.h is ok)
602     AC_CACHE_VAL(ac_cv_header_readline_readline_h_ok,
603     AC_TRY_LINK(
604#include<unistd.h>
605#include<stdio.h>
606#include<readline/readline.h>
607#ifdef HAVE_READLINE_HISTORY_H
608#include<readline/history.h>
609#endif
610,
611,
612ac_cv_header_readline_readline_h_ok="yes",
613ac_cv_header_readline_readline_h_ok="no",
614))
615    AC_MSG_RESULT($ac_cv_header_readline_readline_h_ok)
616    if test "$ac_cv_header_readline_readline_h_ok" != yes; then
617#not ok -- try once more with explicitly declaring everything
618      AC_MSG_CHECKING(whether or not we nevertheless can use readline)
619      AC_CACHE_VAL(ac_cv_have_readline,
620      AC_TRY_LINK(
621#include <stdio.h>
622extern "C"
623{
624extern char * rl_readline_name;
625extern char *rl_line_buffer;
626char *filename_completion_function();
627typedef char **CPPFunction ();
628extern char ** completion_matches ();
629extern CPPFunction * rl_attempted_completion_function;
630extern FILE * rl_outstream;
631char * readline ();
632void add_history ();
633int write_history ();
634int read_history();
635}
636#ifndef NULL
637#define NULL 0
638#endif
639,
640rl_readline_name=NULL;
641*rl_line_buffer=1;
642completion_matches(NULL, filename_completion_function);
643rl_attempted_completion_function = (CPPFunction *) NULL;
644rl_outstream=NULL;
645readline(NULL);
646add_history(NULL);
647read_history(NULL);
648write_history(NULL);
649,
650ac_cv_have_readline="yes"
651,
652ac_cv_have_readline="no"
653))
654      AC_MSG_RESULT($ac_cv_have_readline)
655    else
656      AC_DEFINE(READLINE_READLINE_H_OK)
657      ac_cv_have_readline="yes"
658    fi
659  fi
660  if test "$ac_cv_have_readline" = yes; then
661    AC_DEFINE(HAVE_READLINE)
662  fi
663AC_LANG_RESTORE
664fi
665
666AC_MSG_CHECKING(which readline to use)
667if test "$ac_cv_with_readline" = dynamic; then
668  AC_MSG_RESULT(dynamic)
669  AC_DEFINE(HAVE_DYN_RL)
670elif test "$ac_cv_have_readline" = yes; then
671  AC_MSG_RESULT(static)
672elif test "$ac_cv_singuname" = PowerMacintosh-darwin; then
673  AC_MSG_ERROR(building without readline impossible on PowerMacintosh-darwin)
674else
675  AC_MSG_RESULT(none)
676  AC_MSG_WARN(building without readline: disabling fancy display)
677fi
678 
679NEED_LIBS=$LIBS
680
681# gmp, MP, MPT, factory, libfac
682AC_CHECK_LIB(gmp, main)
683SAVE_LIBS=$LIBS
684AC_CHECK_LIB(MP, IMP_PutGmpInt,,,$MP_LIBS)
685AC_CHECK_LIB(MPT, MPT_GetTree,,,$MP_LIBS)
686LIBS=$SAVE_LIBS
687AC_CHECK_LIB(singcf, atof)
688AC_CHECK_LIB(singfac, atof)
689AC_CHECK_LIB(omalloc, omTestAddr)
690AC_CHECK_LIB(omalloc_ndebug, main)
691AC_CHECK_LIB(ntl,main)
692
693AC_CHECK_HEADERS(gmp.h MP.h  MPT.h factory.h factor.h omalloc.h \
694 omalloc.c)
695
696AC_LANG_SAVE
697AC_LANG_CPLUSPLUS
698AC_CHECK_HEADERS(boost/dynamic_bitset.hpp)
699AC_LANG_RESTORE
700
701if test "$ac_cv_lib_gmp_main" = yes && \
702 test "$ac_cv_header_gmp_h" = yes; then
703    ac_gmp_ok=yes
704fi
705
706if test "$ac_cv_lib_MP_IMP_PutGmpInt" = yes && \
707 test "$ac_cv_lib_MPT_MPT_GetTree" && \
708 test "$ac_cv_header_MP_h" = yes && \
709 test "$ac_cv_header_MPT_h" = yes; then
710  ac_MP_ok=yes
711fi
712
713if test "$ac_cv_lib_singcf_atof" = yes && \
714 test "$ac_cv_header_factory_h" = yes; then
715  ac_factory_ok=yes
716fi
717
718if test "$ac_cv_lib_singfac_atof" = yes && \
719 test "$ac_cv_header_factor_h" = yes; then
720  ac_libfac_ok=yes
721fi
722
723if test "$ac_cv_lib_omalloc_omTestAddr" = yes && \
724   test "$ac_cv_lib_omalloc_ndebug_main" = yes && \
725   test "$ac_cv_header_omalloc_c" = yes && \
726   test "$ac_cv_header_omalloc_h" = yes; then
727  ac_cv_omalloc_ok=yes
728fi
729
730if test "$ac_cv_lib_ntl_main" = yes; then
731  ac_cv_ntl_ok=yes
732fi
733
734# evaluate results
735dnl llllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllll
736dnl make sure that omalloc is there
737dnl
738if test "$ac_cv_omalloc_ok" != yes && test "$enable_omalloc" != yes; then
739  AC_MSG_ERROR(can not build without omalloc)
740fi
741
742AC_MSG_CHECKING(which apint package to use)
743if test "${with_apint}" != gmp; then
744  if test "$ac_gmp_ok" = yes || test "$enable_gmp" = yes; then
745    AC_MSG_RESULT(gmp)
746    will_have_gmp=yes
747    NEED_LIBS="-lgmp ${NEED_LIBS}"
748  else
749    AC_MSG_RESULT(none)
750    AC_MSG_ERROR(can not build without gmp)
751  fi
752else
753  if test "$ac_gmp_ok" = yes || test "$enable_gmp" = yes; then
754    AC_MSG_RESULT(gmp)
755    will_have_gmp=yes
756    NEED_LIBS="-lgmp ${NEED_LIBS}"
757  else
758    AC_MSG_RESULT(none)
759    AC_MSG_ERROR(can not build with gmp)
760  fi
761fi
762
763#
764AC_MSG_CHECKING(whether to have MP)
765if test "${with_MP}" != yes && test "${with_MP}" != no; then
766  if (test "${will_have_gmp}" = yes) && \
767     (test "$ac_MP_ok" =  yes || test "$enable_MP" = yes); then
768    AC_MSG_RESULT(yes)
769    AC_DEFINE(HAVE_MPSR)
770    HAVE_MPSR=1
771    MP_LIBS="-lMPT -lMP ${MP_LIBS}"
772  else
773    AC_MSG_RESULT(no)
774  fi
775elif  test "${with_MP}" = yes; then
776  if (test "${will_have_gmp}" = yes) && \
777     (test "$ac_MP_ok" =  yes || test "$enable_MP" = yes); then
778    AC_MSG_RESULT(yes)
779    AC_DEFINE(HAVE_MPSR)
780    HAVE_MPSR=1
781    MP_LIBS="-lMPT -lMP ${MP_LIBS}"
782  else
783    AC_MSG_RESULT(no)
784    AC_MSG_ERROR(can not build with MP)
785  fi
786else
787  AC_MSG_RESULT(no)
788fi
789AC_SUBST(HAVE_MPSR)
790AC_SUBST(MP_LIBS)
791
792AC_MSG_CHECKING(whether to have NTL)
793if test "${with_NTL}" = yes ; then
794  AC_MSG_RESULT(yes)
795  NEED_LIBS="-lntl ${NEED_LIBS}"
796else
797  AC_MSG_RESULT(no)
798fi
799
800AC_MSG_CHECKING(whether to have factory)
801if test "${with_factory}" != yes && test "${with_factory}" != no; then
802  if test "$ac_factory_ok" =  yes || test "$enable_factory" = yes; then
803    AC_MSG_RESULT(yes)
804    AC_DEFINE(HAVE_FACTORY)
805    will_have_factory=yes
806    NEED_LIBS="-lsingcf ${NEED_LIBS}"
807  else
808    AC_MSG_RESULT(no)
809  fi
810elif  test "${with_factory}" = yes; then
811  if test "$ac_factory_ok" =  yes || test "$enable_factory" = yes; then
812    AC_MSG_RESULT(yes)
813    AC_DEFINE(HAVE_FACTORY)
814    will_have_factory=yes
815    NEED_LIBS="-lsingcf ${NEED_LIBS}"
816  else
817    AC_MSG_RESULT(no)
818    AC_MSG_ERROR(can not build with factory)
819  fi
820else
821  AC_MSG_RESULT(no)
822fi
823
824AC_MSG_CHECKING(whether to have libfac)
825if test "${with_libfac}" != yes && test "${with_libfac}" != no; then
826  if (test "${will_have_factory}" = yes) && \
827     (test "$ac_libfac_ok" =  yes || test "$enable_libfac" = yes); then
828    AC_MSG_RESULT(yes)
829    AC_DEFINE(HAVE_LIBFAC_P)
830    NEED_LIBS="-lsingfac ${NEED_LIBS}"
831  else
832    AC_MSG_RESULT(no)
833  fi
834elif  test "${with_libfac}" = yes; then
835  if (test "${will_have_factory}" = yes) && \
836     (test "$ac_libfac_ok" =  yes || test "$enable_libfac" = yes); then
837    AC_MSG_RESULT(yes)
838    AC_DEFINE(HAVE_LIBFAC_P)
839    NEED_LIBS="-lsingfac ${NEED_LIBS}"
840  else
841    AC_MSG_RESULT(no)
842    AC_MSG_ERROR(can not build with libfac)
843  fi
844else
845  AC_MSG_RESULT(no)
846fi
847
848NEED_LIBSG="${NEED_LIBS}"
849if test "$ac_cv_sizeof_voidp" != 4; then
850  NEED_LIBS="${NEED_LIBS} -lomalloc"
851else
852  NEED_LIBS="${NEED_LIBS} -lomalloc_ndebug"
853fi
854
855
856AC_SUBST(NEED_LIBS)
857AC_SUBST(NEED_LIBSG)
858
859AC_MSG_CHECKING(whether to have dbm links)
860if test "$with_dbm" != no; then
861  AC_DEFINE(HAVE_DBM)
862  AC_MSG_RESULT(yes)
863else
864  AC_MSG_RESULT(no)
865fi
866
867AC_MSG_CHECKING(whether to have namespaces)
868if test "$with_namespaces" != no; then
869  AC_MSG_RESULT(yes)
870  AC_DEFINE(HAVE_NS)
871else
872  AC_MSG_RESULT(no)
873fi
874
875AC_MSG_CHECKING(whether to have dynamic modules)
876if test "$with_dynamic_modules" = no || test "$ac_have_dl" != yes; then
877  AC_MSG_RESULT(no)
878else
879  AC_DEFINE(HAVE_DYNAMIC_LOADING)
880  AC_MSG_RESULT(yes)
881fi
882
883AC_MSG_CHECKING(whether to have dynamic kernel)
884if test "$with_dynamic_kernel" != no && test "$ac_lib_dl" = yes; then
885  DL_KERNEL=1
886  AC_SUBST(DL_KERNEL)
887  AC_MSG_RESULT(yes)
888else
889  AC_MSG_RESULT(no)
890fi
891
892AC_MSG_CHECKING(whether to have Plural)
893if test "$with_Plural" != yes && test "$enable_Plural" != yes; then
894  AC_MSG_RESULT(no)
895else
896  AC_DEFINE(HAVE_PLURAL)
897  AC_MSG_RESULT(yes)
898  PLURAL=1
899  AC_SUBST(PLURAL)
900fi
901
902
903OUTPUT_MAKEFILES="Makefile ../kernel/Makefile"
904
905if test "$ac_cv_singuname" = "ix86-Win"; then
906  OUTPUT_MAKEFILES="${OUTPUT_MAKEFILES} Singular.rc"
907fi
908
909AC_OUTPUT(${OUTPUT_MAKEFILES}, \
910 cp mod2.h ../kernel/mod2.h; \
911 if test "$CONFIG_HEADERS"; then echo timestamp > stamp-h; fi)
Note: See TracBrowser for help on using the repository browser.