source: git/factory/configure.ac @ c74d6a

spielwiese
Last change on this file since c74d6a was e76d7a6, checked in by Mohamed Barakat <mohamed.barakat@…>, 13 years ago
just to get this out of the way, i need to catch my train
  • Property mode set to 100644
File size: 12.2 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_HEADER(config.h)
19AC_CONFIG_AUX_DIR([.])
20AM_INIT_AUTOMAKE
21
22AC_PROG_YACC
23
24#
25# Do not change version here!!!
26#
27dnl #
28dnl # Change version here, do not believe the comment in the
29dnl # preceding lines.
30dnl #
31factory_version="3.1.3"
32factory_configuration="'$ac_configure_args' in `pwd`"
33
34#
35# - check withs and enables.
36#
37AC_ARG_WITH(
38  memman,
39  [  --with-memman(=<memman>) specify Factory memory manager.
40                          <memman> is either \`old' (default), \`new', or \`no'.],
41  ,
42  [ if test "x$with_Singular" = xyes; then
43      with_memman=no
44    else
45      with_memman=old
46    fi ])
47
48# font-lock-trick: '
49
50AC_ARG_WITH(
51  omalloc,
52  [  --with-omalloc           build for use with omalloc])
53
54AC_ARG_WITH(
55  Singular,
56  [  --with-Singular         build for use with computer algebra system Singular.],
57  ,
58  with_Singular=no)
59
60AC_ARG_ENABLE(
61  cf-inline,
62  [  --enable-cf-inline      build Factory with \"configurable inline methods\"
63                          enabled.],
64  ,
65  enable_cf_inline=no)
66
67AC_ARG_ENABLE(
68  streamio,
69  [  --disable-streamio      build Factory without stream IO],
70  ,
71  [ if test "x$with_Singular" = xyes; then
72      enable_streamio=no
73    else
74      enable_streamio=yes
75    fi ])
76
77AC_ARG_ENABLE(
78  memdebug,
79  [  --enable-memdebug=<level> switch on memory management debugging.  Meaningful
80                          with \`--with-memman=new' only.  <level> may be either
81                          \`no' (default), \`normal', or \`full'.],
82  ,
83  enable_memdebug=no)
84
85AC_ARG_ENABLE(
86  assertions,
87  [  --enable-assertions     build Factory with assertions activated],
88  ,
89  enable_assertions=no)
90
91AC_ARG_ENABLE(
92  timing,
93  [  --enable-timing         build Factory so it will print timing information],
94  ,
95  enable_timing=no)
96
97AC_ARG_ENABLE(
98  debugoutput,
99  [  --enable-debugoutput    build Factory so it will print debugging information],
100  ,
101  enable_debugoutput=no)
102
103#
104# - check for CC and CXX but be careful about CFLAGS.
105#
106test "${CFLAGS+set}" = set || cflags_expl_set=no
107AC_PROG_CC
108test "${CXXFLAGS+set}" = set || cxxflags_expl_set=no
109AC_PROG_CXX
110if test "x$GCC" != xyes && test "x$GXX" != xyes; then
111  AC_MSG_WARN(you better use gcc to compile Factory)
112else
113  if test "x$GXX" = xyes && test "x$cxxflags_expl_set" = xno; then
114    AC_MSG_WARN([we use \`-O2 -fomit-frame-pointer' as default for \`CXXFLAGS'
115                    (instead of the configure default \`-g -O')])
116  fi
117  if test "x$GCC" = xyes && test "x$cflags_expl_set" = xno; then
118    AC_MSG_WARN([we use \`-O2 -fomit-frame-pointer' as default for \`CFLAGS'
119                    (instead of the configure default \`-g -O')])
120  fi
121fi
122
123#
124# - check for some other programs.
125#
126AC_PROG_CPP
127AC_PROG_CXXCPP
128AC_PROG_LN_S
129AC_PROG_INSTALL
130AC_PROG_RANLIB
131AC_PROG_MAKE_SET
132AC_CHECK_PROG(AR, ar, ar, where-is-your-ar)
133AC_CHECK_PROG(M4, m4, m4, where-is-your-m4)
134AC_CHECK_PROG(BISON, bison, bison, where-is-your-bison)
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
199# arithmetic shift
200#AC_MSG_CHECKING(whether your compiler does arithmetic shifts)
201#AC_CACHE_VAL(ac_cv_shift,
202#  [ LDFLAGS="-L$explicit_libdir $LDFLAGS"
203#       AC_TRY_RUN(
204#      [ int main() { if (-2 >> 1 == -1) return(0); else return(1); } ],
205#      ac_cv_shift=yes, ac_cv_shift=no, ac_cv_shift=yes) ])
206#if test "x$ac_cv_shift" = xyes; then   
207#  AC_MSG_RESULT(yes)
208#else
209#  AC_MSG_RESULT(no)
210#fi
211
212#
213# - check for header files.
214#
215AC_LANG_CPLUSPLUS
216
217AC_CHECK_HEADERS(stdio.h stdlib.h string.h time.h math.h, ,
218  [ AC_MSG_ERROR(C header files not found) ])
219AC_CHECK_HEADERS(cstdio)
220
221if test "x$enable_streamio" != xno; then
222  AC_CHECK_HEADERS(iostream.h strstream.h fstream.h iostream string fstream)
223  AC_CHECK_HEADERS(ctype.h, , [ AC_MSG_ERROR(standard C header files not found) ])
224
225  # since the FTE will compile only with stream IO enabled we will not
226  # check for the necessary header files if stream IO is disabled
227  AC_CHECK_HEADERS(stdarg.h signal.h errno.h unistd.h, ,
228    [ AC_MSG_WARN(C/C++ header files not found.
229                    You will not be able to build the Factory Test Environment
230                    (though Factory itself should compile)) ])
231fi
232
233if test "x$enable_timing" != xno; then
234  AC_CHECK_HEADERS(sys/param.h sys/times.h, ,
235    [ AC_MSG_ERROR(\`sys/times.h' or \`sys/param.h' not found.  Try
236                  \`configure --disable-timing') ])
237fi
238
239AC_CHECK_HEADERS(omalloc.h,,)
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/factory/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  memmansrc=
284  memmanincl=
285
286  alltargets=cf
287  installtargets=installcf
288  uninstalltargets=uninstallcf
289else
290  libfactory=libcf.a
291
292  factorysrc='$(basefactorysrc)'
293  factoryincl='$(basefactoryincl)'
294  memmansrc='$(basememmansrc)'
295  memmanincl=
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="-O2 -fomit-frame-pointer"
309fi
310
311# CXXFLAGS
312if test "x$GXX" = xyes && test "x$cxxflags_expl_set" = xno; then
313  CXXFLAGS="-O2 -fomit-frame-pointer"
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} -fno-rtti"
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 -fno-rtti"
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
351# Singular
352if test "x$with_Singular" = xyes; then
353  AC_DEFINE([SINGULAR],[1],[SINGULAR])
354fi
355
356# arithmetic shift
357#if test "x$ac_cv_shift" = xyes; then   
358#  AC_DEFINE([HAS_ARITHMETIC_SHIFT],[1],[HAS_ARITHMETIC_SHIFT])
359#fi
360
361AC_MSG_CHECKING(whether to use omalloc)
362
363if test "$with_omalloc" = yes; then
364  if test "$ac_cv_header_omalloc_h" != yes; then
365    if test "$enable_omalloc" = yes; then
366       warn_omalloc=yes
367    else
368       with_omalloc=no
369    fi
370  fi
371else
372  if test "$with_omalloc" != no; then
373    if test "$enable_omalloc" = yes; then
374      if test "$ac_cv_header_omalloc_h" != yes; then
375        warn_omalloc=yes
376      fi
377      with_omalloc=yes
378    else
379      with_omalloc=no
380    fi
381  fi
382fi
383if test "$with_omalloc" = yes; then
384  AC_DEFINE([HAVE_OMALLOC],[1],[HAVE_OMALLOC])
385  with_memman=no
386fi
387AC_MSG_RESULT($with_omalloc)
388if test "$warn_omalloc" = yes; then
389  AC_MSG_WARN(did not find omalloc.h -- install before compiling)
390fi
391
392   
393# memory manager
394if test "x$with_memman" = xyes; then
395  alltargets="$alltargets mem"
396  installtargets="$installtargets installmem"
397  uninstalltargets="$uninstalltargets uninstallmem"
398  AC_DEFINE([USE_MEMUTIL],[1],[USE_MEMUTIL])
399
400  if test "x$with_memman" != xnew; then
401    memmansrc="$memmansrc \$(oldmemmansrc)"
402    memmanincl='$(oldmemmanincl)'
403    AC_DEFINE([USE_OLD_MEMMAN],[1],[USE_OLD_MEMMAN])
404  else
405    memmansrc="$memmansrc \$(newmemmansrc)"
406    memmanincl='$(newmemmanincl)'
407
408    if test "x$enable_memdebug" = xfull; then
409      AC_DEFINE([MDEBUG], [1], [MDEBUG])
410    elif test "x$enable_memdebug" != xno; then
411      AC_DEFINE([MDEBUG], [0], [MDEBUG])
412    fi
413  fi
414fi
415
416# "configurable inline methods"
417if test "x$enable_cf_inline" != xno; then
418  AC_DEFINE([CF_USE_INLINE],[1],[CF_USE_INLINE])
419fi
420
421# iostream
422if test "x$enable_streamio" = xno; then
423  AC_DEFINE([NOSTREAMIO],[1],[NOSTREAMIO])
424else
425  factorysrc="$factorysrc \$(useiofactorysrc)"
426  factoryincl="$factoryincl \$(useiofactoryincl)"
427fi
428
429# assertions
430if test "x$enable_assertions" = xno; then
431  AC_DEFINE([NOASSERT],[1],[NOASSERT])
432fi
433
434# timing
435if test "x$enable_timing" != xno; then
436  AC_DEFINE([TIMING],[1],[TIMING])
437fi
438
439# debugoutput
440if test "x$enable_debugoutput" != xno; then
441  AC_DEFINE([DEBUGOUTPUT],[1],[DEBUGOUTPUT])
442fi
443
444#
445# - complete and substitute variables, defines.
446#
447AC_SUBST(gftabledir)
448AC_SUBST(templatedir)
449
450AC_SUBST(factory_version)
451
452AC_SUBST(libfactory)
453
454AC_SUBST(ARFLAGS)
455AC_SUBST(M4FLAGS)
456AC_SUBST(MAKEHEADERFLAGS)
457
458AC_SUBST(factorysrc)
459AC_SUBST(factoryincl)
460AC_SUBST(memmansrc)
461AC_SUBST(memmanincl)
462
463AC_SUBST(alltargets)
464AC_SUBST(installtargets)
465AC_SUBST(uninstalltargets)
466
467AC_DEFINE_UNQUOTED([FACTORYVERSION], "$factory_version", [FACTORYVERSION])
468AC_DEFINE_UNQUOTED([FACTORYCONFIGURATION], "$factory_configuration", [FACTORYCONFIGURATION])
469AC_DEFINE_UNQUOTED([GFTABLEDIR], "$explicit_gftabledir", [GFTABLEDIR])
470
471AC_OUTPUT(Makefile ftest/GNUmakefile)
Note: See TracBrowser for help on using the repository browser.