source: git/factory/configure.in @ bd860d3

spielwiese
Last change on this file since bd860d3 was bd860d3, checked in by Hans Schönemann <hannes@…>, 17 years ago
*hannes: version 3-0-3 git-svn-id: file:///usr/local/Singular/svn/trunk@9542 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.46 2006-12-06 17:24:09 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.46 2006-12-06 17:24:09 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="3.0.3"
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 iostream string fstream)
272  AC_CHECK_HEADERS(ctype.h, , [ AC_MSG_ERROR(standard C header files not found) ])
273
274  # since the FTE will compile only with stream IO enabled we will not
275  # check for the necessary header files if stream IO is disabled
276  AC_CHECK_HEADERS(stdarg.h signal.h errno.h unistd.h, ,
277    [ AC_MSG_WARN(C/C++ header files not found.
278                    You will not be able to build the Factory Test Environment
279                    (though Factory itself should compile)) ])
280fi
281
282if test "x$enable_timing" != xno; then
283  AC_CHECK_HEADERS(sys/param.h sys/times.h, ,
284    [ AC_MSG_ERROR(\`sys/times.h' or \`sys/param.h' not found.  Try
285                  \`configure --disable-timing') ])
286fi
287
288AC_CHECK_HEADERS(omalloc.h,,)
289
290# font-lock-trick: '
291
292#
293# - check for compiler characteristics.
294#
295
296# use C to check compiler characteristics instead of C++.  On
297# nextstep, checking with C++ may fail.
298AC_LANG_C
299
300# cross-compiling ?!
301#AC_C_CROSS
302#if test "x$cross_compiling" = xyes; then
303#  AC_MSG_WARN([you better specify a cache file to get the values for
304#                    cross-compiling right (e.g., call \`configure
305#                    --cache-file=yourTarget.cache').  In particular, you
306#                    should make sure that your target machine supports
307#                    arithmetic shift.])
308#fi
309
310# font-lock-trick: '
311
312# arithmetic shift
313AC_MSG_CHECKING(whether your compiler does arithmetic shifts)
314AC_CACHE_VAL(ac_cv_shift,
315  [ LDFLAGS="-L$explicit_libdir $LDFLAGS"
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  if test "x$with_Singular" = xyes; then
433    LDFLAGS="-L\$(libdir) -lgmp $LDFLAGS"
434  fi
435fi
436
437AC_MSG_CHECKING(whether to use omalloc)
438
439if test "$with_omalloc" = yes; then
440  if test "$ac_cv_header_omalloc_h" != yes; then
441    if test "$enable_omalloc" = yes; then
442       warn_omalloc=yes
443    else
444       with_omalloc=no
445    fi
446  fi
447else
448  if test "$with_omalloc" != no; then
449    if test "$enable_omalloc" = yes; then
450      if test "$ac_cv_header_omalloc_h" != yes; then
451        warn_omalloc=yes
452      fi
453      with_omalloc=yes
454    else
455      with_omalloc=no
456    fi
457  fi
458fi
459if test "$with_omalloc" = yes; then
460  AC_DEFINE(HAVE_OMALLOC)
461  with_memman=no
462fi
463AC_MSG_RESULT($with_omalloc)
464if test "$warn_omalloc" = yes; then
465  AC_MSG_WARN(did not find omalloc.h -- install before compiling)
466fi
467
468   
469# memory manager
470if test "x$with_memman" != xno; then
471  alltargets="$alltargets mem"
472  installtargets="$installtargets installmem"
473  uninstalltargets="$uninstalltargets uninstallmem"
474  AC_DEFINE(USE_MEMUTIL)
475
476  if test "x$with_memman" != xnew; then
477    memmansrc="$memmansrc \$(oldmemmansrc)"
478    memmanincl='$(oldmemmanincl)'
479    AC_DEFINE(USE_OLD_MEMMAN)
480  else
481    memmansrc="$memmansrc \$(newmemmansrc)"
482    memmanincl='$(newmemmanincl)'
483
484    if test "x$enable_memdebug" = xfull; then
485      AC_DEFINE(MDEBUG, 1)
486    elif test "x$enable_memdebug" != xno; then
487      AC_DEFINE(MDEBUG, 0)
488    fi
489  fi
490fi
491
492# "configurable inline methods"
493if test "x$enable_cf_inline" != xno; then
494  AC_DEFINE(CF_USE_INLINE)
495fi
496
497# iostream
498if test "x$enable_streamio" = xno; then
499  AC_DEFINE(NOSTREAMIO)
500else
501  factorysrc="$factorysrc \$(useiofactorysrc)"
502  factoryincl="$factoryincl \$(useiofactoryincl)"
503fi
504
505# assertions
506if test "x$enable_assertions" = xno; then
507  AC_DEFINE(NOASSERT)
508fi
509
510# timing
511if test "x$enable_timing" != xno; then
512  AC_DEFINE(TIMING)
513fi
514
515# debugoutput
516if test "x$enable_debugoutput" != xno; then
517  AC_DEFINE(DEBUGOUTPUT)
518fi
519
520#
521# - complete and substitute variables, defines.
522#
523AC_SUBST(gftabledir)
524AC_SUBST(templatedir)
525
526AC_SUBST(factory_version)
527
528AC_SUBST(libfactory)
529
530AC_SUBST(ARFLAGS)
531AC_SUBST(M4FLAGS)
532AC_SUBST(MAKEHEADERFLAGS)
533
534AC_SUBST(factorysrc)
535AC_SUBST(factoryincl)
536AC_SUBST(memmansrc)
537AC_SUBST(memmanincl)
538
539AC_SUBST(alltargets)
540AC_SUBST(installtargets)
541AC_SUBST(uninstalltargets)
542
543AC_DEFINE_UNQUOTED(FACTORYVERSION, "$factory_version")
544AC_DEFINE_UNQUOTED(FACTORYCONFIGURATION, "$factory_configuration")
545AC_DEFINE_UNQUOTED(GFTABLEDIR, "$explicit_gftabledir")
546
547AC_OUTPUT(GNUmakefile ftest/GNUmakefile)
Note: See TracBrowser for help on using the repository browser.