source: git/factory/configure.in @ d3ff79

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