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

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