source: git/factory/configure.in @ 104fd23

spielwiese
Last change on this file since 104fd23 was 104fd23, checked in by Olaf Bachmann <obachman@…>, 23 years ago
* check for --no-rtti and --no-exception options to gcc git-svn-id: file:///usr/local/Singular/svn/trunk@4872 2c84dea3-7e68-4137-9b89-c4e89433aadc
  • Property mode set to 100644
File size: 13.3 KB
Line 
1dnl # emacs edit mode for this file is -*- sh -*-
2dnl # $Id: configure.in,v 1.28 2000-12-12 12:35:13 obachman Exp $
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_REVISION($Id: configure.in,v 1.28 2000-12-12 12:35:13 obachman Exp $)
16AC_INIT(canonicalform.cc)
17AC_CONFIG_HEADER(config.h)
18AC_CONFIG_AUX_DIR(bin)
19
20#
21# Do not change version here!!!
22#
23dnl #
24dnl # Change version here, do not believe the comment in the
25dnl # preceding lines.
26dnl #
27factory_version="1.3b"
28factory_configuration="'$ac_configure_args' in `pwd`"
29
30#
31# - check withs and enables.
32#
33AC_ARG_WITH(
34  memman,
35  [  --with-memman(=<memman>) specify Factory memory manager.
36                          <memman> is either \`old' (default), \`new', or \`no'.],
37  ,
38  [ if test "x$with_Singular" = xyes; then
39      with_memman=no
40    else
41      with_memman=old
42    fi ])
43
44# font-lock-trick: '
45
46AC_ARG_WITH(
47  omalloc,
48  [  --with-omalloc           build for use with omalloc])
49AC_ARG_WITH(
50  gmp,
51  [  --with-gmp(=<gmp_inc_path>(,<gmp_lib_path>))
52                          specify where to find gmp library.])
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# a tribute to Singular
104AC_ARG_ENABLE(
105  gmp,
106  [  --enable-gmp            together with \`--with-Singular' means: installation
107                          in process, be graceful when there is no \`gmp.h'],
108  [ if test "x$with_Singular" = xyes && test "x$enable_gmp" != xno; then
109      with_gmp='$(includedir)'
110    fi ])
111
112#
113# - check the results of --with-gmp.
114#
115case "$with_gmp" in
116  yes|no|"")
117    gmp_in_installation=no ;;
118  '$(includedir)'|'${includedir}')
119    gmp_in_installation=yes ;;
120  *,*)
121    saveIFS="$IFS"; IFS="${IFS},"
122    set dummy $with_gmp
123    IFS="$saveIFS"
124    CPPFLAGS="-I$2 $CPPFLAGS"
125    LDFLAGS="-L$3 $LDFLAGS"
126    gmp_in_installation=no ;;
127  *)
128    CPPFLAGS="-I$with_gmp $CPPFLAGS" 
129    LDFLAGS="-L$with_gmp/../lib $LDFLAGS"
130    gmp_in_installation=no ;;
131esac
132
133#
134# - check for CC and CXX but be careful about CFLAGS.
135#
136test "${CFLAGS+set}" = set || cflags_expl_set=no
137AC_PROG_CC
138test "${CXXFLAGS+set}" = set || cxxflags_expl_set=no
139AC_PROG_CXX
140if test "x$GCC" != xyes && test "x$GXX" != xyes; then
141  AC_MSG_WARN(you better use gcc to compile Factory)
142else
143  if test "x$GXX" = xyes && test "x$cxxflags_expl_set" = xno; then
144    AC_MSG_WARN([we use \`-O2 -fomit-frame-pointer' as default for \`CXXFLAGS'
145                    (instead of the configure default \`-g -O')])
146  fi
147  if test "x$GCC" = xyes && test "x$cflags_expl_set" = xno; then
148    AC_MSG_WARN([we use \`-O2 -fomit-frame-pointer' as default for \`CFLAGS'
149                    (instead of the configure default \`-g -O')])
150  fi
151
152# check whether CXX accepts --no-rtti
153AC_MSG_CHECKING(whether gcc accepts --no-rtti)
154CXXFLAGS="${CXXFLAGS} --no-rtti"
155AC_CACHE_VAL(ac_cv_cxx_have_rtti,
156AC_TRY_COMPILE(,,ac_cv_cxx_have_rtti=yes,ac_cv_cxx_have_rtti=no)
157)
158AC_MSG_RESULT(${ac_cv_cxx_have_rtti})
159if test "${ac_cv_cxx_have_rtti}" != yes; then
160CXXFLAGS=$temp_flags
161else
162CXX="${CXX} --no-rtti"
163fi
164
165# check whether gcc accepts --no-exceptions
166AC_MSG_CHECKING(whether gcc accepts --no-exceptions)
167CXXFLAGS="${CXXFLAGS} --no-exceptions"
168AC_CACHE_VAL(ac_cv_cxx_have_exceptions,
169AC_TRY_COMPILE(,,ac_cv_cxx_have_exceptions=yes,ac_cv_cxx_have_exceptions=no)
170)
171AC_MSG_RESULT(${ac_cv_cxx_have_exceptions})
172if test "${ac_cv_cxx_have_exceptions}" != yes; then
173CXXFLAGS=$temp_flags
174else
175CXX="${CXX} --no-exceptions"
176fi
177
178CXXFLAGS=$temp_flags
179 
180fi
181
182#
183# - check for some other programs.
184#
185AC_PROG_CPP
186AC_PROG_CXXCPP
187AC_PROG_LN_S
188AC_PROG_INSTALL
189AC_PROG_RANLIB
190AC_PROG_MAKE_SET
191AC_CHECK_PROG(AR, ar, ar, where-is-your-ar)
192AC_CHECK_PROG(M4, m4, m4, where-is-your-m4)
193AC_CHECK_PROG(BISON, bison, bison, where-is-your-bison)
194
195# do not use `MKINSTALLDIRS' and `MAKEHEADER' since there may be
196# name clashes with other peoples configure scripts via
197# `config.cache'.  Furthermore, we do not use cache at all to
198# avoid some nasty problems with our own development environment.
199unset ac_cv_path_FACTORY_MKINSTALLDIRS
200unset ac_cv_path_FACTORY_MAKEHEADER
201save_path="$PATH"
202PATH="$PATH:$srcdir/bin"
203AC_PATH_PROG(FACTORY_MKINSTALLDIRS, mkinstalldirs, -mkdir)
204PATH="$srcdir/bin:$save_path"
205AC_PATH_PROG(FACTORY_MAKEHEADER, makeheader)
206PATH="$save_path"
207
208#
209# - expand paths.
210#
211
212AC_MSG_CHECKING(and generating explicit install paths)
213
214# generate Makefile
215save_prefix="$prefix"
216save_exec_prefix="$exec_prefix"
217test "x$prefix" = xNONE && prefix=$ac_default_prefix
218test "x$exec_prefix" = xNONE && exec_prefix='${prefix}'
219for dir in prefix exec_prefix bindir sbindir libexecdir \
220           datadir sysconfdir sharedstatedir localstatedir libdir \
221           includedir oldincludedir infodir mandir; do
222  eval "dir_value=\$$dir"
223  cat >> ./conftest.mk << EXPLPATHEOT
224$dir=$dir_value
225explicit_$dir:
226        @ echo \$($dir)
227        @ if echo \$($dir) | grep '^/'; \\
228        then echo \$($dir) > ./conftest.dir; \\
229        else echo \`pwd\`/\$($dir) > ./conftest.dir; fi
230EXPLPATHEOT
231done
232prefix="$save_prefix"
233exec_prefix="$save_exec_prefix"
234
235# generate the explicit paths
236make >&5 2>&1 -f ./conftest.mk explicit_datadir
237explicit_datadir=`cat ./conftest.dir`
238make >&5 2>&1 -f ./conftest.mk explicit_libdir
239explicit_libdir=`cat ./conftest.dir`
240make >&5 2>&1 -f ./conftest.mk explicit_includedir
241explicit_includedir=`cat ./conftest.dir`
242
243# clean up
244rm -f ./conftest.mk ./conftest.dir
245
246AC_MSG_RESULT(done)
247
248#
249# - check for libraries.
250#
251AC_CHECK_LIB(m, atof, , [ AC_MSG_ERROR(libm.a not found) ])
252
253if test "x$gmp_in_installation" != xyes; then
254  AC_CHECK_LIB(gmp, main, ,
255    [
256      # check a second time in `$(libdir)'.  This is a bit tricky,
257      # but I think its worth avoiding long option values.
258      unset ac_cv_lib_gmp_main
259      LDFLAGS="-L$explicit_libdir $LDFLAGS"
260      AC_CHECK_LIB(gmp, main, ,
261        [ AC_MSG_ERROR(libgmp.a not found.  Use option --with-gmp to specify path) ])
262      unset ac_cv_lib_gmp_main
263    ])
264fi
265
266#
267# - check for header files.
268#
269AC_LANG_CPLUSPLUS
270
271if test "x$gmp_in_installation" != xyes; then
272  AC_CHECK_HEADERS(gmp.h, ,
273    [
274      # check a second time in `$(includedir)'.  This is a bit tricky,
275      # but I think it's worth avoiding long option values.
276      unset ac_cv_header_gmp_h
277      CPPFLAGS="-I$explicit_includedir $CPPFLAGS"
278      AC_CHECK_HEADERS(gmp.h, ,
279        [ AC_MSG_ERROR(gmp.h not found.  Use option --with-gmp to specify path) ])
280      unset ac_cv_header_gmp_h
281    ])
282fi
283
284AC_CHECK_HEADERS(stdio.h stdlib.h string.h time.h math.h, ,
285  [ AC_MSG_ERROR(C header files not found) ])
286
287if test "x$enable_streamio" != xno; then
288  AC_CHECK_HEADERS(iostream.h strstream.h fstream.h, ,
289    [ AC_MSG_ERROR(C++ header files not found) ])
290  AC_CHECK_HEADERS(ctype.h, , [ AC_MSG_ERROR(standard C header files not found) ])
291
292  # since the FTE will compile only with stream IO enabled we will not
293  # check for the necessary header files if stream IO is disabled
294  AC_CHECK_HEADERS(stdarg.h signal.h errno.h unistd.h, ,
295    [ AC_MSG_WARN(C/C++ header files not found.
296                    You will not be able to build the Factory Test Environment
297                    (though Factory itself should compile)) ])
298fi
299
300if test "x$enable_timing" != xno; then
301  AC_CHECK_HEADERS(sys/param.h sys/times.h, ,
302    [ AC_MSG_ERROR(\`sys/times.h' or \`sys/param.h' not found.  Try
303                  \`configure --disable-timing') ])
304fi
305
306AC_CHECK_HEADERS(omalloc.h,,)
307
308# font-lock-trick: '
309
310#
311# - check for compiler characteristics.
312#
313
314# use C to check compiler characteristics instead of C++.  On
315# nextstep, checking with C++ may fail.
316AC_LANG_C
317
318# cross-compiling ?!
319AC_C_CROSS
320if test "x$cross_compiling" = xyes; then
321  AC_MSG_WARN([you better specify a cache file to get the values for
322                    cross-compiling right (e.g., call \`configure
323                    --cache-file=yourTarget.cache').  In particular, you
324                    should make sure that your target machine supports
325                    arithmetic shift.])
326fi
327
328# font-lock-trick: '
329
330AC_C_CONST
331AC_C_INLINE
332
333# arithmetic shift
334AC_MSG_CHECKING(whether your compiler does arithmetic shifts)
335AC_CACHE_VAL(ac_cv_shift,
336  [ AC_TRY_RUN(
337      [ int main() { if (-2 >> 1 == -1) exit(0); else exit(1); } ],
338      ac_cv_shift=yes, ac_cv_shift=no, ac_cv_shift=yes) ])
339if test "x$ac_cv_shift" = xyes; then   
340  AC_MSG_RESULT(yes)
341else
342  AC_MSG_RESULT(no)
343fi
344
345#
346# - paths.
347#
348
349# note that Singular has its own mechanism to search the tables,
350# hence we do not need to mind it here
351gftabledir='${datadir}/factory/gftables'
352explicit_gftabledir="$explicit_datadir/factory/gftables"
353
354# for installation of the templates
355templatedir='${includedir}/templates'
356
357#
358# - the name of the game and the targets to create.
359#
360if test "x$with_Singular" = xyes; then
361  libfactory=libsingcf.a
362
363  factorysrc='$(basefactorysrc) $(singfactorysrc)'
364  factoryincl='$(basefactoryincl) $(singfactoryincl)'
365  memmansrc=
366  memmanincl=
367
368  alltargets=cf
369  installtargets=installcf
370  uninstalltargets=uninstallcf
371else
372  libfactory=libcf.a
373
374  factorysrc='$(basefactorysrc)'
375  factoryincl='$(basefactoryincl)'
376  memmansrc='$(basememmansrc)'
377  memmanincl=
378
379  alltargets=cf
380  installtargets=installcf
381  uninstalltargets=uninstallcf
382fi
383
384#
385# - set defines and variables according to our tests.
386#
387
388# CFLAGS
389if test "x$GCC" = xyes && test "x$cflags_expl_set" = xno; then
390  CFLAGS="-O2 -fomit-frame-pointer"
391fi
392
393# CXXFLAGS
394if test "x$GXX" = xyes && test "x$cxxflags_expl_set" = xno; then
395  CXXFLAGS="-O2 -fomit-frame-pointer"
396fi
397
398# ARFLAGS
399test "${ARFLAGS+set}" = set || ARFLAGS=cr
400
401# M4FLAGS
402test "${M4FLAGS+set}" = set || M4FLAGS=
403
404# Singular
405if test "x$with_Singular" = xyes; then
406  AC_DEFINE(SINGULAR)
407fi
408
409# arithmetic shift
410if test "x$ac_cv_shift" = xyes; then   
411  AC_DEFINE(HAS_ARITHMETIC_SHIFT)
412fi
413
414# gmp-stuff.  we must not set these flags before the tests
415# are finished!
416if test "x$gmp_in_installation" = xyes; then
417  CPPFLAGS="-I\$(includedir) $CPPFLAGS"
418  LDFLAGS="-L\$(libdir) -lgmp $LDFLAGS"
419fi
420
421AC_MSG_CHECKING(whether to use omalloc)
422
423if test "$with_omalloc" = yes; then
424  if test "$ac_cv_header_omalloc_h" != yes; then
425    if test "$enable_omalloc" = yes; then
426       warn_omalloc=yes
427    else
428       with_omalloc=no
429    fi
430  fi
431else
432  if test "$with_omalloc" != no; then
433    if test "$enable_omalloc" = yes; then
434      if test "$ac_cv_header_omalloc_h" != yes; then
435        warn_omalloc=yes
436      fi
437      with_omalloc=yes
438    else
439      with_omalloc=no
440    fi
441  fi
442fi
443if test "$with_omalloc" = yes; then
444  AC_DEFINE(HAVE_OMALLOC)
445  with_memman=no
446fi
447AC_MSG_RESULT($with_omalloc)
448if test "$warn_omalloc" = yes; then
449  AC_MSG_WARN(did not find omalloc.h -- install before compiling)
450fi
451
452   
453# memory manager
454if test "x$with_memman" != xno; then
455  alltargets="$alltargets mem"
456  installtargets="$installtargets installmem"
457  uninstalltargets="$uninstalltargets uninstallmem"
458  AC_DEFINE(USE_MEMUTIL)
459
460  if test "x$with_memman" != xnew; then
461    memmansrc="$memmansrc \$(oldmemmansrc)"
462    memmanincl='$(oldmemmanincl)'
463    AC_DEFINE(USE_OLD_MEMMAN)
464  else
465    memmansrc="$memmansrc \$(newmemmansrc)"
466    memmanincl='$(newmemmanincl)'
467
468    if test "x$enable_memdebug" = xfull; then
469      AC_DEFINE(MDEBUG, 1)
470    elif test "x$enable_memdebug" != xno; then
471      AC_DEFINE(MDEBUG, 0)
472    fi
473  fi
474fi
475
476# "configurable inline methods"
477if test "x$enable_cf_inline" != xno; then
478  AC_DEFINE(CF_USE_INLINE)
479fi
480
481# iostream
482if test "x$enable_streamio" = xno; then
483  AC_DEFINE(NOSTREAMIO)
484else
485  factorysrc="$factorysrc \$(useiofactorysrc)"
486  factoryincl="$factoryincl \$(useiofactoryincl)"
487fi
488
489# assertions
490if test "x$enable_assertions" = xno; then
491  AC_DEFINE(NOASSERT)
492fi
493
494# timing
495if test "x$enable_timing" != xno; then
496  AC_DEFINE(TIMING)
497fi
498
499# debugoutput
500if test "x$enable_debugoutput" != xno; then
501  AC_DEFINE(DEBUGOUTPUT)
502fi
503
504#
505# - complete and substitute variables, defines.
506#
507AC_SUBST(gftabledir)
508AC_SUBST(templatedir)
509
510AC_SUBST(factory_version)
511
512AC_SUBST(libfactory)
513
514AC_SUBST(ARFLAGS)
515AC_SUBST(M4FLAGS)
516AC_SUBST(MAKEHEADERFLAGS)
517
518AC_SUBST(factorysrc)
519AC_SUBST(factoryincl)
520AC_SUBST(memmansrc)
521AC_SUBST(memmanincl)
522
523AC_SUBST(alltargets)
524AC_SUBST(installtargets)
525AC_SUBST(uninstalltargets)
526
527AC_DEFINE_UNQUOTED(FACTORYVERSION, "$factory_version")
528AC_DEFINE_UNQUOTED(FACTORYCONFIGURATION, "$factory_configuration")
529AC_DEFINE_UNQUOTED(GFTABLEDIR, "$explicit_gftabledir")
530
531AC_OUTPUT(GNUmakefile ftest/GNUmakefile)
Note: See TracBrowser for help on using the repository browser.