source: git/Singular/configure.in @ 3400e9

spielwiese
Last change on this file since 3400e9 was 3400e9, checked in by Hans Schönemann <hannes@…>, 24 years ago
*hannes: version date March 2000 git-svn-id: file:///usr/local/Singular/svn/trunk@4197 2c84dea3-7e68-4137-9b89-c4e89433aadc
  • Property mode set to 100644
File size: 23.9 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:-7}
46SINGULAR_VERSION="${SINGULAR_VERSION:-$SINGULAR_MAJOR_VERSION${VERSION_SEP}$SINGULAR_MINOR_VERSION${VERSION_SEP}$SINGULAR_SUB_VERSION}"
47VERSION_DATE=${VERSION_DATE:-"March 2000"}
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# this is a work-around to include the right term.h
185if test "$ac_cv_singuname" = SunOS-5; then
186CPPFLAGS="-I/usr/xpg4/include ${CPPFLAGS}"
187fi
188
189
190
191dnl lllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllll
192dnl Checks for programs.
193dnl
194
195# lex
196if test "${with_lex+set}" != set; then
197  AC_MSG_CHECKING(for flex)
198  changequote(<<,>>)dnl
199  AC_CACHE_VAL(ac_cv_prog_flex,
200  if (flex --version >/dev/null 2>&1)
201  then
202    if (flex --version | egrep "[2-9]\.[5-9]" >/dev/null 2>&1)
203    then
204      ac_cv_prog_flex=flex
205    fi
206  fi
207  )
208  changequote([,])dnl
209  if test "${ac_cv_prog_flex+set}" = set; then
210    AC_MSG_RESULT(flex)
211    LEX=flex
212    AC_SUBST(LEX)
213  else
214    AC_MSG_ERROR(can not find flex with version greater 2.4)
215  fi
216elif test "${with_lex}" = no; then
217  AC_MSG_WARN(building without lex -- make might fail)
218else
219  unset LEX
220  unset ac_cv_prog_LEX
221  AC_CHECK_PROGS(LEX, ${with_lex})
222  if test "x${LEX}" = x; then
223    AC_MSG_WARN(building without lex -- make might fail)
224  fi
225fi
226
227# bison
228AC_CHECK_PROGS(BISON, bison)
229if test "${BISON+set}" != set; then
230  AC_MSG_WARN(did not find bison -- make might fail)
231fi
232
233# ln -s
234AC_PROG_LN_S
235
236dnl llllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllll
237dnl check for general libraries, header files, typedefs, etc
238dnl
239# lib checks
240AC_CHECK_LIB(m, atof)
241AC_CHECK_LIB(bsd, socket)
242AC_CHECK_LIB(socket, listen)
243AC_CHECK_LIB(nsl, gethostbyname)
244AC_CHECK_LIB(ucb, index)
245
246# heder file checks
247AC_HEADER_STDC
248AC_CHECK_HEADERS(limits.h unistd.h,,
249  AC_MSG_ERROR(Can not compile without limits.h unistd.h))
250
251AC_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 termcap.h termios.h term.h)
252
253# typedefs, structures
254AC_C_CONST
255AC_C_INLINE
256AC_TYPE_SIZE_T
257AC_HEADER_TIME
258AC_STRUCT_TM
259
260# library functions.
261AC_FUNC_ALLOCA
262AC_PROG_GCC_TRADITIONAL
263AC_FUNC_MMAP
264AC_TYPE_SIGNAL
265AC_FUNC_VPRINTF
266AC_CHECK_FUNCS(gettimeofday atexit bcopy getcwd getwd vsnprintf sbrk readlink sleep usleep valloc getpagesize setenv getpwnam)
267
268dnl llllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllll
269dnl Find out more about particularity of the system
270dnl
271
272# arithmetic shifts
273AC_MSG_CHECKING(whether your machine has correct arithmetic shifts)
274AC_CACHE_VAL(ac_cv_shift, AC_TRY_RUN(
275  [ int main() { if (-2 >> 1 == -1) exit(0); else exit(1); } ],
276   ac_cv_shift=yes,
277   ac_cv_shift=no,
278   if test "$ac_c_cross_dos" = yes; then
279     ac_cv_shift=yes;
280   else
281     AC_MSG_RESULT(no)
282     AC_MSG_ERROR(cross compilation without default value)
283   fi))
284
285if test "$ac_cv_shift" = yes; then
286  AC_MSG_RESULT(yes)
287else
288  AC_MSG_RESULT(no)
289  AC_MSG_ERROR(need  -2 >> 1 == -1)
290fi
291
292
293# check for a peculiar constructor initialization
294AC_MSG_CHECKING(whether explicit C++ constructor calls are allowed)
295AC_LANG_SAVE
296AC_LANG_CPLUSPLUS
297AC_CACHE_VAL(ac_cv_explicit_const,AC_TRY_COMPILE(,
298  class testclass
299  {
300  public:
301    int value;
302    testclass() : value(0) {}
303    testclass( int i ) : value(i) {}
304    ~testclass() { value = 0; }
305  };
306
307  testclass ptr;
308  ptr.testclass(1);
309, ac_cv_explicit_const=yes, ac_cv_explicit_const=no))
310AC_LANG_RESTORE
311AC_MSG_RESULT($ac_cv_explicit_const)
312if test "$ac_cv_explicit_const" = yes; then
313  AC_DEFINE(HAVE_EXPLICIT_CONSTR)
314fi
315
316# sprintf returns number of printed chars
317AC_MSG_CHECKING(whether vsprintf returns number of printed chars)
318AC_CACHE_VAL(ac_cv_returns_n_of_chars, AC_TRY_RUN(
319 [#include <stdio.h>
320 main() { char *str=(char*)malloc(20); if (((int) sprintf(str,"123456789")) == 9) exit(0); else exit(1); }],
321   ac_cv_returns_n_of_chars=yes,
322   ac_cv_returns_n_of_chars=no,
323   ac_cv_returns_n_of_chars=no))
324if test "$ac_cv_returns_n_of_chars" = yes; then
325  AC_MSG_RESULT(yes)
326else
327  AC_MSG_RESULT(no)
328  AC_DEFINE(BSD_SPRINTF)
329fi
330
331# determine ALIGN_8
332AC_CHECK_SIZEOF(char,1)
333AC_CHECK_SIZEOF(short,2)
334AC_CHECK_SIZEOF(int,4)
335AC_CHECK_SIZEOF(long,4)
336AC_CHECK_SIZEOF(void*,4)
337AC_CHECK_SIZEOF(double, 8)
338AC_C_BIGENDIAN
339if test "$ac_cv_sizeof_int" != 4; then
340  AC_MSG_ERROR(need int to be four bytes long)
341fi
342if test "$ac_cv_sizeof_long" != "$ac_cv_sizeof_voidp"; then
343  AC_MSG_ERROR(need equal sizes for long and void*)
344fi
345if test "$ac_cv_sizeof_double" != 8; then
346  AC_MSG_ERROR(need double to b 8 bytes long)
347fi
348if test "$ac_cv_sizeof_voidp" != 4 && "$ac_cv_sizeof_voidp" != 8; then
349  AC_MSG_ERROR(need void* to be 4 or 8 bytes long)
350fi
351
352dnl
353dnl
354dnl figure out the page size of your system
355dnl
356dnl
357AC_MSG_CHECKING(size of system page)
358AC_CACHE_VAL(ac_cv_pagesize,
359AC_TRY_RUN([#include <stdio.h>
360#define HAVE_GMALLOC
361#include "gmalloc.c"
362
363main()
364{
365  FILE *f=fopen("conftestval", "w");
366  if (!f) exit(1);
367  fprintf(f, "%d\n", getpagesize());
368  exit(0);
369}], ac_cv_pagesize=`cat conftestval`, ac_cv_pagesize=0, ac_cv_pagesize=0))
370AC_MSG_RESULT($ac_cv_pagesize)
371if test "$ac_cv_pagesize" != 0; then
372  AC_DEFINE_UNQUOTED(SIZE_OF_SYSTEM_PAGE, $ac_cv_pagesize)
373fi
374
375dnl
376dnl figure out what to do w.r.t. valloc
377dnl
378
379AC_MSG_CHECKING(for page aligned valloc)
380AC_CACHE_VAL(ac_cv_have_page_alignment,
381
382cat > _pagetest.c << EOF
383#include <stdio.h>
384#ifndef ADJUSTMENT
385#define ADJUSTMENT 0
386#endif
387#define REPEAT 1000
388main()
389{
390  long i;
391  unsigned long p1 = (unsigned long) valloc(SIZE_OF_SYSTEM_PAGE - ADJUSTMENT);
392  unsigned long p2;
393  unsigned long diffs = 0;
394
395  if ((p1 == 0) || (p1 & (SIZE_OF_SYSTEM_PAGE - 1))) exit(1);
396
397  for (i = 0; i<REPEAT; i++)
398  {
399    p2 = (unsigned long) valloc(SIZE_OF_SYSTEM_PAGE - ADJUSTMENT);
400    if ((p2 == 0) || (p2 & (SIZE_OF_SYSTEM_PAGE - 1))) exit(1);
401    diffs += (p2 - p1);
402    p1 = p2;
403  }
404
405  if ( ((double) diffs)/((double)REPEAT) < ((double) SIZE_OF_SYSTEM_PAGE)*1.05 )
406  {
407    FILE *f=fopen("conftestval", "w");
408    if (!f) exit(1);
409    fprintf(f, "%d\n", SIZE_OF_SYSTEM_PAGE - ADJUSTMENT);
410    exit(0);
411  }
412  exit(1);
413}
414EOF
415
416ac_cv_have_page_alignment=no
417if test "$with_gmalloc" != yes && \
418   test "$ac_cv_func_valloc" = yes && \
419   test "$ac_cv_pagesize" != 0; then
420AC_TRY_RUN([
421#define ADJUSTMENT 0
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  if test "$ac_cv_have_page_alignment" = no; then
426AC_TRY_RUN([
427#define ADJUSTMENT SIZEOF_VOIDP
428#include "_pagetest.c"
429], ac_cv_have_page_alignment="ac_cv_usable_pagesize="`cat  conftestval`,
430ac_cv_have_page_alignment=no, ac_cv_have_page_alignment=no)
431  fi
432fi
433
434if test "$ac_cv_have_page_alignment" = no && test "$ac_cv_pagesize" != 0; then
435AC_TRY_RUN([
436#define ADJUSTMENT 0
437#define HAVE_GMALLOC
438#include "gmalloc.c"
439#include "_pagetest.c"
440], ac_cv_have_page_alignment="ac_cv_have_gmalloc=yes; ac_cv_usable_pagesize="`cat  conftestval`,
441ac_cv_have_page_alignment=no, ac_cv_have_page_alignment=no)
442  if test "$ac_cv_have_page_alignment" = no; then
443AC_TRY_RUN([
444#define ADJUSTMENT SIZEOF_VOIDP
445#define HAVE_GMALLOC
446#include "gmalloc.c"
447#include "_pagetest.c"
448], ac_cv_have_page_alignment="ac_cv_have_gmalloc=yes; ac_cv_usable_pagesize="`cat  conftestval`,
449ac_cv_have_page_alignment=no, ac_cv_have_page_alignment=no)
450  fi
451fi
452rm -rf conftesteval _pagetest.c
453
454)
455
456if test "$ac_cv_have_page_alignment" != no && test "$ac_cv_with_gmalloc" != no; then
457  eval $ac_cv_have_page_alignment
458  AC_DEFINE_UNQUOTED(PALLOC, valloc)
459  AC_DEFINE_UNQUOTED(PFREE, free)
460  if test "$ac_cv_have_gmalloc" = yes; then
461    AC_DEFINE(HAVE_GMALLOC)
462    AC_MSG_RESULT(from gmalloc)
463  else
464    AC_MSG_RESULT(from system)
465  fi
466  AC_DEFINE_UNQUOTED(SIZE_OF_PAGE, $ac_cv_usable_pagesize)
467else
468  AC_MSG_RESULT(no)
469  AC_MSG_WARN(Advanced memory management disabled)
470fi
471
472dnl lllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllll
473dnl help for configure
474dnl
475AC_ARG_WITH(
476  rootdir,
477  [  --with-rootdir=DIR      use DIR ass compiled-in root directory
478                             (default is PREFIX)])
479AC_ARG_WITH(
480  lex,
481  [  --with-lex=[LEX,no]     uses LEX as lex program, default is flex])
482AC_ARG_WITH(
483  perl5,
484  [  --with-perl5=[PERL5,no] uses PERL5 as perl5 program, default is perl5])
485AC_ARG_WITH(
486  readline,
487  [  --with-readline          do use static readline for fancy display])
488AC_ARG_WITH(
489  MP,
490  [  --without-MP            do not use MP (no MP links)])
491AC_ARG_WITH(
492  dbm,
493  [  --without-dbm           do not use dbm (no DBM links)])
494AC_ARG_WITH(
495  factory,
496  [  --without-factory       do not use factory (no poly factorization)])
497AC_ARG_WITH(
498  libfac,
499  [  --without-libfac        do not use libfac (no primary decompositions)])
500AC_ARG_WITH(
501  namespaces,
502  [  --with-namespaces       do compile namespace support])
503AC_ARG_WITH(
504  dl,
505  [  --with-dl               do use dl (dynamic linking)])
506AC_ARG_WITH(apint,
507  [  --with-apint=PACKAGE    use PACKAGE for arbitary integer arithmetic])
508AC_ARG_WITH(
509  exp_type,
510  [  --with-exp_type=TYPE    uses TYPE as type of exponents in polynomials
511                             -- default type is short
512                             -- possible other types are char and int])
513AC_ARG_WITH(
514  gmalloc,
515  [  --with-gmalloc          use our own gmalloc routines, instead of the ones
516                             provided by the system])
517AC_ARG_WITH(
518  mtrack,
519  [  --with-mtrack           use mpr routines for extended memory tracking
520                             -- works only under ix86-Linux])
521dnl lllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllll
522dnl Check for perl 5
523dnl
524# perl version 5
525if test "${with_perl5+set}" != set; then
526  AC_MSG_CHECKING(for perl5)
527  changequote(<<,>>)dnl
528  AC_CACHE_VAL(ac_cv_prog_perl5,
529  if (perl5 -v >/dev/null 2>&1)
530  then
531   if (perl5 -v | egrep "version 5\.[0-9]" >/dev/null 2>&1 )
532    then
533    ac_cv_prog_perl5=perl5
534   fi
535  elif (perl -v >/dev/null 2>&1)
536  then
537    if (perl -v | egrep "version 5\.[0-9]" >/dev/null 2>&1 )
538    then
539      ac_cv_prog_perl5=perl
540    fi
541  fi
542  )
543  changequote([,])dnl
544  if test "${ac_cv_prog_perl5+set}" = set; then
545    AC_MSG_RESULT(${ac_cv_prog_perl5})
546    PERL5=${ac_cv_prog_perl5}
547    AC_SUBST(PERL5)
548  else
549    AC_MSG_ERROR(can not find perl version 5)
550  fi
551elif test "${with_perl5}" = no; then
552  AC_MSG_WARN(building without perl5 --  make might fail)
553else
554  unset PERL5
555  unset ac_cv_prog_PERL5
556  AC_CHECK_PROGS(PERL5, ${with_perl5})
557  if test "x${PERL5}" = x; then
558    AC_MSG_WARN(building without perl5 -- make might fail)
559  fi
560fi
561
562dnl llllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllll
563dnl check for packages we need
564dnl for gmp, MP, factory and libfac, we built them in, even if the libs
565dnl and headers were not found under the condition that the respective
566dnl  --enable argument was given
567dnl
568
569AC_CHECK_LIB(ncurses,tgetent,,\
570 AC_CHECK_LIB(curses,tgetent,,\
571  AC_CHECK_LIB(termcap,tgetent)))
572
573# readline
574if test "$with_readline" = yes; then
575   AC_CHECK_LIB(readline, rl_abort)
576   AC_CHECK_HEADERS(readline/readline.h readline/history.h)
577   if test "$ac_cv_lib_readline_rl_abort" = yes && \
578      test "$ac_cv_header_readline_readline_h" = yes; then
579     AC_MSG_CHECKING(whether readline.h is ok)
580     AC_CACHE_VAL(ac_cv_header_readline_readline_h_ok,
581     AC_TRY_LINK(
582#include<unistd.h>
583#include<stdio.h>
584#include<readline/readline.h>
585#ifdef HAVE_READLINE_HISTORY_H
586#include<readline/history.h>
587#endif
588,
589#ifndef NULL
590#define NULL 0
591#endif
592rl_readline_name=NULL;
593*rl_line_buffer=1;
594completion_matches(NULL, filename_completion_function);
595rl_attempted_completion_function = (CPPFunction *) NULL;
596rl_outstream=NULL;
597readline(NULL);
598add_history(NULL);
599read_history(NULL);
600write_history(NULL);
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>
612,
613extern char * rl_readline_name;
614extern char *rl_line_buffer;
615char *filename_completion_function();
616typedef char **CPPFunction ();
617extern char ** completion_matches ();
618extern CPPFunction * rl_attempted_completion_function;
619extern FILE * rl_outstream;
620char * readline ();
621void add_history ();
622int write_history ();
623#ifndef NULL
624#define NULL 0
625#endif
626 rl_readline_name=NULL;
627*rl_line_buffer=1;
628completion_matches(NULL, filename_completion_function);
629rl_attempted_completion_function = (CPPFunction *) NULL;
630rl_outstream=NULL;
631readline(NULL);
632add_history(NULL);
633read_history(NULL);
634write_history(NULL);
635,
636ac_cv_have_readline="yes"
637,
638ac_cv_have_readline="no"
639))
640      AC_MSG_RESULT($ac_cv_have_readline)
641    else
642      AC_DEFINE(READLINE_READLINE_H_OK)
643      ac_cv_have_readline="yes"
644    fi
645  fi
646  if test "$ac_cv_have_readline" = yes; then
647    AC_DEFINE(HAVE_READLINE)
648  else
649    AC_MSG_WARN(building without readline: disabling fancy display)
650  fi
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    case "$ac_cv_singuname" in
738    *-Linux | HPUX-* ) LD_DYN_FLAGS="-Xlinker -E" ;;
739    esac
740    LD_LIBC="-lc"
741    AC_SUBST(LD_LIBC)
742    AC_DEFINE(HAVE_DL)
743  fi
744  AC_CHECK_LIB(dld, shl_load)
745  if test "$ac_cv_lib_dld_shl_load" = yes; then
746    NEED_LIBS="-ldld ${NEED_LIBS}"
747    LD_DYN_FLAGS="-Xlinker -E"
748    LD_LIBC="-lc"
749    AC_SUBST(LD_LIBC)
750    AC_DEFINE(HAVE_DL)
751  fi
752fi
753
754AC_MSG_CHECKING(whether to have MP)
755if test "${with_MP}" != yes && test "${with_MP}" != no; then
756  if (test "${will_have_gmp}" = yes) && \
757     (test "$ac_MP_ok" =  yes || test "$enable_MP" = yes); then
758    AC_MSG_RESULT(yes)
759    AC_DEFINE(HAVE_MPSR)
760    NEED_LIBS="-lMPT -lMP ${NEED_LIBS}"
761  else
762    AC_MSG_RESULT(no)
763  fi
764elif  test "${with_MP}" = yes; then
765  if (test "${will_have_gmp}" = yes) && \
766     (test "$ac_MP_ok" =  yes || test "$enable_MP" = yes); then
767    AC_MSG_RESULT(yes)
768    AC_DEFINE(HAVE_MPSR)
769    NEED_LIBS="-lMPT -lMP ${NEED_LIBS}"
770  else
771    AC_MSG_RESULT(no)
772    AC_MSG_ERROR(can not build with MP)
773  fi
774else
775  AC_MSG_RESULT(no)
776fi
777
778AC_MSG_CHECKING(whether to have factory)
779if test "${with_factory}" != yes && test "${with_factory}" != no; then
780  if test "$ac_factory_ok" =  yes || test "$enable_factory" = yes; then
781    AC_MSG_RESULT(yes)
782    AC_DEFINE(HAVE_FACTORY)
783    will_have_factory=yes
784    NEED_LIBS="-lsingcf ${NEED_LIBS}"
785  else
786    AC_MSG_RESULT(no)
787  fi
788elif  test "${with_factory}" = yes; 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    AC_MSG_ERROR(can not build with factory)
797  fi
798else
799  AC_MSG_RESULT(no)
800fi
801
802AC_MSG_CHECKING(whether to have libfac)
803if test "${with_libfac}" != yes && test "${with_libfac}" != no; then
804  if (test "${will_have_factory}" = yes) && \
805     (test "$ac_libfac_ok" =  yes || test "$enable_libfac" = yes); then
806    AC_MSG_RESULT(yes)
807    AC_DEFINE(HAVE_LIBFAC_P)
808    NEED_LIBS="-lsingfac ${NEED_LIBS}"
809  else
810    AC_MSG_RESULT(no)
811  fi
812elif  test "${with_libfac}" = yes; 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    AC_MSG_ERROR(can not build with libfac)
821  fi
822else
823  AC_MSG_RESULT(no)
824fi
825AC_SUBST(NEED_LIBS)
826
827AC_MSG_CHECKING(whether to have dbm links)
828if test "$with_dbm" != no; then
829  AC_DEFINE(HAVE_DBM)
830  AC_MSG_RESULT(yes)
831else
832  AC_MSG_RESULT(no)
833fi
834
835AC_MSG_CHECKING(whether to have namespaces)
836if test "$with_namespaces" != yes; then
837  AC_MSG_RESULT(no)
838else
839  AC_DEFINE(HAVE_NAMESPACES)
840  AC_MSG_RESULT(yes)
841fi
842
843AC_MSG_CHECKING(whether to have dynamic loading)
844if test "$with_dl" != yes; then
845  AC_MSG_RESULT(no)
846else
847  AC_DEFINE(HAVE_DYNAMIC_LOADING)
848  AC_MSG_RESULT(yes)
849  case "$ac_cv_singuname" in
850        unknown) ;;
851        HPUX-9)
852          AC_CHECK_LIB(dld, shl_load)
853          NEED_LIBS="-ldld ${NEED_LIBS}"
854          LD_DYN_FLAGS="-Xlinker -E"
855        ;;
856        HPUX-10)
857          AC_CHECK_LIB(dld, shl_load)
858          NEED_LIBS="-ldld ${NEED_LIBS}"
859          LD_DYN_FLAGS="-Xlinker -E"
860        ;;
861        ix86-Linux)
862          NEED_LIBS="-ldl ${NEED_LIBS}"
863          LD_DYN_FLAGS="-rdynamic"
864        ;;
865  esac
866  AC_SUBST(LD_DYN_FLAGS)
867fi
868
869dnl
870dnl check for mtrack
871dnl
872AC_MSG_CHECKING(whether to use mtrack)
873if test "$with_mtrack" = yes && test "$ac_cv_singuname" = ix86-Linux; then
874  AC_MSG_RESULT(yes)
875  AC_DEFINE(HAVE_MTRACK)
876else
877  AC_MSG_RESULT(no)
878fi
879
880
881
882dnl
883dnl figure out Exponent_t and Order_t
884dnl make sure that 2*sizeof(Exponent_t) + sizeof(Order_t) is aligned
885dnl
886AC_MSG_CHECKING(which exponent type to use)
887if test "$with_exp_type" = "char"; then
888  AC_MSG_RESULT(char)
889  AC_DEFINE(EXPONENT_TYPE, char)
890  AC_DEFINE(SIZEOF_EXPONENT, SIZEOF_CHAR)
891elif test "with_exp_type" = "int"; then
892  AC_MSG_RESULT(int)
893  AC_DEFINE(EXPONENT_TYPE, int)
894  AC_DEFINE(SIZEOF_EXPONENT, SIZEOF_INT)
895else
896  AC_MSG_RESULT(short)
897  AC_DEFINE(EXPONENT_TYPE, short)
898  AC_DEFINE(SIZEOF_TYPE, SIZEOF_SHORT)
899fi
900
901AC_OUTPUT(Makefile, \
902 if test "$CONFIG_HEADERS"; then echo timestamp > stamp-h; fi)
903
904
905
906
Note: See TracBrowser for help on using the repository browser.