source: git/factory/configure.ac @ e65b1a4

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