source: git/Singular/configure.in @ 0513d8

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