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
RevLine 
[5f9072]1dnl Process this file with autoconf to produce a configure script.
[97cec0]2AC_INIT(tesths.cc)
[9c35ef]3AC_CONFIG_HEADER(mod2.h)
[938688]4AC_CONFIG_HEADER(../kernel/mod2.h)
[5f9072]5
[1bed80]6dnl lllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllll
7dnl determine singuname
[5f9072]8dnl
[64c6d1]9
[592359]10AC_MSG_CHECKING(CPU for singular)
11ac_cv_singcpuname=`uname -p`
[9c0b60a]12AC_MSG_RESULT($ac_cv_singcpuname)
13
[fe40293]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
[ffc0b6]22if test "$ac_cv_singuname" = unknown && test -r "../singuname.sh"; then
[fe40293]23  if (/bin/sh ../singuname.sh >/dev/null 2>&1) then
[6d7a86]24    ac_cv_singuname=`/bin/sh ../singuname.sh`
[fe40293]25  fi
26fi
27)
28AC_MSG_RESULT($ac_cv_singuname)
29if test "$ac_cv_singuname" = unknown; then
[16b993]30  AC_MSG_WARN(Unknown architecture: Check singuname.sh)
31  ac_cv_singuname="unknown"
[fe40293]32fi
[72f950]33AC_DEFINE_UNQUOTED(S_UNAME, "$ac_cv_singuname")
[7497447]34SINGUNAME=$ac_cv_singuname
35AC_SUBST(SINGUNAME)
[5f9072]36
[a70441f]37if test "$ac_cv_singuname" = ix86-Win; then
38  EXEC_EXT=".exe"
[592359]39  AC_DEFINE(SI_CPU_I386)
[9c0b60a]40  AC_SUBST(SI_CPU_I386)
41  AC_MSG_RESULT(SI_CPU_I386)
[a70441f]42fi
43AC_SUBST(EXEC_EXT)
[7afec5]44if test "$ac_cv_ac_cv_singcpuname" = sparc; then
45  AC_DEFINE(SI_CPU_SPARC)
[9c0b60a]46  AC_SUBST(SI_CPU_SPARC)
47  AC_MSG_RESULT(SI_CPU_SPARC)
[7afec5]48fi
[592359]49if test "$ac_cv_singuname" = x86_64-Linux; then
50  AC_DEFINE(SI_CPU_X86_64)
[9c0b60a]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)
[592359]58fi
59if test "$ac_cv_singuname" = IA64-Linux; then
60  AC_DEFINE(SI_CPU_IA64)
[9c0b60a]61  AC_SUBST(SI_CPU_IA64)
62  AC_MSG_RESULT(SI_CPU_IA64)
[592359]63fi
64if test "$ac_cv_singuname" = ppc-Linux; then
65  AC_DEFINE(SI_CPU_PPC)
[9c0b60a]66  AC_SUBST(SI_CPU_PPC)
67  AC_MSG_RESULT(SI_CPU_PPC)
[592359]68fi
69if test "$ac_cv_singuname" = ppcMac-darwin; then
70  AC_DEFINE(SI_CPU_PPC)
[9c0b60a]71  AC_SUBST(SI_CPU_PPC)
72  AC_MSG_RESULT(SI_CPU_PPC)
[592359]73fi
[a70441f]74
[907274]75SING_UNAME=`echo $SINGUNAME | tr '-' '_' `
76AC_SUBST(SING_UNAME)
77
[1bed80]78# stupid Win programs do not like dots in their pathnames
[af6a6b]79VERSION_SEP="-"
[1bed80]80
81dnl llllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllll
82dnl version stuff -- should be set in ../configure.in
83dnl
84dnl here are some defaults
85
[23b5a6]86SINGULAR_MAJOR_VERSION=${SINGULAR_MAJOR_VERSION:-3}
[b4e3253]87SINGULAR_MINOR_VERSION=${SINGULAR_MINOR_VERSION:-1}
88SINGULAR_SUB_VERSION=${SINGULAR_SUB_VERSION:-0}
[1bed80]89SINGULAR_VERSION="${SINGULAR_VERSION:-$SINGULAR_MAJOR_VERSION${VERSION_SEP}$SINGULAR_MINOR_VERSION${VERSION_SEP}$SINGULAR_SUB_VERSION}"
[b4e3253]90VERSION_DATE=${VERSION_DATE:-"Aug 2008"}
[1bed80]91
92dnl pass them on into the Makefiles
93AC_SUBST(SINGULAR_VERSION)
[8654b5]94AC_SUBST(VERSION_DATE)
95AC_SUBST(SINGULAR_MAJOR_VERSION)
96AC_SUBST(SINGULAR_MINOR_VERSION)
97AC_SUBST(SINGULAR_SUB_VERSION)
[1bed80]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
[64c6d1]106dnl lllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllll
[5f9072]107dnl compiler stuff
[64c6d1]108dnl is needed to check for libs and headers, later on
109dnl
[59dff8]110dnl we do not want to have "-g -O" for CFLAGS
[5f9072]111if test "${CXXFLAGS+set}" != set; then
[4c001a]112  ac_cxxflags_set=no
[5f9072]113  CXXFLAGS="-O"
114fi
115if test "${CFLAGS+set}" != set; then
116  CFLAGS="-O"
[4c001a]117  ac_cflags_set=no
[5f9072]118fi
119
[f988c9]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
[5f9072]126AC_PROG_CC
[a492d2]127AC_PROG_CPP
[5f9072]128AC_PROG_CXX
[ef0124]129AC_PROG_INSTALL
[64c6d1]130AC_AIX
131
[676bae]132# test for gcc-version: gcc2: prefer CC=gcc, CXX=gcc (if not with boost)
[fd7acf]133#                       gcc3:        CC=gcc  CXX=g++
134#                       other:       CC=cc   CXX=c++
[40ecfd]135AC_MSG_CHECKING(gcc version)
[fd7acf]136AC_CACHE_VAL(ac_cv_c_cpp,
[40ecfd]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)
[fd7acf]143
[64c6d1]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
[40ecfd]147  if test "${ac_cv_c_cpp}" = gcc2; then
[676bae]148    CXX=g++
[40ecfd]149  elif test "${ac_cv_c_cpp}" = gcc3; then
150    CXX=g++
151  fi
[002517]152  temp_flags="${CXXFLAGS}"
[40ecfd]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
[002517]163    CXXFLAGS="$temp_flags"
[40ecfd]164  else
[002517]165    CXXFLAGS="${temp_flags} --no-rtti"
166    temp_flags="${CXXFLAGS}"
[40ecfd]167  fi
[104fd23]168
169# check whether gcc accepts --no-exceptions
[40ecfd]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
[002517]177    CXXFLAGS="$temp_flags"
[40ecfd]178  else
[002517]179    CXXFLAGS="${temp_flags} --no-exceptions"
180    temp_flags="${CXXFLAGS}"
[40ecfd]181  fi
[104fd23]182
[40ecfd]183  AC_LANG_RESTORE
[002517]184  CXXFLAGS="$temp_flags"
[31bf3a]185  #here is broking something
186  #uncommented breaks CXXFLAGS variable set
187  #only pipes would remain then in CXXFLAGS
[59dff8]188fi
[64c6d1]189
190# check whether the compiler accepts -pipe
[ce8776]191if test x$ac_cv_c_cpp = xgcc2 -o  x$ac_cv_c_cpp = xgcc3
[91ff167]192then
193  AC_MSG_CHECKING(whether compiler accepts -pipe)
[002517]194  temp_cflags="${CFLAGS}"
[91ff167]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
[64c6d1]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
[5f9072]224
[64c6d1]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
[002517]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}"
[6cd020]235  CXXTEMPLFLAGS="-fno-implicit-templates"
[002517]236  if test "${ac_cv_cxx_have_exceptions}" = yes; then
[6cd020]237    CXXTEMPLFLAGS="${CXXTEMPLFLAGS} --no-exceptions"
[002517]238  fi
[64c6d1]239  if test "$ac_cv_is_aix" = yes; then
240    CXXNOOPTFLAGS="-w"
241  else
242    CXXNOOPTFLAGS=$CXXFLAGS
243  fi
[3610c28]244  STATIC_LDFLAGS="-static"
[f988c9]245else
[64c6d1]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"
[f988c9]256fi
257
[64c6d1]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
[59dff8]266dnl if they are not yet already set
[64c6d1]267
[59dff8]268# expand prefix
[64c6d1]269test "x$prefix" = xNONE && prefix=$ac_default_prefix
270if test "${with_rootdir+set}" != set; then
[744d1ce]271  AC_DEFINE_UNQUOTED(S_ROOT_DIR, "${prefix}")
[0164d0]272else
[744d1ce]273  AC_DEFINE_UNQUOTED(S_ROOT_DIR, "${with_rootdir}")
[0164d0]274fi
275
[744d1ce]276# expand exec_prefixad
[64c6d1]277if test "x$exec_prefix" = xNONE; then
[fe40293]278 exec_prefix=${prefix}/${ac_cv_singuname}
[64c6d1]279fi
[0164d0]280
[64c6d1]281# expand bindir
[a70441f]282test "x$bindir" = 'x${exec_prefix}/bin' && bindir="${exec_prefix}"
[ef0124]283SINGULAR=${SINGULAR:-$bindir/Singular-$SINGULAR_MAJOR_VERSION${VERSION_SEP}$SINGULAR_MINOR_VERSION${VERSION_SEP}$SINGULAR_SUB_VERSION}
[64c6d1]284AC_SUBST(SINGULAR)
[744d1ce]285AC_DEFINE_UNQUOTED(S_BIN_DIR, "${bindir}")
[64c6d1]286
287# expand libdir
[a70441f]288test "x$libdir" = 'x${exec_prefix}/lib'&& libdir="${exec_prefix}/lib"
[64c6d1]289
290# expand includedir
[a70441f]291test "x$includedir" = 'x${prefix}/include' && includedir="${exec_prefix}/include"
[5f9072]292
[64c6d1]293# add to -I to CPPFLAGS and and -L to LDFLAGS, just to be sure
[833e11]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
[64c6d1]301
[80bc9a]302# this is a work-around to include the right term.h
303if test "$ac_cv_singuname" = SunOS-5; then
[cbb86c9]304CPPFLAGS="-I/usr/xpg4/include ${CPPFLAGS}"
[80bc9a]305fi
306
307
[64c6d1]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
[a2a6c7]316  cmd="egrep [2-9]\.[5-9]"
317  changequote([,])dnl
[64c6d1]318  AC_CACHE_VAL(ac_cv_prog_flex,
319  if (flex --version >/dev/null 2>&1)
320    then
[a2a6c7]321    if (flex --version | $cmd >/dev/null 2>&1 )
322    then
323        ac_cv_prog_flex=flex
[dc87554]324    fi
[64c6d1]325  fi
326  )
[a2a6c7]327  dnl changequote([,])dnl
[64c6d1]328  if test "${ac_cv_prog_flex+set}" = set; then
329    AC_MSG_RESULT(flex)
330    LEX=flex
331    AC_SUBST(LEX)
[f7b5a1]332  else
[ca847b]333    AC_MSG_WARN(can not find flex with version 2.4.5-2.5.4)
[f7b5a1]334  fi
[64c6d1]335elif test "${with_lex}" = no; then
336  AC_MSG_WARN(building without lex -- make might fail)
[f7b5a1]337else
[64c6d1]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)
[59dff8]343  fi
[64c6d1]344fi
[59dff8]345
[64c6d1]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
[59dff8]352# ln -s
[64c6d1]353AC_PROG_LN_S
354
[a70441f]355AC_CHECK_PROGS(PERL, perl5 perl)
356
[64c6d1]357dnl llllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllll
358dnl check for general libraries, header files, typedefs, etc
359dnl
360# lib checks
[f8dcbcb]361# under cygwin, we should not explicitly link with -lm, except for
[b46ce0]362# it really is the last thing to link with
[f8dcbcb]363if test "$ac_cv_singuname" != ix86-Win; then
[64c6d1]364AC_CHECK_LIB(m, atof)
[f8dcbcb]365fi
[20ac44]366AC_CHECK_LIB(nsl)
367AC_CHECK_LIB(socket)
[6b32990]368SAVE_LIBS=${LIBS}
369LIBS=
[185af8]370
371dnl I'm not sure what they are for
[bdd18d]372AC_CHECK_LIB(bsd, setenv)
[20ac44]373dnl i386-SunOS needs nsl and socket
374AC_CHECK_LIB(socket, listen)
375AC_CHECK_LIB(nsl, gethostbyname)
[185af8]376dnl AC_CHECK_LIB(ucb, index)
[20ac44]377MP_LIBS=${LIBS}
[7e5a38]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"
[50cbdc]384                SFLAGS="-fpic -fPIC -DPIC"
[d94d07]385                SLDFLAGS="-fPIC -DPIC -shared"
[937cbcd]386                LD=gcc
[7e5a38]387                ac_lib_dl=yes
388          fi
389        ;;
390        *Linux*)
391          AC_CHECK_LIB(dl, dlopen)
[a3f22c]392          if test "$ac_cv_lib_dl_dlopen" = yes; then
[7e5a38]393                LD_DYN_FLAGS="-ldl -rdynamic"
[c88397]394                SFLAGS="-fpic -DPIC"
[ea6657f]395                SLDFLAGS=-shared
[937cbcd]396                LD=ld
[7e5a38]397                ac_lib_dl=yes
398          fi
399        ;;
[50cbdc]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        ;;
[457d8d6]407        SunOS-5)
408          AC_CHECK_LIB(dl, dlopen)
409          if test "$ac_cv_lib_dl_dlopen" = yes; then
[f4e34d9]410                LD_DYN_FLAGS="-ldl"
[457d8d6]411                SFLAGS="-fpic -DPIC"
412                SLDFLAGS=-shared
[f4e34d9]413                LD=$CC
[457d8d6]414                ac_lib_dl=yes
415          fi
416        ;;
[8e7056]417        #use export MACOSX_DEPLOYMENT_TARGET=10.3
[7c7282]418        ppcMac-darwin)
419          AC_CHECK_LIB(dl, dlopen)
420          if test "$ac_cv_lib_dl_dlopen" = yes; then
[db0c1bb]421                LD_DYN_FLAGS="-ldl -dynamic"
[7c7282]422                SFLAGS="-fpic -DPIC"
[8e7056]423                SLDFLAGS="-dynamic -twolevel_namespace -weak_reference_mismatches weak -undefined dynamic_lookup"
424                LD=libtool
[7c7282]425                ac_lib_dl=yes
426          fi
427        ;;
[54252c]428        ix86Mac-darwin)
[e40798]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        ;;
[145917]438        ix86-freebsd)
439          AC_CHECK_LIB(c, dlopen)
440          if test "$ac_cv_lib_c_dlopen" = yes; then
[c1c32ff]441                LD_DYN_FLAGS="-Xlinker -E"
[145917]442                SFLAGS="-fpic -DPIC"
443                SLDFLAGS=-shared
444                LD=ld
445                ac_lib_dl=yes
446          fi
447        ;;
[7e5a38]448esac
449AC_SUBST(LD_DYN_FLAGS)
450AC_SUBST(SFLAGS)
451AC_SUBST(SLDFLAGS)
[937cbcd]452AC_SUBST(LD)
[6b32990]453LIBS=${SAVE_LIBS}
[7e5a38]454
[013557]455
[59dff8]456# heder file checks
[64c6d1]457AC_HEADER_STDC
458AC_CHECK_HEADERS(limits.h unistd.h,,
459  AC_MSG_ERROR(Can not compile without limits.h unistd.h))
460
[a2a6c7]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)
[64c6d1]464
465# typedefs, structures
466AC_C_CONST
467AC_C_INLINE
468AC_TYPE_SIZE_T
469AC_STRUCT_TM
[a2a6c7]470AC_HEADER_TIME
[64c6d1]471
472# library functions.
473AC_FUNC_ALLOCA
474AC_PROG_GCC_TRADITIONAL
475AC_FUNC_MMAP
476AC_TYPE_SIGNAL
477AC_FUNC_VPRINTF
[013557]478AC_SEARCH_LIBS(setenv, bsd)
[a2a6c7]479AC_CHECK_FUNCS(gettimeofday atexit bcopy getcwd getwd vsnprintf readlink \
[4094088]480 sleep usleep getpwnam popen setenv siginterrupt sysconf)
[013557]481
[64c6d1]482
483dnl llllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllll
484dnl Find out more about particularity of the system
[5f9072]485dnl
[64c6d1]486
487# arithmetic shifts
488AC_MSG_CHECKING(whether your machine has correct arithmetic shifts)
489AC_CACHE_VAL(ac_cv_shift, AC_TRY_RUN(
[8cce43]490  [ int main() { if (-2 >> 1 == -1) return(0); else return(1); } ],
[64c6d1]491   ac_cv_shift=yes,
492   ac_cv_shift=no,
[59dff8]493   if test "$ac_c_cross_dos" = yes; then
494     ac_cv_shift=yes;
495   else
[64c6d1]496     AC_MSG_RESULT(no)
497     AC_MSG_ERROR(cross compilation without default value)
498   fi))
499
[59dff8]500if test "$ac_cv_shift" = yes; then
[64c6d1]501  AC_MSG_RESULT(yes)
502else
503  AC_MSG_RESULT(no)
504  AC_MSG_ERROR(need  -2 >> 1 == -1)
505fi
506
[c7db8e]507
508# check for a peculiar constructor initialization
509AC_MSG_CHECKING(whether explicit C++ constructor calls are allowed)
[3a8afb6]510AC_LANG_SAVE
511AC_LANG_CPLUSPLUS
[59dff8]512AC_CACHE_VAL(ac_cv_explicit_const,AC_TRY_COMPILE(,
513  class testclass
[c7db8e]514  {
515  public:
516    int value;
[3a8afb6]517    testclass() : value(0) {}
[c7db8e]518    testclass( int i ) : value(i) {}
519    ~testclass() { value = 0; }
520  };
[59dff8]521
[c7db8e]522  testclass ptr;
523  ptr.testclass(1);
524, ac_cv_explicit_const=yes, ac_cv_explicit_const=no))
[3a8afb6]525AC_LANG_RESTORE
[c7db8e]526AC_MSG_RESULT($ac_cv_explicit_const)
527if test "$ac_cv_explicit_const" = yes; then
528  AC_DEFINE(HAVE_EXPLICIT_CONSTR)
529fi
530
[64c6d1]531# sprintf returns number of printed chars
532AC_MSG_CHECKING(whether vsprintf returns number of printed chars)
[59dff8]533AC_CACHE_VAL(ac_cv_returns_n_of_chars, AC_TRY_RUN(
534 [#include <stdio.h>
[64c6d1]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)
[fff984]552AC_CHECK_SIZEOF(double, 8)
[64c6d1]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
[fff984]560if test "$ac_cv_sizeof_double" != 8; then
561  AC_MSG_ERROR(need double to b 8 bytes long)
562fi
[79370c5]563if test "$ac_cv_sizeof_voidp" != 4 && test "$ac_cv_sizeof_voidp" != 8; then
[fff984]564  AC_MSG_ERROR(need void* to be 4 or 8 bytes long)
565fi
[6e7af3a]566if test "$ac_cv_sizeof_voidp" != 4; then
[ecce503]567  DEFS="-UOM_NDEBUG"
[6e7af3a]568  AC_SUBST(DEFS)
569fi
[64c6d1]570
571dnl lllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllll
[52a5e8]572dnl help for configure
[5f9072]573dnl
[64c6d1]574AC_ARG_WITH(
575  rootdir,
[59dff8]576  [  --with-rootdir=DIR      use DIR ass compiled-in root directory
577                             (default is PREFIX)])
[64c6d1]578AC_ARG_WITH(
579  lex,
580  [  --with-lex=[LEX,no]     uses LEX as lex program, default is flex])
[5f9072]581AC_ARG_WITH(
582  readline,
[ea6657f]583  [  --with-readline=[dynamic,static,no]
[7e5a38]584                          do use dynamic/static/no readline for fancy display])
[ea6657f]585AC_ARG_WITH(
586  Boost,
587  [  --without-Boost         do not use Boost ])
588AC_ARG_WITH(
589  stdvec,
590  [  --with-stdvec           use std::vector ])
[5f9072]591AC_ARG_WITH(
592  MP,
[64c6d1]593  [  --without-MP            do not use MP (no MP links)])
[5f9072]594AC_ARG_WITH(
595  dbm,
[64c6d1]596  [  --without-dbm           do not use dbm (no DBM links)])
[5f9072]597AC_ARG_WITH(
598  factory,
[64c6d1]599  [  --without-factory       do not use factory (no poly factorization)])
[5f9072]600AC_ARG_WITH(
601  libfac,
[64c6d1]602  [  --without-libfac        do not use libfac (no primary decompositions)])
[cd6b45]603AC_ARG_WITH(
604  namespaces,
605  [  --with-namespaces       do compile namespace support])
606AC_ARG_WITH(
607  dl,
[7e5a38]608  [  --without-dl            do not use dynamic linking, modules, and kernel])
609AC_ARG_WITH(
610  dynamic-modules,
[ea6657f]611  [  --with-dynamic-modules  do compile with dynamic modules support])
[7e5a38]612AC_ARG_WITH(
613  dynamic-kernel,
[ea6657f]614  [  --without-dynamic-kernel
[7e5a38]615                          do not compile with dynamic kernel parts])
[59dff8]616AC_ARG_WITH(apint,
[52a5e8]617  [  --with-apint=PACKAGE    use PACKAGE for arbitary integer arithmetic])
[051dc7]618AC_ARG_WITH(svd,
619  [  --with-svd              use libsvd])
[51c163]620AC_ARG_WITH(
[bd63e0]621  Plural,
[6e04b1]622  [  --without-Plural        do compile without Plural support])
[d7fc6e]623AC_ARG_WITH(
624  NTL,
625  [  --with-NTL              build for use with NTL.],
626  ,
627  with_NTL=yes)
[814c11]628
[64c6d1]629dnl llllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllll
630dnl check for packages we need
[5f9072]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
[59dff8]635
[7e5a38]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
[aac46c]646AC_CHECK_LIB(ncurses,tgetent,,\
647 AC_CHECK_LIB(curses,tgetent,,\
648  AC_CHECK_LIB(termcap,tgetent)))
[3037783]649
[64c6d1]650# readline
[6b32990]651if test "$with_readline" = dynamic && test "$ac_have_dl" != yes; then
[7e5a38]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
[a70441f]658AC_LANG_SAVE
659AC_LANG_CPLUSPLUS
[3a8afb6]660   AC_CHECK_LIB(readline, rl_abort)
[744d1ce]661   AC_CHECK_HEADERS(readline/readline.h readline/history.h)
[3a8afb6]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>
[ef0124]685extern "C"
686{
[3a8afb6]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 ();
[ef0124]697int read_history();
698}
[3a8afb6]699#ifndef NULL
700#define NULL 0
701#endif
[ef0124]702,
703rl_readline_name=NULL;
[3a8afb6]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
[a70441f]726AC_LANG_RESTORE
[5f9072]727fi
[64c6d1]728
[7e5a38]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)
[6af0cf6]735elif test "$ac_cv_singuname" = PowerMacintosh-darwin; then
736  AC_MSG_ERROR(building without readline impossible on PowerMacintosh-darwin)
[7e5a38]737else
738  AC_MSG_RESULT(none)
739  AC_MSG_WARN(building without readline: disabling fancy display)
740fi
[ea6657f]741
[5f9072]742NEED_LIBS=$LIBS
743
[91329a]744# gmp, MP, MPT, factory, libfac
[a70441f]745AC_CHECK_LIB(gmp, main)
[6b32990]746SAVE_LIBS=$LIBS
747AC_CHECK_LIB(MP, IMP_PutGmpInt,,,$MP_LIBS)
748AC_CHECK_LIB(MPT, MPT_GetTree,,,$MP_LIBS)
749LIBS=$SAVE_LIBS
[bde08b]750AC_CHECK_LIB(singcf, atof)
751AC_CHECK_LIB(singfac, atof)
[c232af]752AC_CHECK_LIB(omalloc, omTestAddr)
753AC_CHECK_LIB(omalloc_ndebug, main)
[451d80f]754AC_CHECK_LIB(ntl,main)
[bde08b]755
[91329a]756AC_CHECK_HEADERS(gmp.h MP.h  MPT.h factory.h factor.h omalloc.h \
[a2a6c7]757 omalloc.c)
[bde08b]758
[ea6657f]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)
[1cddd8]778
[a70441f]779if test "$ac_cv_lib_gmp_main" = yes && \
[bde08b]780 test "$ac_cv_header_gmp_h" = yes; then
[5f9072]781    ac_gmp_ok=yes
[bde08b]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
[c232af]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
[451d80f]808if test "$ac_cv_lib_ntl_main" = yes; then
809  ac_cv_ntl_ok=yes
810fi
[c232af]811
[0fb3336]812SAVE_LIBS=$LIBS
[d4eb3f3]813AC_CHECK_LIB(c_nonshared,__stack_chk_fail_local,GLIBC_DYN_FIX="-lc_nonshared",GLIBC_DYN_FIX="")
[0fb3336]814LIBS=$SAVE_LIBS
815AC_SUBST(GLIBC_DYN_FIX)
816
[64c6d1]817# evaluate results
[c232af]818dnl llllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllll
819dnl make sure that omalloc is there
[ea6657f]820dnl
[c232af]821if test "$ac_cv_omalloc_ok" != yes && test "$enable_omalloc" != yes; then
822  AC_MSG_ERROR(can not build without omalloc)
823fi
824
[bde08b]825AC_MSG_CHECKING(which apint package to use)
[91329a]826if test "${with_apint}" != gmp; then
[64c6d1]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}"
[5f9072]831  else
[64c6d1]832    AC_MSG_RESULT(none)
[91329a]833    AC_MSG_ERROR(can not build without gmp)
[64c6d1]834  fi
[91329a]835else
[64c6d1]836  if test "$ac_gmp_ok" = yes || test "$enable_gmp" = yes; then
[bde08b]837    AC_MSG_RESULT(gmp)
[64c6d1]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)
[5f9072]843  fi
844fi
845
[051dc7]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
[59dff8]856#
[64c6d1]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)
[6b32990]863    HAVE_MPSR=1
864    MP_LIBS="-lMPT -lMP ${MP_LIBS}"
[5f9072]865  else
[64c6d1]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)
[6b32990]873    HAVE_MPSR=1
874    MP_LIBS="-lMPT -lMP ${MP_LIBS}"
[64c6d1]875  else
876    AC_MSG_RESULT(no)
877    AC_MSG_ERROR(can not build with MP)
[5f9072]878  fi
[bde08b]879else
880  AC_MSG_RESULT(no)
881fi
[6b32990]882AC_SUBST(HAVE_MPSR)
883AC_SUBST(MP_LIBS)
[5f9072]884
[451d80f]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
[64c6d1]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}"
[5f9072]900  else
[64c6d1]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)
[5f9072]912  fi
[bde08b]913else
914  AC_MSG_RESULT(no)
915fi
[59dff8]916
[64c6d1]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}"
[5f9072]924  else
[64c6d1]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)
[5f9072]936  fi
[bde08b]937else
938  AC_MSG_RESULT(no)
939fi
[c232af]940
[bf4f49b]941NEED_LIBSG="${NEED_LIBS}"
[d4f80c]942if test "$ac_cv_sizeof_voidp" != 4; then
943  NEED_LIBS="${NEED_LIBS} -lomalloc"
944else
945  NEED_LIBS="${NEED_LIBS} -lomalloc_ndebug"
946fi
947
[c232af]948
[5f9072]949AC_SUBST(NEED_LIBS)
[bf4f49b]950AC_SUBST(NEED_LIBSG)
[5f9072]951
[64c6d1]952AC_MSG_CHECKING(whether to have dbm links)
[92e539]953if test "$with_dbm" != no; then
[59dff8]954  AC_DEFINE(HAVE_DBM)
[5f9072]955  AC_MSG_RESULT(yes)
956else
957  AC_MSG_RESULT(no)
[51c163]958fi
959
[73aa5e]960AC_MSG_CHECKING(whether to have namespaces)
[6b86672]961if test "$with_namespaces" != no; then
962  AC_MSG_RESULT(yes)
[8ceecb]963  AC_DEFINE(HAVE_NS)
[f835c6a]964else
[6b86672]965  AC_MSG_RESULT(no)
[cd6b45]966fi
967
[7e5a38]968AC_MSG_CHECKING(whether to have dynamic modules)
[457d8d6]969if test "$with_dynamic_modules" = no || test "$ac_have_dl" != yes; then
[bd3d4e]970  AC_MSG_RESULT(no)
971else
972  AC_DEFINE(HAVE_DYNAMIC_LOADING)
973  AC_MSG_RESULT(yes)
[cd6b45]974fi
975
[7e5a38]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)
[f8dcbcb]981else
982  AC_MSG_RESULT(no)
[7e5a38]983fi
984
[814c11]985AC_MSG_CHECKING(whether to have Plural)
[2da8a4a]986if test "$with_Plural" != no && test "$enable_Plural" != no; then
[814c11]987  AC_DEFINE(HAVE_PLURAL)
988  AC_MSG_RESULT(yes)
[0513d8]989  PLURAL=1
990  AC_SUBST(PLURAL)
[2da8a4a]991else
992  AC_MSG_RESULT(no)
[814c11]993fi
994
[bd3d4e]995
[938688]996OUTPUT_MAKEFILES="Makefile ../kernel/Makefile"
[8654b5]997
998if test "$ac_cv_singuname" = "ix86-Win"; then
999  OUTPUT_MAKEFILES="${OUTPUT_MAKEFILES} Singular.rc"
1000fi
1001
1002AC_OUTPUT(${OUTPUT_MAKEFILES}, \
[d18a3c]1003 cp mod2.h ../kernel/mod2.h; \
[a492d2]1004 if test "$CONFIG_HEADERS"; then echo timestamp > stamp-h; fi)
Note: See TracBrowser for help on using the repository browser.