source: git/factory/configure.in @ a70441f

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