source: git/Singular/configure.in @ af6a6b

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