source: git/factory/configure.ac @ 8267b8

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