source: git/factory/configure.in @ 241b061

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