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

spielwiese
Last change on this file since 82e0a7 was 82e0a7, checked in by Oleksandr Motsak <motsak@…>, 11 years ago
Enable static factory library!
  • Property mode set to 100644
File size: 12.9 KB
RevLine 
[429497]1
[8e8aca3]2dnl # emacs edit mode for this file is -*- sh -*-
[575680]3
[a013ed]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 #
[beca7c]11
12#
13# - initialisation.
14#
[635774]15AC_INIT([factory], [3.1.3])
[e76d7a6]16AC_CONFIG_SRCDIR(canonicalform.cc)
[9af8a63]17AC_CONFIG_MACRO_DIR([../m4])
[e76d7a6]18AC_CONFIG_AUX_DIR([.])
[f3ea6ce]19AC_CONFIG_HEADER(config.h)
[ab788d]20
[ea0001]21AM_MAINTAINER_MODE
[24a77fb]22AM_INIT_AUTOMAKE([-Wall foreign subdir-objects]) # -Wno-extra-portability -Werror silent-rules
[2e984a]23m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES])
[280286e]24m4_ifdef([AM_PROG_AR], [AM_PROG_AR])
[2e984a]25
[e08559]26# Add pre'prefixed config
[3af3ca]27AX_PREFIX_CONFIG_H([config.h],[],[config.h])
[e08559]28
[7d160bb]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
[82e0a7]44## AC_DISABLE_STATIC
[7d160bb]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
[beca7c]56#
57# - check withs and enables.
58#
[e4fe2b]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
[429497]65AC_ARG_ENABLE(omalloc, AS_HELP_STRING([--enable-omalloc],[build for use with omalloc]),
66[if test "x$enableval" = "xyes"; then
[461f40]67  ENABLE_OMALLOC=yes
68fi], ENABLE_OMALLOC=no)
[e4fe2b]69
[429497]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)
[575680]74
[429497]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="")
[575680]77
[1cdedcb]78AC_ARG_ENABLE(
79  cf-inline,
[e4fe2b]80  [AS_HELP_STRING([--enable-cf-inline],[build Factory with \"configurable inline methods\" enabled.])],
81  [enable_cf_inline=$enableval],
82  [enable_cf_inline=no])
[1cdedcb]83
[beca7c]84AC_ARG_ENABLE(
85  streamio,
[e4fe2b]86  [AS_HELP_STRING([--enable-streamio],[build Factory with stream IO])],
[575680]87  ,
[e4fe2b]88  [enable_streamio=no])
[beca7c]89
90AC_ARG_ENABLE(
91  assertions,
[ff3a4f]92  [AS_HELP_STRING([--disable-assertions],[build Factory with no assertions])],
[beca7c]93  ,
[ff3a4f]94  enable_assertions=yes)
[beca7c]95
96AC_ARG_ENABLE(
97  timing,
[e4fe2b]98  [AS_HELP_STRING([--enable-timing],[build Factory so it will print timing information])],
[575680]99  ,
[beca7c]100  enable_timing=no)
101
102AC_ARG_ENABLE(
103  debugoutput,
[e4fe2b]104  [AS_HELP_STRING([--enable-debugoutput],[build Factory so it will print debugging information])],
[575680]105  ,
[beca7c]106  enable_debugoutput=no)
107
[089d1f]108AH_TEMPLATE([INT64], [Defenition for INT64])
109# Always long long int???!
110AC_DEFINE([INT64], [long long int]) 
111
[a11768]112DX_INIT_DOXYGEN($PACKAGE_NAME, MYDOXYGENCONFIG)
[beca7c]113
[64f32c7]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.
[a38e457]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"
[726f4d]126
127#
128# - expand paths.
129#
130
[a38e457]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"
[726f4d]153
[413cbb]154# generate the explicit paths
[a38e457]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`
[726f4d]161
[413cbb]162# clean up
[a38e457]163#rm -f ./conftest.mk ./conftest.dir
[726f4d]164
[a38e457]165#AC_MSG_RESULT(done)
[beca7c]166
167#
168# - check for libraries.
169#
[20d724f]170AC_CHECK_LIB(m, atof, , [ AC_MSG_ERROR(libm.a not found) ])
171
[9af8a63]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)]))
[beca7c]175
[3ed6ccf]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)]))
[97a059]177
[b46fb9]178# arithmetic shift
[1bc850]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
[b46fb9]190
[beca7c]191#
192# - check for header files.
193#
194AC_LANG_CPLUSPLUS
195
[43b476]196AC_CHECK_HEADERS(stdio.h stdlib.h string.h time.h math.h, ,
[9d50d3]197  [ AC_MSG_ERROR(C header files not found) ])
[958fc4]198AC_CHECK_HEADERS(cstdio)
[beca7c]199
[575680]200if test "x$enable_streamio" != xno; then
[1dc616]201  AC_CHECK_HEADERS(iostream.h strstream.h fstream.h iostream string fstream)
[beca7c]202  AC_CHECK_HEADERS(ctype.h, , [ AC_MSG_ERROR(standard C header files not found) ])
[9d50d3]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
[dc11d0]206  AC_CHECK_HEADERS(stdarg.h signal.h errno.h unistd.h, ,
[9d50d3]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)) ])
[575680]210fi
[beca7c]211
212if test "x$enable_timing" != xno; then
213  AC_CHECK_HEADERS(sys/param.h sys/times.h, ,
[a013ed]214    [ AC_MSG_ERROR(\`sys/times.h' or \`sys/param.h' not found.  Try
215                  \`configure --disable-timing') ])
[beca7c]216fi
217
[a013ed]218# font-lock-trick: '
219
[beca7c]220#
221# - check for compiler characteristics.
222#
223
[654824]224# use C to check compiler characteristics instead of C++.  On
225# nextstep, checking with C++ may fail.
[a38e457]226# AC_LANG_C
[654824]227
[575680]228# cross-compiling ?!
[7f7d55f]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
[beca7c]237
[a013ed]238# font-lock-trick: '
239
[beca7c]240#
241# - paths.
242#
243
[726f4d]244# note that Singular has its own mechanism to search the tables,
245# hence we do not need to mind it here
[a38e457]246#gftabledir='${datadir}/factory/gftables'
247#explicit_gftabledir="$explicit_datadir/gftables"
[beca7c]248
[726f4d]249# for installation of the templates
[a38e457]250#templatedir='${includedir}/templates'
[beca7c]251
252#
253# - the name of the game and the targets to create.
254#
[a38e457]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
[beca7c]274
275#
[6e304e3]276# - set defines and variables according to our tests.
[beca7c]277#
278
[a38e457]279## CFLAGS
280#if test "x$GCC" = xyes && test "x$cflags_expl_set" = xno; then
281#  CFLAGS=""
282#fi
[beca7c]283
284# CXXFLAGS
[a38e457]285#if test "x$GXX" = xyes && test "x$cxxflags_expl_set" = xno; then
286#  CXXFLAGS=""
287#
288#AC_LANG_SAVE
289#AC_LANG_CPLUSPLUS
[8c0b57]290# check whether CXX accepts -fno-rtti
[a38e457]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
[beca7c]316
317# ARFLAGS
[a38e457]318#test "${ARFLAGS+set}" = set || ARFLAGS=cr
[beca7c]319
[9d50d3]320# M4FLAGS
[a38e457]321#test "${M4FLAGS+set}" = set || M4FLAGS=
[9d50d3]322
[089d1f]323AH_TEMPLATE([SINGULAR], [define if linked to Singular])
324AH_TEMPLATE([DISABLE_GMP_CPP],[DISABLE_GMP_CPP])
325AH_TEMPLATE([NOSTREAMIO],[DISABLE_GMP_CPP])
326
[beca7c]327# Singular
328if test "x$with_Singular" = xyes; then
[089d1f]329  AC_DEFINE([SINGULAR],[1]) 
330  AC_DEFINE([DISABLE_GMP_CPP],[1])
331  AC_DEFINE([NOSTREAMIO],[1])
[beca7c]332fi
333
334# arithmetic shift
[1bc850]335#if test "x$ac_cv_shift" = xyes; then   
[e76d7a6]336#  AC_DEFINE([HAS_ARITHMETIC_SHIFT],[1],[HAS_ARITHMETIC_SHIFT])
[1bc850]337#fi
[beca7c]338
[429497]339AH_TEMPLATE([HAVE_OMALLOC], [define if build with OMALLOC])
[72486f0]340
341if test "x$with_Singular" = xyes; then
342
[461f40]343AC_MSG_CHECKING([whether to use omalloc/omalloc.h])
344if test "x$ENABLE_OMALLOC" = xyes; then
[429497]345  AC_MSG_RESULT(yes)
[461f40]346 
[429497]347  if test "x$with_omalloc_dir" != "x"; then
348    OMALLOC_CFLAGS="-I${with_omalloc_dir}"
[f79b94c]349  fi
[429497]350  if test "x$with_omalloc_extra_dir" != "x"; then
351    OMALLOC_CFLAGS="$OMALLOC_CFLAGS -I${with_omalloc_extra_dir}"
[2c889f]352    OMALLOC_LDFLAGS="$OMALLOC_LDFLAGS -L${with_omalloc_extra_dir}/omalloc -L${with_omalloc_extra_dir}/resources"
[429497]353  fi
[461f40]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]))
[429497]360  else
[461f40]361    AC_CHECK_HEADERS([omalloc/omalloc.h],,AC_MSG_WARN([trusting the omalloc locations given: ${OMALLOC_CFLAGS}]))
[f79b94c]362  fi
[461f40]363  CPPFLAGS="$CPPFLAGS_save"
364
[a38e457]365#  OMALLOC_G_LDADD="-lresources_g -lomalloc_g"
[2c889f]366  OMALLOC_R_LDADD="-lresources -lomalloc"
[72486f0]367 
[461f40]368  AC_DEFINE(HAVE_OMALLOC, 1, [omalloc support])
369 
[429497]370  AC_SUBST(OMALLOC_CFLAGS)
[461f40]371  AC_SUBST(OMALLOC_LDFLAGS)
[72486f0]372
[a38e457]373#  AC_SUBST(OMALLOC_G_LDADD)
[72486f0]374  AC_SUBST(OMALLOC_R_LDADD)
[429497]375else
376  AC_MSG_RESULT(no)
[43b476]377fi
378
[72486f0]379fi
380
[461f40]381AM_CONDITIONAL([ENABLE_OMALLOC],[test "x$ENABLE_OMALLOC" = xyes])
382
[beca7c]383
[089d1f]384AH_TEMPLATE([CF_USE_INLINE], [define to use "configurable inline methods" (see cf_inline.cc)])
[1cdedcb]385# "configurable inline methods"
386if test "x$enable_cf_inline" != xno; then
[089d1f]387  AC_DEFINE([CF_USE_INLINE],[1])
[1cdedcb]388fi
389
[089d1f]390AH_TEMPLATE([NOSTREAMIO], [define to build factory without stream IO])
[beca7c]391# iostream
392if test "x$enable_streamio" = xno; then
[089d1f]393  AC_DEFINE([NOSTREAMIO],[1])
[a38e457]394#else
395#  factorysrc="$factorysrc \$(useiofactorysrc)"
396#  factoryincl="$factoryincl \$(useiofactoryincl)"
[beca7c]397fi
398
[089d1f]399AH_TEMPLATE([NOASSERT], [define if you do not want to activate assertions])
[beca7c]400# assertions
401if test "x$enable_assertions" = xno; then
[089d1f]402  AC_DEFINE([NOASSERT],[1])
[beca7c]403fi
404
[089d1f]405AH_TEMPLATE([TIMING], [define if you want to activate the timing stuff])
[beca7c]406# timing
407if test "x$enable_timing" != xno; then
[089d1f]408  AC_DEFINE([TIMING],[1])
[beca7c]409fi
410
411# debugoutput
[089d1f]412AH_TEMPLATE([DEBUGOUTPUT], [define if you want to have debugging output])
[beca7c]413if test "x$enable_debugoutput" != xno; then
[089d1f]414  AC_DEFINE([DEBUGOUTPUT],[1]) 
[beca7c]415fi
416
417#
418# - complete and substitute variables, defines.
419#
[a38e457]420#AC_SUBST(gftabledir)
421#AC_SUBST(templatedir)
422
[beca7c]423
424
[a38e457]425# AC_SUBST(libfactory)
426
427#AC_SUBST(ARFLAGS)
428#AC_SUBST(M4FLAGS)
[beca7c]429
430AC_SUBST(MAKEHEADERFLAGS)
431
[a38e457]432#AC_SUBST(factorysrc)
433#AC_SUBST(factoryincl)
434
435#AC_SUBST(alltargets)
436#AC_SUBST(installtargets)
437#AC_SUBST(uninstalltargets)
[beca7c]438
[a38e457]439factory_version="3.1.3"
440factory_configuration="'$ac_configure_args' in `pwd`"
441AC_SUBST(factory_version)
[beca7c]442
[d2f9df]443AH_TEMPLATE([FACTORYVERSION], [factory version])
[089d1f]444AC_DEFINE_UNQUOTED([FACTORYVERSION], "$factory_version")
445
[d92d71]446AH_TEMPLATE([HAVE_LIBFAC], [have libfac])
447AC_DEFINE_UNQUOTED([HAVE_LIBFAC], 1)
448
[d2f9df]449AH_TEMPLATE([FACTORYCONFIGURATION], [factory configuration])
[089d1f]450AC_DEFINE_UNQUOTED([FACTORYCONFIGURATION], "$factory_configuration")
451
[a38e457]452#AH_TEMPLATE([GFTABLEDIR], [where the gftables live])
453#AC_DEFINE_UNQUOTED([GFTABLEDIR], "$explicit_gftabledir")
454
455
[beca7c]456
[4eb485]457AM_CONDITIONAL(
458    [WITH_PARSER_FOR_CANONICAL_FORM],
459    [test x$with_Singular != xyes && test x$enable_streamio != xno])
460
[ee668e]461AC_CONFIG_FILES([Makefile include/factory/Makefile libfac/Makefile]) #  ftest/GNUmakefile
[c2eb2e]462AC_OUTPUT
[4eb485]463
Note: See TracBrowser for help on using the repository browser.