source: git/factory/configure.ac @ ae4d9b

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