source: git/Singular/configure.in @ b4e3253

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