source: git/Singular/configure.in @ 907274

fieker-DuValspielwiese
Last change on this file since 907274 was 907274, checked in by Olaf Bachmann <obachman@…>, 25 years ago
* added -DSING_UNAME flag to DEFS of compilation where SING_UNAME=`echo $SINGUNAME | tr '-' '_' i.e., now ix86_Linux is defiend as preprocessor symbol, if SINGUNAME == ix86-Linux, and so on git-svn-id: file:///usr/local/Singular/svn/trunk@2975 2c84dea3-7e68-4137-9b89-c4e89433aadc
  • Property mode set to 100644
File size: 23.5 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
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:-2}
46SINGULAR_VERSION="${SINGULAR_VERSION:-$SINGULAR_MAJOR_VERSION${VERSION_SEP}$SINGULAR_MINOR_VERSION${VERSION_SEP}$SINGULAR_SUB_VERSION}"
47VERSION_DATE=${VERSION_DATE:-"February 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# perl version 5
222if test "${with_perl5+set}" != set; then
223  AC_MSG_CHECKING(for perl5)
224  changequote(<<,>>)dnl
225  AC_CACHE_VAL(ac_cv_prog_perl5,
226  if (perl5 -v >/dev/null 2>&1)
227  then
228   if (perl5 -v | egrep "version 5\.[0-9]" >/dev/null 2>&1 )
229    then
230    ac_cv_prog_perl5=perl5
231   fi
232  elif (perl -v >/dev/null 2>&1)
233  then
234    if (perl -v | egrep "version 5\.[0-9]" >/dev/null 2>&1 )
235    then
236      ac_cv_prog_perl5=perl
237    fi
238  fi
239  )
240  changequote([,])dnl
241  if test "${ac_cv_prog_perl5+set}" = set; then
242    AC_MSG_RESULT(${ac_cv_prog_perl5})
243    PERL5=${ac_cv_prog_perl5}
244    AC_SUBST(PERL5)
245  else
246    AC_MSG_ERROR(can not find perl version 5)
247  fi
248elif test "${with_perl5}" = no; then
249  AC_MSG_WARN(building without perl5 --  make might fail)
250else
251  unset PERL5
252  unset ac_cv_prog_PERL5
253  AC_CHECK_PROGS(PERL5, ${with_perl5})
254  if test "x${PERL5}" = x; then
255    AC_MSG_WARN(building without perl5 -- make might fail)
256  fi
257fi
258
259# bison
260AC_CHECK_PROGS(BISON, bison)
261if test "${BISON+set}" != set; then
262  AC_MSG_WARN(did not find bison -- make might fail)
263fi
264
265if test "${with_info+set}" != set; then
266  AC_CHECK_PROGS(INFO, info, notfound)
267  if test "${INFO}" = notfound; then
268    AC_MSG_ERROR(did not find info)
269  fi
270  AC_DEFINE_UNQUOTED(HAVE_INFO, "info")
271elif test "$with_info" != no; then
272  unset INFO
273  unset ac_cv_prog_INFO
274  AC_CHECK_PROGS(INFO, ${with_info}, notfound)
275  if test "${INFO}" = notfound; then
276    AC_MSG_ERROR(did not find ${with_info})
277  fi
278  AC_DEFINE_UNQUOTED(HAVE_INFO, "${with_info}")
279fi
280
281# ln -s 
282AC_PROG_LN_S
283
284dnl llllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllll
285dnl check for general libraries, header files, typedefs, etc
286dnl
287# lib checks
288AC_CHECK_LIB(m, atof)
289AC_CHECK_LIB(bsd, socket)
290AC_CHECK_LIB(socket, listen)
291AC_CHECK_LIB(nsl, gethostbyname)
292AC_CHECK_LIB(ucb, index)
293
294# heder file checks
295AC_HEADER_STDC
296AC_CHECK_HEADERS(limits.h unistd.h,,
297  AC_MSG_ERROR(Can not compile without limits.h unistd.h))
298
299AC_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)
300
301# typedefs, structures
302AC_C_CONST
303AC_C_INLINE
304AC_TYPE_SIZE_T
305AC_HEADER_TIME
306AC_STRUCT_TM
307
308# library functions.
309AC_FUNC_ALLOCA
310AC_PROG_GCC_TRADITIONAL
311AC_FUNC_MMAP
312AC_TYPE_SIGNAL
313AC_FUNC_VPRINTF
314AC_CHECK_FUNCS(gettimeofday atexit bcopy getcwd getwd sbrk readlink sleep usleep valloc getpagesize)
315
316dnl llllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllll
317dnl Find out more about particularity of the system
318dnl
319
320# arithmetic shifts
321AC_MSG_CHECKING(whether your machine has correct arithmetic shifts)
322AC_CACHE_VAL(ac_cv_shift, AC_TRY_RUN(
323  [ int main() { if (-2 >> 1 == -1) exit(0); else exit(1); } ],
324   ac_cv_shift=yes,
325   ac_cv_shift=no,
326   if test "$ac_c_cross_dos" = yes; then
327     ac_cv_shift=yes;
328   else
329     AC_MSG_RESULT(no)
330     AC_MSG_ERROR(cross compilation without default value)
331   fi))
332
333if test "$ac_cv_shift" = yes; then   
334  AC_MSG_RESULT(yes)
335else
336  AC_MSG_RESULT(no)
337  AC_MSG_ERROR(need  -2 >> 1 == -1)
338fi
339
340
341# check for a peculiar constructor initialization
342AC_MSG_CHECKING(whether explicit C++ constructor calls are allowed)
343AC_LANG_SAVE
344AC_LANG_CPLUSPLUS
345AC_CACHE_VAL(ac_cv_explicit_const,AC_TRY_COMPILE(,
346  class testclass
347  {
348  public:
349    int value;
350    testclass() : value(0) {}
351    testclass( int i ) : value(i) {}
352    ~testclass() { value = 0; }
353  };
354 
355  testclass ptr;
356  ptr.testclass(1);
357, ac_cv_explicit_const=yes, ac_cv_explicit_const=no))
358AC_LANG_RESTORE
359AC_MSG_RESULT($ac_cv_explicit_const)
360if test "$ac_cv_explicit_const" = yes; then
361  AC_DEFINE(HAVE_EXPLICIT_CONSTR)
362fi
363
364# sprintf returns number of printed chars
365AC_MSG_CHECKING(whether vsprintf returns number of printed chars)
366AC_CACHE_VAL(ac_cv_returns_n_of_chars, AC_TRY_RUN(
367 [#include <stdio.h>
368 main() { char *str=(char*)malloc(20); if (((int) sprintf(str,"123456789")) == 9) exit(0); else exit(1); }],
369   ac_cv_returns_n_of_chars=yes,
370   ac_cv_returns_n_of_chars=no,
371   ac_cv_returns_n_of_chars=no))
372if test "$ac_cv_returns_n_of_chars" = yes; then
373  AC_MSG_RESULT(yes)
374else
375  AC_MSG_RESULT(no)
376  AC_DEFINE(BSD_SPRINTF)
377fi
378
379# determine ALIGN_8
380AC_CHECK_SIZEOF(char,1)
381AC_CHECK_SIZEOF(short,2)
382AC_CHECK_SIZEOF(int,4)
383AC_CHECK_SIZEOF(long,4)
384AC_CHECK_SIZEOF(void*,4)
385AC_CHECK_SIZEOF(double, 8)
386AC_C_BIGENDIAN
387if test "$ac_cv_sizeof_int" != 4; then
388  AC_MSG_ERROR(need int to be four bytes long)
389fi
390if test "$ac_cv_sizeof_long" != "$ac_cv_sizeof_voidp"; then
391  AC_MSG_ERROR(need equal sizes for long and void*)
392fi
393if test "$ac_cv_sizeof_double" != 8; then
394  AC_MSG_ERROR(need double to b 8 bytes long)
395fi
396if test "$ac_cv_sizeof_voidp" != 4 && "$ac_cv_sizeof_voidp" != 8; then
397  AC_MSG_ERROR(need void* to be 4 or 8 bytes long)
398fi
399
400dnl
401dnl
402dnl figure out the page size of your system
403dnl
404dnl
405AC_MSG_CHECKING(size of system page)
406AC_CACHE_VAL(ac_cv_pagesize,
407AC_TRY_RUN([#include <stdio.h>
408#define HAVE_GMALLOC
409#include "gmalloc.c"
410
411main()
412{
413  FILE *f=fopen("conftestval", "w");
414  if (!f) exit(1);
415  fprintf(f, "%d\n", getpagesize());
416  exit(0);
417}], ac_cv_pagesize=`cat conftestval`, ac_cv_pagesize=0, ac_cv_pagesize=0))
418AC_MSG_RESULT($ac_cv_pagesize)
419if test "$ac_cv_pagesize" != 0; then
420  AC_DEFINE_UNQUOTED(SIZE_OF_SYSTEM_PAGE, $ac_cv_pagesize)
421fi
422
423dnl
424dnl figure out what to do w.r.t. valloc
425dnl
426
427AC_MSG_CHECKING(for page aligned valloc)
428AC_CACHE_VAL(ac_cv_have_page_alignment,
429
430cat > _pagetest.c << EOF
431#include <stdio.h>
432#ifndef ADJUSTMENT
433#define ADJUSTMENT 0
434#endif
435#define REPEAT 1000
436main()
437{
438  long i;
439  unsigned long p1 = (unsigned long) valloc(SIZE_OF_SYSTEM_PAGE - ADJUSTMENT);
440  unsigned long p2;
441  unsigned long diffs = 0;
442 
443  if ((p1 == 0) || (p1 & (SIZE_OF_SYSTEM_PAGE - 1))) exit(1);
444 
445  for (i = 0; i<REPEAT; i++)
446  {
447    p2 = (unsigned long) valloc(SIZE_OF_SYSTEM_PAGE - ADJUSTMENT);
448    if ((p2 == 0) || (p2 & (SIZE_OF_SYSTEM_PAGE - 1))) exit(1);
449    diffs += (p2 - p1);
450    p1 = p2;
451  }
452 
453  if ( ((double) diffs)/((double)REPEAT) < ((double) SIZE_OF_SYSTEM_PAGE)*1.05 )
454  {
455    FILE *f=fopen("conftestval", "w");
456    if (!f) exit(1);
457    fprintf(f, "%d\n", SIZE_OF_SYSTEM_PAGE - ADJUSTMENT);
458    exit(0);
459  }
460  exit(1);
461}
462EOF
463
464ac_cv_have_page_alignment=no
465if test "$with_gmalloc" != yes && \
466   test "$ac_cv_func_valloc" = yes && \
467   test "$ac_cv_pagesize" != 0; then
468AC_TRY_RUN([
469#define ADJUSTMENT 0
470#include "_pagetest.c"
471], ac_cv_have_page_alignment="ac_cv_usable_pagesize="`cat  conftestval`,
472ac_cv_have_page_alignment=no, ac_cv_have_page_alignment=no)
473  if test "$ac_cv_have_page_alignment" = no; then
474AC_TRY_RUN([
475#define ADJUSTMENT SIZEOF_VOIDP
476#include "_pagetest.c"
477], ac_cv_have_page_alignment="ac_cv_usable_pagesize="`cat  conftestval`,
478ac_cv_have_page_alignment=no, ac_cv_have_page_alignment=no)
479  fi
480fi
481
482if test "$ac_cv_have_page_alignment" = no && test "$ac_cv_pagesize" != 0; then
483AC_TRY_RUN([
484#define ADJUSTMENT 0
485#define HAVE_GMALLOC
486#include "gmalloc.c"
487#include "_pagetest.c"
488], ac_cv_have_page_alignment="ac_cv_have_gmalloc=yes; ac_cv_usable_pagesize="`cat  conftestval`,
489ac_cv_have_page_alignment=no, ac_cv_have_page_alignment=no)
490  if test "$ac_cv_have_page_alignment" = no; then
491AC_TRY_RUN([
492#define ADJUSTMENT SIZEOF_VOIDP
493#define HAVE_GMALLOC
494#include "gmalloc.c"
495#include "_pagetest.c"
496], ac_cv_have_page_alignment="ac_cv_have_gmalloc=yes; ac_cv_usable_pagesize="`cat  conftestval`,
497ac_cv_have_page_alignment=no, ac_cv_have_page_alignment=no)
498  fi
499fi
500rm -rf conftesteval _pagetest.c
501
502)
503
504if test "$ac_cv_have_page_alignment" != no; then
505  eval $ac_cv_have_page_alignment
506  AC_DEFINE(HAVE_PAGE_ALIGNMENT)
507  AC_DEFINE_UNQUOTED(PALLOC, valloc)
508  AC_DEFINE_UNQUOTED(PFREE, free)
509  if test "$ac_cv_have_gmalloc" = yes; then
510    AC_DEFINE(HAVE_GMALLOC)
511    AC_MSG_RESULT(from gmalloc)
512  else
513    AC_MSG_RESULT(from system)
514  fi
515  AC_DEFINE_UNQUOTED(SIZE_OF_PAGE, $ac_cv_usable_pagesize)
516else
517  AC_MSG_RESULT(no)
518  AC_MSG_WARN(Advanced memory management disabled)
519fi
520
521dnl lllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllll
522dnl help for configure
523dnl
524AC_ARG_WITH(
525  rootdir,
526  [  --with-rootdir=DIR      use DIR ass compiled-in root directory
527                             (default is PREFIX)])
528AC_ARG_WITH(
529  lex,
530  [  --with-lex=[LEX,no]     uses LEX as lex program, default is flex])
531AC_ARG_WITH(
532  perl5,
533  [  --with-perl5=[PERL5,no] uses PERL5 as perl5 program, default is perl5])
534AC_ARG_WITH(
535  info,
536  [  --with-info=[INFO,no]   uses INFO as info program, default is info])
537AC_ARG_WITH(
538  readline,
539  [  --without-readline      do not use readline for fancy display])
540AC_ARG_WITH(
541  MP,
542  [  --without-MP            do not use MP (no MP links)])
543AC_ARG_WITH(
544  dbm,
545  [  --without-dbm           do not use dbm (no DBM links)])
546AC_ARG_WITH(
547  factory,
548  [  --without-factory       do not use factory (no poly factorization)])
549AC_ARG_WITH(
550  libfac,
551  [  --without-libfac        do not use libfac (no primary decompositions)])
552AC_ARG_WITH(
553  namespaces,
554  [  --with-namespaces       do compile namespace support])
555AC_ARG_WITH(
556  dl,
557  [  --with-dl               do use dl (no dynamic linking)])
558AC_ARG_WITH(apint,
559  [  --with-apint=PACKAGE    use PACKAGE for arbitary integer arithmetic])
560AC_ARG_WITH(
561  exp_type,
562  [  --with-exp_type=TYPE    uses TYPE as type of exponents in polynomials
563                             -- default type is short
564                             -- possible other types are char and int])
565AC_ARG_WITH(
566  gmalloc,
567  [  --with-gmalloc          use our own gmalloc routines, instead of the ones
568                             provided by the system])
569
570dnl llllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllll
571dnl check for packages we need
572dnl for gmp, MP, factory and libfac, we built them in, even if the libs
573dnl and headers were not found under the condition that the respective
574dnl  --enable argument was given
575dnl
576 
577# readline
578if test "$with_readline" != no; then
579  AC_CHECK_LIB(ncurses,tgetent,,\
580   AC_CHECK_LIB(curses,tgetent,,\
581   AC_CHECK_LIB(termcap,tgetent)))
582   AC_CHECK_LIB(readline, rl_abort)
583   AC_CHECK_HEADERS(readline/readline.h readline/history.h)
584   if test "$ac_cv_lib_readline_rl_abort" = yes && \
585      test "$ac_cv_header_readline_readline_h" = yes; then
586     AC_MSG_CHECKING(whether readline.h is ok)
587     AC_CACHE_VAL(ac_cv_header_readline_readline_h_ok,
588     AC_TRY_LINK(
589#include<unistd.h>
590#include<stdio.h>
591#include<readline/readline.h>
592#ifdef HAVE_READLINE_HISTORY_H
593#include<readline/history.h>
594#endif
595,
596#ifndef NULL
597#define NULL 0
598#endif
599rl_readline_name=NULL;
600*rl_line_buffer=1;
601completion_matches(NULL, filename_completion_function);
602rl_attempted_completion_function = (CPPFunction *) NULL;
603rl_outstream=NULL;
604readline(NULL);
605add_history(NULL);
606read_history(NULL);
607write_history(NULL);
608,
609ac_cv_header_readline_readline_h_ok="yes",
610ac_cv_header_readline_readline_h_ok="no",
611))
612    AC_MSG_RESULT($ac_cv_header_readline_readline_h_ok)
613    if test "$ac_cv_header_readline_readline_h_ok" != yes; then
614#not ok -- try once more with explicitly declaring everything
615      AC_MSG_CHECKING(whether or not we nevertheless can use readline)
616      AC_CACHE_VAL(ac_cv_have_readline,
617      AC_TRY_LINK(
618#include <stdio.h>
619,
620extern char * rl_readline_name;
621extern char *rl_line_buffer;
622char *filename_completion_function();
623typedef char **CPPFunction ();
624extern char ** completion_matches ();
625extern CPPFunction * rl_attempted_completion_function;
626extern FILE * rl_outstream;
627char * readline ();
628void add_history ();
629int write_history ();
630#ifndef NULL
631#define NULL 0
632#endif
633 rl_readline_name=NULL;
634*rl_line_buffer=1;
635completion_matches(NULL, filename_completion_function);
636rl_attempted_completion_function = (CPPFunction *) NULL;
637rl_outstream=NULL;
638readline(NULL);
639add_history(NULL);
640read_history(NULL);
641write_history(NULL);
642,
643ac_cv_have_readline="yes"
644,
645ac_cv_have_readline="no"
646))
647      AC_MSG_RESULT($ac_cv_have_readline)
648    else
649      AC_DEFINE(READLINE_READLINE_H_OK)
650      ac_cv_have_readline="yes"
651    fi
652  fi
653  if test "$ac_cv_have_readline" = yes; then
654    AC_DEFINE(HAVE_READLINE)
655  else
656    AC_MSG_WARN(building without readline: disabling fancy display)
657    AC_DEFINE(HAVE_FEREAD)
658  fi
659else
660  AC_DEFINE(HAVE_FEREAD)
661fi
662
663#   
664# dl
665if test "$with_dl" = yes; then
666  AC_CHECK_LIB(dl, dl_init,\
667   AC_MSG_WARN(building without dl: disabling dynamic linking))
668fi
669
670NEED_LIBS=$LIBS
671
672# gmp, smallgmp, MP, MPT, factory, libfac
673AC_CHECK_LIB(gmp, mpq_init)
674if test "ac_cv_lib_gmp_mpq_init" = yes && test "$with-apint" = smallgmp; then
675  LIBS=NEED_LIBS
676fi
677AC_CHECK_LIB(smallgmp, mpz_init)
678AC_CHECK_LIB(MP, IMP_PutGmpInt)
679AC_CHECK_LIB(MPT, MPT_GetTree)
680AC_CHECK_LIB(singcf, atof)
681AC_CHECK_LIB(singfac, atof)
682
683AC_CHECK_HEADERS(gmp.h smallgmp.h MP.h  MPT.h factory.h factor.h)
684
685if test "$ac_cv_lib_gmp_mpq_init" = yes && \
686 test "$ac_cv_header_gmp_h" = yes; then
687    ac_gmp_ok=yes
688fi
689
690if test "$ac_cv_lib_smallgmp_mpz_init" = yes && \
691 test "$ac_cv_header_smallgmp_h" = yes && \
692 test "$ac_cv_header_gmp_h" = yes; then
693    ac_smallgmp_ok=yes
694fi
695
696if test "$ac_cv_lib_MP_IMP_PutGmpInt" = yes && \
697 test "$ac_cv_lib_MPT_MPT_GetTree" && \
698 test "$ac_cv_header_MP_h" = yes && \
699 test "$ac_cv_header_MPT_h" = yes; then
700  ac_MP_ok=yes
701fi
702
703if test "$ac_cv_lib_singcf_atof" = yes && \
704 test "$ac_cv_header_factory_h" = yes; then
705  ac_factory_ok=yes
706fi
707
708if test "$ac_cv_lib_singfac_atof" = yes && \
709 test "$ac_cv_header_factor_h" = yes; then
710  ac_libfac_ok=yes
711fi
712
713# evaluate results
714AC_MSG_CHECKING(which apint package to use)
715if test "${with_apint}" != gmp && test "${with_apint}" != smallgmp; then
716  if test "$ac_gmp_ok" = yes || test "$enable_gmp" = yes; then
717    AC_MSG_RESULT(gmp)
718    will_have_gmp=yes
719    NEED_LIBS="-lgmp ${NEED_LIBS}"
720  elif test "ac_gmp_smallgmp_ok" = yes || test "$enable_smallgmp" = "yes"; then
721    AC_MSG_RESULT(smallgmp)
722    AC_DEFINE(HAVE_SMALLGMP)
723    NEED_LIBS="-lsmallgmp ${NEED_LIBS}"
724  else
725    AC_MSG_RESULT(none)
726    AC_MSG_ERROR(can not build without gmp or smallgmp)
727  fi
728elif test "${with_apint}" = gmp; then
729  if test "$ac_gmp_ok" = yes || test "$enable_gmp" = yes; then
730    AC_MSG_RESULT(gmp)
731    will_have_gmp=yes
732    NEED_LIBS="-lgmp ${NEED_LIBS}"
733  else
734    AC_MSG_RESULT(none)
735    AC_MSG_ERROR(can not build with gmp)
736  fi
737else
738  if test "ac_gmp_smallgmp_ok" = yes || test "$enable_smallgmp" = "yes"; then
739    AC_MSG_RESULT(smallgmp)
740    AC_DEFINE(HAVE_SMALLGMP)
741    NEED_LIBS="-lsmallgmp ${NEED_LIBS}"
742  else
743    AC_MSG_RESULT(none)
744    AC_MSG_ERROR(can not build with smallgmp)
745  fi
746fi
747
748AC_MSG_CHECKING(whether to have MP)
749if test "${with_MP}" != yes && test "${with_MP}" != no; then
750  if (test "${will_have_gmp}" = yes) && \
751     (test "$ac_MP_ok" =  yes || test "$enable_MP" = yes); then
752    AC_MSG_RESULT(yes)
753    AC_DEFINE(HAVE_MPSR)
754    NEED_LIBS="-lMPT -lMP ${NEED_LIBS}"
755  else
756    AC_MSG_RESULT(no)
757  fi
758elif  test "${with_MP}" = yes; then
759  if (test "${will_have_gmp}" = yes) && \
760     (test "$ac_MP_ok" =  yes || test "$enable_MP" = yes); then
761    AC_MSG_RESULT(yes)
762    AC_DEFINE(HAVE_MPSR)
763    NEED_LIBS="-lMPT -lMP ${NEED_LIBS}"
764  else
765    AC_MSG_RESULT(no)
766    AC_MSG_ERROR(can not build with MP)
767  fi
768else
769  AC_MSG_RESULT(no)
770fi
771
772AC_MSG_CHECKING(whether to have factory)
773if test "${with_factory}" != yes && test "${with_factory}" != no; then
774  if test "$ac_factory_ok" =  yes || test "$enable_factory" = yes; then
775    AC_MSG_RESULT(yes)
776    AC_DEFINE(HAVE_FACTORY)
777    will_have_factory=yes
778    NEED_LIBS="-lsingcf ${NEED_LIBS}"
779  else
780    AC_MSG_RESULT(no)
781  fi
782elif  test "${with_factory}" = yes; 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    AC_MSG_ERROR(can not build with factory)
791  fi
792else
793  AC_MSG_RESULT(no)
794fi
795     
796AC_MSG_CHECKING(whether to have libfac)
797if test "${with_libfac}" != yes && test "${with_libfac}" != no; then
798  if (test "${will_have_factory}" = yes) && \
799     (test "$ac_libfac_ok" =  yes || test "$enable_libfac" = yes); then
800    AC_MSG_RESULT(yes)
801    AC_DEFINE(HAVE_LIBFAC_P)
802    NEED_LIBS="-lsingfac ${NEED_LIBS}"
803  else
804    AC_MSG_RESULT(no)
805  fi
806elif  test "${with_libfac}" = yes; 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    AC_MSG_ERROR(can not build with libfac)
815  fi
816else
817  AC_MSG_RESULT(no)
818fi
819AC_SUBST(NEED_LIBS)
820
821AC_MSG_CHECKING(whether to have dbm links)
822if test "$with_dbm" != no; then
823  AC_DEFINE(HAVE_DBM)
824  AC_MSG_RESULT(yes)
825else
826  AC_MSG_RESULT(no)
827fi
828
829AC_MSG_CHECKING(whether to have namespaces)
830if test "$with_namespaces" != yes; then
831  AC_MSG_RESULT(no)
832else
833  AC_DEFINE(HAVE_NAMESPACES)
834  AC_MSG_RESULT(yes)
835fi
836
837AC_MSG_CHECKING(whether to have dynamic loading)
838if test "$with_dl" != yes; then
839  AC_MSG_RESULT(no)
840else
841  AC_DEFINE(HAVE_DYNAMIC_LOADING)
842  AC_MSG_RESULT(yes)
843  case "$ac_cv_singuname" in
844        unknown) ;;
845        HPUX-9)
846          AC_CHECK_LIB(dld, shl_load)
847          NEED_LIBS="-ldld ${NEED_LIBS}"
848          LD_DYN_FLAGS="-Xlinker -E"
849        ;;
850        HPUX-10)
851          AC_CHECK_LIB(dld, shl_load)
852          NEED_LIBS="-ldld ${NEED_LIBS}"
853          LD_DYN_FLAGS="-Xlinker -E"
854        ;;
855        ix86-Linux)
856          NEED_LIBS="-ldl ${NEED_LIBS}"
857          LD_DYN_FLAGS="-rdynamic"
858        ;;
859  esac
860  AC_SUBST(LD_DYN_FLAGS)
861fi
862
863dnl
864dnl figure out Exponent_t and Order_t
865dnl make sure that 2*sizeof(Exponent_t) + sizeof(Order_t) is aligned
866dnl
867AC_MSG_CHECKING(which exponent type to use)
868if test "$with_exp_type" = "char"; then
869  AC_MSG_RESULT(char)
870  AC_DEFINE(EXPONENT_TYPE, char)
871  AC_DEFINE(SIZEOF_EXPONENT, SIZEOF_CHAR)
872elif test "with_exp_type" = "int"; then
873  AC_MSG_RESULT(int)
874  AC_DEFINE(EXPONENT_TYPE, int)
875  AC_DEFINE(SIZEOF_EXPONENT, SIZEOF_INT)
876else
877  AC_MSG_RESULT(short)
878  AC_DEFINE(EXPONENT_TYPE, short)
879  AC_DEFINE(SIZEOF_TYPE, SIZEOF_SHORT)
880fi
881
882
883 
884AC_OUTPUT(Makefile, \
885 if test "$CONFIG_HEADERS"; then echo timestamp > stamp-h; fi)
886
887
888
889
Note: See TracBrowser for help on using the repository browser.