source: git/factory/configure.ac @ f1cfef

fieker-DuValspielwiese
Last change on this file since f1cfef was 6ce030f, checked in by Oleksandr Motsak <motsak@…>, 12 years ago
removal of the $Id$ svn tag from everywhere NOTE: the git SHA1 may be used instead (only on special places) NOTE: the libraries Singular/LIB/*.lib still contain the marker due to our current use of svn
  • Property mode set to 100644
File size: 13.3 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 silent-rules]) # -Wno-extra-portability -Werror
23
24# Add pre'prefixed config
25AX_PREFIX_CONFIG_H([config.h],[],[config.h])
26
27AC_PROG_YACC
28# AM_PROG_AR
29LT_INIT
30
31#
32# Do not change version here!!!
33#
34dnl #
35dnl # Change version here, do not believe the comment in the
36dnl # preceding lines.
37dnl #
38factory_version="3.1.3"
39factory_configuration="'$ac_configure_args' in `pwd`"
40
41#
42# - check withs and enables.
43#
44AC_ARG_WITH(
45  Singular,
46  [AS_HELP_STRING([--without-Singular],[build NOT for the use with CAS Singular.])],
47  ,
48  [with_Singular=yes])
49
50AC_ARG_ENABLE(omalloc, AS_HELP_STRING([--enable-omalloc],[build for use with omalloc]),
51[if test "x$enableval" = "xyes"; then
52  ENABLE_OMALLOC=yes
53fi], ENABLE_OMALLOC=no)
54
55AC_ARG_ENABLE(omalloc_trust, AS_HELP_STRING([--enable-omalloc-trust],[do not check the omalloc header]),
56[if test "x$enableval" = "xyes"; then
57  omalloc_trust=yes
58fi], omalloc_trust=no)
59
60AC_ARG_WITH(omalloc_dir,[AS_HELP_STRING([--with-omalloc-dir=PTH],[location of omalloc])], with_omalloc_dir="$withval", with_omalloc_dir="")
61AC_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="")
62
63AC_ARG_ENABLE(
64  cf-inline,
65  [AS_HELP_STRING([--enable-cf-inline],[build Factory with \"configurable inline methods\" enabled.])],
66  [enable_cf_inline=$enableval],
67  [enable_cf_inline=no])
68
69AC_ARG_ENABLE(
70  streamio,
71  [AS_HELP_STRING([--enable-streamio],[build Factory with stream IO])],
72  ,
73  [enable_streamio=no])
74
75AC_ARG_ENABLE(
76  assertions,
77  [AS_HELP_STRING([--disable-assertions],[build Factory with no assertions])],
78  ,
79  enable_assertions=yes)
80
81AC_ARG_ENABLE(
82  timing,
83  [AS_HELP_STRING([--enable-timing],[build Factory so it will print timing information])],
84  ,
85  enable_timing=no)
86
87AC_ARG_ENABLE(
88  debugoutput,
89  [AS_HELP_STRING([--enable-debugoutput],[build Factory so it will print debugging information])],
90  ,
91  enable_debugoutput=no)
92
93#
94# - check for CC and CXX but be careful about CFLAGS.
95#
96test "${CFLAGS+set}" = set || cflags_expl_set=no
97AC_PROG_CC
98test "${CXXFLAGS+set}" = set || cxxflags_expl_set=no
99AC_PROG_CXX
100if test "x$GCC" != xyes && test "x$GXX" != xyes; then
101  AC_MSG_WARN(you better use gcc to compile Factory)
102else
103  if test "x$GXX" = xyes && test "x$cxxflags_expl_set" = xno; then
104    AC_MSG_WARN([we use \`' as default for \`CXXFLAGS'
105                    (instead of the configure default \`-g -O')])
106  fi
107  if test "x$GCC" = xyes && test "x$cflags_expl_set" = xno; then
108    AC_MSG_WARN([we use \`' as default for \`CFLAGS'
109                    (instead of the configure default \`-g -O')])
110  fi
111fi
112
113#
114# - check for some other programs.
115#
116AC_PROG_CPP
117AC_PROG_CXXCPP
118AC_PROG_LN_S
119AC_PROG_INSTALL
120AC_DISABLE_STATIC
121LT_INIT
122AC_PROG_MAKE_SET
123AC_CHECK_PROG(AR, ar, ar, where-is-your-ar)
124AC_CHECK_PROG(M4, m4, m4, where-is-your-m4)
125AC_CHECK_PROG(BISON, bison, bison, where-is-your-bison)
126AC_CHECK_SIZEOF(long,4)
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
198LB_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)]))
199
200# arithmetic shift
201#AC_MSG_CHECKING(whether your compiler does arithmetic shifts)
202#AC_CACHE_VAL(ac_cv_shift,
203#  [ LDFLAGS="-L$explicit_libdir $LDFLAGS"
204#       AC_TRY_RUN(
205#      [ int main() { if (-2 >> 1 == -1) return(0); else return(1); } ],
206#      ac_cv_shift=yes, ac_cv_shift=no, ac_cv_shift=yes) ])
207#if test "x$ac_cv_shift" = xyes; then   
208#  AC_MSG_RESULT(yes)
209#else
210#  AC_MSG_RESULT(no)
211#fi
212
213#
214# - check for header files.
215#
216AC_LANG_CPLUSPLUS
217
218AC_CHECK_HEADERS(stdio.h stdlib.h string.h time.h math.h, ,
219  [ AC_MSG_ERROR(C header files not found) ])
220AC_CHECK_HEADERS(cstdio)
221
222if test "x$enable_streamio" != xno; then
223  AC_CHECK_HEADERS(iostream.h strstream.h fstream.h iostream string fstream)
224  AC_CHECK_HEADERS(ctype.h, , [ AC_MSG_ERROR(standard C header files not found) ])
225
226  # since the FTE will compile only with stream IO enabled we will not
227  # check for the necessary header files if stream IO is disabled
228  AC_CHECK_HEADERS(stdarg.h signal.h errno.h unistd.h, ,
229    [ AC_MSG_WARN(C/C++ header files not found.
230                    You will not be able to build the Factory Test Environment
231                    (though Factory itself should compile)) ])
232fi
233
234if test "x$enable_timing" != xno; then
235  AC_CHECK_HEADERS(sys/param.h sys/times.h, ,
236    [ AC_MSG_ERROR(\`sys/times.h' or \`sys/param.h' not found.  Try
237                  \`configure --disable-timing') ])
238fi
239
240# font-lock-trick: '
241
242#
243# - check for compiler characteristics.
244#
245
246# use C to check compiler characteristics instead of C++.  On
247# nextstep, checking with C++ may fail.
248AC_LANG_C
249
250# cross-compiling ?!
251#AC_C_CROSS
252#if test "x$cross_compiling" = xyes; then
253#  AC_MSG_WARN([you better specify a cache file to get the values for
254#                    cross-compiling right (e.g., call \`configure
255#                    --cache-file=yourTarget.cache').  In particular, you
256#                    should make sure that your target machine supports
257#                    arithmetic shift.])
258#fi
259
260# font-lock-trick: '
261
262#
263# - paths.
264#
265
266# note that Singular has its own mechanism to search the tables,
267# hence we do not need to mind it here
268gftabledir='${datadir}/factory/gftables'
269explicit_gftabledir="$explicit_datadir/gftables"
270
271# for installation of the templates
272templatedir='${includedir}/templates'
273
274#
275# - the name of the game and the targets to create.
276#
277if test "x$with_Singular" = xyes; then
278  libfactory=libfactory.a
279
280  factorysrc='$(basefactorysrc) $(singfactorysrc)'
281  factoryincl='$(basefactoryincl) $(singfactoryincl)'
282
283  alltargets=cf
284  installtargets=installcf
285  uninstalltargets=uninstallcf
286else
287  libfactory=libcf.a
288
289  factorysrc='$(basefactorysrc)'
290  factoryincl='$(basefactoryincl)'
291
292  alltargets=cf
293  installtargets=installcf
294  uninstalltargets=uninstallcf
295fi
296
297#
298# - set defines and variables according to our tests.
299#
300
301# CFLAGS
302if test "x$GCC" = xyes && test "x$cflags_expl_set" = xno; then
303  CFLAGS=""
304fi
305
306# CXXFLAGS
307if test "x$GXX" = xyes && test "x$cxxflags_expl_set" = xno; then
308  CXXFLAGS=""
309
310AC_LANG_SAVE
311AC_LANG_CPLUSPLUS
312# check whether CXX accepts -fno-rtti
313AC_MSG_CHECKING(whether gcc accepts -fno-rtti)
314tmp_flags=${CXXFLAGS}
315CXXFLAGS="${CXXFLAGS}"
316AC_CACHE_VAL(ac_cv_cxx_have_rtti,
317AC_TRY_COMPILE(,,ac_cv_cxx_have_rtti=yes,ac_cv_cxx_have_rtti=no)
318)
319AC_MSG_RESULT(${ac_cv_cxx_have_rtti})
320CXXFLAGS=$tmp_flags
321if test "${ac_cv_cxx_have_rtti}" = yes; then
322CXXFLAGS="$CXXFLAGS"
323fi
324
325AC_MSG_CHECKING(whether gcc accepts -fno-exceptions)
326tmp_flags=${CXXFLAGS}
327CXXFLAGS="${CXXFLAGS} -fno-exceptions"
328AC_CACHE_VAL(ac_cv_cxx_have_exceptions,
329AC_TRY_LINK(,,ac_cv_cxx_have_exceptions=yes,ac_cv_cxx_have_exceptions=no)
330)
331AC_MSG_RESULT(${ac_cv_cxx_have_exceptions})
332CXXFLAGS=$tmp_flags
333if test "${ac_cv_cxx_have_exceptions}" = yes; then
334CXXFLAGS="$CXXFLAGS -fno-exceptions"
335fi
336AC_LANG_RESTORE
337
338fi
339
340# ARFLAGS
341test "${ARFLAGS+set}" = set || ARFLAGS=cr
342
343# M4FLAGS
344test "${M4FLAGS+set}" = set || M4FLAGS=
345
346AH_TEMPLATE([SINGULAR], [define if linked to Singular])
347AH_TEMPLATE([DISABLE_GMP_CPP],[DISABLE_GMP_CPP])
348AH_TEMPLATE([NOSTREAMIO],[DISABLE_GMP_CPP])
349
350# Singular
351if test "x$with_Singular" = xyes; then
352  AC_DEFINE([SINGULAR],[1]) 
353  AC_DEFINE([DISABLE_GMP_CPP],[1])
354  AC_DEFINE([NOSTREAMIO],[1])
355fi
356
357# arithmetic shift
358#if test "x$ac_cv_shift" = xyes; then   
359#  AC_DEFINE([HAS_ARITHMETIC_SHIFT],[1],[HAS_ARITHMETIC_SHIFT])
360#fi
361
362AH_TEMPLATE([HAVE_OMALLOC], [define if build with OMALLOC])
363
364if test "x$with_Singular" = xyes; then
365
366AC_MSG_CHECKING([whether to use omalloc/omalloc.h])
367if test "x$ENABLE_OMALLOC" = xyes; then
368  AC_MSG_RESULT(yes)
369 
370  if test "x$with_omalloc_dir" != "x"; then
371    OMALLOC_CFLAGS="-I${with_omalloc_dir}"
372  fi
373  if test "x$with_omalloc_extra_dir" != "x"; then
374    OMALLOC_CFLAGS="$OMALLOC_CFLAGS -I${with_omalloc_extra_dir}"
375    OMALLOC_LDFLAGS="$OMALLOC_LDFLAGS -L${with_omalloc_extra_dir}/omalloc -L${with_omalloc_extra_dir}/findexec"
376  fi
377 
378  CPPFLAGS_save="$CPPFLAGS"
379  # adding $with_omalloc_dir and $with_omalloc_extra_dir to header search path
380  CPPFLAGS="$CPPFLAGS ${OMALLOC_CFLAGS}"
381  if test "x$omalloc_trust" = xno; then
382    AC_CHECK_HEADERS([omalloc/omalloc.h],,AC_MSG_ERROR([You asked for omalloc but it cannot be found with your default header search path]))
383  else
384    AC_CHECK_HEADERS([omalloc/omalloc.h],,AC_MSG_WARN([trusting the omalloc locations given: ${OMALLOC_CFLAGS}]))
385  fi
386  CPPFLAGS="$CPPFLAGS_save"
387
388  OMALLOC_G_LDADD="-lfindexec_g -lomalloc_g"
389  OMALLOC_R_LDADD="-lfindexec -lomalloc"
390 
391  AC_DEFINE(HAVE_OMALLOC, 1, [omalloc support])
392 
393  AC_SUBST(OMALLOC_CFLAGS)
394  AC_SUBST(OMALLOC_LDFLAGS)
395
396  AC_SUBST(OMALLOC_G_LDADD)
397  AC_SUBST(OMALLOC_R_LDADD)
398else
399  AC_MSG_RESULT(no)
400fi
401
402fi
403
404AM_CONDITIONAL([ENABLE_OMALLOC],[test "x$ENABLE_OMALLOC" = xyes])
405
406
407AH_TEMPLATE([CF_USE_INLINE], [define to use "configurable inline methods" (see cf_inline.cc)])
408# "configurable inline methods"
409if test "x$enable_cf_inline" != xno; then
410  AC_DEFINE([CF_USE_INLINE],[1])
411fi
412
413AH_TEMPLATE([NOSTREAMIO], [define to build factory without stream IO])
414# iostream
415if test "x$enable_streamio" = xno; then
416  AC_DEFINE([NOSTREAMIO],[1])
417else
418  factorysrc="$factorysrc \$(useiofactorysrc)"
419  factoryincl="$factoryincl \$(useiofactoryincl)"
420fi
421
422AH_TEMPLATE([NOASSERT], [define if you do not want to activate assertions])
423# assertions
424if test "x$enable_assertions" = xno; then
425  AC_DEFINE([NOASSERT],[1])
426fi
427
428AH_TEMPLATE([TIMING], [define if you want to activate the timing stuff])
429# timing
430if test "x$enable_timing" != xno; then
431  AC_DEFINE([TIMING],[1])
432fi
433
434# debugoutput
435AH_TEMPLATE([DEBUGOUTPUT], [define if you want to have debugging output])
436if test "x$enable_debugoutput" != xno; then
437  AC_DEFINE([DEBUGOUTPUT],[1]) 
438fi
439
440#
441# - complete and substitute variables, defines.
442#
443AC_SUBST(gftabledir)
444AC_SUBST(templatedir)
445
446AC_SUBST(factory_version)
447
448AC_SUBST(libfactory)
449
450AC_SUBST(ARFLAGS)
451AC_SUBST(M4FLAGS)
452AC_SUBST(MAKEHEADERFLAGS)
453
454AC_SUBST(factorysrc)
455AC_SUBST(factoryincl)
456
457AC_SUBST(alltargets)
458AC_SUBST(installtargets)
459AC_SUBST(uninstalltargets)
460
461AH_TEMPLATE([FACTORYVERSION], [factory version])
462AC_DEFINE_UNQUOTED([FACTORYVERSION], "$factory_version")
463
464AH_TEMPLATE([HAVE_LIBFAC], [have libfac])
465AC_DEFINE_UNQUOTED([HAVE_LIBFAC], 1)
466
467AH_TEMPLATE([FACTORYCONFIGURATION], [factory configuration])
468AC_DEFINE_UNQUOTED([FACTORYCONFIGURATION], "$factory_configuration")
469
470AH_TEMPLATE([GFTABLEDIR], [where the gftables live])
471AC_DEFINE_UNQUOTED([GFTABLEDIR], "$explicit_gftabledir")
472
473AM_CONDITIONAL(
474    [WITH_PARSER_FOR_CANONICAL_FORM],
475    [test x$with_Singular != xyes && test x$enable_streamio != xno])
476
477AC_CONFIG_FILES([Makefile include/factory/Makefile libfac/Makefile]) #  ftest/GNUmakefile
478AC_OUTPUT
479
Note: See TracBrowser for help on using the repository browser.