source: git/Singular/configure.in @ 666c90

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