source: git/factory/configure.ac @ e62a1d

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