source: git/factory/configure.ac @ 72ebdb

spielwiese
Last change on this file since 72ebdb was e4fe2b, checked in by Oleksandr Motsak <motsak@…>, 13 years ago
FIX: Fixed huge BUG in cf_gmp.h CHG: starting to cleanup factory
  • Property mode set to 100644
File size: 12.2 KB
Line 
1dnl # emacs edit mode for this file is -*- sh -*-
2dnl # $Id$
3
4dnl #
5dnl # configure.in - process this file with `autoconf' to generate
6dnl #   a `configure' script.
7dnl #
8dnl # See the `INSTALL' file for information on how the `configure'
9dnl # script works.
10dnl #
11
12#
13# - initialisation.
14#
15AC_INIT([factory], [3.1.2.sw])
16AC_CONFIG_SRCDIR(canonicalform.cc)
17AC_CONFIG_MACRO_DIR([../m4])
18AC_CONFIG_AUX_DIR([.])
19AM_MAINTAINER_MODE
20AM_INIT_AUTOMAKE
21
22AC_PROG_YACC
23
24#
25# Do not change version here!!!
26#
27dnl #
28dnl # Change version here, do not believe the comment in the
29dnl # preceding lines.
30dnl #
31factory_version="3.1.3"
32factory_configuration="'$ac_configure_args' in `pwd`"
33
34#
35# - check withs and enables.
36#
37AC_ARG_WITH(
38  Singular,
39  [AS_HELP_STRING([--without-Singular],[build NOT for the use with CAS Singular.])],
40  ,
41  [with_Singular=yes])
42
43
44AC_ARG_WITH(
45  memman,
46  [  --with-memman(=<memman>) specify Factory memory manager.
47                          <memman> is either \`old' (default), \`new', or \`no'.],
48  ,
49  [ if test "x$with_Singular" = xyes; then
50      with_memman=no
51    else
52      with_memman=old
53    fi ])
54
55# font-lock-trick: '
56
57AC_ARG_WITH(
58  omalloc,
59  [AS_HELP_STRING([--with-omalloc],[build for use with omalloc])])
60
61
62AC_ARG_ENABLE(
63  cf-inline,
64  [AS_HELP_STRING([--enable-cf-inline],[build Factory with \"configurable inline methods\" enabled.])],
65  [enable_cf_inline=$enableval],
66  [enable_cf_inline=no])
67
68AC_ARG_ENABLE(
69  streamio,
70  [AS_HELP_STRING([--enable-streamio],[build Factory with stream IO])],
71  ,
72  [enable_streamio=no])
73
74AC_ARG_ENABLE(
75  memdebug,
76  [  --enable-memdebug=<level> switch on memory management debugging.  Meaningful
77                          with \`--with-memman=new' only.  <level> may be either
78                          \`no' (default), \`normal', or \`full'.],
79  ,
80  enable_memdebug=no)
81
82AC_ARG_ENABLE(
83  assertions,
84  [AS_HELP_STRING([--enable-assertions],[build Factory with assertions activated])],
85  ,
86  enable_assertions=no)
87
88AC_ARG_ENABLE(
89  timing,
90  [AS_HELP_STRING([--enable-timing],[build Factory so it will print timing information])],
91  ,
92  enable_timing=no)
93
94AC_ARG_ENABLE(
95  debugoutput,
96  [AS_HELP_STRING([--enable-debugoutput],[build Factory so it will print debugging information])],
97  ,
98  enable_debugoutput=no)
99
100#
101# - check for CC and CXX but be careful about CFLAGS.
102#
103test "${CFLAGS+set}" = set || cflags_expl_set=no
104AC_PROG_CC
105test "${CXXFLAGS+set}" = set || cxxflags_expl_set=no
106AC_PROG_CXX
107if test "x$GCC" != xyes && test "x$GXX" != xyes; then
108  AC_MSG_WARN(you better use gcc to compile Factory)
109else
110  if test "x$GXX" = xyes && test "x$cxxflags_expl_set" = xno; then
111    AC_MSG_WARN([we use \`-O2 -fomit-frame-pointer' as default for \`CXXFLAGS'
112                    (instead of the configure default \`-g -O')])
113  fi
114  if test "x$GCC" = xyes && test "x$cflags_expl_set" = xno; then
115    AC_MSG_WARN([we use \`-O2 -fomit-frame-pointer' as default for \`CFLAGS'
116                    (instead of the configure default \`-g -O')])
117  fi
118fi
119
120#
121# - check for some other programs.
122#
123AC_PROG_CPP
124AC_PROG_CXXCPP
125AC_PROG_LN_S
126AC_PROG_INSTALL
127AC_PROG_RANLIB
128AC_PROG_MAKE_SET
129AC_CHECK_PROG(AR, ar, ar, where-is-your-ar)
130AC_CHECK_PROG(M4, m4, m4, where-is-your-m4)
131AC_CHECK_PROG(BISON, bison, bison, where-is-your-bison)
132DX_INIT_DOXYGEN($PACKAGE_NAME, MYDOXYGENCONFIG)
133
134# do not use `MKINSTALLDIRS' and `MAKEHEADER' since there may be
135# name clashes with other peoples configure scripts via
136# `config.cache'.  Furthermore, we do not use cache at all to
137# avoid some nasty problems with our own development environment.
138unset ac_cv_path_FACTORY_MKINSTALLDIRS
139unset ac_cv_path_FACTORY_MAKEHEADER
140save_path="$PATH"
141PATH="$PATH:$srcdir/bin"
142AC_PATH_PROG(FACTORY_MKINSTALLDIRS, mkinstalldirs, -mkdir)
143PATH="$srcdir/bin:$save_path"
144AC_PATH_PROG(FACTORY_MAKEHEADER, makeheader)
145PATH="$save_path"
146
147#
148# - expand paths.
149#
150
151AC_MSG_CHECKING(and generating explicit install paths)
152
153# generate Makefile
154save_prefix="$prefix"
155save_exec_prefix="$exec_prefix"
156test "x$prefix" = xNONE && prefix=$ac_default_prefix
157test "x$exec_prefix" = xNONE && exec_prefix='${prefix}'
158for dir in prefix exec_prefix bindir sbindir libexecdir \
159           datadir sysconfdir sharedstatedir localstatedir libdir \
160           includedir oldincludedir infodir mandir; do
161  eval "dir_value=\$$dir"
162  cat >> ./conftest.mk << EXPLPATHEOT
163$dir=$dir_value
164explicit_$dir:
165        @ echo \$($dir)
166        @ if echo \$($dir) | grep '^/'; \\
167        then echo \$($dir) > ./conftest.dir; \\
168        else echo \`pwd\`/\$($dir) > ./conftest.dir; fi
169EXPLPATHEOT
170done
171prefix="$save_prefix"
172exec_prefix="$save_exec_prefix"
173
174# generate the explicit paths
175make >&5 2>&1 -f ./conftest.mk explicit_datadir
176explicit_datadir=`cat ./conftest.dir`
177make >&5 2>&1 -f ./conftest.mk explicit_libdir
178explicit_libdir=`cat ./conftest.dir`
179make >&5 2>&1 -f ./conftest.mk explicit_includedir
180explicit_includedir=`cat ./conftest.dir`
181
182# clean up
183rm -f ./conftest.mk ./conftest.dir
184
185AC_MSG_RESULT(done)
186
187#
188# - check for libraries.
189#
190AC_CHECK_LIB(m, atof, , [ AC_MSG_ERROR(libm.a not found) ])
191
192LB_CHECK_GMP(3.1.1,,AC_MSG_ERROR([Unable to find GMP on your machine: please use --with-gmp=PATH_TO_DIR_CONTAINING_LIB_AND_INCLUDE (see also ./configure --help if you do not understand what we are talking about)]))
193
194LB_CHECK_NTL(5.0,,AC_MSG_WARN([Unable to find NTL (which is strongly recommended) on your machine: please use --with-ntl=PATH_TO_DIR_CONTAINING_LIB_AND_INCLUDE (see also ./configure --help if you do not understand what we are talking about)]))
195
196# arithmetic shift
197#AC_MSG_CHECKING(whether your compiler does arithmetic shifts)
198#AC_CACHE_VAL(ac_cv_shift,
199#  [ LDFLAGS="-L$explicit_libdir $LDFLAGS"
200#       AC_TRY_RUN(
201#      [ int main() { if (-2 >> 1 == -1) return(0); else return(1); } ],
202#      ac_cv_shift=yes, ac_cv_shift=no, ac_cv_shift=yes) ])
203#if test "x$ac_cv_shift" = xyes; then   
204#  AC_MSG_RESULT(yes)
205#else
206#  AC_MSG_RESULT(no)
207#fi
208
209#
210# - check for header files.
211#
212AC_LANG_CPLUSPLUS
213
214AC_CHECK_HEADERS(stdio.h stdlib.h string.h time.h math.h, ,
215  [ AC_MSG_ERROR(C header files not found) ])
216AC_CHECK_HEADERS(cstdio)
217
218if test "x$enable_streamio" != xno; then
219  AC_CHECK_HEADERS(iostream.h strstream.h fstream.h iostream string fstream)
220  AC_CHECK_HEADERS(ctype.h, , [ AC_MSG_ERROR(standard C header files not found) ])
221
222  # since the FTE will compile only with stream IO enabled we will not
223  # check for the necessary header files if stream IO is disabled
224  AC_CHECK_HEADERS(stdarg.h signal.h errno.h unistd.h, ,
225    [ AC_MSG_WARN(C/C++ header files not found.
226                    You will not be able to build the Factory Test Environment
227                    (though Factory itself should compile)) ])
228fi
229
230if test "x$enable_timing" != xno; then
231  AC_CHECK_HEADERS(sys/param.h sys/times.h, ,
232    [ AC_MSG_ERROR(\`sys/times.h' or \`sys/param.h' not found.  Try
233                  \`configure --disable-timing') ])
234fi
235
236AC_CHECK_HEADERS(omalloc.h,,)
237
238# font-lock-trick: '
239
240#
241# - check for compiler characteristics.
242#
243
244# use C to check compiler characteristics instead of C++.  On
245# nextstep, checking with C++ may fail.
246AC_LANG_C
247
248# cross-compiling ?!
249#AC_C_CROSS
250#if test "x$cross_compiling" = xyes; then
251#  AC_MSG_WARN([you better specify a cache file to get the values for
252#                    cross-compiling right (e.g., call \`configure
253#                    --cache-file=yourTarget.cache').  In particular, you
254#                    should make sure that your target machine supports
255#                    arithmetic shift.])
256#fi
257
258# font-lock-trick: '
259
260#
261# - paths.
262#
263
264# note that Singular has its own mechanism to search the tables,
265# hence we do not need to mind it here
266gftabledir='${datadir}/factory/gftables'
267explicit_gftabledir="$explicit_datadir/gftables"
268
269# for installation of the templates
270templatedir='${includedir}/templates'
271
272#
273# - the name of the game and the targets to create.
274#
275if test "x$with_Singular" = xyes; then
276  libfactory=libfactory.a
277
278  factorysrc='$(basefactorysrc) $(singfactorysrc)'
279  factoryincl='$(basefactoryincl) $(singfactoryincl)'
280  memmansrc=
281  memmanincl=
282
283  alltargets=cf
284  installtargets=installcf
285  uninstalltargets=uninstallcf
286else
287  libfactory=libcf.a
288
289  factorysrc='$(basefactorysrc)'
290  factoryincl='$(basefactoryincl)'
291  memmansrc='$(basememmansrc)'
292  memmanincl=
293
294  alltargets=cf
295  installtargets=installcf
296  uninstalltargets=uninstallcf
297fi
298
299#
300# - set defines and variables according to our tests.
301#
302
303# CFLAGS
304if test "x$GCC" = xyes && test "x$cflags_expl_set" = xno; then
305  CFLAGS="-O2 -fomit-frame-pointer"
306fi
307
308# CXXFLAGS
309if test "x$GXX" = xyes && test "x$cxxflags_expl_set" = xno; then
310  CXXFLAGS="-O2 -fomit-frame-pointer"
311
312AC_LANG_SAVE
313AC_LANG_CPLUSPLUS
314# check whether CXX accepts -fno-rtti
315AC_MSG_CHECKING(whether gcc accepts -fno-rtti)
316tmp_flags=${CXXFLAGS}
317CXXFLAGS="${CXXFLAGS} -fno-rtti"
318AC_CACHE_VAL(ac_cv_cxx_have_rtti,
319AC_TRY_COMPILE(,,ac_cv_cxx_have_rtti=yes,ac_cv_cxx_have_rtti=no)
320)
321AC_MSG_RESULT(${ac_cv_cxx_have_rtti})
322CXXFLAGS=$tmp_flags
323if test "${ac_cv_cxx_have_rtti}" = yes; then
324CXXFLAGS="$CXXFLAGS -fno-rtti"
325fi
326
327AC_MSG_CHECKING(whether gcc accepts -fno-exceptions)
328tmp_flags=${CXXFLAGS}
329CXXFLAGS="${CXXFLAGS} -fno-exceptions"
330AC_CACHE_VAL(ac_cv_cxx_have_exceptions,
331AC_TRY_LINK(,,ac_cv_cxx_have_exceptions=yes,ac_cv_cxx_have_exceptions=no)
332)
333AC_MSG_RESULT(${ac_cv_cxx_have_exceptions})
334CXXFLAGS=$tmp_flags
335if test "${ac_cv_cxx_have_exceptions}" = yes; then
336CXXFLAGS="$CXXFLAGS -fno-exceptions"
337fi
338AC_LANG_RESTORE
339
340fi
341
342# ARFLAGS
343test "${ARFLAGS+set}" = set || ARFLAGS=cr
344
345# M4FLAGS
346test "${M4FLAGS+set}" = set || M4FLAGS=
347
348# Singular
349if test "x$with_Singular" = xyes; then
350  AC_DEFINE([SINGULAR],[1],[SINGULAR])
351fi
352
353# arithmetic shift
354#if test "x$ac_cv_shift" = xyes; then   
355#  AC_DEFINE([HAS_ARITHMETIC_SHIFT],[1],[HAS_ARITHMETIC_SHIFT])
356#fi
357
358AC_MSG_CHECKING(whether to use omalloc)
359
360if test "$with_omalloc" = yes; then
361  if test "$ac_cv_header_omalloc_h" != yes; then
362    if test "$enable_omalloc" = yes; then
363       warn_omalloc=yes
364    else
365       with_omalloc=no
366    fi
367  fi
368else
369  if test "$with_omalloc" != no; then
370    if test "$enable_omalloc" = yes; then
371      if test "$ac_cv_header_omalloc_h" != yes; then
372        warn_omalloc=yes
373      fi
374      with_omalloc=yes
375    else
376      with_omalloc=no
377    fi
378  fi
379fi
380if test "$with_omalloc" = yes; then
381  AC_DEFINE([HAVE_OMALLOC],[1],[HAVE_OMALLOC])
382  with_memman=no
383fi
384AC_MSG_RESULT($with_omalloc)
385if test "$warn_omalloc" = yes; then
386  AC_MSG_WARN(did not find omalloc.h -- install before compiling)
387fi
388
389   
390# memory manager
391if test "x$with_memman" = xyes; then
392  alltargets="$alltargets mem"
393  installtargets="$installtargets installmem"
394  uninstalltargets="$uninstalltargets uninstallmem"
395  AC_DEFINE([USE_MEMUTIL],[1],[USE_MEMUTIL])
396
397  if test "x$with_memman" != xnew; then
398    memmansrc="$memmansrc \$(oldmemmansrc)"
399    memmanincl='$(oldmemmanincl)'
400    AC_DEFINE([USE_OLD_MEMMAN],[1],[USE_OLD_MEMMAN])
401  else
402    memmansrc="$memmansrc \$(newmemmansrc)"
403    memmanincl='$(newmemmanincl)'
404
405    if test "x$enable_memdebug" = xfull; then
406      AC_DEFINE([MDEBUG], [1], [MDEBUG])
407    elif test "x$enable_memdebug" != xno; then
408      AC_DEFINE([MDEBUG], [0], [MDEBUG])
409    fi
410  fi
411fi
412
413# "configurable inline methods"
414if test "x$enable_cf_inline" != xno; then
415  AC_DEFINE([CF_USE_INLINE],[1],[CF_USE_INLINE])
416fi
417
418# iostream
419if test "x$enable_streamio" = xno; then
420  AC_DEFINE([NOSTREAMIO],[1],[NOSTREAMIO])
421else
422  factorysrc="$factorysrc \$(useiofactorysrc)"
423  factoryincl="$factoryincl \$(useiofactoryincl)"
424fi
425
426# assertions
427if test "x$enable_assertions" = xno; then
428  AC_DEFINE([NOASSERT],[1],[NOASSERT])
429fi
430
431# timing
432if test "x$enable_timing" != xno; then
433  AC_DEFINE([TIMING],[1],[TIMING])
434fi
435
436# debugoutput
437if test "x$enable_debugoutput" != xno; then
438  AC_DEFINE([DEBUGOUTPUT],[1],[DEBUGOUTPUT])
439fi
440
441#
442# - complete and substitute variables, defines.
443#
444AC_SUBST(gftabledir)
445AC_SUBST(templatedir)
446
447AC_SUBST(factory_version)
448
449AC_SUBST(libfactory)
450
451AC_SUBST(ARFLAGS)
452AC_SUBST(M4FLAGS)
453AC_SUBST(MAKEHEADERFLAGS)
454
455AC_SUBST(factorysrc)
456AC_SUBST(factoryincl)
457AC_SUBST(memmansrc)
458AC_SUBST(memmanincl)
459
460AC_SUBST(alltargets)
461AC_SUBST(installtargets)
462AC_SUBST(uninstalltargets)
463
464AC_DEFINE_UNQUOTED([FACTORYVERSION], "$factory_version", [FACTORYVERSION])
465AC_DEFINE_UNQUOTED([FACTORYCONFIGURATION], "$factory_configuration", [FACTORYCONFIGURATION])
466AC_DEFINE_UNQUOTED([GFTABLEDIR], "$explicit_gftabledir", [GFTABLEDIR])
467
468AC_CONFIG_HEADER(config.h)
469AC_OUTPUT(Makefile ftest/GNUmakefile)
Note: See TracBrowser for help on using the repository browser.