source: git/kernel/configure.in @ eab144e

spielwiese
Last change on this file since eab144e was ba0772, checked in by Michael Brickenstein <bricken@…>, 18 years ago
*bricken: adjustments for mac git-svn-id: file:///usr/local/Singular/svn/trunk@9266 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(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        ;;
359        #use export MACOSX_DEPLOYMENT_TARGET=10.3
360        ppcMac-darwin)
361          AC_CHECK_LIB(dl, dlopen)
362          if test "$ac_cv_lib_dl_dlopen" = yes; then
363                LD_DYN_FLAGS="-ldl -dynamic"
364                SFLAGS="-fpic -DPIC"
365                SLDFLAGS="-dynamic -twolevel_namespace -weak_reference_mismatches weak -undefined dynamic_lookup"
366                LD=libtool
367                ac_lib_dl=yes
368          fi
369        ;;
370        i386Mac-darwin)
371          AC_CHECK_LIB(dl, dlopen)
372          if test "$ac_cv_lib_dl_dlopen" = yes; then
373                LD_DYN_FLAGS="-ldl -dynamic"
374                SFLAGS="-fpic -DPIC"
375                SLDFLAGS="-dynamic -twolevel_namespace -weak_reference_mismatches weak -undefined dynamic_lookup"
376                LD=libtool
377                ac_lib_dl=yes
378          fi
379        ;;
380esac
381AC_SUBST(LD_DYN_FLAGS)
382AC_SUBST(SFLAGS)
383AC_SUBST(SLDFLAGS)
384AC_SUBST(LD)
385LIBS=${SAVE_LIBS}
386
387
388# heder file checks
389AC_HEADER_STDC
390AC_CHECK_HEADERS(limits.h unistd.h,,
391  AC_MSG_ERROR(Can not compile without limits.h unistd.h))
392
393AC_CHECK_HEADERS(sys/file.h sys/ioctl.h sys/time.h sys/times.h sys/types.h \
394 sys/stat.h fcntl.h sys/param.h pwd.h asm/sigcontext.h pwd.h termcap.h \
395 termios.h term.h readline/readline.h)
396
397# typedefs, structures
398AC_C_CONST
399AC_C_INLINE
400AC_TYPE_SIZE_T
401AC_STRUCT_TM
402AC_HEADER_TIME
403
404# library functions.
405AC_FUNC_ALLOCA
406AC_PROG_GCC_TRADITIONAL
407AC_FUNC_MMAP
408AC_TYPE_SIGNAL
409AC_FUNC_VPRINTF
410AC_SEARCH_LIBS(setenv, bsd)
411AC_CHECK_FUNCS(gettimeofday atexit bcopy getcwd getwd vsnprintf readlink \
412 sleep usleep getpwnam popen setenv)
413
414
415dnl llllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllll
416dnl Find out more about particularity of the system
417dnl
418
419# arithmetic shifts
420AC_MSG_CHECKING(whether your machine has correct arithmetic shifts)
421AC_CACHE_VAL(ac_cv_shift, AC_TRY_RUN(
422  [ int main() { if (-2 >> 1 == -1) exit(0); else exit(1); } ],
423   ac_cv_shift=yes,
424   ac_cv_shift=no,
425   if test "$ac_c_cross_dos" = yes; then
426     ac_cv_shift=yes;
427   else
428     AC_MSG_RESULT(no)
429     AC_MSG_ERROR(cross compilation without default value)
430   fi))
431
432if test "$ac_cv_shift" = yes; then
433  AC_MSG_RESULT(yes)
434else
435  AC_MSG_RESULT(no)
436  AC_MSG_ERROR(need  -2 >> 1 == -1)
437fi
438
439
440# check for a peculiar constructor initialization
441AC_MSG_CHECKING(whether explicit C++ constructor calls are allowed)
442AC_LANG_SAVE
443AC_LANG_CPLUSPLUS
444AC_CACHE_VAL(ac_cv_explicit_const,AC_TRY_COMPILE(,
445  class testclass
446  {
447  public:
448    int value;
449    testclass() : value(0) {}
450    testclass( int i ) : value(i) {}
451    ~testclass() { value = 0; }
452  };
453
454  testclass ptr;
455  ptr.testclass(1);
456, ac_cv_explicit_const=yes, ac_cv_explicit_const=no))
457AC_LANG_RESTORE
458AC_MSG_RESULT($ac_cv_explicit_const)
459if test "$ac_cv_explicit_const" = yes; then
460  AC_DEFINE(HAVE_EXPLICIT_CONSTR)
461fi
462
463# sprintf returns number of printed chars
464AC_MSG_CHECKING(whether vsprintf returns number of printed chars)
465AC_CACHE_VAL(ac_cv_returns_n_of_chars, AC_TRY_RUN(
466 [#include <stdio.h>
467 main() { char *str=(char*)malloc(20); if (((int) sprintf(str,"123456789")) == 9) exit(0); else exit(1); }],
468   ac_cv_returns_n_of_chars=yes,
469   ac_cv_returns_n_of_chars=no,
470   ac_cv_returns_n_of_chars=no))
471if test "$ac_cv_returns_n_of_chars" = yes; then
472  AC_MSG_RESULT(yes)
473else
474  AC_MSG_RESULT(no)
475  AC_DEFINE(BSD_SPRINTF)
476fi
477
478# determine ALIGN_8
479AC_CHECK_SIZEOF(char,1)
480AC_CHECK_SIZEOF(short,2)
481AC_CHECK_SIZEOF(int,4)
482AC_CHECK_SIZEOF(long,4)
483AC_CHECK_SIZEOF(void*,4)
484AC_CHECK_SIZEOF(double, 8)
485AC_C_BIGENDIAN
486if test "$ac_cv_sizeof_int" != 4; then
487  AC_MSG_ERROR(need int to be four bytes long)
488fi
489if test "$ac_cv_sizeof_long" != "$ac_cv_sizeof_voidp"; then
490  AC_MSG_ERROR(need equal sizes for long and void*)
491fi
492if test "$ac_cv_sizeof_double" != 8; then
493  AC_MSG_ERROR(need double to b 8 bytes long)
494fi
495if test "$ac_cv_sizeof_voidp" != 4 && test "$ac_cv_sizeof_voidp" != 8; then
496  AC_MSG_ERROR(need void* to be 4 or 8 bytes long)
497fi
498
499dnl lllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllll
500dnl help for configure
501dnl
502AC_ARG_WITH(
503  rootdir,
504  [  --with-rootdir=DIR      use DIR ass compiled-in root directory
505                             (default is PREFIX)])
506AC_ARG_WITH(
507  lex,
508  [  --with-lex=[LEX,no]     uses LEX as lex program, default is flex])
509AC_ARG_WITH(
510  readline,
511  [  --with-readline=[dynamic,static,no]         
512                          do use dynamic/static/no readline for fancy display])
513AC_ARG_WITH(
514  MP,
515  [  --without-MP            do not use MP (no MP links)])
516AC_ARG_WITH(
517  dbm,
518  [  --without-dbm           do not use dbm (no DBM links)])
519AC_ARG_WITH(
520  factory,
521  [  --without-factory       do not use factory (no poly factorization)])
522AC_ARG_WITH(
523  libfac,
524  [  --without-libfac        do not use libfac (no primary decompositions)])
525AC_ARG_WITH(
526  namespaces,
527  [  --with-namespaces       do compile namespace support])
528AC_ARG_WITH(
529  dl,
530  [  --without-dl            do not use dynamic linking, modules, and kernel])
531AC_ARG_WITH(
532  dynamic-modules,
533  [  --with-dynamic-modules  do compile with dynamic modules support])
534AC_ARG_WITH(
535  dynamic-kernel,
536  [  --without-dynamic-kernel               
537                          do not compile with dynamic kernel parts])
538AC_ARG_WITH(apint,
539  [  --with-apint=PACKAGE    use PACKAGE for arbitary integer arithmetic])
540AC_ARG_WITH(
541  Plural,
542  [  --with-Plural           do compile with Plural support])
543AC_ARG_WITH(
544  NTL,
545  [  --with-NTL              build for use with NTL.],
546  ,
547  with_NTL=yes)
548
549dnl llllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllll
550dnl check for packages we need
551dnl for gmp, MP, factory and libfac, we built them in, even if the libs
552dnl and headers were not found under the condition that the respective
553dnl  --enable argument was given
554dnl
555
556
557AC_MSG_CHECKING(whether to use dynamic linking)
558if test "$with_dl" != no && test "$ac_lib_dl" = yes; then
559  AC_DEFINE(HAVE_DL)
560  ac_have_dl=yes
561  AC_MSG_RESULT(yes)
562else
563  AC_MSG_RESULT(no)
564fi
565
566AC_CHECK_LIB(ncurses,tgetent,,\
567 AC_CHECK_LIB(curses,tgetent,,\
568  AC_CHECK_LIB(termcap,tgetent)))
569
570# readline
571if test "$with_readline" = dynamic && test "$ac_have_dl" != yes; then
572  AC_MSG_WARN(can not build dynamic readline without dynamic linking)
573  with_readline=static
574fi
575
576
577if test "$with_readline" != dynamic && test "$with_readline" != no; then
578AC_LANG_SAVE
579AC_LANG_CPLUSPLUS
580   AC_CHECK_LIB(readline, rl_abort)
581   AC_CHECK_HEADERS(readline/readline.h readline/history.h)
582   if test "$ac_cv_lib_readline_rl_abort" = yes && \
583      test "$ac_cv_header_readline_readline_h" = yes; then
584     AC_MSG_CHECKING(whether readline.h is ok)
585     AC_CACHE_VAL(ac_cv_header_readline_readline_h_ok,
586     AC_TRY_LINK(
587#include<unistd.h>
588#include<stdio.h>
589#include<readline/readline.h>
590#ifdef HAVE_READLINE_HISTORY_H
591#include<readline/history.h>
592#endif
593,
594,
595ac_cv_header_readline_readline_h_ok="yes",
596ac_cv_header_readline_readline_h_ok="no",
597))
598    AC_MSG_RESULT($ac_cv_header_readline_readline_h_ok)
599    if test "$ac_cv_header_readline_readline_h_ok" != yes; then
600#not ok -- try once more with explicitly declaring everything
601      AC_MSG_CHECKING(whether or not we nevertheless can use readline)
602      AC_CACHE_VAL(ac_cv_have_readline,
603      AC_TRY_LINK(
604#include <stdio.h>
605extern "C"
606{
607extern char * rl_readline_name;
608extern char *rl_line_buffer;
609char *filename_completion_function();
610typedef char **CPPFunction ();
611extern char ** completion_matches ();
612extern CPPFunction * rl_attempted_completion_function;
613extern FILE * rl_outstream;
614char * readline ();
615void add_history ();
616int write_history ();
617int read_history();
618}
619#ifndef NULL
620#define NULL 0
621#endif
622,
623rl_readline_name=NULL;
624*rl_line_buffer=1;
625completion_matches(NULL, filename_completion_function);
626rl_attempted_completion_function = (CPPFunction *) NULL;
627rl_outstream=NULL;
628readline(NULL);
629add_history(NULL);
630read_history(NULL);
631write_history(NULL);
632,
633ac_cv_have_readline="yes"
634,
635ac_cv_have_readline="no"
636))
637      AC_MSG_RESULT($ac_cv_have_readline)
638    else
639      AC_DEFINE(READLINE_READLINE_H_OK)
640      ac_cv_have_readline="yes"
641    fi
642  fi
643  if test "$ac_cv_have_readline" = yes; then
644    AC_DEFINE(HAVE_READLINE)
645  fi
646AC_LANG_RESTORE
647fi
648
649AC_MSG_CHECKING(which readline to use)
650if test "$ac_cv_with_readline" = dynamic; then
651  AC_MSG_RESULT(dynamic)
652  AC_DEFINE(HAVE_DYN_RL)
653elif test "$ac_cv_have_readline" = yes; then
654  AC_MSG_RESULT(static)
655elif test "$ac_cv_singuname" = PowerMacintosh-darwin; then
656  AC_MSG_ERROR(building without readline impossible on PowerMacintosh-darwin)
657else
658  AC_MSG_RESULT(none)
659  AC_MSG_WARN(building without readline: disabling fancy display)
660fi
661 
662NEED_LIBS=$LIBS
663
664# gmp, smallgmp, MP, MPT, factory, libfac
665AC_CHECK_LIB(gmp, main)
666if test "ac_cv_lib_gmp_main" = yes && test "$with-apint" = smallgmp; then
667  LIBS=${NEED_LIBS}
668fi
669AC_CHECK_LIB(smallgmp, main)
670SAVE_LIBS=$LIBS
671AC_CHECK_LIB(MP, IMP_PutGmpInt,,,$MP_LIBS)
672AC_CHECK_LIB(MPT, MPT_GetTree,,,$MP_LIBS)
673LIBS=$SAVE_LIBS
674AC_CHECK_LIB(singcf, atof)
675AC_CHECK_LIB(singfac, atof)
676AC_CHECK_LIB(omalloc, omTestAddr)
677AC_CHECK_LIB(omalloc_ndebug, main)
678AC_CHECK_LIB(ntl,main)
679
680AC_CHECK_HEADERS(gmp.h smallgmp.h MP.h  MPT.h factory.h factor.h omalloc.h \
681 omalloc.c)
682
683if test "$ac_cv_lib_gmp_main" = yes && \
684 test "$ac_cv_header_gmp_h" = yes; then
685    ac_gmp_ok=yes
686fi
687
688if test "$ac_cv_lib_smallgmp_main" = yes && \
689 test "$ac_cv_header_smallgmp_h" = yes && \
690 test "$ac_cv_header_gmp_h" = yes; then
691    ac_smallgmp_ok=yes
692fi
693
694if test "$ac_cv_lib_MP_IMP_PutGmpInt" = yes && \
695 test "$ac_cv_lib_MPT_MPT_GetTree" && \
696 test "$ac_cv_header_MP_h" = yes && \
697 test "$ac_cv_header_MPT_h" = yes; then
698  ac_MP_ok=yes
699fi
700
701if test "$ac_cv_lib_singcf_atof" = yes && \
702 test "$ac_cv_header_factory_h" = yes; then
703  ac_factory_ok=yes
704fi
705
706if test "$ac_cv_lib_singfac_atof" = yes && \
707 test "$ac_cv_header_factor_h" = yes; then
708  ac_libfac_ok=yes
709fi
710
711if test "$ac_cv_lib_omalloc_omTestAddr" = yes && \
712   test "$ac_cv_lib_omalloc_ndebug_main" = yes && \
713   test "$ac_cv_header_omalloc_c" = yes && \
714   test "$ac_cv_header_omalloc_h" = yes; then
715  ac_cv_omalloc_ok=yes
716fi
717
718if test "$ac_cv_lib_ntl_main" = yes; then
719  ac_cv_ntl_ok=yes
720fi
721
722# evaluate results
723dnl llllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllll
724dnl make sure that omalloc is there
725dnl
726if test "$ac_cv_omalloc_ok" != yes && test "$enable_omalloc" != yes; then
727  AC_MSG_ERROR(can not build without omalloc)
728fi
729
730AC_MSG_CHECKING(which apint package to use)
731if test "${with_apint}" != gmp && test "${with_apint}" != smallgmp; then
732  if test "$ac_gmp_ok" = yes || test "$enable_gmp" = yes; then
733    AC_MSG_RESULT(gmp)
734    will_have_gmp=yes
735    NEED_LIBS="-lgmp ${NEED_LIBS}"
736  elif test "ac_gmp_smallgmp_ok" = yes || test "$enable_smallgmp" = "yes"; then
737    AC_MSG_RESULT(smallgmp)
738    AC_DEFINE(HAVE_SMALLGMP)
739    NEED_LIBS="-lsmallgmp ${NEED_LIBS}"
740  else
741    AC_MSG_RESULT(none)
742    AC_MSG_ERROR(can not build without gmp or smallgmp)
743  fi
744elif test "${with_apint}" = gmp; then
745  if test "$ac_gmp_ok" = yes || test "$enable_gmp" = yes; then
746    AC_MSG_RESULT(gmp)
747    will_have_gmp=yes
748    NEED_LIBS="-lgmp ${NEED_LIBS}"
749  else
750    AC_MSG_RESULT(none)
751    AC_MSG_ERROR(can not build with gmp)
752  fi
753else
754  if test "ac_gmp_smallgmp_ok" = yes || test "$enable_smallgmp" = "yes"; then
755    AC_MSG_RESULT(smallgmp)
756    AC_DEFINE(HAVE_SMALLGMP)
757    NEED_LIBS="-lsmallgmp ${NEED_LIBS}"
758  else
759    AC_MSG_RESULT(none)
760    AC_MSG_ERROR(can not build with smallgmp)
761  fi
762fi
763
764#
765AC_MSG_CHECKING(whether to have MP)
766if test "${with_MP}" != yes && test "${with_MP}" != no; then
767  if (test "${will_have_gmp}" = yes) && \
768     (test "$ac_MP_ok" =  yes || test "$enable_MP" = yes); then
769    AC_MSG_RESULT(yes)
770    AC_DEFINE(HAVE_MPSR)
771    HAVE_MPSR=1
772    MP_LIBS="-lMPT -lMP ${MP_LIBS}"
773  else
774    AC_MSG_RESULT(no)
775  fi
776elif  test "${with_MP}" = yes; then
777  if (test "${will_have_gmp}" = yes) && \
778     (test "$ac_MP_ok" =  yes || test "$enable_MP" = yes); then
779    AC_MSG_RESULT(yes)
780    AC_DEFINE(HAVE_MPSR)
781    HAVE_MPSR=1
782    MP_LIBS="-lMPT -lMP ${MP_LIBS}"
783  else
784    AC_MSG_RESULT(no)
785    AC_MSG_ERROR(can not build with MP)
786  fi
787else
788  AC_MSG_RESULT(no)
789fi
790AC_SUBST(HAVE_MPSR)
791AC_SUBST(MP_LIBS)
792
793AC_MSG_CHECKING(whether to have NTL)
794if test "${with_NTL}" = yes ; then
795  AC_MSG_RESULT(yes)
796  NEED_LIBS="-lntl ${NEED_LIBS}"
797else
798  AC_MSG_RESULT(no)
799fi
800
801AC_MSG_CHECKING(whether to have factory)
802if test "${with_factory}" != yes && test "${with_factory}" != no; then
803  if test "$ac_factory_ok" =  yes || test "$enable_factory" = yes; then
804    AC_MSG_RESULT(yes)
805    AC_DEFINE(HAVE_FACTORY)
806    will_have_factory=yes
807    NEED_LIBS="-lsingcf ${NEED_LIBS}"
808  else
809    AC_MSG_RESULT(no)
810  fi
811elif  test "${with_factory}" = yes; then
812  if test "$ac_factory_ok" =  yes || test "$enable_factory" = yes; then
813    AC_MSG_RESULT(yes)
814    AC_DEFINE(HAVE_FACTORY)
815    will_have_factory=yes
816    NEED_LIBS="-lsingcf ${NEED_LIBS}"
817  else
818    AC_MSG_RESULT(no)
819    AC_MSG_ERROR(can not build with factory)
820  fi
821else
822  AC_MSG_RESULT(no)
823fi
824
825AC_MSG_CHECKING(whether to have libfac)
826if test "${with_libfac}" != yes && test "${with_libfac}" != no; then
827  if (test "${will_have_factory}" = yes) && \
828     (test "$ac_libfac_ok" =  yes || test "$enable_libfac" = yes); then
829    AC_MSG_RESULT(yes)
830    AC_DEFINE(HAVE_LIBFAC_P)
831    NEED_LIBS="-lsingfac ${NEED_LIBS}"
832  else
833    AC_MSG_RESULT(no)
834  fi
835elif  test "${with_libfac}" = yes; then
836  if (test "${will_have_factory}" = yes) && \
837     (test "$ac_libfac_ok" =  yes || test "$enable_libfac" = yes); then
838    AC_MSG_RESULT(yes)
839    AC_DEFINE(HAVE_LIBFAC_P)
840    NEED_LIBS="-lsingfac ${NEED_LIBS}"
841  else
842    AC_MSG_RESULT(no)
843    AC_MSG_ERROR(can not build with libfac)
844  fi
845else
846  AC_MSG_RESULT(no)
847fi
848
849
850AC_SUBST(NEED_LIBS)
851
852AC_MSG_CHECKING(whether to have dbm links)
853if test "$with_dbm" != no; then
854  AC_DEFINE(HAVE_DBM)
855  AC_MSG_RESULT(yes)
856else
857  AC_MSG_RESULT(no)
858fi
859
860AC_MSG_CHECKING(whether to have namespaces)
861if test "$with_namespaces" != no; then
862  AC_MSG_RESULT(yes)
863  AC_DEFINE(HAVE_NS)
864else
865  AC_MSG_RESULT(no)
866fi
867
868AC_MSG_CHECKING(whether to have dynamic modules)
869if test "$with_dynamic_modules" = no || test "$ac_have_dl" != yes; then
870  AC_MSG_RESULT(no)
871else
872  AC_DEFINE(HAVE_DYNAMIC_LOADING)
873  AC_MSG_RESULT(yes)
874fi
875
876AC_MSG_CHECKING(whether to have dynamic kernel)
877if test "$with_dynamic_kernel" != no && test "$ac_lib_dl" = yes; then
878  DL_KERNEL=1
879  AC_SUBST(DL_KERNEL)
880  AC_MSG_RESULT(yes)
881else
882  AC_MSG_RESULT(no)
883fi
884
885AC_MSG_CHECKING(whether to have Plural)
886if test "$with_Plural" != yes && test "$enable_Plural" != yes; then
887  AC_MSG_RESULT(no)
888else
889  AC_DEFINE(HAVE_PLURAL)
890  AC_MSG_RESULT(yes)
891fi
892
893
894OUTPUT_MAKEFILES=Makefile
895
896if test "$ac_cv_singuname" = "ix86-Win"; then
897  OUTPUT_MAKEFILES="${OUTPUT_MAKEFILES} Singular.rc"
898fi
899
900AC_OUTPUT(${OUTPUT_MAKEFILES}, \
901 if test "$CONFIG_HEADERS"; then echo timestamp > stamp-h; fi)
Note: See TracBrowser for help on using the repository browser.