source: git/Singular/configure.in @ 3037783

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