source: git/Singular/configure.in @ 623a7d

spielwiese
Last change on this file since 623a7d was 623a7d, checked in by Hans Schoenemann <hannes@…>, 13 years ago
the official version 3-1-3 git-svn-id: file:///usr/local/Singular/svn/trunk@14112 2c84dea3-7e68-4137-9b89-c4e89433aadc
  • Property mode set to 100644
File size: 36.3 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 check for python (see AC_PYTHON_DEVEL in newer autoconf versions)
8dnl
9AC_DEFUN([AC_PYTHON_DEVEL_SINGULAR],[
10        #
11        # Allow the use of a (user set) custom python version
12        #
13        PYTHON_VERSION="$1"
14        PYTHON="$2"
15
16        #
17        # Check for a version of Python >= 2.1.0
18        #
19        AC_MSG_CHECKING([for a version of Python >= '2.1.0'])
20        ac_supports_python_ver=`$PYTHON -c "import sys, string; \
21                        ver = string.split(sys.version)[[0]]; \
22                        print ver >= '2.1.0'"`
23        if test "$ac_supports_python_ver" != "True"; then
24                if test -z "$PYTHON_NOVERSIONCHECK"; then
25                        AC_MSG_RESULT([no])
26                        AC_MSG_ERROR([
27This version of the AC@&t@_PYTHON_DEVEL macro
28doesn't work properly with versions of Python before
292.1.0. You may need to re-run configure, setting the
30variables PYTHON_CPPFLAGS, PYTHON_LDFLAGS, PYTHON_SITE_PKG,
31PYTHON_EXTRA_LIBS and PYTHON_EXTRA_LDFLAGS by hand.
32Moreover, to disable this check, set PYTHON_NOVERSIONCHECK
33to something else than an empty string.
34])
35                else
36                        AC_MSG_RESULT([skip at user request])
37                fi
38        else
39                AC_MSG_RESULT([yes])
40        fi
41
42        #
43        # if the macro parameter ``version'' is set, honour it
44        #
45        if test -n "$1"; then
46                AC_MSG_CHECKING([for a version of Python $1])
47                ac_supports_python_ver=`$PYTHON -c "import sys, string; \
48                        ver = string.split(sys.version)[[0]]; print ver $1"`
49                if test "$ac_supports_python_ver" = "True"; then
50                   AC_MSG_RESULT([yes])
51                else
52                        AC_MSG_RESULT([no])
53                        AC_MSG_ERROR([this package requires Python $1.
54If you have it installed, but it isn't the default Python
55interpreter in your system path, please pass the PYTHON_VERSION
56variable to configure. See ``configure --help'' for reference.
57])
58                        PYTHON_VERSION=""
59                fi
60        fi
61
62        #
63        # Check if you have distutils, else fail
64        #
65        AC_MSG_CHECKING([for the distutils Python package])
66        ac_distutils_result=`$PYTHON -c "import distutils" 2>&1`
67        if test -z "$ac_distutils_result"; then
68                AC_MSG_RESULT([yes])
69        else
70                AC_MSG_RESULT([no])
71                AC_MSG_ERROR([cannot import Python module "distutils".
72Please check your Python installation. The error was:
73$ac_distutils_result])
74                PYTHON_VERSION=""
75        fi
76
77        #
78        # Check for Python include path
79        #
80        AC_MSG_CHECKING([for Python include path])
81        if test -z "$PYTHON_CPPFLAGS"; then
82                python_path=`$PYTHON -c "import distutils.sysconfig; \
83                                print distutils.sysconfig.get_python_inc();"`
84                if test -n "${python_path}"; then
85                        python_path="-I$python_path"
86                fi
87                PYTHON_CPPFLAGS=$python_path
88        fi
89        AC_MSG_RESULT([$PYTHON_CPPFLAGS])
90        AC_SUBST([PYTHON_CPPFLAGS])
91
92        #
93        # Check for Python library path
94        #
95        AC_MSG_CHECKING([for Python library path])
96        if test -z "$PYTHON_LDFLAGS"; then
97                # (makes two attempts to ensure we've got a version number
98                # from the interpreter)
99                py_version=`$PYTHON -c "from distutils.sysconfig import *; \
100                        from string import join; \
101                        print join(get_config_vars('VERSION'))"`
102                if test "$py_version" == "[None]"; then
103                        if test -n "$PYTHON_VERSION"; then
104                                py_version=$PYTHON_VERSION
105                        else
106                                py_version=`$PYTHON -c "import sys; \
107                                        print sys.version[[:3]]"`
108                        fi
109                fi
110
111                PYTHON_LDFLAGS=`$PYTHON -c "from distutils.sysconfig import *; \
112                        from string import join; \
113                        from os import path; \
114                        print '-L' + get_python_lib(0,1), \
115                        '-L' + path.dirname(get_python_lib(0,1)), \
116                        '-lpython';"`$py_version
117        fi
118        AC_MSG_RESULT([$PYTHON_LDFLAGS])
119        AC_SUBST([PYTHON_LDFLAGS])
120
121        #
122        # Check for site packages
123        #
124        AC_MSG_CHECKING([for Python site-packages path])
125        if test -z "$PYTHON_SITE_PKG"; then
126                PYTHON_SITE_PKG=`$PYTHON -c "import distutils.sysconfig; \
127print distutils.sysconfig.get_python_lib(0,0);"`
128        fi
129        AC_MSG_RESULT([$PYTHON_SITE_PKG])
130        AC_SUBST([PYTHON_SITE_PKG])
131
132        #
133        # libraries which must be linked in when embedding
134        #
135        AC_MSG_CHECKING(python extra libraries)
136        if test -z "$PYTHON_EXTRA_LIBS"; then
137           PYTHON_EXTRA_LIBS=`$PYTHON -c "import distutils.sysconfig; \
138conf = distutils.sysconfig.get_config_var; \
139print conf('LOCALMODLIBS'), conf('LIBS')"`
140        fi
141        AC_MSG_RESULT([$PYTHON_EXTRA_LIBS])
142        AC_SUBST(PYTHON_EXTRA_LIBS)
143
144        #
145        # linking flags needed when embedding
146        #
147        AC_MSG_CHECKING(python extra linking flags)
148        if test -z "$PYTHON_EXTRA_LDFLAGS"; then
149                PYTHON_EXTRA_LDFLAGS=`$PYTHON -c "import distutils.sysconfig; \
150                        conf = distutils.sysconfig.get_config_var; \
151                        print conf('LINKFORSHARED')"`
152        fi
153        AC_MSG_RESULT([$PYTHON_EXTRA_LDFLAGS])
154        AC_SUBST(PYTHON_EXTRA_LDFLAGS)
155
156        #
157        # final check to see if everything compiles alright
158        #
159        AC_MSG_CHECKING([consistency of all components of python development environment])
160#       AC_LANG_PUSH([C])
161        # save current global flags
162        ac_save_LIBS_for_python="${LIBS}"
163        LIBS="$ac_save_LIBS $PYTHON_LDFLAGS"
164        ac_save_CPPFLAGS_for_python="${CPPFLAGS}"
165        CPPFLAGS="$ac_save_CPPFLAGS $PYTHON_CPPFLAGS"
166        AC_TRY_LINK([
167                #include <Python.h>
168        ],[
169                Py_Initialize();
170        ],[pythonexists=yes],[pythonexists=no])
171
172        AC_MSG_RESULT([$pythonexists])
173
174        if test ! "$pythonexists" = "yes"; then
175           AC_MSG_RESULT([
176  Could not link test program to Python. Maybe the main Python library has been
177  installed in some non-standard library path. If so, pass it to configure,
178  via the LDFLAGS environment variable.
179  Example: ./configure LDFLAGS="-L/usr/non-standard-path/python/lib"
180  ============================================================================
181   ERROR!
182   You probably have to install the development version of the Python package
183   for your distribution.  The exact name of this package varies among them.
184  ============================================================================
185           ])
186          PYTHON_VERSION=""
187          pythonexists=no
188        else
189          AC_DEFINE(HAVE_PYTHON)
190          HAVE_PYTHON_VALUE=1
191          AC_SUBST(HAVE_PYTHON_VALUE)
192        fi
193
194#       AC_LANG_POP
195        # turn back to default flags
196        CPPFLAGS="$ac_save_CPPFLAGS_for_python"
197        LIBS="$ac_save_LIBS_for_python"
198
199        #
200        # all done!
201        #
202])
203
204
205dnl lllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllll
206dnl check whethe python-based module can be build statically
207dnl
208AC_DEFUN([AC_PYTHON_TEST_STATIC],[
209        ac_save_LIBS_for_python="${LIBS}"
210        ac_save_CPPFLAGS_for_python="${CPPFLAGS}"
211
212        AC_MSG_CHECKING([${try_python_shared_static_flags} for linking \
213python statically])
214        all_cppflags="${ac_save_CPPFLAGS} ${PYTHON_CPPFLAGS}"
215
216        CPPFLAGS="-static ${all_cppflags}"
217        LIBS="$ac_save_LIBS $PYTHON_LDFLAGS $PYTHON_EXTRA_LIBS -lc -lm $PYTHON_EXTRA_LDFLAGS"
218
219        AC_TRY_LINK([
220              #include <Python.h>
221        ],[
222              Py_Initialize();
223        ],[pythonstaticexists=yes],[pythonstaticexists=no])
224
225        AC_MSG_RESULT([$pythonstaticexists])
226
227        if test "$pythonstaticexists" == yes ; then
228          AC_DEFINE(HAVE_STATIC_PYTHON)
229          PYTHON_STATIC_LIBS="$PYTHON_LDFLAGS $PYTHON_EXTRA_LIBS"
230          AC_SUBST(PYTHON_STATIC_LIBS)
231   
232          try_flags="-Xlinker -static -nodefaultlibs"
233          CPPFLAGS="-shared -fPIC ${try_flags} ${all_cppflags}"
234          AC_MSG_CHECKING([$try_flags for linking python module statically])
235          AC_TRY_LINK([
236                #include <Python.h>
237          ],[
238                Py_Initialize();
239          ],[pythonsharedstaticexists=yes],[pythonsharedstaticexists=no])
240          AC_MSG_RESULT([$pythonsharedstaticexists])
241 
242          if test "$pythonsharedstaticexists" = yes; then
243            PYTHON_MODULE_FLAGS="${try_flags}"
244          fi
245        fi
246
247        AC_SUBST(PYTHON_MODULE_FLAGS)
248        CPPFLAGS="$ac_save_CPPFLAGS_for_python"
249        LIBS="$ac_save_LIBS_for_python"
250])
251
252
253dnl lllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllll
254dnl determine singuname
255dnl
256
257AC_MSG_CHECKING(CPU for singular)
258ac_cv_singcpuname=`uname -m`
259AC_MSG_RESULT($ac_cv_singcpuname)
260
261AC_MSG_CHECKING(uname for singular)
262AC_CACHE_VAL(ac_cv_singuname,
263ac_cv_singuname="unknown"
264if test -r "singuname.sh"; then
265  if (/bin/sh singuname.sh >/dev/null 2>&1) then
266    ac_cv_singuname=`/bin/sh singuname.sh`
267  fi
268fi
269if test "$ac_cv_singuname" = unknown && test -r "../singuname.sh"; then
270  if (/bin/sh ../singuname.sh >/dev/null 2>&1) then
271    ac_cv_singuname=`/bin/sh ../singuname.sh`
272  fi
273fi
274)
275AC_MSG_RESULT($ac_cv_singuname)
276if test "$ac_cv_singuname" = unknown; then
277  AC_MSG_WARN(Unknown architecture: Check singuname.sh)
278  ac_cv_singuname="unknown"
279fi
280AC_DEFINE_UNQUOTED(S_UNAME, "$ac_cv_singuname")
281SINGUNAME=$ac_cv_singuname
282AC_SUBST(SINGUNAME)
283
284if test "$ac_cv_singuname" = ix86-Win; then
285  EXEC_EXT=".exe"
286  AC_DEFINE(SI_CPU_I386)
287  AC_SUBST(SI_CPU_I386)
288  AC_MSG_RESULT(SI_CPU_I386)
289fi
290AC_SUBST(EXEC_EXT)
291if test "$ac_cv_singuname" = x86_64-Linux; then
292  AC_DEFINE(SI_CPU_X86_64)
293  AC_SUBST(SI_CPU_X86_64)
294  AC_MSG_RESULT(SI_CPU_X86_64)
295fi
296if test "$ac_cv_singuname" = ix86-Linux; then
297  AC_DEFINE(SI_CPU_I386)
298  AC_SUBST(SI_CPU_I386)
299  AC_MSG_RESULT(SI_CPU_I386)
300fi
301if test "$ac_cv_singuname" = IA64-Linux; then
302  AC_DEFINE(SI_CPU_IA64)
303  AC_SUBST(SI_CPU_IA64)
304  AC_MSG_RESULT(SI_CPU_IA64)
305fi
306if test "$ac_cv_singuname" = ppc-Linux; then
307  AC_DEFINE(SI_CPU_PPC)
308  AC_SUBST(SI_CPU_PPC)
309  AC_MSG_RESULT(SI_CPU_PPC)
310fi
311if test "$ac_cv_singuname" = ppcMac-darwin; then
312  AC_DEFINE(SI_CPU_PPC)
313  AC_SUBST(SI_CPU_PPC)
314  AC_MSG_RESULT(SI_CPU_PPC)
315fi
316# test again with CPU names
317if test "$ac_cv_singcpuname" = i386; then
318  AC_DEFINE(SI_CPU_I386)
319  AC_SUBST(SI_CPU_I386)
320  AC_MSG_RESULT(SI_CPU_I386)
321fi
322if test "$ac_cv_singcpuname" = i686; then
323  AC_DEFINE(SI_CPU_I386)
324  AC_SUBST(SI_CPU_I386)
325  AC_MSG_RESULT(SI_CPU_I386)
326fi
327if test "$ac_cv_singcpuname" = x86_64; then
328  AC_DEFINE(SI_CPU_X86_64)
329  AC_SUBST(SI_CPU_X86_64)
330  AC_MSG_RESULT(SI_CPU_X86_64)
331fi
332if test "$ac_cv_singcpuname" = ia64; then
333  AC_DEFINE(SI_CPU_IA64)
334  AC_SUBST(SI_CPU_IA64)
335  AC_MSG_RESULT(SI_CPU_IA64)
336fi
337if test "$ac_cv_singcpuname" = sparc; then
338  AC_DEFINE(SI_CPU_SPARC)
339  AC_SUBST(SI_CPU_SPARC)
340  AC_MSG_RESULT(SI_CPU_SPARC)
341fi
342if test "$ac_cv_singcpuname" = ppc; then
343  AC_DEFINE(SI_CPU_PPC)
344  AC_SUBST(SI_CPU_PPC)
345  AC_MSG_RESULT(SI_CPU_PPC)
346fi
347
348SING_UNAME=`echo $SINGUNAME | tr '-' '_' `
349AC_SUBST(SING_UNAME)
350
351# stupid Win programs do not like dots in their pathnames
352VERSION_SEP="-"
353
354dnl llllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllll
355dnl version stuff -- should be set in ../configure.in
356dnl
357dnl here are some defaults
358
359SINGULAR_MAJOR_VERSION=${SINGULAR_MAJOR_VERSION:-3}
360SINGULAR_MINOR_VERSION=${SINGULAR_MINOR_VERSION:-1}
361SINGULAR_SUB_VERSION=${SINGULAR_SUB_VERSION:-3}
362SINGULAR_VERSION="${SINGULAR_VERSION:-$SINGULAR_MAJOR_VERSION${VERSION_SEP}$SINGULAR_MINOR_VERSION${VERSION_SEP}$SINGULAR_SUB_VERSION}"
363VERSION_DATE=${VERSION_DATE:-"March 2011"}
364
365dnl pass them on into the Makefiles
366AC_SUBST(SINGULAR_VERSION)
367AC_SUBST(VERSION_DATE)
368AC_SUBST(SINGULAR_MAJOR_VERSION)
369AC_SUBST(SINGULAR_MINOR_VERSION)
370AC_SUBST(SINGULAR_SUB_VERSION)
371AC_DEFINE_UNQUOTED(SINGULAR_MAJOR_VERSION, ${SINGULAR_MAJOR_VERSION})
372AC_DEFINE_UNQUOTED(SINGULAR_MINOR_VERSION, ${SINGULAR_MINOR_VERSION})
373AC_DEFINE_UNQUOTED(SINGULAR_SUB_VERSION, ${SINGULAR_SUB_VERSION})
374AC_DEFINE_UNQUOTED(S_VERSION1, "${SINGULAR_MAJOR_VERSION}${VERSION_SEP}${SINGULAR_MINOR_VERSION}${VERSION_SEP}${SINGULAR_SUB_VERSION}")
375AC_DEFINE_UNQUOTED(S_VERSION2, "${VERSION_DATE}")
376AC_DEFINE_UNQUOTED(SINGULAR_SUB_VERSION, ${SINGULAR_SUB_VERSION})
377
378
379dnl lllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllll
380dnl compiler stuff
381dnl is needed to check for libs and headers, later on
382dnl
383dnl we do not want to have "-g -O" for CFLAGS
384if test "${CXXFLAGS+set}" != set; then
385  ac_cxxflags_set=no
386  CXXFLAGS="-O"
387fi
388if test "${CFLAGS+set}" != set; then
389  CFLAGS="-O"
390  ac_cflags_set=no
391fi
392
393# check whether CXX was set by user as env variable
394if test "${CXX+set}" != set; then
395  ac_cxx_set=no
396else
397  ac_cxx_set=yes
398fi
399AC_PROG_CC
400AC_PROG_CPP
401AC_PROG_CXX
402AC_PROG_INSTALL
403AC_AIX
404
405# test for gcc-version: gcc2: prefer CC=gcc, CXX=gcc (if not with boost)
406#                       gcc3:        CC=gcc  CXX=g++
407#                       other:       CC=cc   CXX=c++
408AC_MSG_CHECKING(gcc version)
409AC_CACHE_VAL(ac_cv_c_cpp,
410ac_cv_c_cp="unknown"
411if test -r "gccversion.sh"; then
412  ac_cv_c_cpp=`/bin/sh gccversion.sh`
413fi
414)
415AC_MSG_RESULT($ac_cv_c_cpp)
416
417# we prefer using gcc for compiling C++ files, provided the user did
418# not overwrite it explicitely
419if test "${GXX}" = yes && test "${ac_cxx_set}" = no; then
420  if test "${ac_cv_c_cpp}" = gcc2; then
421    CXX=g++
422  elif test "${ac_cv_c_cpp}" = gcc3; then
423    CXX=g++
424  fi
425  temp_flags="${CXXFLAGS}"
426  AC_LANG_SAVE
427  AC_LANG_CPLUSPLUS
428  # check whether gcc accepts --no-rtti
429  AC_MSG_CHECKING(whether gcc accepts --no-rtti)
430  CXXFLAGS="${CXXFLAGS} --no-rtti"
431  AC_CACHE_VAL(ac_cv_cxx_have_rtti,
432    AC_TRY_COMPILE(,,ac_cv_cxx_have_rtti=yes,ac_cv_cxx_have_rtti=no)
433  )
434  AC_MSG_RESULT(${ac_cv_cxx_have_rtti})
435  if test "${ac_cv_cxx_have_rtti}" != yes; then
436    CXXFLAGS="$temp_flags"
437  else
438    CXXFLAGS="${temp_flags} --no-rtti"
439    temp_flags="${CXXFLAGS}"
440  fi
441
442# check whether gcc accepts --no-exceptions
443  AC_MSG_CHECKING(whether gcc accepts --no-exceptions)
444  CXXFLAGS="${CXXFLAGS} --no-exceptions"
445  AC_CACHE_VAL(ac_cv_cxx_have_exceptions,
446    AC_TRY_LINK(,,ac_cv_cxx_have_exceptions=yes,ac_cv_cxx_have_exceptions=no)
447  )
448  AC_MSG_RESULT(${ac_cv_cxx_have_exceptions})
449  if test "${ac_cv_cxx_have_exceptions}" != yes; then
450    CXXFLAGS="$temp_flags"
451  else
452    CXXFLAGS="${temp_flags} --no-exceptions"
453    temp_flags="${CXXFLAGS}"
454  fi
455
456  AC_LANG_RESTORE
457  CXXFLAGS="$temp_flags"
458  #here is broking something
459  #uncommented breaks CXXFLAGS variable set
460  #only pipes would remain then in CXXFLAGS
461fi
462
463# check whether the compiler accepts -pipe
464if test x$ac_cv_c_cpp = xgcc2 -o  x$ac_cv_c_cpp = xgcc3
465then
466  AC_MSG_CHECKING(whether compiler accepts -pipe)
467  temp_cflags="${CFLAGS}"
468  CFLAGS="${CFLAGS} -pipe"
469  AC_CACHE_VAL(ac_cv_cxx_have_pipe,
470  AC_TRY_COMPILE(,,ac_cv_cxx_have_pipe=yes,ac_cv_cxx_have_pipe=no))
471  AC_MSG_RESULT(${ac_cv_cxx_have_pipe})
472  CFLAGS=${temp_cflags}
473else
474  ac_cv_cxx_have_pipe="no"
475fi
476
477if test "${ac_cv_cxx_have_pipe}" != yes; then
478  PIPE=
479else
480  PIPE="-pipe"
481fi
482AC_SUBST(PIPE)
483
484# Customize CFLAGS
485AC_MSG_CHECKING(whether _AIX is defined)
486AC_CACHE_VAL(ac_cv_is_aix,
487AC_EGREP_CPP(yes,
488[#ifdef _AIX
489    yes
490#endif
491], ac_cv_is_aix=yes, ac_cv_is_aix=no, 1))
492if test "$ac_cv_is_aix" = yes; then
493  AC_MSG_RESULT(yes)
494else
495  AC_MSG_RESULT(no)
496fi
497
498# we know best when compiling with gcc
499if test "${GXX}" = yes; then
500  if test "$ac_cxxflags_set" = no; then
501    CXXFLAGS="-O3 -w -fomit-frame-pointer"
502  fi
503  temp_flags="${CXXFLAGS}"
504  if test "${ac_cv_cxx_have_rtti}" = yes; then
505    CXXFLAGS="${temp_flags} --no-rtti"
506  fi
507  temp_flags="${CXXFLAGS}"
508  CXXTEMPLFLAGS="-fno-implicit-templates"
509  if test "${ac_cv_cxx_have_exceptions}" = yes; then
510    CXXTEMPLFLAGS="${CXXTEMPLFLAGS} --no-exceptions"
511  fi
512  if test "$ac_cv_is_aix" = yes; then
513    CXXNOOPTFLAGS="-w"
514  else
515    CXXNOOPTFLAGS=$CXXFLAGS
516  fi
517  STATIC_LDFLAGS="-static"
518else
519  CXXTEMPFLAGS=""
520  CXXNOOPTFLAGS=$CXXFLAGS
521  STATIC_LDFLAGS=""
522fi
523AC_SUBST(CXXTEMPLFLAGS)
524AC_SUBST(CXXNOOPTFLAGS)
525AC_SUBST(STATIC_LDFLAGS)
526
527if test "${GCC}" = yes && test "$ac_cflags_set" = no ; then
528  CFLAGS="-O3 -w -fomit-frame-pointer"
529fi
530
531AC_PROG_MAKE_SET
532
533dnl lllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllll
534dnl path stuff
535dnl
536AC_PREFIX_DEFAULT(`pwd`/..)
537
538dnl set exec_prefix, bindir, libdir, includedir to some sensible values
539dnl if they are not yet already set
540
541# expand prefix
542test "x$prefix" = xNONE && prefix=$ac_default_prefix
543if test "${with_rootdir+set}" != set; then
544  AC_DEFINE_UNQUOTED(S_ROOT_DIR, "${prefix}")
545else
546  AC_DEFINE_UNQUOTED(S_ROOT_DIR, "${with_rootdir}")
547fi
548
549# expand exec_prefixad
550if test "x$exec_prefix" = xNONE; then
551 exec_prefix=${prefix}/${ac_cv_singuname}
552fi
553
554# expand bindir
555test "x$bindir" = 'x${exec_prefix}/bin' && bindir="${exec_prefix}"
556SINGULAR=${SINGULAR:-$bindir/Singular-$SINGULAR_MAJOR_VERSION${VERSION_SEP}$SINGULAR_MINOR_VERSION${VERSION_SEP}$SINGULAR_SUB_VERSION}
557AC_SUBST(SINGULAR)
558AC_DEFINE_UNQUOTED(S_BIN_DIR, "${bindir}")
559
560# expand libdir
561test "x$libdir" = 'x${exec_prefix}/lib'&& libdir="${exec_prefix}/lib"
562
563# expand includedir
564test "x$includedir" = 'x${prefix}/include' && includedir="${exec_prefix}/include"
565
566# add to -I to CPPFLAGS and and -L to LDFLAGS, just to be sure
567if test "$ac_cv_c_cpp" = gcc3 ; then
568  LDFLAGS="-L${libdir} ${LDFLAGS}"
569  CPPFLAGS="-I${includedir} ${CPPFLAGS}"
570else
571  LDFLAGS="-L${libdir} ${LDFLAGS} -L/usr/local/lib"
572  CPPFLAGS="-I${includedir} ${CPPFLAGS} -I/usr/local/include"
573fi
574
575# this is a work-around to include the right term.h
576if test "$ac_cv_singuname" = SunOS-5; then
577CPPFLAGS="-I/usr/xpg4/include ${CPPFLAGS}"
578fi
579
580
581dnl lllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllll
582dnl Checks for programs.
583dnl
584
585# lex
586if test "${with_lex+set}" != set; then
587  AC_MSG_CHECKING(for flex)
588  changequote(<<,>>)dnl
589  cmd="egrep [2-9]\.[5-9]"
590  changequote([,])dnl
591  AC_CACHE_VAL(ac_cv_prog_flex,
592  if (flex --version >/dev/null 2>&1)
593    then
594    if (flex --version | $cmd >/dev/null 2>&1 )
595    then
596        ac_cv_prog_flex=flex
597    fi
598  fi
599  )
600  dnl changequote([,])dnl
601  if test "${ac_cv_prog_flex+set}" = set; then
602    AC_MSG_RESULT(flex)
603    LEX=flex
604    AC_SUBST(LEX)
605  else
606    AC_MSG_WARN(can not find flex with version 2.4.5-2.5.4)
607  fi
608elif test "${with_lex}" = no; then
609  AC_MSG_WARN(building without lex -- make might fail)
610else
611  unset LEX
612  unset ac_cv_prog_LEX
613  AC_CHECK_PROGS(LEX, ${with_lex})
614  if test "x${LEX}" = x; then
615    AC_MSG_WARN(building without lex -- make might fail)
616  fi
617fi
618
619# bison
620AC_CHECK_PROGS(BISON, bison)
621if test "${BISON+set}" != set; then
622  AC_MSG_WARN(did not find bison -- make might fail)
623fi
624
625# ln -s
626AC_PROG_LN_S
627
628AC_CHECK_PROGS(PERL, perl5 perl)
629
630# python
631dnl Default values here!
632python_exe_name="no"
633PYTHON_PLUGIN="module"
634PYTHON_LINKAGE="static"
635
636if test "${with_python+set}" == set; then
637  case "${with_python}" in
638    yes|static*|dynamic*|shared*|module*|embed*)
639      python_exe_name="python"
640    ;;
641    *)
642    python_exe_name="${with_python%%,*}"
643    ;;
644  esac
645
646  case ",${with_python}," in
647    *,dynamic,*|*,shared,*)
648      PYTHON_LINKAGE="dynamic"
649    ;;
650    *,static,*)
651      PYTHON_LINKAGE="static"
652    ;;
653  esac
654
655  case ",${with_python}," in
656    *,embed,*|*,embedded,*)
657      PYTHON_PLUGIN="embed"
658    ;;
659    *,static,*)
660      PYTHON_PLUGIN="module"
661    ;;
662  esac
663fi
664
665PYTHON_EXE=`basename "${python_exe_name}"`
666PYTHON_PATH=`dirname "${python_exe_name}"`
667
668if test "${PYTHON_EXE}" = no; then
669  AC_MSG_WARN(building without python support)
670else
671  AC_PATH_PROG([PYTHON],[$PYTHON_EXE],, "$PYTHON_PATH:$PATH")
672  if test -z "$PYTHON"; then
673    AC_MSG_WARN([Cannot find $PYTHON_EXE in your system path - skipping python support])
674  else
675    AC_PYTHON_DEVEL_SINGULAR(>= '2.4', "${PYTHON}")
676    AC_PYTHON_TEST_STATIC()
677
678    if test "${PYTHON_PLUGIN}" = embed; then
679      AC_DEFINE(EMBED_PYTHON)
680      EMBED_PYTHON_VALUE=1
681
682      PYTHON_EMBED_LIBS="$PYTHON_LDFLAGS $PYTHON_EXTRA_LIBS"
683      AC_SUBST(PYTHON_EMBED_LIBS)
684    fi
685
686  fi
687fi
688AC_SUBST(EMBED_PYTHON_VALUE)
689
690
691dnl llllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllll
692dnl check for general libraries, header files, typedefs, etc
693dnl
694# lib checks
695# under cygwin, we should not explicitly link with -lm, except for
696# it really is the last thing to link with
697if test "$ac_cv_singuname" != ix86-Win; then
698AC_CHECK_LIB(m, atof)
699fi
700AC_CHECK_LIB(nsl)
701AC_CHECK_LIB(socket)
702SAVE_LIBS=${LIBS}
703LIBS=
704
705dnl I'm not sure what they are for
706AC_CHECK_LIB(bsd, setenv)
707dnl i386-SunOS needs nsl and socket
708AC_CHECK_LIB(socket, listen)
709AC_CHECK_LIB(nsl, gethostbyname)
710dnl AC_CHECK_LIB(ucb, index)
711MP_LIBS=${LIBS}
712# check for dl lib
713case "$ac_cv_singuname" in
714        HPUX*)
715          AC_CHECK_LIB(dld, shl_load)
716          if test "$ac_cv_lib_dld_shl_load" = yes; then
717                LD_DYN_FLAGS="-ldld -Xlinker -E"
718                SFLAGS="-fpic -fPIC -DPIC"
719                SLDFLAGS="-fPIC -DPIC -shared"
720                if test "${LD+set}" != set; then
721                  LD=gcc
722                fi
723                ac_lib_dl=yes
724          fi
725        ;;
726        *Linux*)
727          AC_CHECK_LIB(dl, dlopen)
728          if test "$ac_cv_lib_dl_dlopen" = yes; then
729                LD_DYN_FLAGS="-ldl -rdynamic"
730                SFLAGS="-fpic -DPIC"
731                SLDFLAGS=-shared
732                if test "${LD+set}" != set; then
733                  LD=ld
734                fi
735                ac_lib_dl=yes
736          fi
737        ;;
738        IRIX-6)
739          LD_DYN_FLAGS="-lc"
740          SFLAGS="-fPIC -DPIC"
741          SLDFLAGS="-w -no_unresolved -_SYSTYPE_SVR4 -n32 -shared"
742          if test "${LD+set}" != set; then
743            LD=ld
744          fi
745          ac_lib_dl=yes
746        ;;
747        SunOS-5)
748          AC_CHECK_LIB(dl, dlopen)
749          if test "$ac_cv_lib_dl_dlopen" = yes; then
750                LD_DYN_FLAGS="-ldl"
751                SFLAGS="-fpic -DPIC"
752                SLDFLAGS=-shared
753                if test "${LD+set}" != set; then
754                  LD=$CC
755                fi
756                ac_lib_dl=yes
757          fi
758        ;;
759        #use export MACOSX_DEPLOYMENT_TARGET=10.3
760        ppcMac-darwin)
761          AC_CHECK_LIB(dl, dlopen)
762          if test "$ac_cv_lib_dl_dlopen" = yes; then
763                LD_DYN_FLAGS="-ldl -dynamic"
764                SFLAGS="-fpic -DPIC"
765                SLDFLAGS="-dynamic -twolevel_namespace -weak_reference_mismatches weak -undefined dynamic_lookup"
766                if test "${LD+set}" != set; then
767                  LD=libtool
768                fi
769                ac_lib_dl=yes
770          fi
771        ;;
772        ix86Mac-darwin)
773          AC_CHECK_LIB(dl, dlopen)
774          if test "$ac_cv_lib_dl_dlopen" = yes; then
775                LD_DYN_FLAGS="-ldl -dynamic"
776                SFLAGS="-fpic -DPIC"
777                SLDFLAGS="-dynamic -twolevel_namespace -weak_reference_mismatches weak -undefined dynamic_lookup"
778                if test "${LD+set}" != set; then
779                  LD=libtool
780                fi
781                ac_lib_dl=yes
782          fi
783        ;;
784        ix86-freebsd)
785          AC_CHECK_LIB(c, dlopen)
786          if test "$ac_cv_lib_c_dlopen" = yes; then
787                LD_DYN_FLAGS="-Xlinker -E"
788                SFLAGS="-fpic -DPIC"
789                SLDFLAGS=-shared
790                if test "${LD+set}" != set; then
791                  LD=ld
792                fi
793                ac_lib_dl=yes
794          fi
795        ;;
796esac
797AC_SUBST(LD_DYN_FLAGS)
798AC_SUBST(SFLAGS)
799AC_SUBST(SLDFLAGS)
800AC_SUBST(LD)
801LIBS="${SAVE_LIBS} ${MP_LIBS}"
802
803
804# heder file checks
805AC_HEADER_STDC
806AC_CHECK_HEADERS(limits.h unistd.h,,
807  AC_MSG_ERROR(Can not compile without limits.h unistd.h))
808
809AC_CHECK_HEADERS(sys/file.h sys/ioctl.h sys/time.h sys/times.h sys/types.h \
810 sys/stat.h fcntl.h sys/param.h pwd.h asm/sigcontext.h pwd.h termcap.h \
811 termios.h term.h readline/readline.h)
812
813# typedefs, structures
814AC_C_CONST
815AC_C_INLINE
816AC_TYPE_SIZE_T
817AC_STRUCT_TM
818AC_HEADER_TIME
819
820# library functions.
821AC_FUNC_ALLOCA
822AC_PROG_GCC_TRADITIONAL
823AC_FUNC_MMAP
824AC_TYPE_SIGNAL
825AC_FUNC_VPRINTF
826AC_SEARCH_LIBS(setenv, bsd)
827AC_CHECK_FUNCS(gettimeofday atexit bcopy getcwd getwd vsnprintf readlink \
828 sleep usleep getpwnam popen setenv siginterrupt sysconf pselect)
829
830
831dnl llllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllll
832dnl Find out more about particularity of the system
833dnl
834
835# arithmetic shifts
836#AC_MSG_CHECKING(whether your machine has correct arithmetic shifts)
837#AC_CACHE_VAL(ac_cv_shift, AC_TRY_RUN(
838#  [ int main() { if (-2 >> 1 == -1) return(0); else return(1); } ],
839#   ac_cv_shift=yes,
840#   ac_cv_shift=no,
841#   if test "$ac_c_cross_dos" = yes; then
842#     ac_cv_shift=yes;
843#   else
844#     AC_MSG_RESULT(no)
845#     AC_MSG_ERROR(cross compilation without default value)
846#   fi))
847#
848#if test "$ac_cv_shift" = yes; then
849#  AC_MSG_RESULT(yes)
850#else
851#  AC_MSG_RESULT(no)
852#  AC_MSG_ERROR(need  -2 >> 1 == -1)
853#fi
854
855
856# check for a peculiar constructor initialization
857AC_MSG_CHECKING(whether explicit C++ constructor calls are allowed)
858AC_LANG_SAVE
859AC_LANG_CPLUSPLUS
860AC_CACHE_VAL(ac_cv_explicit_const,AC_TRY_COMPILE(,
861  class testclass
862  {
863  public:
864    int value;
865    testclass() : value(0) {}
866    testclass( int i ) : value(i) {}
867    ~testclass() { value = 0; }
868  };
869
870  testclass ptr;
871  ptr.testclass(1);
872, ac_cv_explicit_const=yes, ac_cv_explicit_const=no))
873AC_LANG_RESTORE
874AC_MSG_RESULT($ac_cv_explicit_const)
875if test "$ac_cv_explicit_const" = yes; then
876  AC_DEFINE(HAVE_EXPLICIT_CONSTR)
877fi
878
879# sprintf returns number of printed chars
880AC_MSG_CHECKING(whether vsprintf returns number of printed chars)
881AC_CACHE_VAL(ac_cv_returns_n_of_chars, AC_TRY_RUN(
882 [#include <stdio.h>
883 main() { char *str=(char*)malloc(20); if (((int) sprintf(str,"123456789")) == 9) exit(0); else exit(1); }],
884   ac_cv_returns_n_of_chars=yes,
885   ac_cv_returns_n_of_chars=no,
886   ac_cv_returns_n_of_chars=no))
887if test "$ac_cv_returns_n_of_chars" = yes; then
888  AC_MSG_RESULT(yes)
889else
890  AC_MSG_RESULT(no)
891  AC_DEFINE(BSD_SPRINTF)
892fi
893
894# determine ALIGN_8
895AC_CHECK_SIZEOF(char,1)
896AC_CHECK_SIZEOF(short,2)
897AC_CHECK_SIZEOF(int,4)
898AC_CHECK_SIZEOF(long,4)
899AC_CHECK_SIZEOF(void*,4)
900AC_CHECK_SIZEOF(double, 8)
901AC_C_BIGENDIAN
902if test "$ac_cv_sizeof_int" != 4; then
903  AC_MSG_ERROR(need int to be four bytes long)
904fi
905if test "$ac_cv_sizeof_long" != "$ac_cv_sizeof_voidp"; then
906  AC_MSG_ERROR(need equal sizes for long and void*)
907fi
908if test "$ac_cv_sizeof_double" != 8; then
909  AC_MSG_ERROR(need double to b 8 bytes long)
910fi
911if test "$ac_cv_sizeof_voidp" != 4 && test "$ac_cv_sizeof_voidp" != 8; then
912  AC_MSG_ERROR(need void* to be 4 or 8 bytes long)
913fi
914if test "$ac_cv_sizeof_voidp" != 4; then
915  DEFS="-UOM_NDEBUG"
916  AC_SUBST(DEFS)
917fi
918
919dnl lllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllll
920dnl help for configure
921dnl
922AC_ARG_WITH(
923  rootdir,
924  [  --with-rootdir=DIR      use DIR ass compiled-in root directory
925                             (default is PREFIX)])
926AC_ARG_WITH(
927  lex,
928  [  --with-lex=[LEX,no]     uses LEX as lex program, default is flex])
929AC_ARG_WITH(
930  readline,
931  [  --with-readline=[dynamic,static,no]
932                        do use dynamic/static/no readline for fancy display])
933AC_ARG_WITH(
934  python,
935  [  --with-python[=PYTHON[,embed|module[,static|dynamic]]]
936                        uses PYTHON as python executable, default is python;
937                        optionally set plug-in and linkage type])
938AC_ARG_WITH(
939  Boost,
940  [  --without-Boost         do not use Boost ])
941AC_ARG_WITH(
942  stdvec,
943  [  --with-stdvec           use std::vector ])
944AC_ARG_WITH(
945  MP,
946  [  --without-MP            do not use MP (no MP links)])
947AC_ARG_WITH(
948  dbm,
949  [  --without-dbm           do not use dbm (no DBM links)])
950AC_ARG_WITH(
951  factory,
952  [  --without-factory       do not use factory (no poly factorization)])
953AC_ARG_WITH(
954  libfac,
955  [  --without-libfac        do not use libfac (no primary decompositions)])
956AC_ARG_WITH(
957  dl,
958  [  --without-dl            do not use dynamic linking, modules, and kernel])
959AC_ARG_WITH(
960  dynamic-modules,
961  [  --with-dynamic-modules  do compile with dynamic modules support])
962AC_ARG_WITH(
963  dynamic-kernel,
964  [  --without-dynamic-kernel
965                          do not compile with dynamic kernel parts])
966AC_ARG_WITH(apint,
967  [  --with-apint=PACKAGE    use PACKAGE for arbitary integer arithmetic])
968AC_ARG_WITH(svd,
969  [  --with-svd              use libsvd])
970AC_ARG_WITH(
971  Plural,
972  [  --without-Plural        do compile without Plural support])
973AC_ARG_WITH(
974  NTL,
975  [  --with-NTL              build for use with NTL.],
976  ,
977  with_NTL=yes)
978AC_ARG_WITH(
979  RatGB,
980  [  --with-ratGB            do compile with ratGB support (experimental)])
981
982dnl llllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllll
983dnl check for packages we need
984dnl for gmp, MP, factory and libfac, we built them in, even if the libs
985dnl and headers were not found under the condition that the respective
986dnl  --enable argument was given
987dnl
988
989
990AC_MSG_CHECKING(whether to use dynamic linking)
991if test "$with_dl" != no && test "$ac_lib_dl" = yes; then
992  AC_DEFINE(HAVE_DL)
993  ac_have_dl=yes
994  AC_MSG_RESULT(yes)
995else
996  AC_MSG_RESULT(no)
997fi
998
999AC_CHECK_LIB(ncurses,tgetent,,\
1000 AC_CHECK_LIB(curses,tgetent,,\
1001  AC_CHECK_LIB(termcap,tgetent)))
1002
1003# readline
1004if test "$with_readline" = dynamic && test "$ac_have_dl" != yes; then
1005  AC_MSG_WARN(can not build dynamic readline without dynamic linking)
1006  with_readline=static
1007fi
1008
1009
1010if test "$with_readline" != dynamic && test "$with_readline" != no; then
1011AC_LANG_SAVE
1012AC_LANG_CPLUSPLUS
1013   AC_CHECK_LIB(readline, rl_abort)
1014   AC_CHECK_HEADERS(readline/readline.h readline/history.h)
1015   if test "$ac_cv_lib_readline_rl_abort" = yes && \
1016      test "$ac_cv_header_readline_readline_h" = yes; then
1017     AC_MSG_CHECKING(whether readline.h is ok)
1018     AC_CACHE_VAL(ac_cv_header_readline_readline_h_ok,
1019     AC_TRY_LINK(
1020#include<unistd.h>
1021#include<stdio.h>
1022#include<readline/readline.h>
1023#ifdef HAVE_READLINE_HISTORY_H
1024#include<readline/history.h>
1025#endif
1026,
1027,
1028ac_cv_header_readline_readline_h_ok="yes",
1029ac_cv_header_readline_readline_h_ok="no",
1030))
1031    AC_MSG_RESULT($ac_cv_header_readline_readline_h_ok)
1032    if test "$ac_cv_header_readline_readline_h_ok" != yes; then
1033#not ok -- try once more with explicitly declaring everything
1034      AC_MSG_CHECKING(whether or not we nevertheless can use readline)
1035      AC_CACHE_VAL(ac_cv_have_readline,
1036      AC_TRY_LINK(
1037#include <stdio.h>
1038extern "C"
1039{
1040extern char * rl_readline_name;
1041extern char *rl_line_buffer;
1042char *filename_completion_function();
1043typedef char **CPPFunction ();
1044extern char ** completion_matches ();
1045extern CPPFunction * rl_attempted_completion_function;
1046extern FILE * rl_outstream;
1047char * readline ();
1048void add_history ();
1049int write_history ();
1050int read_history();
1051}
1052#ifndef NULL
1053#define NULL 0
1054#endif
1055,
1056rl_readline_name=NULL;
1057*rl_line_buffer=1;
1058completion_matches(NULL, filename_completion_function);
1059rl_attempted_completion_function = (CPPFunction *) NULL;
1060rl_outstream=NULL;
1061readline(NULL);
1062add_history(NULL);
1063read_history(NULL);
1064write_history(NULL);
1065,
1066ac_cv_have_readline="yes"
1067,
1068ac_cv_have_readline="no"
1069))
1070      AC_MSG_RESULT($ac_cv_have_readline)
1071    else
1072      AC_DEFINE(READLINE_READLINE_H_OK)
1073      ac_cv_have_readline="yes"
1074    fi
1075  fi
1076  if test "$ac_cv_have_readline" = yes; then
1077    AC_DEFINE(HAVE_READLINE)
1078  fi
1079AC_LANG_RESTORE
1080fi
1081
1082AC_MSG_CHECKING(which readline to use)
1083if test "$ac_cv_with_readline" = dynamic; then
1084  AC_MSG_RESULT(dynamic)
1085  AC_DEFINE(HAVE_DYN_RL)
1086elif test "$ac_cv_have_readline" = yes; then
1087  AC_MSG_RESULT(static)
1088elif test "$ac_cv_singuname" = PowerMacintosh-darwin; then
1089  AC_MSG_ERROR(building without readline impossible on PowerMacintosh-darwin)
1090else
1091  AC_MSG_RESULT(none)
1092  AC_MSG_WARN(building without readline: disabling fancy display)
1093fi
1094
1095NEED_LIBS=$LIBS
1096
1097# gmp, MP, MPT, factory, libfac
1098AC_CHECK_LIB(gmp, main)
1099SAVE_LIBS=$LIBS
1100AC_CHECK_LIB(MP, IMP_PutGmpInt,,,$MP_LIBS)
1101AC_CHECK_LIB(MPT, MPT_GetTree,,,$MP_LIBS)
1102LIBS=$SAVE_LIBS
1103AC_CHECK_LIB(singcf, atof)
1104AC_CHECK_LIB(singfac, atof)
1105AC_CHECK_LIB(omalloc, omTestAddr)
1106AC_CHECK_LIB(omalloc_ndebug, main)
1107AC_CHECK_LIB(ntl,main)
1108
1109AC_CHECK_HEADERS(gmp.h MP.h  MPT.h factory.h factor.h omalloc.h \
1110 omalloc.c)
1111
1112AC_MSG_CHECKING(whether to use Boost)
1113if test "$with_Boost" != no; then
1114  AC_MSG_RESULT(yes)
1115  AC_LANG_SAVE
1116  AC_LANG_CPLUSPLUS
1117  AC_CHECK_HEADERS(boost/dynamic_bitset.hpp)
1118  AC_LANG_RESTORE
1119else
1120  AC_MSG_RESULT(no)
1121  AC_MSG_CHECKING(whether to use std::vector)
1122  if test "$with_stdvec" != yes; then
1123    AC_MSG_RESULT(no)
1124  else
1125    AC_MSG_RESULT(yes)
1126    AC_DEFINE(USE_STDVECBOOL)
1127    USE_STDVECBOOL=1
1128  fi
1129fi
1130AC_SUBST(USE_STDVECBOOL)
1131
1132if test "$ac_cv_lib_gmp_main" = yes && \
1133 test "$ac_cv_header_gmp_h" = yes; then
1134    ac_gmp_ok=yes
1135fi
1136
1137if test "$ac_cv_lib_MP_IMP_PutGmpInt" = yes && \
1138 test "$ac_cv_lib_MPT_MPT_GetTree" && \
1139 test "$ac_cv_header_MP_h" = yes && \
1140 test "$ac_cv_header_MPT_h" = yes; then
1141  ac_MP_ok=yes
1142fi
1143
1144if test "$ac_cv_lib_singcf_atof" = yes && \
1145 test "$ac_cv_header_factory_h" = yes; then
1146  ac_factory_ok=yes
1147fi
1148
1149if test "$ac_cv_lib_singfac_atof" = yes && \
1150 test "$ac_cv_header_factor_h" = yes; then
1151  ac_libfac_ok=yes
1152fi
1153
1154if test "$ac_cv_lib_omalloc_omTestAddr" = yes && \
1155   test "$ac_cv_lib_omalloc_ndebug_main" = yes && \
1156   test "$ac_cv_header_omalloc_c" = yes && \
1157   test "$ac_cv_header_omalloc_h" = yes; then
1158  ac_cv_omalloc_ok=yes
1159fi
1160
1161if test "$ac_cv_lib_ntl_main" = yes; then
1162  ac_cv_ntl_ok=yes
1163fi
1164
1165SAVE_LIBS=$LIBS
1166AC_CHECK_LIB(c_nonshared,__stack_chk_fail_local,GLIBC_DYN_FIX="-lc_nonshared",GLIBC_DYN_FIX="")
1167LIBS=$SAVE_LIBS
1168AC_SUBST(GLIBC_DYN_FIX)
1169
1170
1171# evaluate results
1172dnl llllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllll
1173dnl make sure that omalloc is there
1174dnl
1175if test "$ac_cv_omalloc_ok" != yes && test "$enable_omalloc" != yes; then
1176  AC_MSG_ERROR(can not build without omalloc)
1177fi
1178
1179AC_MSG_CHECKING(which apint package to use)
1180if test "${with_apint}" != gmp; then
1181  if test "$ac_gmp_ok" = yes || test "$enable_gmp" = yes; then
1182    AC_MSG_RESULT(gmp)
1183    will_have_gmp=yes
1184    NEED_LIBS="-lgmp ${NEED_LIBS}"
1185  else
1186    AC_MSG_RESULT(none)
1187    AC_MSG_ERROR(can not build without gmp)
1188  fi
1189else
1190  if test "$ac_gmp_ok" = yes || test "$enable_gmp" = yes; then
1191    AC_MSG_RESULT(gmp)
1192    will_have_gmp=yes
1193    NEED_LIBS="-lgmp ${NEED_LIBS}"
1194  else
1195    AC_MSG_RESULT(none)
1196    AC_MSG_ERROR(can not build with gmp)
1197  fi
1198fi
1199
1200AC_MSG_CHECKING(gfanlib)
1201if test "$enable_gfanlib" = yes; then
1202  AC_MSG_RESULT(yes)
1203  NEED_LIBS="${NEED_LIBS} -lgfan -lcddgmp"
1204else
1205  AC_MSG_RESULT(can not build with gfan lib)
1206fi
1207
1208AC_MSG_CHECKING(whether to use libsvd)
1209if test "$with_svd" = yes; then
1210  AC_MSG_RESULT(yes)
1211  AC_DEFINE(HAVE_SVD)
1212  NEED_LIBS="-lsvd -lmpfr ${NEED_LIBS}"
1213else
1214  AC_MSG_RESULT(no)
1215fi
1216AC_SUBST(HAVE_SVD)
1217
1218#
1219AC_MSG_CHECKING(whether to have MP)
1220if test "${with_MP}" != yes && test "${with_MP}" != no; then
1221  if (test "${will_have_gmp}" = yes) && \
1222     (test "$ac_MP_ok" =  yes || test "$enable_MP" = yes); then
1223    AC_MSG_RESULT(yes)
1224    AC_DEFINE(HAVE_MPSR)
1225    HAVE_MPSR=1
1226    MP_LIBS="-lMPT -lMP ${MP_LIBS}"
1227  else
1228    AC_MSG_RESULT(no)
1229  fi
1230elif  test "${with_MP}" = yes; then
1231  if (test "${will_have_gmp}" = yes) && \
1232     (test "$ac_MP_ok" =  yes || test "$enable_MP" = yes); then
1233    AC_MSG_RESULT(yes)
1234    AC_DEFINE(HAVE_MPSR)
1235    HAVE_MPSR=1
1236    MP_LIBS="-lMPT -lMP ${MP_LIBS}"
1237  else
1238    AC_MSG_RESULT(no)
1239    AC_MSG_ERROR(can not build with MP)
1240  fi
1241else
1242  AC_MSG_RESULT(no)
1243fi
1244AC_SUBST(HAVE_MPSR)
1245AC_SUBST(MP_LIBS)
1246
1247AC_MSG_CHECKING(whether to have NTL)
1248if test "${with_NTL}" = yes ; then
1249  AC_MSG_RESULT(yes)
1250  NEED_LIBS="-lntl ${NEED_LIBS}"
1251else
1252  AC_MSG_RESULT(no)
1253fi
1254
1255AC_MSG_CHECKING(whether to have factory)
1256if test "${with_factory}" != yes && test "${with_factory}" != no; then
1257  if test "$ac_factory_ok" =  yes || test "$enable_factory" = yes; then
1258    AC_MSG_RESULT(yes)
1259    AC_DEFINE(HAVE_FACTORY)
1260    will_have_factory=yes
1261    NEED_LIBS="-lsingcf ${NEED_LIBS}"
1262  else
1263    AC_MSG_RESULT(no)
1264  fi
1265elif  test "${with_factory}" = yes; then
1266  if test "$ac_factory_ok" =  yes || test "$enable_factory" = yes; then
1267    AC_MSG_RESULT(yes)
1268    AC_DEFINE(HAVE_FACTORY)
1269    will_have_factory=yes
1270    NEED_LIBS="-lsingcf ${NEED_LIBS}"
1271  else
1272    AC_MSG_RESULT(no)
1273    AC_MSG_ERROR(can not build with factory)
1274  fi
1275else
1276  AC_MSG_RESULT(no)
1277fi
1278
1279AC_MSG_CHECKING(whether to have libfac)
1280if test "${with_libfac}" != yes && test "${with_libfac}" != no; then
1281  if (test "${will_have_factory}" = yes) && \
1282     (test "$ac_libfac_ok" =  yes || test "$enable_libfac" = yes); then
1283    AC_MSG_RESULT(yes)
1284    NEED_LIBS="-lsingfac ${NEED_LIBS}"
1285  else
1286    AC_MSG_RESULT(no)
1287    AC_MSG_ERROR(can not build without libfac)
1288  fi
1289elif  test "${with_libfac}" = yes; then
1290  if (test "${will_have_factory}" = yes) && \
1291     (test "$ac_libfac_ok" =  yes || test "$enable_libfac" = yes); then
1292    AC_MSG_RESULT(yes)
1293    NEED_LIBS="-lsingfac ${NEED_LIBS}"
1294  else
1295    AC_MSG_RESULT(no)
1296    AC_MSG_ERROR(can not build with libfac)
1297  fi
1298else
1299  AC_MSG_RESULT(no)
1300fi
1301
1302NEED_LIBSG="${NEED_LIBS}"
1303if test "$ac_cv_sizeof_voidp" != 4; then
1304  NEED_LIBS="${NEED_LIBS} -lomalloc"
1305else
1306  NEED_LIBS="${NEED_LIBS} -lomalloc_ndebug"
1307fi
1308
1309
1310AC_SUBST(NEED_LIBS)
1311AC_SUBST(NEED_LIBSG)
1312
1313AC_MSG_CHECKING(whether to have dbm links)
1314if test "$with_dbm" != no; then
1315  AC_DEFINE(HAVE_DBM)
1316  AC_MSG_RESULT(yes)
1317else
1318  AC_MSG_RESULT(no)
1319fi
1320
1321AC_MSG_CHECKING(whether to have dynamic modules)
1322if test "$with_dynamic_modules" = no || test "$ac_have_dl" != yes; then
1323  AC_MSG_RESULT(no)
1324else
1325  AC_DEFINE(HAVE_DYNAMIC_LOADING)
1326  AC_MSG_RESULT(yes)
1327fi
1328
1329AC_MSG_CHECKING(whether to have dynamic kernel)
1330if test "$with_dynamic_kernel" != no && test "$ac_lib_dl" = yes; then
1331  DL_KERNEL=1
1332  AC_SUBST(DL_KERNEL)
1333  AC_MSG_RESULT(yes)
1334else
1335  AC_MSG_RESULT(no)
1336fi
1337
1338AC_MSG_CHECKING(whether to have Plural)
1339if test "$with_Plural" != no && test "$enable_Plural" != no; then
1340  AC_DEFINE(HAVE_PLURAL)
1341  AC_MSG_RESULT(yes)
1342  PLURAL=1
1343  AC_SUBST(PLURAL)
1344else
1345  AC_MSG_RESULT(no)
1346fi
1347
1348AC_MSG_CHECKING(whether to have ratGB)
1349if test "$with_ratGB" != yes && test "$enable_ratGB" != yes; then
1350  AC_MSG_RESULT(no)
1351else
1352  AC_DEFINE(HAVE_RATGRING)
1353  AC_MSG_RESULT(yes)
1354fi
1355
1356
1357OUTPUT_MAKEFILES="Makefile ../kernel/Makefile"
1358
1359if test "$ac_cv_singuname" = "ix86-Win"; then
1360  OUTPUT_MAKEFILES="${OUTPUT_MAKEFILES} Singular.rc"
1361fi
1362
1363AC_OUTPUT(${OUTPUT_MAKEFILES}, \
1364 cp mod2.h ../kernel/mod2.h; \
1365 if test "$CONFIG_HEADERS"; then echo timestamp > stamp-h; fi)
Note: See TracBrowser for help on using the repository browser.