source: git/Singular/configure.in @ 1fe227

spielwiese
Last change on this file since 1fe227 was 1fe227, checked in by Hans Schoenemann <hannes@…>, 12 years ago
fix readline on MacOsX git-svn-id: file:///usr/local/Singular/svn/trunk@14245 2c84dea3-7e68-4137-9b89-c4e89433aadc
  • Property mode set to 100644
File size: 36.4 KB
Line 
1dnl Process this file with autoconf to produce a configure script.
2AC_INIT(tesths.cc)
3AC_CONFIG_HEADER(mod2.h)
4AC_CONFIG_HEADER(../kernel/mod2.h)
5
6dnl lllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllll
7dnl 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        *-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
797if test $ac_cv_c_cpp = unknown;
798then
799  LD_DYN_FLAGS=
800  SFLAGS=
801  SLDFLAGS=
802fi
803AC_SUBST(LD_DYN_FLAGS)
804AC_SUBST(SFLAGS)
805AC_SUBST(SLDFLAGS)
806AC_SUBST(LD)
807LIBS="${SAVE_LIBS} ${MP_LIBS}"
808
809
810# heder file checks
811AC_HEADER_STDC
812AC_CHECK_HEADERS(limits.h unistd.h,,
813  AC_MSG_ERROR(Can not compile without limits.h unistd.h))
814
815AC_CHECK_HEADERS(sys/file.h sys/ioctl.h sys/time.h sys/times.h sys/types.h \
816 sys/stat.h fcntl.h sys/param.h pwd.h asm/sigcontext.h pwd.h termcap.h \
817 termios.h term.h readline/readline.h)
818
819# typedefs, structures
820AC_C_CONST
821AC_C_INLINE
822AC_TYPE_SIZE_T
823AC_STRUCT_TM
824AC_HEADER_TIME
825
826# library functions.
827AC_FUNC_ALLOCA
828AC_PROG_GCC_TRADITIONAL
829AC_FUNC_MMAP
830AC_TYPE_SIGNAL
831AC_FUNC_VPRINTF
832AC_SEARCH_LIBS(setenv, bsd)
833AC_CHECK_FUNCS(gettimeofday atexit bcopy getcwd getwd vsnprintf readlink \
834 sleep usleep getpwnam popen setenv siginterrupt sysconf pselect)
835
836
837dnl llllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllll
838dnl Find out more about particularity of the system
839dnl
840
841# arithmetic shifts
842#AC_MSG_CHECKING(whether your machine has correct arithmetic shifts)
843#AC_CACHE_VAL(ac_cv_shift, AC_TRY_RUN(
844#  [ int main() { if (-2 >> 1 == -1) return(0); else return(1); } ],
845#   ac_cv_shift=yes,
846#   ac_cv_shift=no,
847#   if test "$ac_c_cross_dos" = yes; then
848#     ac_cv_shift=yes;
849#   else
850#     AC_MSG_RESULT(no)
851#     AC_MSG_ERROR(cross compilation without default value)
852#   fi))
853#
854#if test "$ac_cv_shift" = yes; then
855#  AC_MSG_RESULT(yes)
856#else
857#  AC_MSG_RESULT(no)
858#  AC_MSG_ERROR(need  -2 >> 1 == -1)
859#fi
860
861
862# check for a peculiar constructor initialization
863AC_MSG_CHECKING(whether explicit C++ constructor calls are allowed)
864AC_LANG_SAVE
865AC_LANG_CPLUSPLUS
866AC_CACHE_VAL(ac_cv_explicit_const,AC_TRY_COMPILE(,
867  class testclass
868  {
869  public:
870    int value;
871    testclass() : value(0) {}
872    testclass( int i ) : value(i) {}
873    ~testclass() { value = 0; }
874  };
875
876  testclass ptr;
877  ptr.testclass(1);
878, ac_cv_explicit_const=yes, ac_cv_explicit_const=no))
879AC_LANG_RESTORE
880AC_MSG_RESULT($ac_cv_explicit_const)
881if test "$ac_cv_explicit_const" = yes; then
882  AC_DEFINE(HAVE_EXPLICIT_CONSTR)
883fi
884
885# sprintf returns number of printed chars
886AC_MSG_CHECKING(whether vsprintf returns number of printed chars)
887AC_CACHE_VAL(ac_cv_returns_n_of_chars, AC_TRY_RUN(
888 [#include <stdio.h>
889 main() { char *str=(char*)malloc(20); if (((int) sprintf(str,"123456789")) == 9) exit(0); else exit(1); }],
890   ac_cv_returns_n_of_chars=yes,
891   ac_cv_returns_n_of_chars=no,
892   ac_cv_returns_n_of_chars=no))
893if test "$ac_cv_returns_n_of_chars" = yes; then
894  AC_MSG_RESULT(yes)
895else
896  AC_MSG_RESULT(no)
897  AC_DEFINE(BSD_SPRINTF)
898fi
899
900# determine ALIGN_8
901AC_CHECK_SIZEOF(char,1)
902AC_CHECK_SIZEOF(short,2)
903AC_CHECK_SIZEOF(int,4)
904AC_CHECK_SIZEOF(long,4)
905AC_CHECK_SIZEOF(void*,4)
906AC_CHECK_SIZEOF(double, 8)
907AC_C_BIGENDIAN
908if test "$ac_cv_sizeof_int" != 4; then
909  AC_MSG_ERROR(need int to be four bytes long)
910fi
911if test "$ac_cv_sizeof_long" != "$ac_cv_sizeof_voidp"; then
912  AC_MSG_ERROR(need equal sizes for long and void*)
913fi
914if test "$ac_cv_sizeof_double" != 8; then
915  AC_MSG_ERROR(need double to b 8 bytes long)
916fi
917if test "$ac_cv_sizeof_voidp" != 4 && test "$ac_cv_sizeof_voidp" != 8; then
918  AC_MSG_ERROR(need void* to be 4 or 8 bytes long)
919fi
920if test "$ac_cv_sizeof_voidp" != 4; then
921  DEFS="-UOM_NDEBUG"
922  AC_SUBST(DEFS)
923fi
924
925dnl lllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllll
926dnl help for configure
927dnl
928AC_ARG_WITH(
929  rootdir,
930  [  --with-rootdir=DIR      use DIR ass compiled-in root directory
931                             (default is PREFIX)])
932AC_ARG_WITH(
933  lex,
934  [  --with-lex=[LEX,no]     uses LEX as lex program, default is flex])
935AC_ARG_WITH(
936  readline,
937  [  --with-readline=[dynamic,static,no]
938                        do use dynamic/static/no readline for fancy display])
939AC_ARG_WITH(
940  python,
941  [  --with-python[=PYTHON[,embed|module[,static|dynamic]]]
942                        uses PYTHON as python executable, default is python;
943                        optionally set plug-in and linkage type])
944AC_ARG_WITH(
945  Boost,
946  [  --without-Boost         do not use Boost ])
947AC_ARG_WITH(
948  stdvec,
949  [  --with-stdvec           use std::vector ])
950AC_ARG_WITH(
951  MP,
952  [  --without-MP            do not use MP (no MP links)])
953AC_ARG_WITH(
954  dbm,
955  [  --without-dbm           do not use dbm (no DBM links)])
956AC_ARG_WITH(
957  factory,
958  [  --without-factory       do not use factory (no poly factorization)])
959AC_ARG_WITH(
960  libfac,
961  [  --without-libfac        do not use libfac (no primary decompositions)])
962AC_ARG_WITH(
963  dl,
964  [  --without-dl            do not use dynamic linking, modules, and kernel])
965AC_ARG_WITH(
966  dynamic-modules,
967  [  --with-dynamic-modules  do compile with dynamic modules support])
968AC_ARG_WITH(
969  dynamic-kernel,
970  [  --without-dynamic-kernel
971                          do not compile with dynamic kernel parts])
972AC_ARG_WITH(apint,
973  [  --with-apint=PACKAGE    use PACKAGE for arbitary integer arithmetic])
974AC_ARG_WITH(svd,
975  [  --with-svd              use libsvd])
976AC_ARG_WITH(
977  Plural,
978  [  --without-Plural        do compile without Plural support])
979AC_ARG_WITH(
980  NTL,
981  [  --with-NTL              build for use with NTL.],
982  ,
983  with_NTL=yes)
984AC_ARG_WITH(
985  RatGB,
986  [  --with-ratGB            do compile with ratGB support (experimental)])
987
988dnl llllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllll
989dnl check for packages we need
990dnl for gmp, MP, factory and libfac, we built them in, even if the libs
991dnl and headers were not found under the condition that the respective
992dnl  --enable argument was given
993dnl
994
995
996AC_MSG_CHECKING(whether to use dynamic linking)
997if test "$with_dl" != no && test "$ac_lib_dl" = yes; then
998  AC_DEFINE(HAVE_DL)
999  ac_have_dl=yes
1000  AC_MSG_RESULT(yes)
1001else
1002  AC_MSG_RESULT(no)
1003fi
1004
1005AC_CHECK_LIB(ncurses,tgetent,,\
1006 AC_CHECK_LIB(curses,tgetent,,\
1007  AC_CHECK_LIB(termcap,tgetent)))
1008
1009# readline
1010if test "$with_readline" = dynamic && test "$ac_have_dl" != yes; then
1011  AC_MSG_WARN(can not build dynamic readline without dynamic linking)
1012  with_readline=static
1013fi
1014
1015
1016if test "$with_readline" != dynamic && test "$with_readline" != no; then
1017AC_LANG_SAVE
1018AC_LANG_CPLUSPLUS
1019   AC_CHECK_LIB(readline, readline)
1020   AC_CHECK_HEADERS(readline/readline.h readline/history.h)
1021   if test "$ac_cv_lib_readline_readline" = yes && \
1022      test "$ac_cv_header_readline_readline_h" = yes; then
1023     AC_MSG_CHECKING(whether readline.h is ok)
1024     AC_CACHE_VAL(ac_cv_header_readline_readline_h_ok,
1025     AC_TRY_LINK(
1026#include<unistd.h>
1027#include<stdio.h>
1028#include<readline/readline.h>
1029#ifdef HAVE_READLINE_HISTORY_H
1030#include<readline/history.h>
1031#endif
1032,
1033,
1034ac_cv_header_readline_readline_h_ok="yes",
1035ac_cv_header_readline_readline_h_ok="no",
1036))
1037    AC_MSG_RESULT($ac_cv_header_readline_readline_h_ok)
1038    if test "$ac_cv_header_readline_readline_h_ok" != yes; then
1039#not ok -- try once more with explicitly declaring everything
1040      AC_MSG_CHECKING(whether or not we nevertheless can use readline)
1041      AC_CACHE_VAL(ac_cv_have_readline,
1042      AC_TRY_LINK(
1043#include <stdio.h>
1044extern "C"
1045{
1046extern char * rl_readline_name;
1047extern char *rl_line_buffer;
1048char *filename_completion_function();
1049typedef char **CPPFunction ();
1050extern char ** completion_matches ();
1051extern CPPFunction * rl_attempted_completion_function;
1052extern FILE * rl_outstream;
1053char * readline ();
1054void add_history ();
1055int write_history ();
1056int read_history();
1057}
1058#ifndef NULL
1059#define NULL 0
1060#endif
1061,
1062rl_readline_name=NULL;
1063*rl_line_buffer=1;
1064completion_matches(NULL, filename_completion_function);
1065rl_attempted_completion_function = (CPPFunction *) NULL;
1066rl_outstream=NULL;
1067readline(NULL);
1068add_history(NULL);
1069read_history(NULL);
1070write_history(NULL);
1071,
1072ac_cv_have_readline="yes"
1073,
1074ac_cv_have_readline="no"
1075))
1076      AC_MSG_RESULT($ac_cv_have_readline)
1077    else
1078      AC_DEFINE(READLINE_READLINE_H_OK)
1079      ac_cv_have_readline="yes"
1080    fi
1081  fi
1082  if test "$ac_cv_have_readline" = yes; then
1083    AC_DEFINE(HAVE_READLINE)
1084  fi
1085AC_LANG_RESTORE
1086fi
1087
1088AC_MSG_CHECKING(which readline to use)
1089if test "$ac_cv_with_readline" = dynamic; then
1090  AC_MSG_RESULT(dynamic)
1091  AC_DEFINE(HAVE_DYN_RL)
1092elif test "$ac_cv_have_readline" = yes; then
1093  AC_MSG_RESULT(static)
1094elif test "$ac_cv_singuname" = PowerMacintosh-darwin; then
1095  AC_MSG_ERROR(building without readline impossible on PowerMacintosh-darwin)
1096else
1097  AC_MSG_RESULT(none)
1098  AC_MSG_WARN(building without readline: disabling fancy display)
1099fi
1100
1101NEED_LIBS=$LIBS
1102
1103# gmp, MP, MPT, factory, libfac
1104AC_CHECK_LIB(gmp, main)
1105SAVE_LIBS=$LIBS
1106AC_CHECK_LIB(MP, IMP_PutGmpInt,,,$MP_LIBS)
1107AC_CHECK_LIB(MPT, MPT_GetTree,,,$MP_LIBS)
1108LIBS=$SAVE_LIBS
1109AC_CHECK_LIB(singcf, atof)
1110AC_CHECK_LIB(singfac, atof)
1111AC_CHECK_LIB(omalloc, omTestAddr)
1112AC_CHECK_LIB(omalloc_ndebug, main)
1113AC_CHECK_LIB(ntl,main)
1114
1115AC_CHECK_HEADERS(gmp.h MP.h  MPT.h factory.h factor.h omalloc.h \
1116 omalloc.c)
1117
1118AC_MSG_CHECKING(whether to use Boost)
1119if test "$with_Boost" != no; then
1120  AC_MSG_RESULT(yes)
1121  AC_LANG_SAVE
1122  AC_LANG_CPLUSPLUS
1123  AC_CHECK_HEADERS(boost/dynamic_bitset.hpp)
1124  AC_LANG_RESTORE
1125else
1126  AC_MSG_RESULT(no)
1127  AC_MSG_CHECKING(whether to use std::vector)
1128  if test "$with_stdvec" != yes; then
1129    AC_MSG_RESULT(no)
1130  else
1131    AC_MSG_RESULT(yes)
1132    AC_DEFINE(USE_STDVECBOOL)
1133    USE_STDVECBOOL=1
1134  fi
1135fi
1136AC_SUBST(USE_STDVECBOOL)
1137
1138if test "$ac_cv_lib_gmp_main" = yes && \
1139 test "$ac_cv_header_gmp_h" = yes; then
1140    ac_gmp_ok=yes
1141fi
1142
1143if test "$ac_cv_lib_MP_IMP_PutGmpInt" = yes && \
1144 test "$ac_cv_lib_MPT_MPT_GetTree" && \
1145 test "$ac_cv_header_MP_h" = yes && \
1146 test "$ac_cv_header_MPT_h" = yes; then
1147  ac_MP_ok=yes
1148fi
1149
1150if test "$ac_cv_lib_singcf_atof" = yes && \
1151 test "$ac_cv_header_factory_h" = yes; then
1152  ac_factory_ok=yes
1153fi
1154
1155if test "$ac_cv_lib_singfac_atof" = yes && \
1156 test "$ac_cv_header_factor_h" = yes; then
1157  ac_libfac_ok=yes
1158fi
1159
1160if test "$ac_cv_lib_omalloc_omTestAddr" = yes && \
1161   test "$ac_cv_lib_omalloc_ndebug_main" = yes && \
1162   test "$ac_cv_header_omalloc_c" = yes && \
1163   test "$ac_cv_header_omalloc_h" = yes; then
1164  ac_cv_omalloc_ok=yes
1165fi
1166
1167if test "$ac_cv_lib_ntl_main" = yes; then
1168  ac_cv_ntl_ok=yes
1169fi
1170
1171SAVE_LIBS=$LIBS
1172AC_CHECK_LIB(c_nonshared,__stack_chk_fail_local,GLIBC_DYN_FIX="-lc_nonshared",GLIBC_DYN_FIX="")
1173LIBS=$SAVE_LIBS
1174AC_SUBST(GLIBC_DYN_FIX)
1175
1176
1177# evaluate results
1178dnl llllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllll
1179dnl make sure that omalloc is there
1180dnl
1181if test "$ac_cv_omalloc_ok" != yes && test "$enable_omalloc" != yes; then
1182  AC_MSG_ERROR(can not build without omalloc)
1183fi
1184
1185AC_MSG_CHECKING(which apint package to use)
1186if test "${with_apint}" != gmp; then
1187  if test "$ac_gmp_ok" = yes || test "$enable_gmp" = yes; then
1188    AC_MSG_RESULT(gmp)
1189    will_have_gmp=yes
1190    NEED_LIBS="-lgmp ${NEED_LIBS}"
1191  else
1192    AC_MSG_RESULT(none)
1193    AC_MSG_ERROR(can not build without gmp)
1194  fi
1195else
1196  if test "$ac_gmp_ok" = yes || test "$enable_gmp" = yes; then
1197    AC_MSG_RESULT(gmp)
1198    will_have_gmp=yes
1199    NEED_LIBS="-lgmp ${NEED_LIBS}"
1200  else
1201    AC_MSG_RESULT(none)
1202    AC_MSG_ERROR(can not build with gmp)
1203  fi
1204fi
1205
1206AC_MSG_CHECKING(gfanlib)
1207if test "$enable_gfanlib" = yes; then
1208  AC_MSG_RESULT(yes)
1209  NEED_LIBS="${NEED_LIBS} -lgfan -lcddgmp"
1210else
1211  AC_MSG_RESULT(can not build with gfan lib)
1212fi
1213
1214AC_MSG_CHECKING(whether to use libsvd)
1215if test "$with_svd" = yes; then
1216  AC_MSG_RESULT(yes)
1217  AC_DEFINE(HAVE_SVD)
1218  NEED_LIBS="-lsvd -lmpfr ${NEED_LIBS}"
1219else
1220  AC_MSG_RESULT(no)
1221fi
1222AC_SUBST(HAVE_SVD)
1223
1224#
1225AC_MSG_CHECKING(whether to have MP)
1226if test "${with_MP}" != yes && test "${with_MP}" != no; then
1227  if (test "${will_have_gmp}" = yes) && \
1228     (test "$ac_MP_ok" =  yes || test "$enable_MP" = yes); then
1229    AC_MSG_RESULT(yes)
1230    AC_DEFINE(HAVE_MPSR)
1231    HAVE_MPSR=1
1232    MP_LIBS="-lMPT -lMP ${MP_LIBS}"
1233  else
1234    AC_MSG_RESULT(no)
1235  fi
1236elif  test "${with_MP}" = yes; then
1237  if (test "${will_have_gmp}" = yes) && \
1238     (test "$ac_MP_ok" =  yes || test "$enable_MP" = yes); then
1239    AC_MSG_RESULT(yes)
1240    AC_DEFINE(HAVE_MPSR)
1241    HAVE_MPSR=1
1242    MP_LIBS="-lMPT -lMP ${MP_LIBS}"
1243  else
1244    AC_MSG_RESULT(no)
1245    AC_MSG_ERROR(can not build with MP)
1246  fi
1247else
1248  AC_MSG_RESULT(no)
1249fi
1250AC_SUBST(HAVE_MPSR)
1251AC_SUBST(MP_LIBS)
1252
1253AC_MSG_CHECKING(whether to have NTL)
1254if test "${with_NTL}" = yes ; then
1255  AC_MSG_RESULT(yes)
1256  NEED_LIBS="-lntl ${NEED_LIBS}"
1257else
1258  AC_MSG_RESULT(no)
1259fi
1260
1261AC_MSG_CHECKING(whether to have factory)
1262if test "${with_factory}" != yes && test "${with_factory}" != no; then
1263  if test "$ac_factory_ok" =  yes || test "$enable_factory" = yes; then
1264    AC_MSG_RESULT(yes)
1265    AC_DEFINE(HAVE_FACTORY)
1266    will_have_factory=yes
1267    NEED_LIBS="-lsingcf ${NEED_LIBS}"
1268  else
1269    AC_MSG_RESULT(no)
1270  fi
1271elif  test "${with_factory}" = yes; then
1272  if test "$ac_factory_ok" =  yes || test "$enable_factory" = yes; then
1273    AC_MSG_RESULT(yes)
1274    AC_DEFINE(HAVE_FACTORY)
1275    will_have_factory=yes
1276    NEED_LIBS="-lsingcf ${NEED_LIBS}"
1277  else
1278    AC_MSG_RESULT(no)
1279    AC_MSG_ERROR(can not build with factory)
1280  fi
1281else
1282  AC_MSG_RESULT(no)
1283fi
1284
1285AC_MSG_CHECKING(whether to have libfac)
1286if test "${with_libfac}" != yes && test "${with_libfac}" != no; then
1287  if (test "${will_have_factory}" = yes) && \
1288     (test "$ac_libfac_ok" =  yes || test "$enable_libfac" = yes); then
1289    AC_MSG_RESULT(yes)
1290    NEED_LIBS="-lsingfac ${NEED_LIBS}"
1291  else
1292    AC_MSG_RESULT(no)
1293    AC_MSG_ERROR(can not build without libfac)
1294  fi
1295elif  test "${with_libfac}" = yes; then
1296  if (test "${will_have_factory}" = yes) && \
1297     (test "$ac_libfac_ok" =  yes || test "$enable_libfac" = yes); then
1298    AC_MSG_RESULT(yes)
1299    NEED_LIBS="-lsingfac ${NEED_LIBS}"
1300  else
1301    AC_MSG_RESULT(no)
1302    AC_MSG_ERROR(can not build with libfac)
1303  fi
1304else
1305  AC_MSG_RESULT(no)
1306fi
1307
1308NEED_LIBSG="${NEED_LIBS}"
1309if test "$ac_cv_sizeof_voidp" != 4; then
1310  NEED_LIBS="${NEED_LIBS} -lomalloc"
1311else
1312  NEED_LIBS="${NEED_LIBS} -lomalloc_ndebug"
1313fi
1314
1315
1316AC_SUBST(NEED_LIBS)
1317AC_SUBST(NEED_LIBSG)
1318
1319AC_MSG_CHECKING(whether to have dbm links)
1320if test "$with_dbm" != no; then
1321  AC_DEFINE(HAVE_DBM)
1322  AC_MSG_RESULT(yes)
1323else
1324  AC_MSG_RESULT(no)
1325fi
1326
1327AC_MSG_CHECKING(whether to have dynamic modules)
1328if test "$with_dynamic_modules" = no || test "$ac_have_dl" != yes; then
1329  AC_MSG_RESULT(no)
1330else
1331  AC_DEFINE(HAVE_DYNAMIC_LOADING)
1332  AC_MSG_RESULT(yes)
1333fi
1334
1335AC_MSG_CHECKING(whether to have dynamic kernel)
1336if test "$with_dynamic_kernel" != no && test "$ac_lib_dl" = yes; then
1337  DL_KERNEL=1
1338  AC_SUBST(DL_KERNEL)
1339  AC_MSG_RESULT(yes)
1340else
1341  AC_MSG_RESULT(no)
1342fi
1343
1344AC_MSG_CHECKING(whether to have Plural)
1345if test "$with_Plural" != no && test "$enable_Plural" != no; then
1346  AC_DEFINE(HAVE_PLURAL)
1347  AC_MSG_RESULT(yes)
1348  PLURAL=1
1349  AC_SUBST(PLURAL)
1350else
1351  AC_MSG_RESULT(no)
1352fi
1353
1354AC_MSG_CHECKING(whether to have ratGB)
1355if test "$with_ratGB" != yes && test "$enable_ratGB" != yes; then
1356  AC_MSG_RESULT(no)
1357else
1358  AC_DEFINE(HAVE_RATGRING)
1359  AC_MSG_RESULT(yes)
1360fi
1361
1362
1363OUTPUT_MAKEFILES="Makefile ../kernel/Makefile"
1364
1365if test "$ac_cv_singuname" = "ix86-Win"; then
1366  OUTPUT_MAKEFILES="${OUTPUT_MAKEFILES} Singular.rc"
1367fi
1368
1369AC_OUTPUT(${OUTPUT_MAKEFILES}, \
1370 cp mod2.h ../kernel/mod2.h; \
1371 if test "$CONFIG_HEADERS"; then echo timestamp > stamp-h; fi)
Note: See TracBrowser for help on using the repository browser.