source: git/factory/configure.ac @ d2f9df

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