source: git/Singular/configure.in @ 05c6849

spielwiese
Last change on this file since 05c6849 was 05c6849, checked in by Hans Schönemann <hannes@…>, 16 years ago
*hannes: GLIBC_DYN_FIX git-svn-id: file:///usr/local/Singular/svn/trunk@10557 2c84dea3-7e68-4137-9b89-c4e89433aadc
  • Property mode set to 100644
File size: 24.7 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:-4}
52SINGULAR_VERSION="${SINGULAR_VERSION:-$SINGULAR_MAJOR_VERSION${VERSION_SEP}$SINGULAR_MINOR_VERSION${VERSION_SEP}$SINGULAR_SUB_VERSION}"
53VERSION_DATE=${VERSION_DATE:-"Nov 2007"}
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 2.4.5-2.5.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 sysconf)
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  Boost,
550  [  --without-Boost         do not use Boost ])
551AC_ARG_WITH(
552  stdvec,
553  [  --with-stdvec           use std::vector ])
554AC_ARG_WITH(
555  MP,
556  [  --without-MP            do not use MP (no MP links)])
557AC_ARG_WITH(
558  dbm,
559  [  --without-dbm           do not use dbm (no DBM links)])
560AC_ARG_WITH(
561  factory,
562  [  --without-factory       do not use factory (no poly factorization)])
563AC_ARG_WITH(
564  libfac,
565  [  --without-libfac        do not use libfac (no primary decompositions)])
566AC_ARG_WITH(
567  namespaces,
568  [  --with-namespaces       do compile namespace support])
569AC_ARG_WITH(
570  dl,
571  [  --without-dl            do not use dynamic linking, modules, and kernel])
572AC_ARG_WITH(
573  dynamic-modules,
574  [  --with-dynamic-modules  do compile with dynamic modules support])
575AC_ARG_WITH(
576  dynamic-kernel,
577  [  --without-dynamic-kernel
578                          do not compile with dynamic kernel parts])
579AC_ARG_WITH(apint,
580  [  --with-apint=PACKAGE    use PACKAGE for arbitary integer arithmetic])
581AC_ARG_WITH(
582  Plural,
583  [  --without-Plural        do compile without Plural support])
584AC_ARG_WITH(
585  NTL,
586  [  --with-NTL              build for use with NTL.],
587  ,
588  with_NTL=yes)
589
590dnl llllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllll
591dnl check for packages we need
592dnl for gmp, MP, factory and libfac, we built them in, even if the libs
593dnl and headers were not found under the condition that the respective
594dnl  --enable argument was given
595dnl
596
597
598AC_MSG_CHECKING(whether to use dynamic linking)
599if test "$with_dl" != no && test "$ac_lib_dl" = yes; then
600  AC_DEFINE(HAVE_DL)
601  ac_have_dl=yes
602  AC_MSG_RESULT(yes)
603else
604  AC_MSG_RESULT(no)
605fi
606
607AC_CHECK_LIB(ncurses,tgetent,,\
608 AC_CHECK_LIB(curses,tgetent,,\
609  AC_CHECK_LIB(termcap,tgetent)))
610
611# readline
612if test "$with_readline" = dynamic && test "$ac_have_dl" != yes; then
613  AC_MSG_WARN(can not build dynamic readline without dynamic linking)
614  with_readline=static
615fi
616
617
618if test "$with_readline" != dynamic && test "$with_readline" != no; then
619AC_LANG_SAVE
620AC_LANG_CPLUSPLUS
621   AC_CHECK_LIB(readline, rl_abort)
622   AC_CHECK_HEADERS(readline/readline.h readline/history.h)
623   if test "$ac_cv_lib_readline_rl_abort" = yes && \
624      test "$ac_cv_header_readline_readline_h" = yes; then
625     AC_MSG_CHECKING(whether readline.h is ok)
626     AC_CACHE_VAL(ac_cv_header_readline_readline_h_ok,
627     AC_TRY_LINK(
628#include<unistd.h>
629#include<stdio.h>
630#include<readline/readline.h>
631#ifdef HAVE_READLINE_HISTORY_H
632#include<readline/history.h>
633#endif
634,
635,
636ac_cv_header_readline_readline_h_ok="yes",
637ac_cv_header_readline_readline_h_ok="no",
638))
639    AC_MSG_RESULT($ac_cv_header_readline_readline_h_ok)
640    if test "$ac_cv_header_readline_readline_h_ok" != yes; then
641#not ok -- try once more with explicitly declaring everything
642      AC_MSG_CHECKING(whether or not we nevertheless can use readline)
643      AC_CACHE_VAL(ac_cv_have_readline,
644      AC_TRY_LINK(
645#include <stdio.h>
646extern "C"
647{
648extern char * rl_readline_name;
649extern char *rl_line_buffer;
650char *filename_completion_function();
651typedef char **CPPFunction ();
652extern char ** completion_matches ();
653extern CPPFunction * rl_attempted_completion_function;
654extern FILE * rl_outstream;
655char * readline ();
656void add_history ();
657int write_history ();
658int read_history();
659}
660#ifndef NULL
661#define NULL 0
662#endif
663,
664rl_readline_name=NULL;
665*rl_line_buffer=1;
666completion_matches(NULL, filename_completion_function);
667rl_attempted_completion_function = (CPPFunction *) NULL;
668rl_outstream=NULL;
669readline(NULL);
670add_history(NULL);
671read_history(NULL);
672write_history(NULL);
673,
674ac_cv_have_readline="yes"
675,
676ac_cv_have_readline="no"
677))
678      AC_MSG_RESULT($ac_cv_have_readline)
679    else
680      AC_DEFINE(READLINE_READLINE_H_OK)
681      ac_cv_have_readline="yes"
682    fi
683  fi
684  if test "$ac_cv_have_readline" = yes; then
685    AC_DEFINE(HAVE_READLINE)
686  fi
687AC_LANG_RESTORE
688fi
689
690AC_MSG_CHECKING(which readline to use)
691if test "$ac_cv_with_readline" = dynamic; then
692  AC_MSG_RESULT(dynamic)
693  AC_DEFINE(HAVE_DYN_RL)
694elif test "$ac_cv_have_readline" = yes; then
695  AC_MSG_RESULT(static)
696elif test "$ac_cv_singuname" = PowerMacintosh-darwin; then
697  AC_MSG_ERROR(building without readline impossible on PowerMacintosh-darwin)
698else
699  AC_MSG_RESULT(none)
700  AC_MSG_WARN(building without readline: disabling fancy display)
701fi
702
703NEED_LIBS=$LIBS
704
705# gmp, MP, MPT, factory, libfac
706AC_CHECK_LIB(gmp, main)
707SAVE_LIBS=$LIBS
708AC_CHECK_LIB(MP, IMP_PutGmpInt,,,$MP_LIBS)
709AC_CHECK_LIB(MPT, MPT_GetTree,,,$MP_LIBS)
710LIBS=$SAVE_LIBS
711AC_CHECK_LIB(singcf, atof)
712AC_CHECK_LIB(singfac, atof)
713AC_CHECK_LIB(omalloc, omTestAddr)
714AC_CHECK_LIB(omalloc_ndebug, main)
715AC_CHECK_LIB(ntl,main)
716
717AC_CHECK_HEADERS(gmp.h MP.h  MPT.h factory.h factor.h omalloc.h \
718 omalloc.c)
719
720AC_MSG_CHECKING(whether to use Boost)
721if test "$with_Boost" != no; then
722  AC_MSG_RESULT(yes)
723  AC_LANG_SAVE
724  AC_LANG_CPLUSPLUS
725  AC_CHECK_HEADERS(boost/dynamic_bitset.hpp)
726  AC_LANG_RESTORE
727else
728  AC_MSG_RESULT(no)
729  AC_MSG_CHECKING(whether to use std::vector)
730  if test "$with_stdvec" != yes; then
731    AC_MSG_RESULT(no)
732  else
733    AC_MSG_RESULT(yes)
734    AC_DEFINE(USE_STDVECBOOL)
735    USE_STDVECBOOL=1
736  fi
737fi
738AC_SUBST(USE_STDVECBOOL)
739
740if test "$ac_cv_lib_gmp_main" = yes && \
741 test "$ac_cv_header_gmp_h" = yes; then
742    ac_gmp_ok=yes
743fi
744
745if test "$ac_cv_lib_MP_IMP_PutGmpInt" = yes && \
746 test "$ac_cv_lib_MPT_MPT_GetTree" && \
747 test "$ac_cv_header_MP_h" = yes && \
748 test "$ac_cv_header_MPT_h" = yes; then
749  ac_MP_ok=yes
750fi
751
752if test "$ac_cv_lib_singcf_atof" = yes && \
753 test "$ac_cv_header_factory_h" = yes; then
754  ac_factory_ok=yes
755fi
756
757if test "$ac_cv_lib_singfac_atof" = yes && \
758 test "$ac_cv_header_factor_h" = yes; then
759  ac_libfac_ok=yes
760fi
761
762if test "$ac_cv_lib_omalloc_omTestAddr" = yes && \
763   test "$ac_cv_lib_omalloc_ndebug_main" = yes && \
764   test "$ac_cv_header_omalloc_c" = yes && \
765   test "$ac_cv_header_omalloc_h" = yes; then
766  ac_cv_omalloc_ok=yes
767fi
768
769if test "$ac_cv_lib_ntl_main" = yes; then
770  ac_cv_ntl_ok=yes
771fi
772
773SAVE_LIBS=$LIBS
774AC_CHECK_LIB(c_nonshared,printf,GLIBC_DYN_FIX="-lc_nonshared",GLIBC_DYN_FIX="")
775LIBS=$SAVE_LIBS
776AC_SUBST(GLIBC_DYN_FIX)
777
778# evaluate results
779dnl llllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllll
780dnl make sure that omalloc is there
781dnl
782if test "$ac_cv_omalloc_ok" != yes && test "$enable_omalloc" != yes; then
783  AC_MSG_ERROR(can not build without omalloc)
784fi
785
786AC_MSG_CHECKING(which apint package to use)
787if test "${with_apint}" != gmp; then
788  if test "$ac_gmp_ok" = yes || test "$enable_gmp" = yes; then
789    AC_MSG_RESULT(gmp)
790    will_have_gmp=yes
791    NEED_LIBS="-lgmp ${NEED_LIBS}"
792  else
793    AC_MSG_RESULT(none)
794    AC_MSG_ERROR(can not build without gmp)
795  fi
796else
797  if test "$ac_gmp_ok" = yes || test "$enable_gmp" = yes; then
798    AC_MSG_RESULT(gmp)
799    will_have_gmp=yes
800    NEED_LIBS="-lgmp ${NEED_LIBS}"
801  else
802    AC_MSG_RESULT(none)
803    AC_MSG_ERROR(can not build with gmp)
804  fi
805fi
806
807#
808AC_MSG_CHECKING(whether to have MP)
809if test "${with_MP}" != yes && test "${with_MP}" != no; then
810  if (test "${will_have_gmp}" = yes) && \
811     (test "$ac_MP_ok" =  yes || test "$enable_MP" = yes); then
812    AC_MSG_RESULT(yes)
813    AC_DEFINE(HAVE_MPSR)
814    HAVE_MPSR=1
815    MP_LIBS="-lMPT -lMP ${MP_LIBS}"
816  else
817    AC_MSG_RESULT(no)
818  fi
819elif  test "${with_MP}" = yes; then
820  if (test "${will_have_gmp}" = yes) && \
821     (test "$ac_MP_ok" =  yes || test "$enable_MP" = yes); then
822    AC_MSG_RESULT(yes)
823    AC_DEFINE(HAVE_MPSR)
824    HAVE_MPSR=1
825    MP_LIBS="-lMPT -lMP ${MP_LIBS}"
826  else
827    AC_MSG_RESULT(no)
828    AC_MSG_ERROR(can not build with MP)
829  fi
830else
831  AC_MSG_RESULT(no)
832fi
833AC_SUBST(HAVE_MPSR)
834AC_SUBST(MP_LIBS)
835
836AC_MSG_CHECKING(whether to have NTL)
837if test "${with_NTL}" = yes ; then
838  AC_MSG_RESULT(yes)
839  NEED_LIBS="-lntl ${NEED_LIBS}"
840else
841  AC_MSG_RESULT(no)
842fi
843
844AC_MSG_CHECKING(whether to have factory)
845if test "${with_factory}" != yes && test "${with_factory}" != no; then
846  if test "$ac_factory_ok" =  yes || test "$enable_factory" = yes; then
847    AC_MSG_RESULT(yes)
848    AC_DEFINE(HAVE_FACTORY)
849    will_have_factory=yes
850    NEED_LIBS="-lsingcf ${NEED_LIBS}"
851  else
852    AC_MSG_RESULT(no)
853  fi
854elif  test "${with_factory}" = yes; then
855  if test "$ac_factory_ok" =  yes || test "$enable_factory" = yes; then
856    AC_MSG_RESULT(yes)
857    AC_DEFINE(HAVE_FACTORY)
858    will_have_factory=yes
859    NEED_LIBS="-lsingcf ${NEED_LIBS}"
860  else
861    AC_MSG_RESULT(no)
862    AC_MSG_ERROR(can not build with factory)
863  fi
864else
865  AC_MSG_RESULT(no)
866fi
867
868AC_MSG_CHECKING(whether to have libfac)
869if test "${with_libfac}" != yes && test "${with_libfac}" != no; then
870  if (test "${will_have_factory}" = yes) && \
871     (test "$ac_libfac_ok" =  yes || test "$enable_libfac" = yes); then
872    AC_MSG_RESULT(yes)
873    AC_DEFINE(HAVE_LIBFAC_P)
874    NEED_LIBS="-lsingfac ${NEED_LIBS}"
875  else
876    AC_MSG_RESULT(no)
877  fi
878elif  test "${with_libfac}" = yes; then
879  if (test "${will_have_factory}" = yes) && \
880     (test "$ac_libfac_ok" =  yes || test "$enable_libfac" = yes); then
881    AC_MSG_RESULT(yes)
882    AC_DEFINE(HAVE_LIBFAC_P)
883    NEED_LIBS="-lsingfac ${NEED_LIBS}"
884  else
885    AC_MSG_RESULT(no)
886    AC_MSG_ERROR(can not build with libfac)
887  fi
888else
889  AC_MSG_RESULT(no)
890fi
891
892NEED_LIBSG="${NEED_LIBS}"
893if test "$ac_cv_sizeof_voidp" != 4; then
894  NEED_LIBS="${NEED_LIBS} -lomalloc"
895else
896  NEED_LIBS="${NEED_LIBS} -lomalloc_ndebug"
897fi
898
899
900AC_SUBST(NEED_LIBS)
901AC_SUBST(NEED_LIBSG)
902
903AC_MSG_CHECKING(whether to have dbm links)
904if test "$with_dbm" != no; then
905  AC_DEFINE(HAVE_DBM)
906  AC_MSG_RESULT(yes)
907else
908  AC_MSG_RESULT(no)
909fi
910
911AC_MSG_CHECKING(whether to have namespaces)
912if test "$with_namespaces" != no; then
913  AC_MSG_RESULT(yes)
914  AC_DEFINE(HAVE_NS)
915else
916  AC_MSG_RESULT(no)
917fi
918
919AC_MSG_CHECKING(whether to have dynamic modules)
920if test "$with_dynamic_modules" = no || test "$ac_have_dl" != yes; then
921  AC_MSG_RESULT(no)
922else
923  AC_DEFINE(HAVE_DYNAMIC_LOADING)
924  AC_MSG_RESULT(yes)
925fi
926
927AC_MSG_CHECKING(whether to have dynamic kernel)
928if test "$with_dynamic_kernel" != no && test "$ac_lib_dl" = yes; then
929  DL_KERNEL=1
930  AC_SUBST(DL_KERNEL)
931  AC_MSG_RESULT(yes)
932else
933  AC_MSG_RESULT(no)
934fi
935
936AC_MSG_CHECKING(whether to have Plural)
937if test "$with_Plural" != no && test "$enable_Plural" != no; then
938  AC_DEFINE(HAVE_PLURAL)
939  AC_MSG_RESULT(yes)
940  PLURAL=1
941  AC_SUBST(PLURAL)
942else
943  AC_MSG_RESULT(no)
944fi
945
946
947OUTPUT_MAKEFILES="Makefile ../kernel/Makefile"
948
949if test "$ac_cv_singuname" = "ix86-Win"; then
950  OUTPUT_MAKEFILES="${OUTPUT_MAKEFILES} Singular.rc"
951fi
952
953AC_OUTPUT(${OUTPUT_MAKEFILES}, \
954 cp mod2.h ../kernel/mod2.h; \
955 if test "$CONFIG_HEADERS"; then echo timestamp > stamp-h; fi)
Note: See TracBrowser for help on using the repository browser.