source: git/Singular/configure.in @ 116690

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