source: git/factory/configure.ac @ 2e984a

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