source: git/factory/configure.in @ ec989c

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