source: git/factory/configure.in @ fc7220

spielwiese
Last change on this file since fc7220 was fc7220, checked in by Olaf Bachmann <obachman@…>, 23 years ago
--no-rtti stuff git-svn-id: file:///usr/local/Singular/svn/trunk@4899 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.30 2000-12-14 15:37:57 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.30 2000-12-14 15:37:57 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
151fi
152
153#
154# - check for some other programs.
155#
156AC_PROG_CPP
157AC_PROG_CXXCPP
158AC_PROG_LN_S
159AC_PROG_INSTALL
160AC_PROG_RANLIB
161AC_PROG_MAKE_SET
162AC_CHECK_PROG(AR, ar, ar, where-is-your-ar)
163AC_CHECK_PROG(M4, m4, m4, where-is-your-m4)
164AC_CHECK_PROG(BISON, bison, bison, where-is-your-bison)
165
166# do not use `MKINSTALLDIRS' and `MAKEHEADER' since there may be
167# name clashes with other peoples configure scripts via
168# `config.cache'.  Furthermore, we do not use cache at all to
169# avoid some nasty problems with our own development environment.
170unset ac_cv_path_FACTORY_MKINSTALLDIRS
171unset ac_cv_path_FACTORY_MAKEHEADER
172save_path="$PATH"
173PATH="$PATH:$srcdir/bin"
174AC_PATH_PROG(FACTORY_MKINSTALLDIRS, mkinstalldirs, -mkdir)
175PATH="$srcdir/bin:$save_path"
176AC_PATH_PROG(FACTORY_MAKEHEADER, makeheader)
177PATH="$save_path"
178
179#
180# - expand paths.
181#
182
183AC_MSG_CHECKING(and generating explicit install paths)
184
185# generate Makefile
186save_prefix="$prefix"
187save_exec_prefix="$exec_prefix"
188test "x$prefix" = xNONE && prefix=$ac_default_prefix
189test "x$exec_prefix" = xNONE && exec_prefix='${prefix}'
190for dir in prefix exec_prefix bindir sbindir libexecdir \
191           datadir sysconfdir sharedstatedir localstatedir libdir \
192           includedir oldincludedir infodir mandir; do
193  eval "dir_value=\$$dir"
194  cat >> ./conftest.mk << EXPLPATHEOT
195$dir=$dir_value
196explicit_$dir:
197        @ echo \$($dir)
198        @ if echo \$($dir) | grep '^/'; \\
199        then echo \$($dir) > ./conftest.dir; \\
200        else echo \`pwd\`/\$($dir) > ./conftest.dir; fi
201EXPLPATHEOT
202done
203prefix="$save_prefix"
204exec_prefix="$save_exec_prefix"
205
206# generate the explicit paths
207make >&5 2>&1 -f ./conftest.mk explicit_datadir
208explicit_datadir=`cat ./conftest.dir`
209make >&5 2>&1 -f ./conftest.mk explicit_libdir
210explicit_libdir=`cat ./conftest.dir`
211make >&5 2>&1 -f ./conftest.mk explicit_includedir
212explicit_includedir=`cat ./conftest.dir`
213
214# clean up
215rm -f ./conftest.mk ./conftest.dir
216
217AC_MSG_RESULT(done)
218
219#
220# - check for libraries.
221#
222AC_CHECK_LIB(m, atof, , [ AC_MSG_ERROR(libm.a not found) ])
223
224if test "x$gmp_in_installation" != xyes; then
225  AC_CHECK_LIB(gmp, main, ,
226    [
227      # check a second time in `$(libdir)'.  This is a bit tricky,
228      # but I think its worth avoiding long option values.
229      unset ac_cv_lib_gmp_main
230      LDFLAGS="-L$explicit_libdir $LDFLAGS"
231      AC_CHECK_LIB(gmp, main, ,
232        [ AC_MSG_ERROR(libgmp.a not found.  Use option --with-gmp to specify path) ])
233      unset ac_cv_lib_gmp_main
234    ])
235fi
236
237#
238# - check for header files.
239#
240AC_LANG_CPLUSPLUS
241
242if test "x$gmp_in_installation" != xyes; then
243  AC_CHECK_HEADERS(gmp.h, ,
244    [
245      # check a second time in `$(includedir)'.  This is a bit tricky,
246      # but I think it's worth avoiding long option values.
247      unset ac_cv_header_gmp_h
248      CPPFLAGS="-I$explicit_includedir $CPPFLAGS"
249      AC_CHECK_HEADERS(gmp.h, ,
250        [ AC_MSG_ERROR(gmp.h not found.  Use option --with-gmp to specify path) ])
251      unset ac_cv_header_gmp_h
252    ])
253fi
254
255AC_CHECK_HEADERS(stdio.h stdlib.h string.h time.h math.h, ,
256  [ AC_MSG_ERROR(C header files not found) ])
257
258if test "x$enable_streamio" != xno; then
259  AC_CHECK_HEADERS(iostream.h strstream.h fstream.h, ,
260    [ AC_MSG_ERROR(C++ header files not found) ])
261  AC_CHECK_HEADERS(ctype.h, , [ AC_MSG_ERROR(standard C header files not found) ])
262
263  # since the FTE will compile only with stream IO enabled we will not
264  # check for the necessary header files if stream IO is disabled
265  AC_CHECK_HEADERS(stdarg.h signal.h errno.h unistd.h, ,
266    [ AC_MSG_WARN(C/C++ header files not found.
267                    You will not be able to build the Factory Test Environment
268                    (though Factory itself should compile)) ])
269fi
270
271if test "x$enable_timing" != xno; then
272  AC_CHECK_HEADERS(sys/param.h sys/times.h, ,
273    [ AC_MSG_ERROR(\`sys/times.h' or \`sys/param.h' not found.  Try
274                  \`configure --disable-timing') ])
275fi
276
277AC_CHECK_HEADERS(omalloc.h,,)
278
279# font-lock-trick: '
280
281#
282# - check for compiler characteristics.
283#
284
285# use C to check compiler characteristics instead of C++.  On
286# nextstep, checking with C++ may fail.
287AC_LANG_C
288
289# cross-compiling ?!
290AC_C_CROSS
291if test "x$cross_compiling" = xyes; then
292  AC_MSG_WARN([you better specify a cache file to get the values for
293                    cross-compiling right (e.g., call \`configure
294                    --cache-file=yourTarget.cache').  In particular, you
295                    should make sure that your target machine supports
296                    arithmetic shift.])
297fi
298
299# font-lock-trick: '
300
301AC_C_CONST
302AC_C_INLINE
303
304# arithmetic shift
305AC_MSG_CHECKING(whether your compiler does arithmetic shifts)
306AC_CACHE_VAL(ac_cv_shift,
307  [ AC_TRY_RUN(
308      [ int main() { if (-2 >> 1 == -1) exit(0); else exit(1); } ],
309      ac_cv_shift=yes, ac_cv_shift=no, ac_cv_shift=yes) ])
310if test "x$ac_cv_shift" = xyes; then   
311  AC_MSG_RESULT(yes)
312else
313  AC_MSG_RESULT(no)
314fi
315
316#
317# - paths.
318#
319
320# note that Singular has its own mechanism to search the tables,
321# hence we do not need to mind it here
322gftabledir='${datadir}/factory/gftables'
323explicit_gftabledir="$explicit_datadir/factory/gftables"
324
325# for installation of the templates
326templatedir='${includedir}/templates'
327
328#
329# - the name of the game and the targets to create.
330#
331if test "x$with_Singular" = xyes; then
332  libfactory=libsingcf.a
333
334  factorysrc='$(basefactorysrc) $(singfactorysrc)'
335  factoryincl='$(basefactoryincl) $(singfactoryincl)'
336  memmansrc=
337  memmanincl=
338
339  alltargets=cf
340  installtargets=installcf
341  uninstalltargets=uninstallcf
342else
343  libfactory=libcf.a
344
345  factorysrc='$(basefactorysrc)'
346  factoryincl='$(basefactoryincl)'
347  memmansrc='$(basememmansrc)'
348  memmanincl=
349
350  alltargets=cf
351  installtargets=installcf
352  uninstalltargets=uninstallcf
353fi
354
355#
356# - set defines and variables according to our tests.
357#
358
359# CFLAGS
360if test "x$GCC" = xyes && test "x$cflags_expl_set" = xno; then
361  CFLAGS="-O2 -fomit-frame-pointer"
362fi
363
364# CXXFLAGS
365if test "x$GXX" = xyes && test "x$cxxflags_expl_set" = xno; then
366  CXXFLAGS="-O2 -fomit-frame-pointer"
367
368AC_LANG_SAVE
369AC_LANG_CPLUSPLUS
370# check whether CXX accepts --no-rtti
371AC_MSG_CHECKING(whether gcc accepts --no-rtti)
372tmp_flags=${CXXFLAGS}
373CXXFLAGS="${CXXFLAGS} --no-rtti"
374AC_CACHE_VAL(ac_cv_cxx_have_rtti,
375AC_TRY_COMPILE(,,ac_cv_cxx_have_rtti=yes,ac_cv_cxx_have_rtti=no)
376)
377AC_MSG_RESULT(${ac_cv_cxx_have_rtti})
378CXXFLAGS=$tmp_flags
379if test "${ac_cv_cxx_have_rtti}" = yes; then
380CXXFLAGS="$CXXFLAGS --no-rtti"
381fi
382
383AC_MSG_CHECKING(whether gcc accepts --no-exceptions)
384tmp_flags=${CXXFLAGS}
385CXXFLAGS="${CXXFLAGS} --no-exceptions"
386AC_CACHE_VAL(ac_cv_cxx_have_exceptions,
387AC_TRY_COMPILE(,,ac_cv_cxx_have_exceptions=yes,ac_cv_cxx_have_exceptions=no)
388)
389AC_MSG_RESULT(${ac_cv_cxx_have_exceptions})
390CXXFLAGS=$tmp_flags
391if test "${ac_cv_cxx_have_exceptions}" = yes; then
392CXXFLAGS="$CXXFLAGS --no-exceptions"
393fi
394AC_LANG_RESTORE
395
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.