source: git/factory/configure.ac @ c2eb2e

spielwiese
Last change on this file since c2eb2e was c2eb2e, checked in by Volker Braun <vbraun.name@…>, 12 years ago
make install and make distcheck work now
  • Property mode set to 100644
File size: 10.9 KB
Line 
1dnl # emacs edit mode for this file is -*- sh -*-
2dnl # $Id$
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.2.sw])
16AC_CONFIG_SRCDIR(canonicalform.cc)
17AC_CONFIG_MACRO_DIR([../m4])
18AC_CONFIG_AUX_DIR([.])
19AC_CONFIG_HEADER(config.h)
20AM_MAINTAINER_MODE
21AM_INIT_AUTOMAKE
22
23AC_PROG_YACC
24
25#
26# Do not change version here!!!
27#
28dnl #
29dnl # Change version here, do not believe the comment in the
30dnl # preceding lines.
31dnl #
32factory_version="3.1.3"
33factory_configuration="'$ac_configure_args' in `pwd`"
34
35#
36# - check withs and enables.
37#
38AC_ARG_WITH(
39  Singular,
40  [AS_HELP_STRING([--without-Singular],[build NOT for the use with CAS Singular.])],
41  ,
42  [with_Singular=yes])
43
44
45AC_ARG_WITH(
46  omalloc,
47  [AS_HELP_STRING([--with-omalloc],[build for use with omalloc])])
48
49
50AC_ARG_ENABLE(
51  cf-inline,
52  [AS_HELP_STRING([--enable-cf-inline],[build Factory with \"configurable inline methods\" enabled.])],
53  [enable_cf_inline=$enableval],
54  [enable_cf_inline=no])
55
56AC_ARG_ENABLE(
57  streamio,
58  [AS_HELP_STRING([--enable-streamio],[build Factory with stream IO])],
59  ,
60  [enable_streamio=no])
61
62AC_ARG_ENABLE(
63  assertions,
64  [AS_HELP_STRING([--enable-assertions],[build Factory with assertions activated])],
65  ,
66  enable_assertions=no)
67
68AC_ARG_ENABLE(
69  timing,
70  [AS_HELP_STRING([--enable-timing],[build Factory so it will print timing information])],
71  ,
72  enable_timing=no)
73
74AC_ARG_ENABLE(
75  debugoutput,
76  [AS_HELP_STRING([--enable-debugoutput],[build Factory so it will print debugging information])],
77  ,
78  enable_debugoutput=no)
79
80#
81# - check for CC and CXX but be careful about CFLAGS.
82#
83test "${CFLAGS+set}" = set || cflags_expl_set=no
84AC_PROG_CC
85test "${CXXFLAGS+set}" = set || cxxflags_expl_set=no
86AC_PROG_CXX
87if test "x$GCC" != xyes && test "x$GXX" != xyes; then
88  AC_MSG_WARN(you better use gcc to compile Factory)
89else
90  if test "x$GXX" = xyes && test "x$cxxflags_expl_set" = xno; then
91    AC_MSG_WARN([we use \`' as default for \`CXXFLAGS'
92                    (instead of the configure default \`-g -O')])
93  fi
94  if test "x$GCC" = xyes && test "x$cflags_expl_set" = xno; then
95    AC_MSG_WARN([we use \`' as default for \`CFLAGS'
96                    (instead of the configure default \`-g -O')])
97  fi
98fi
99
100#
101# - check for some other programs.
102#
103AC_PROG_CPP
104AC_PROG_CXXCPP
105AC_PROG_LN_S
106AC_PROG_INSTALL
107AC_PROG_RANLIB
108AC_PROG_MAKE_SET
109AC_CHECK_PROG(AR, ar, ar, where-is-your-ar)
110AC_CHECK_PROG(M4, m4, m4, where-is-your-m4)
111AC_CHECK_PROG(BISON, bison, bison, where-is-your-bison)
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.
118unset ac_cv_path_FACTORY_MKINSTALLDIRS
119unset ac_cv_path_FACTORY_MAKEHEADER
120save_path="$PATH"
121PATH="$PATH:$srcdir/bin"
122AC_PATH_PROG(FACTORY_MKINSTALLDIRS, mkinstalldirs, -mkdir)
123PATH="$srcdir/bin:$save_path"
124AC_PATH_PROG(FACTORY_MAKEHEADER, makeheader)
125PATH="$save_path"
126
127#
128# - expand paths.
129#
130
131AC_MSG_CHECKING(and generating explicit install paths)
132
133# generate Makefile
134save_prefix="$prefix"
135save_exec_prefix="$exec_prefix"
136test "x$prefix" = xNONE && prefix=$ac_default_prefix
137test "x$exec_prefix" = xNONE && exec_prefix='${prefix}'
138for 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
144explicit_$dir:
145        @ echo \$($dir)
146        @ if echo \$($dir) | grep '^/'; \\
147        then echo \$($dir) > ./conftest.dir; \\
148        else echo \`pwd\`/\$($dir) > ./conftest.dir; fi
149EXPLPATHEOT
150done
151prefix="$save_prefix"
152exec_prefix="$save_exec_prefix"
153
154# generate the explicit paths
155make >&5 2>&1 -f ./conftest.mk explicit_datadir
156explicit_datadir=`cat ./conftest.dir`
157make >&5 2>&1 -f ./conftest.mk explicit_libdir
158explicit_libdir=`cat ./conftest.dir`
159make >&5 2>&1 -f ./conftest.mk explicit_includedir
160explicit_includedir=`cat ./conftest.dir`
161
162# clean up
163rm -f ./conftest.mk ./conftest.dir
164
165AC_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
176# arithmetic shift
177#AC_MSG_CHECKING(whether your compiler does arithmetic shifts)
178#AC_CACHE_VAL(ac_cv_shift,
179#  [ LDFLAGS="-L$explicit_libdir $LDFLAGS"
180#       AC_TRY_RUN(
181#      [ int main() { if (-2 >> 1 == -1) return(0); else return(1); } ],
182#      ac_cv_shift=yes, ac_cv_shift=no, ac_cv_shift=yes) ])
183#if test "x$ac_cv_shift" = xyes; then   
184#  AC_MSG_RESULT(yes)
185#else
186#  AC_MSG_RESULT(no)
187#fi
188
189#
190# - check for header files.
191#
192AC_LANG_CPLUSPLUS
193
194AC_CHECK_HEADERS(stdio.h stdlib.h string.h time.h math.h, ,
195  [ AC_MSG_ERROR(C header files not found) ])
196AC_CHECK_HEADERS(cstdio)
197
198if test "x$enable_streamio" != xno; then
199  AC_CHECK_HEADERS(iostream.h strstream.h fstream.h iostream string fstream)
200  AC_CHECK_HEADERS(ctype.h, , [ AC_MSG_ERROR(standard C header files not found) ])
201
202  # since the FTE will compile only with stream IO enabled we will not
203  # check for the necessary header files if stream IO is disabled
204  AC_CHECK_HEADERS(stdarg.h signal.h errno.h unistd.h, ,
205    [ AC_MSG_WARN(C/C++ header files not found.
206                    You will not be able to build the Factory Test Environment
207                    (though Factory itself should compile)) ])
208fi
209
210if test "x$enable_timing" != xno; then
211  AC_CHECK_HEADERS(sys/param.h sys/times.h, ,
212    [ AC_MSG_ERROR(\`sys/times.h' or \`sys/param.h' not found.  Try
213                  \`configure --disable-timing') ])
214fi
215
216AC_CHECK_HEADERS(omalloc.h,,)
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.
226AC_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
246gftabledir='${datadir}/factory/gftables'
247explicit_gftabledir="$explicit_datadir/gftables"
248
249# for installation of the templates
250templatedir='${includedir}/templates'
251
252#
253# - the name of the game and the targets to create.
254#
255if 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
264else
265  libfactory=libcf.a
266
267  factorysrc='$(basefactorysrc)'
268  factoryincl='$(basefactoryincl)'
269
270  alltargets=cf
271  installtargets=installcf
272  uninstalltargets=uninstallcf
273fi
274
275#
276# - set defines and variables according to our tests.
277#
278
279# CFLAGS
280if test "x$GCC" = xyes && test "x$cflags_expl_set" = xno; then
281  CFLAGS=""
282fi
283
284# CXXFLAGS
285if test "x$GXX" = xyes && test "x$cxxflags_expl_set" = xno; then
286  CXXFLAGS=""
287
288AC_LANG_SAVE
289AC_LANG_CPLUSPLUS
290# check whether CXX accepts -fno-rtti
291AC_MSG_CHECKING(whether gcc accepts -fno-rtti)
292tmp_flags=${CXXFLAGS}
293CXXFLAGS="${CXXFLAGS}"
294AC_CACHE_VAL(ac_cv_cxx_have_rtti,
295AC_TRY_COMPILE(,,ac_cv_cxx_have_rtti=yes,ac_cv_cxx_have_rtti=no)
296)
297AC_MSG_RESULT(${ac_cv_cxx_have_rtti})
298CXXFLAGS=$tmp_flags
299if test "${ac_cv_cxx_have_rtti}" = yes; then
300CXXFLAGS="$CXXFLAGS"
301fi
302
303AC_MSG_CHECKING(whether gcc accepts -fno-exceptions)
304tmp_flags=${CXXFLAGS}
305CXXFLAGS="${CXXFLAGS} -fno-exceptions"
306AC_CACHE_VAL(ac_cv_cxx_have_exceptions,
307AC_TRY_LINK(,,ac_cv_cxx_have_exceptions=yes,ac_cv_cxx_have_exceptions=no)
308)
309AC_MSG_RESULT(${ac_cv_cxx_have_exceptions})
310CXXFLAGS=$tmp_flags
311if test "${ac_cv_cxx_have_exceptions}" = yes; then
312CXXFLAGS="$CXXFLAGS -fno-exceptions"
313fi
314AC_LANG_RESTORE
315
316fi
317
318# ARFLAGS
319test "${ARFLAGS+set}" = set || ARFLAGS=cr
320
321# M4FLAGS
322test "${M4FLAGS+set}" = set || M4FLAGS=
323
324# Singular
325if test "x$with_Singular" = xyes; then
326  AC_DEFINE([SINGULAR],[1],[SINGULAR])
327  AC_DEFINE([DISABLE_GMP_CPP],[1],[DISABLE_GMP_CPP])
328  AC_DEFINE([NOSTREAMIO],[1],[DISABLE_GMP_CPP])
329fi
330
331# arithmetic shift
332#if test "x$ac_cv_shift" = xyes; then   
333#  AC_DEFINE([HAS_ARITHMETIC_SHIFT],[1],[HAS_ARITHMETIC_SHIFT])
334#fi
335
336AC_MSG_CHECKING(whether to use omalloc)
337
338if test "$with_omalloc" = yes; then
339  if test "$ac_cv_header_omalloc_h" != yes; then
340    if test "$enable_omalloc" = yes; then
341       warn_omalloc=yes
342    else
343       with_omalloc=no
344    fi
345  fi
346else
347  if test "$with_omalloc" != no; then
348    if test "$enable_omalloc" = yes; then
349      if test "$ac_cv_header_omalloc_h" != yes; then
350        warn_omalloc=yes
351      fi
352      with_omalloc=yes
353    else
354      with_omalloc=no
355    fi
356  fi
357fi
358if test "$with_omalloc" = yes; then
359  AC_DEFINE([HAVE_OMALLOC],[1],[HAVE_OMALLOC])
360fi
361AC_MSG_RESULT($with_omalloc)
362if test "$warn_omalloc" = yes; then
363  AC_MSG_WARN(did not find omalloc.h -- install before compiling)
364fi
365
366
367# "configurable inline methods"
368if test "x$enable_cf_inline" != xno; then
369  AC_DEFINE([CF_USE_INLINE],[1],[CF_USE_INLINE])
370fi
371
372# iostream
373if test "x$enable_streamio" = xno; then
374  AC_DEFINE([NOSTREAMIO],[1],[NOSTREAMIO])
375else
376  factorysrc="$factorysrc \$(useiofactorysrc)"
377  factoryincl="$factoryincl \$(useiofactoryincl)"
378fi
379
380# assertions
381if test "x$enable_assertions" = xno; then
382  AC_DEFINE([NOASSERT],[1],[NOASSERT])
383fi
384
385# timing
386if test "x$enable_timing" != xno; then
387  AC_DEFINE([TIMING],[1],[TIMING])
388fi
389
390# debugoutput
391if test "x$enable_debugoutput" != xno; then
392  AC_DEFINE([DEBUGOUTPUT],[1],[DEBUGOUTPUT])
393fi
394
395#
396# - complete and substitute variables, defines.
397#
398AC_SUBST(gftabledir)
399AC_SUBST(templatedir)
400
401AC_SUBST(factory_version)
402
403AC_SUBST(libfactory)
404
405AC_SUBST(ARFLAGS)
406AC_SUBST(M4FLAGS)
407AC_SUBST(MAKEHEADERFLAGS)
408
409AC_SUBST(factorysrc)
410AC_SUBST(factoryincl)
411
412AC_SUBST(alltargets)
413AC_SUBST(installtargets)
414AC_SUBST(uninstalltargets)
415
416AC_DEFINE_UNQUOTED([FACTORYVERSION], "$factory_version", [FACTORYVERSION])
417AC_DEFINE_UNQUOTED([FACTORYCONFIGURATION], "$factory_configuration", [FACTORYCONFIGURATION])
418AC_DEFINE_UNQUOTED([GFTABLEDIR], "$explicit_gftabledir", [GFTABLEDIR])
419
420AM_CONDITIONAL(
421    [WITH_PARSER_FOR_CANONICAL_FORM],
422    [test x$with_Singular != xyes && test x$enable_streamio != xno])
423
424AC_CONFIG_FILES([Makefile ftest/GNUmakefile])
425AC_OUTPUT
426
Note: See TracBrowser for help on using the repository browser.