source: git/kernel/configure.in @ 585bbcb

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