source: git/factory/configure.in @ 341696

spielwiese
Last change on this file since 341696 was 341696, checked in by Hans Schönemann <hannes@…>, 14 years ago
Adding Id property to all files git-svn-id: file:///usr/local/Singular/svn/trunk@12231 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$
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$)
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.1.0"
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# arithmetic shift
250#AC_MSG_CHECKING(whether your compiler does arithmetic shifts)
251#AC_CACHE_VAL(ac_cv_shift,
252#  [ LDFLAGS="-L$explicit_libdir $LDFLAGS"
253#       AC_TRY_RUN(
254#      [ int main() { if (-2 >> 1 == -1) return(0); else return(1); } ],
255#      ac_cv_shift=yes, ac_cv_shift=no, ac_cv_shift=yes) ])
256#if test "x$ac_cv_shift" = xyes; then   
257#  AC_MSG_RESULT(yes)
258#else
259#  AC_MSG_RESULT(no)
260#fi
261
262#
263# - check for header files.
264#
265AC_LANG_CPLUSPLUS
266
267if test "x$gmp_in_installation" != xyes; then
268  AC_CHECK_HEADERS(gmp.h, ,
269    [
270      # check a second time in `$(includedir)'.  This is a bit tricky,
271      # but I think it's worth avoiding long option values.
272      unset ac_cv_header_gmp_h
273      CPPFLAGS="-I$explicit_includedir $CPPFLAGS"
274      AC_CHECK_HEADERS(gmp.h, ,
275        [ AC_MSG_ERROR(gmp.h not found.  Use option --with-gmp to specify path) ])
276      unset ac_cv_header_gmp_h
277    ])
278fi
279
280AC_CHECK_HEADERS(stdio.h stdlib.h string.h time.h math.h, ,
281  [ AC_MSG_ERROR(C header files not found) ])
282AC_CHECK_HEADERS(cstdio)
283
284if test "x$enable_streamio" != xno; then
285  AC_CHECK_HEADERS(iostream.h strstream.h fstream.h iostream string fstream)
286  AC_CHECK_HEADERS(ctype.h, , [ AC_MSG_ERROR(standard C header files not found) ])
287
288  # since the FTE will compile only with stream IO enabled we will not
289  # check for the necessary header files if stream IO is disabled
290  AC_CHECK_HEADERS(stdarg.h signal.h errno.h unistd.h, ,
291    [ AC_MSG_WARN(C/C++ header files not found.
292                    You will not be able to build the Factory Test Environment
293                    (though Factory itself should compile)) ])
294fi
295
296if test "x$enable_timing" != xno; then
297  AC_CHECK_HEADERS(sys/param.h sys/times.h, ,
298    [ AC_MSG_ERROR(\`sys/times.h' or \`sys/param.h' not found.  Try
299                  \`configure --disable-timing') ])
300fi
301
302AC_CHECK_HEADERS(omalloc.h,,)
303
304# font-lock-trick: '
305
306#
307# - check for compiler characteristics.
308#
309
310# use C to check compiler characteristics instead of C++.  On
311# nextstep, checking with C++ may fail.
312AC_LANG_C
313
314# cross-compiling ?!
315#AC_C_CROSS
316#if test "x$cross_compiling" = xyes; then
317#  AC_MSG_WARN([you better specify a cache file to get the values for
318#                    cross-compiling right (e.g., call \`configure
319#                    --cache-file=yourTarget.cache').  In particular, you
320#                    should make sure that your target machine supports
321#                    arithmetic shift.])
322#fi
323
324# font-lock-trick: '
325
326#
327# - paths.
328#
329
330# note that Singular has its own mechanism to search the tables,
331# hence we do not need to mind it here
332gftabledir='${datadir}/factory/gftables'
333explicit_gftabledir="$explicit_datadir/factory/gftables"
334
335# for installation of the templates
336templatedir='${includedir}/templates'
337
338#
339# - the name of the game and the targets to create.
340#
341if test "x$with_Singular" = xyes; then
342  libfactory=libsingcf.a
343
344  factorysrc='$(basefactorysrc) $(singfactorysrc)'
345  factoryincl='$(basefactoryincl) $(singfactoryincl)'
346  memmansrc=
347  memmanincl=
348
349  alltargets=cf
350  installtargets=installcf
351  uninstalltargets=uninstallcf
352else
353  libfactory=libcf.a
354
355  factorysrc='$(basefactorysrc)'
356  factoryincl='$(basefactoryincl)'
357  memmansrc='$(basememmansrc)'
358  memmanincl=
359
360  alltargets=cf
361  installtargets=installcf
362  uninstalltargets=uninstallcf
363fi
364
365#
366# - set defines and variables according to our tests.
367#
368
369# CFLAGS
370if test "x$GCC" = xyes && test "x$cflags_expl_set" = xno; then
371  CFLAGS="-O2 -fomit-frame-pointer"
372fi
373
374# CXXFLAGS
375if test "x$GXX" = xyes && test "x$cxxflags_expl_set" = xno; then
376  CXXFLAGS="-O2 -fomit-frame-pointer"
377
378AC_LANG_SAVE
379AC_LANG_CPLUSPLUS
380# check whether CXX accepts -fno-rtti
381AC_MSG_CHECKING(whether gcc accepts -fno-rtti)
382tmp_flags=${CXXFLAGS}
383CXXFLAGS="${CXXFLAGS} -fno-rtti"
384AC_CACHE_VAL(ac_cv_cxx_have_rtti,
385AC_TRY_COMPILE(,,ac_cv_cxx_have_rtti=yes,ac_cv_cxx_have_rtti=no)
386)
387AC_MSG_RESULT(${ac_cv_cxx_have_rtti})
388CXXFLAGS=$tmp_flags
389if test "${ac_cv_cxx_have_rtti}" = yes; then
390CXXFLAGS="$CXXFLAGS -fno-rtti"
391fi
392
393AC_MSG_CHECKING(whether gcc accepts -fno-exceptions)
394tmp_flags=${CXXFLAGS}
395CXXFLAGS="${CXXFLAGS} -fno-exceptions"
396AC_CACHE_VAL(ac_cv_cxx_have_exceptions,
397AC_TRY_LINK(,,ac_cv_cxx_have_exceptions=yes,ac_cv_cxx_have_exceptions=no)
398)
399AC_MSG_RESULT(${ac_cv_cxx_have_exceptions})
400CXXFLAGS=$tmp_flags
401if test "${ac_cv_cxx_have_exceptions}" = yes; then
402CXXFLAGS="$CXXFLAGS -fno-exceptions"
403fi
404AC_LANG_RESTORE
405
406fi
407
408# ARFLAGS
409test "${ARFLAGS+set}" = set || ARFLAGS=cr
410
411# M4FLAGS
412test "${M4FLAGS+set}" = set || M4FLAGS=
413
414# Singular
415if test "x$with_Singular" = xyes; then
416  AC_DEFINE(SINGULAR)
417fi
418
419# NTL
420if test "x$with_NTL" = xyes; then
421  AC_DEFINE(HAVE_NTL)
422fi
423
424# arithmetic shift
425#if test "x$ac_cv_shift" = xyes; then   
426#  AC_DEFINE(HAS_ARITHMETIC_SHIFT)
427#fi
428
429# gmp-stuff.  we must not set these flags before the tests
430# are finished!
431if test "x$gmp_in_installation" = xyes; then
432  CPPFLAGS="-I\$(includedir) $CPPFLAGS"
433  if test "x$with_Singular" = xyes; then
434    LDFLAGS="-L\$(libdir) -lgmp $LDFLAGS"
435  fi
436fi
437
438AC_MSG_CHECKING(whether to use omalloc)
439
440if test "$with_omalloc" = yes; then
441  if test "$ac_cv_header_omalloc_h" != yes; then
442    if test "$enable_omalloc" = yes; then
443       warn_omalloc=yes
444    else
445       with_omalloc=no
446    fi
447  fi
448else
449  if test "$with_omalloc" != no; then
450    if test "$enable_omalloc" = yes; then
451      if test "$ac_cv_header_omalloc_h" != yes; then
452        warn_omalloc=yes
453      fi
454      with_omalloc=yes
455    else
456      with_omalloc=no
457    fi
458  fi
459fi
460if test "$with_omalloc" = yes; then
461  AC_DEFINE(HAVE_OMALLOC)
462  with_memman=no
463fi
464AC_MSG_RESULT($with_omalloc)
465if test "$warn_omalloc" = yes; then
466  AC_MSG_WARN(did not find omalloc.h -- install before compiling)
467fi
468
469   
470# memory manager
471if test "x$with_memman" != xno; then
472  alltargets="$alltargets mem"
473  installtargets="$installtargets installmem"
474  uninstalltargets="$uninstalltargets uninstallmem"
475  AC_DEFINE(USE_MEMUTIL)
476
477  if test "x$with_memman" != xnew; then
478    memmansrc="$memmansrc \$(oldmemmansrc)"
479    memmanincl='$(oldmemmanincl)'
480    AC_DEFINE(USE_OLD_MEMMAN)
481  else
482    memmansrc="$memmansrc \$(newmemmansrc)"
483    memmanincl='$(newmemmanincl)'
484
485    if test "x$enable_memdebug" = xfull; then
486      AC_DEFINE(MDEBUG, 1)
487    elif test "x$enable_memdebug" != xno; then
488      AC_DEFINE(MDEBUG, 0)
489    fi
490  fi
491fi
492
493# "configurable inline methods"
494if test "x$enable_cf_inline" != xno; then
495  AC_DEFINE(CF_USE_INLINE)
496fi
497
498# iostream
499if test "x$enable_streamio" = xno; then
500  AC_DEFINE(NOSTREAMIO)
501else
502  factorysrc="$factorysrc \$(useiofactorysrc)"
503  factoryincl="$factoryincl \$(useiofactoryincl)"
504fi
505
506# assertions
507if test "x$enable_assertions" = xno; then
508  AC_DEFINE(NOASSERT)
509fi
510
511# timing
512if test "x$enable_timing" != xno; then
513  AC_DEFINE(TIMING)
514fi
515
516# debugoutput
517if test "x$enable_debugoutput" != xno; then
518  AC_DEFINE(DEBUGOUTPUT)
519fi
520
521#
522# - complete and substitute variables, defines.
523#
524AC_SUBST(gftabledir)
525AC_SUBST(templatedir)
526
527AC_SUBST(factory_version)
528
529AC_SUBST(libfactory)
530
531AC_SUBST(ARFLAGS)
532AC_SUBST(M4FLAGS)
533AC_SUBST(MAKEHEADERFLAGS)
534
535AC_SUBST(factorysrc)
536AC_SUBST(factoryincl)
537AC_SUBST(memmansrc)
538AC_SUBST(memmanincl)
539
540AC_SUBST(alltargets)
541AC_SUBST(installtargets)
542AC_SUBST(uninstalltargets)
543
544AC_DEFINE_UNQUOTED(FACTORYVERSION, "$factory_version")
545AC_DEFINE_UNQUOTED(FACTORYCONFIGURATION, "$factory_configuration")
546AC_DEFINE_UNQUOTED(GFTABLEDIR, "$explicit_gftabledir")
547
548AC_OUTPUT(GNUmakefile ftest/GNUmakefile)
Note: See TracBrowser for help on using the repository browser.