source: git/factory/configure.ac @ 4df5bd

spielwiese
Last change on this file since 4df5bd was 3af3ca, checked in by Oleksandr Motsak <motsak@…>, 12 years ago
FIX: public factory config.h should have ifndef/define/endif guards!
  • 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
24# Add pre'prefixed config
25AX_PREFIX_CONFIG_H([config.h],[],[config.h])
26
27AC_PROG_YACC
28
29#
30# Do not change version here!!!
31#
32dnl #
33dnl # Change version here, do not believe the comment in the
34dnl # preceding lines.
35dnl #
36factory_version="3.1.3"
37factory_configuration="'$ac_configure_args' in `pwd`"
38
39#
40# - check withs and enables.
41#
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
49AC_ARG_WITH(
50  omalloc,
51  [AS_HELP_STRING([--with-omalloc],[build for use with omalloc])])
52
53
54AC_ARG_ENABLE(
55  cf-inline,
56  [AS_HELP_STRING([--enable-cf-inline],[build Factory with \"configurable inline methods\" enabled.])],
57  [enable_cf_inline=$enableval],
58  [enable_cf_inline=no])
59
60AC_ARG_ENABLE(
61  streamio,
62  [AS_HELP_STRING([--enable-streamio],[build Factory with stream IO])],
63  ,
64  [enable_streamio=no])
65
66AC_ARG_ENABLE(
67  assertions,
68  [AS_HELP_STRING([--enable-assertions],[build Factory with assertions activated])],
69  ,
70  enable_assertions=no)
71
72AC_ARG_ENABLE(
73  timing,
74  [AS_HELP_STRING([--enable-timing],[build Factory so it will print timing information])],
75  ,
76  enable_timing=no)
77
78AC_ARG_ENABLE(
79  debugoutput,
80  [AS_HELP_STRING([--enable-debugoutput],[build Factory so it will print debugging information])],
81  ,
82  enable_debugoutput=no)
83
84#
85# - check for CC and CXX but be careful about CFLAGS.
86#
87test "${CFLAGS+set}" = set || cflags_expl_set=no
88AC_PROG_CC
89test "${CXXFLAGS+set}" = set || cxxflags_expl_set=no
90AC_PROG_CXX
91if test "x$GCC" != xyes && test "x$GXX" != xyes; then
92  AC_MSG_WARN(you better use gcc to compile Factory)
93else
94  if test "x$GXX" = xyes && test "x$cxxflags_expl_set" = xno; then
95    AC_MSG_WARN([we use \`' as default for \`CXXFLAGS'
96                    (instead of the configure default \`-g -O')])
97  fi
98  if test "x$GCC" = xyes && test "x$cflags_expl_set" = xno; then
99    AC_MSG_WARN([we use \`' as default for \`CFLAGS'
100                    (instead of the configure default \`-g -O')])
101  fi
102fi
103
104#
105# - check for some other programs.
106#
107AC_PROG_CPP
108AC_PROG_CXXCPP
109AC_PROG_LN_S
110AC_PROG_INSTALL
111AC_DISABLE_STATIC
112LT_INIT
113AC_PROG_MAKE_SET
114AC_CHECK_PROG(AR, ar, ar, where-is-your-ar)
115AC_CHECK_PROG(M4, m4, m4, where-is-your-m4)
116AC_CHECK_PROG(BISON, bison, bison, where-is-your-bison)
117AC_C_CONST
118AC_C_INLINE
119
120AH_TEMPLATE([INT64], [Defenition for INT64])
121# Always long long int???!
122AC_DEFINE([INT64], [long long int]) 
123
124DX_INIT_DOXYGEN($PACKAGE_NAME, MYDOXYGENCONFIG)
125
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
132save_path="$PATH"
133PATH="$PATH:$srcdir/bin"
134AC_PATH_PROG(FACTORY_MKINSTALLDIRS, mkinstalldirs, -mkdir)
135PATH="$srcdir/bin:$save_path"
136AC_PATH_PROG(FACTORY_MAKEHEADER, makeheader)
137PATH="$save_path"
138
139#
140# - expand paths.
141#
142
143AC_MSG_CHECKING(and generating explicit install paths)
144
145# generate Makefile
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"
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
162done
163prefix="$save_prefix"
164exec_prefix="$save_exec_prefix"
165
166# generate the explicit paths
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`
173
174# clean up
175rm -f ./conftest.mk ./conftest.dir
176
177AC_MSG_RESULT(done)
178
179#
180# - check for libraries.
181#
182AC_CHECK_LIB(m, atof, , [ AC_MSG_ERROR(libm.a not found) ])
183
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)]))
187
188# arithmetic shift
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
200
201#
202# - check for header files.
203#
204AC_LANG_CPLUSPLUS
205
206AC_CHECK_HEADERS(stdio.h stdlib.h string.h time.h math.h, ,
207  [ AC_MSG_ERROR(C header files not found) ])
208AC_CHECK_HEADERS(cstdio)
209
210if test "x$enable_streamio" != xno; then
211  AC_CHECK_HEADERS(iostream.h strstream.h fstream.h iostream string fstream)
212  AC_CHECK_HEADERS(ctype.h, , [ AC_MSG_ERROR(standard C header files not found) ])
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
216  AC_CHECK_HEADERS(stdarg.h signal.h errno.h unistd.h, ,
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)) ])
220fi
221
222if test "x$enable_timing" != xno; then
223  AC_CHECK_HEADERS(sys/param.h sys/times.h, ,
224    [ AC_MSG_ERROR(\`sys/times.h' or \`sys/param.h' not found.  Try
225                  \`configure --disable-timing') ])
226fi
227
228AC_CHECK_HEADERS(omalloc.h,,)
229
230# font-lock-trick: '
231
232#
233# - check for compiler characteristics.
234#
235
236# use C to check compiler characteristics instead of C++.  On
237# nextstep, checking with C++ may fail.
238AC_LANG_C
239
240# cross-compiling ?!
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
249
250# font-lock-trick: '
251
252#
253# - paths.
254#
255
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'
259explicit_gftabledir="$explicit_datadir/gftables"
260
261# for installation of the templates
262templatedir='${includedir}/templates'
263
264#
265# - the name of the game and the targets to create.
266#
267if test "x$with_Singular" = xyes; then
268  libfactory=libfactory.a
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
283  installtargets=installcf
284  uninstalltargets=uninstallcf
285fi
286
287#
288# - set defines and variables according to our tests.
289#
290
291# CFLAGS
292if test "x$GCC" = xyes && test "x$cflags_expl_set" = xno; then
293  CFLAGS=""
294fi
295
296# CXXFLAGS
297if test "x$GXX" = xyes && test "x$cxxflags_expl_set" = xno; then
298  CXXFLAGS=""
299
300AC_LANG_SAVE
301AC_LANG_CPLUSPLUS
302# check whether CXX accepts -fno-rtti
303AC_MSG_CHECKING(whether gcc accepts -fno-rtti)
304tmp_flags=${CXXFLAGS}
305CXXFLAGS="${CXXFLAGS}"
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
312CXXFLAGS="$CXXFLAGS"
313fi
314
315AC_MSG_CHECKING(whether gcc accepts -fno-exceptions)
316tmp_flags=${CXXFLAGS}
317CXXFLAGS="${CXXFLAGS} -fno-exceptions"
318AC_CACHE_VAL(ac_cv_cxx_have_exceptions,
319AC_TRY_LINK(,,ac_cv_cxx_have_exceptions=yes,ac_cv_cxx_have_exceptions=no)
320)
321AC_MSG_RESULT(${ac_cv_cxx_have_exceptions})
322CXXFLAGS=$tmp_flags
323if test "${ac_cv_cxx_have_exceptions}" = yes; then
324CXXFLAGS="$CXXFLAGS -fno-exceptions"
325fi
326AC_LANG_RESTORE
327
328fi
329
330# ARFLAGS
331test "${ARFLAGS+set}" = set || ARFLAGS=cr
332
333# M4FLAGS
334test "${M4FLAGS+set}" = set || M4FLAGS=
335
336AH_TEMPLATE([SINGULAR], [define if linked to Singular])
337AH_TEMPLATE([DISABLE_GMP_CPP],[DISABLE_GMP_CPP])
338AH_TEMPLATE([NOSTREAMIO],[DISABLE_GMP_CPP])
339
340# Singular
341if test "x$with_Singular" = xyes; then
342  AC_DEFINE([SINGULAR],[1]) 
343  AC_DEFINE([DISABLE_GMP_CPP],[1])
344  AC_DEFINE([NOSTREAMIO],[1])
345fi
346
347# arithmetic shift
348#if test "x$ac_cv_shift" = xyes; then   
349#  AC_DEFINE([HAS_ARITHMETIC_SHIFT],[1],[HAS_ARITHMETIC_SHIFT])
350#fi
351
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
357       warn_omalloc=yes
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
366        warn_omalloc=yes
367      fi
368      with_omalloc=yes
369    else
370      with_omalloc=no
371    fi
372  fi
373fi
374
375AH_TEMPLATE([HAVE_OMALLOC], [define if build with OMALLOC])
376if test "$with_omalloc" = yes; then
377  AC_DEFINE([HAVE_OMALLOC],[1])
378fi
379AC_MSG_RESULT($with_omalloc)
380if test "$warn_omalloc" = yes; then
381  AC_MSG_WARN(did not find omalloc.h -- install before compiling)
382fi
383
384
385AH_TEMPLATE([CF_USE_INLINE], [define to use "configurable inline methods" (see cf_inline.cc)])
386# "configurable inline methods"
387if test "x$enable_cf_inline" != xno; then
388  AC_DEFINE([CF_USE_INLINE],[1])
389fi
390
391AH_TEMPLATE([NOSTREAMIO], [define to build factory without stream IO])
392# iostream
393if test "x$enable_streamio" = xno; then
394  AC_DEFINE([NOSTREAMIO],[1])
395else
396  factorysrc="$factorysrc \$(useiofactorysrc)"
397  factoryincl="$factoryincl \$(useiofactoryincl)"
398fi
399
400AH_TEMPLATE([NOASSERT], [define if you do not want to activate assertions])
401# assertions
402if test "x$enable_assertions" = xno; then
403  AC_DEFINE([NOASSERT],[1])
404fi
405
406AH_TEMPLATE([TIMING], [define if you want to activate the timing stuff])
407# timing
408if test "x$enable_timing" != xno; then
409  AC_DEFINE([TIMING],[1])
410fi
411
412# debugoutput
413AH_TEMPLATE([DEBUGOUTPUT], [define if you want to have debugging output])
414if test "x$enable_debugoutput" != xno; then
415  AC_DEFINE([DEBUGOUTPUT],[1]) 
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)
429AC_SUBST(M4FLAGS)
430AC_SUBST(MAKEHEADERFLAGS)
431
432AC_SUBST(factorysrc)
433AC_SUBST(factoryincl)
434
435AC_SUBST(alltargets)
436AC_SUBST(installtargets)
437AC_SUBST(uninstalltargets)
438
439AH_TEMPLATE([FACTORYVERSION], [factory version])
440AC_DEFINE_UNQUOTED([FACTORYVERSION], "$factory_version")
441
442AH_TEMPLATE([FACTORYCONFIGURATION], [factory configuration])
443AC_DEFINE_UNQUOTED([FACTORYCONFIGURATION], "$factory_configuration")
444
445AH_TEMPLATE([GFTABLEDIR], [where the gftables live])
446AC_DEFINE_UNQUOTED([GFTABLEDIR], "$explicit_gftabledir")
447
448AM_CONDITIONAL(
449    [WITH_PARSER_FOR_CANONICAL_FORM],
450    [test x$with_Singular != xyes && test x$enable_streamio != xno])
451
452AC_CONFIG_FILES([Makefile ftest/GNUmakefile])
453AC_OUTPUT
454
Note: See TracBrowser for help on using the repository browser.