source: git/factory/configure.ac @ 3af3ca

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