source: git/Singular/configure.in @ 6cd020

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