source: git/factory/configure.ac @ 82e0a7

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