source: git/factory/configure.ac @ e078e0

jengelh-datetimespielwiese
Last change on this file since e078e0 was e078e0, checked in by Oleksandr Motsak <motsak@…>, 11 years ago
fixing the build system as suggested by autoreconf & fixing the fix add: AM_PROG_AR&-Wno-extra-portability&-Werror are commented out for now due to problems with incompatible autotools :( add: usefull autotools flags (subdir-objects silent-rules) chg: removed some minor warnings
  • Property mode set to 100644
File size: 13.4 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 subdir-objects silent-rules]) # -Wno-extra-portability -Werror
24
25# Add pre'prefixed config
26AX_PREFIX_CONFIG_H([config.h],[],[config.h])
27
28AC_PROG_YACC
29# AM_PROG_AR
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([--disable-assertions],[build Factory with no assertions])],
79  ,
80  enable_assertions=yes)
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
199LB_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)]))
200
201# arithmetic shift
202#AC_MSG_CHECKING(whether your compiler does arithmetic shifts)
203#AC_CACHE_VAL(ac_cv_shift,
204#  [ LDFLAGS="-L$explicit_libdir $LDFLAGS"
205#       AC_TRY_RUN(
206#      [ int main() { if (-2 >> 1 == -1) return(0); else return(1); } ],
207#      ac_cv_shift=yes, ac_cv_shift=no, ac_cv_shift=yes) ])
208#if test "x$ac_cv_shift" = xyes; then   
209#  AC_MSG_RESULT(yes)
210#else
211#  AC_MSG_RESULT(no)
212#fi
213
214#
215# - check for header files.
216#
217AC_LANG_CPLUSPLUS
218
219AC_CHECK_HEADERS(stdio.h stdlib.h string.h time.h math.h, ,
220  [ AC_MSG_ERROR(C header files not found) ])
221AC_CHECK_HEADERS(cstdio)
222
223if test "x$enable_streamio" != xno; then
224  AC_CHECK_HEADERS(iostream.h strstream.h fstream.h iostream string fstream)
225  AC_CHECK_HEADERS(ctype.h, , [ AC_MSG_ERROR(standard C header files not found) ])
226
227  # since the FTE will compile only with stream IO enabled we will not
228  # check for the necessary header files if stream IO is disabled
229  AC_CHECK_HEADERS(stdarg.h signal.h errno.h unistd.h, ,
230    [ AC_MSG_WARN(C/C++ header files not found.
231                    You will not be able to build the Factory Test Environment
232                    (though Factory itself should compile)) ])
233fi
234
235if test "x$enable_timing" != xno; then
236  AC_CHECK_HEADERS(sys/param.h sys/times.h, ,
237    [ AC_MSG_ERROR(\`sys/times.h' or \`sys/param.h' not found.  Try
238                  \`configure --disable-timing') ])
239fi
240
241# font-lock-trick: '
242
243#
244# - check for compiler characteristics.
245#
246
247# use C to check compiler characteristics instead of C++.  On
248# nextstep, checking with C++ may fail.
249AC_LANG_C
250
251# cross-compiling ?!
252#AC_C_CROSS
253#if test "x$cross_compiling" = xyes; then
254#  AC_MSG_WARN([you better specify a cache file to get the values for
255#                    cross-compiling right (e.g., call \`configure
256#                    --cache-file=yourTarget.cache').  In particular, you
257#                    should make sure that your target machine supports
258#                    arithmetic shift.])
259#fi
260
261# font-lock-trick: '
262
263#
264# - paths.
265#
266
267# note that Singular has its own mechanism to search the tables,
268# hence we do not need to mind it here
269gftabledir='${datadir}/factory/gftables'
270explicit_gftabledir="$explicit_datadir/gftables"
271
272# for installation of the templates
273templatedir='${includedir}/templates'
274
275#
276# - the name of the game and the targets to create.
277#
278if test "x$with_Singular" = xyes; then
279  libfactory=libfactory.a
280
281  factorysrc='$(basefactorysrc) $(singfactorysrc)'
282  factoryincl='$(basefactoryincl) $(singfactoryincl)'
283
284  alltargets=cf
285  installtargets=installcf
286  uninstalltargets=uninstallcf
287else
288  libfactory=libcf.a
289
290  factorysrc='$(basefactorysrc)'
291  factoryincl='$(basefactoryincl)'
292
293  alltargets=cf
294  installtargets=installcf
295  uninstalltargets=uninstallcf
296fi
297
298#
299# - set defines and variables according to our tests.
300#
301
302# CFLAGS
303if test "x$GCC" = xyes && test "x$cflags_expl_set" = xno; then
304  CFLAGS=""
305fi
306
307# CXXFLAGS
308if test "x$GXX" = xyes && test "x$cxxflags_expl_set" = xno; then
309  CXXFLAGS=""
310
311AC_LANG_SAVE
312AC_LANG_CPLUSPLUS
313# check whether CXX accepts -fno-rtti
314AC_MSG_CHECKING(whether gcc accepts -fno-rtti)
315tmp_flags=${CXXFLAGS}
316CXXFLAGS="${CXXFLAGS}"
317AC_CACHE_VAL(ac_cv_cxx_have_rtti,
318AC_TRY_COMPILE(,,ac_cv_cxx_have_rtti=yes,ac_cv_cxx_have_rtti=no)
319)
320AC_MSG_RESULT(${ac_cv_cxx_have_rtti})
321CXXFLAGS=$tmp_flags
322if test "${ac_cv_cxx_have_rtti}" = yes; then
323CXXFLAGS="$CXXFLAGS"
324fi
325
326AC_MSG_CHECKING(whether gcc accepts -fno-exceptions)
327tmp_flags=${CXXFLAGS}
328CXXFLAGS="${CXXFLAGS} -fno-exceptions"
329AC_CACHE_VAL(ac_cv_cxx_have_exceptions,
330AC_TRY_LINK(,,ac_cv_cxx_have_exceptions=yes,ac_cv_cxx_have_exceptions=no)
331)
332AC_MSG_RESULT(${ac_cv_cxx_have_exceptions})
333CXXFLAGS=$tmp_flags
334if test "${ac_cv_cxx_have_exceptions}" = yes; then
335CXXFLAGS="$CXXFLAGS -fno-exceptions"
336fi
337AC_LANG_RESTORE
338
339fi
340
341# ARFLAGS
342test "${ARFLAGS+set}" = set || ARFLAGS=cr
343
344# M4FLAGS
345test "${M4FLAGS+set}" = set || M4FLAGS=
346
347AH_TEMPLATE([SINGULAR], [define if linked to Singular])
348AH_TEMPLATE([DISABLE_GMP_CPP],[DISABLE_GMP_CPP])
349AH_TEMPLATE([NOSTREAMIO],[DISABLE_GMP_CPP])
350
351# Singular
352if test "x$with_Singular" = xyes; then
353  AC_DEFINE([SINGULAR],[1]) 
354  AC_DEFINE([DISABLE_GMP_CPP],[1])
355  AC_DEFINE([NOSTREAMIO],[1])
356fi
357
358# arithmetic shift
359#if test "x$ac_cv_shift" = xyes; then   
360#  AC_DEFINE([HAS_ARITHMETIC_SHIFT],[1],[HAS_ARITHMETIC_SHIFT])
361#fi
362
363AH_TEMPLATE([HAVE_OMALLOC], [define if build with OMALLOC])
364
365if test "x$with_Singular" = xyes; then
366
367AC_MSG_CHECKING([whether to use omalloc/omalloc.h])
368if test "x$ENABLE_OMALLOC" = xyes; then
369  AC_MSG_RESULT(yes)
370 
371  if test "x$with_omalloc_dir" != "x"; then
372    OMALLOC_CFLAGS="-I${with_omalloc_dir}"
373  fi
374  if test "x$with_omalloc_extra_dir" != "x"; then
375    OMALLOC_CFLAGS="$OMALLOC_CFLAGS -I${with_omalloc_extra_dir}"
376    OMALLOC_LDFLAGS="$OMALLOC_LDFLAGS -L${with_omalloc_extra_dir}/omalloc -L${with_omalloc_extra_dir}/findexec"
377  fi
378 
379  CPPFLAGS_save="$CPPFLAGS"
380  # adding $with_omalloc_dir and $with_omalloc_extra_dir to header search path
381  CPPFLAGS="$CPPFLAGS ${OMALLOC_CFLAGS}"
382  if test "x$omalloc_trust" = xno; then
383    AC_CHECK_HEADERS([omalloc/omalloc.h],,AC_MSG_ERROR([You asked for omalloc but it cannot be found with your default header search path]))
384  else
385    AC_CHECK_HEADERS([omalloc/omalloc.h],,AC_MSG_WARN([trusting the omalloc locations given: ${OMALLOC_CFLAGS}]))
386  fi
387  CPPFLAGS="$CPPFLAGS_save"
388
389  OMALLOC_G_LDADD="-lfindexec_g -lomalloc_g"
390  OMALLOC_R_LDADD="-lfindexec -lomalloc"
391 
392  AC_DEFINE(HAVE_OMALLOC, 1, [omalloc support])
393 
394  AC_SUBST(OMALLOC_CFLAGS)
395  AC_SUBST(OMALLOC_LDFLAGS)
396
397  AC_SUBST(OMALLOC_G_LDADD)
398  AC_SUBST(OMALLOC_R_LDADD)
399else
400  AC_MSG_RESULT(no)
401fi
402
403fi
404
405AM_CONDITIONAL([ENABLE_OMALLOC],[test "x$ENABLE_OMALLOC" = xyes])
406
407
408AH_TEMPLATE([CF_USE_INLINE], [define to use "configurable inline methods" (see cf_inline.cc)])
409# "configurable inline methods"
410if test "x$enable_cf_inline" != xno; then
411  AC_DEFINE([CF_USE_INLINE],[1])
412fi
413
414AH_TEMPLATE([NOSTREAMIO], [define to build factory without stream IO])
415# iostream
416if test "x$enable_streamio" = xno; then
417  AC_DEFINE([NOSTREAMIO],[1])
418else
419  factorysrc="$factorysrc \$(useiofactorysrc)"
420  factoryincl="$factoryincl \$(useiofactoryincl)"
421fi
422
423AH_TEMPLATE([NOASSERT], [define if you do not want to activate assertions])
424# assertions
425if test "x$enable_assertions" = xno; then
426  AC_DEFINE([NOASSERT],[1])
427fi
428
429AH_TEMPLATE([TIMING], [define if you want to activate the timing stuff])
430# timing
431if test "x$enable_timing" != xno; then
432  AC_DEFINE([TIMING],[1])
433fi
434
435# debugoutput
436AH_TEMPLATE([DEBUGOUTPUT], [define if you want to have debugging output])
437if test "x$enable_debugoutput" != xno; then
438  AC_DEFINE([DEBUGOUTPUT],[1]) 
439fi
440
441#
442# - complete and substitute variables, defines.
443#
444AC_SUBST(gftabledir)
445AC_SUBST(templatedir)
446
447AC_SUBST(factory_version)
448
449AC_SUBST(libfactory)
450
451AC_SUBST(ARFLAGS)
452AC_SUBST(M4FLAGS)
453AC_SUBST(MAKEHEADERFLAGS)
454
455AC_SUBST(factorysrc)
456AC_SUBST(factoryincl)
457
458AC_SUBST(alltargets)
459AC_SUBST(installtargets)
460AC_SUBST(uninstalltargets)
461
462AH_TEMPLATE([FACTORYVERSION], [factory version])
463AC_DEFINE_UNQUOTED([FACTORYVERSION], "$factory_version")
464
465AH_TEMPLATE([HAVE_LIBFAC], [have libfac])
466AC_DEFINE_UNQUOTED([HAVE_LIBFAC], 1)
467
468AH_TEMPLATE([FACTORYCONFIGURATION], [factory configuration])
469AC_DEFINE_UNQUOTED([FACTORYCONFIGURATION], "$factory_configuration")
470
471AH_TEMPLATE([GFTABLEDIR], [where the gftables live])
472AC_DEFINE_UNQUOTED([GFTABLEDIR], "$explicit_gftabledir")
473
474AM_CONDITIONAL(
475    [WITH_PARSER_FOR_CANONICAL_FORM],
476    [test x$with_Singular != xyes && test x$enable_streamio != xno])
477
478AC_CONFIG_FILES([Makefile include/factory/Makefile libfac/Makefile]) #  ftest/GNUmakefile
479AC_OUTPUT
480
Note: See TracBrowser for help on using the repository browser.