source: git/factory/configure.ac @ ab788d

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