source: git/factory/configure.in @ e4dda1

fieker-DuValspielwiese
Last change on this file since e4dda1 was 654824, checked in by Jens Schmidt <schmidt@…>, 27 years ago
* configure.in: checks for compiler characteristic are done with C instead of C++ git-svn-id: file:///usr/local/Singular/svn/trunk@592 2c84dea3-7e68-4137-9b89-c4e89433aadc
  • Property mode set to 100644
File size: 10.8 KB
Line 
1dnl $Id: configure.in,v 1.7 1997-08-01 09:10:22 schmidt Exp $
2
3dnl
4dnl configure.in - process this file with autoconf to generate
5dnl   a configure script.
6dnl
7dnl See the INSTALL file for information on how the configure script
8dnl works.
9dnl
10
11#
12# - initialisation.
13#
14AC_REVISION($Id: configure.in,v 1.7 1997-08-01 09:10:22 schmidt Exp $)
15AC_INIT(canonicalform.cc)
16AC_CONFIG_HEADER(config.h)
17AC_CONFIG_AUX_DIR(bin)
18
19#
20# Do not change version here!!!
21#
22dnl
23dnl Change version here, do not believe the comment in the
24dnl preceding lines.
25dnl
26factory_version="1.3a"
27
28#
29# - check withs and enables.
30#
31AC_ARG_WITH(
32  memman,
33  [  --with-memman(=<memman>) specify Factory memory manager.
34                          <memman> is either 'old' (default), 'new', or 'no'.],
35  ,
36  [ if test "x$with_Singular" = xyes; then
37      with_memman=no
38    else
39      with_memman=old
40    fi ])
41
42AC_ARG_WITH(
43  gmp,
44  [  --with-gmp(=<gmp_inc_path>(,<gmp_lib_path>))
45                          specify where to find gmp library.])
46
47AC_ARG_WITH(
48  Singular,
49  [  --with-Singular         build for use with computer algebra system Singular.],
50  ,
51  with_Singular=no)
52
53AC_ARG_ENABLE(
54  streamio,
55  [  --disable-streamio      build Factory without stream IO],
56  ,
57  [ if test "x$with_Singular" = xyes; then
58      enable_streamio=no
59    else
60      enable_streamio=yes
61    fi ])
62
63AC_ARG_ENABLE(
64  memdebug,
65  [  --enable-memdebug=<level> switch on memory management debugging.  Meaningful
66                          with --with-memman=new only.  <level> may be either
67                          'no' (default), 'normal', or 'full'.],
68  ,
69  enable_memdebug=no)
70
71AC_ARG_ENABLE(
72  assertions,
73  [  --enable-assertions     build Factory with assertions activated],
74  ,
75  enable_assertions=no)
76
77AC_ARG_ENABLE(
78  timing,
79  [  --enable-timing         build Factory so it will print timing information],
80  ,
81  enable_timing=no)
82
83AC_ARG_ENABLE(
84  debugoutput,
85  [  --enable-debugoutput    build Factory so it will print debugging information],
86  ,
87  enable_debugoutput=no)
88
89# an ugly tribute to Singular
90AC_ARG_ENABLE(
91  gmp,
92  [  --enable-gmp            together with --with-Singular means: installation
93                          in process, be graceful when there is no gmp.h],
94  [ if test "x$with_Singular" = xyes && test "x$enable_gmp" != xno; then
95      with_gmp='$(includedir)'
96    fi ])
97
98#
99# - check the results of --with-gmp.
100#
101case "$with_gmp" in
102  yes|no|"")
103    gmp_in_installation=no ;;
104  '$(includedir)'|'${includedir}')
105    gmp_in_installation=yes ;;
106  *,*)
107    saveIFS="$IFS"; IFS="${IFS},"
108    set dummy $with_gmp
109    IFS="$saveIFS"
110    CPPFLAGS="-I$2 $CPPFLAGS"
111    LDFLAGS="-L$3 $LDFLAGS"
112    gmp_in_installation=no ;;
113  *)
114    CPPFLAGS="-I$with_gmp $CPPFLAGS"
115    LDFLAGS="-L$with_gmp/../lib $LDFLAGS"
116    gmp_in_installation=no ;;
117esac
118
119#
120# - check for CC and CXX but be careful about CFLAGS.
121#
122test "${CFLAGS+set}" = set || cflags_expl_set=no
123AC_PROG_CC
124test "${CXXFLAGS+set}" = set || cxxflags_expl_set=no
125AC_PROG_CXX
126if test "x$GCC" != xyes && test "x$GXX" != xyes; then
127  AC_MSG_WARN(you better use gcc to compile Factory)
128else
129  if test "x$GXX" = xyes && test "x$cxxflags_expl_set" = xno; then
130    AC_MSG_WARN([we will use '-O2 -fomit-frame-pointer' as default for CXXFLAGS
131                      (instead of the configure default '-g -O')])
132  fi
133  if test "x$GCC" = xyes && test "x$cflags_expl_set" = xno; then
134    AC_MSG_WARN([we will use '-O2 -fomit-frame-pointer' as default for CFLAGS
135                      (instead of the configure default '-g -O')])
136  fi
137fi
138
139#
140# - check for some other programs.
141#
142AC_PROG_CPP
143AC_PROG_CXXCPP
144AC_PROG_INSTALL
145AC_PROG_RANLIB
146AC_PROG_MAKE_SET
147AC_CHECK_PROG(AR, ar, ar, where-is-your-ar)
148AC_CHECK_PROG(BISON, bison, bison, where-is-your-bison)
149
150# get absolute path of srcdir to avoid some funny problems when
151# feeding our results to other peoples configure via cache
152if echo "$srcdir" | grep '^/' > /dev/null 2> /dev/null; then
153  abssrcdir="$srcdir"
154else
155  abssrcdir="`pwd`/$srcdir"
156fi
157AC_PATH_PROG(MKINSTALLDIRS, mkinstalldirs, -mkdir, $PATH:$abssrcdir/bin)
158AC_PATH_PROG(MAKEHEADER, makeheader, , $abssrcdir/bin:$PATH)
159
160#
161# - check for libraries.
162#
163if test "x$gmp_in_installation" != xyes; then
164  AC_CHECK_LIB(gmp, mpz_init)
165fi
166AC_CHECK_LIB(m, sqrt)
167
168#
169# - check for header files.
170#
171AC_LANG_CPLUSPLUS
172
173if test "x$gmp_in_installation" != xyes; then
174  AC_CHECK_HEADERS(gmp.h, ,
175    [ AC_MSG_ERROR(gmp.h not found.  Use option --with-gmp to specify path) ])
176fi
177
178AC_CHECK_HEADERS(stdio.h stdlib.h string.h time.h math.h, ,
179  [ AC_MSG_ERROR(standard C header files not found) ])
180
181if test "x$enable_streamio" != xno; then
182  AC_CHECK_HEADERS(iostream.h strstream.h fstream.h, ,
183    [ AC_MSG_ERROR(C++ header files not found) ])
184  AC_CHECK_HEADERS(ctype.h, , [ AC_MSG_ERROR(standard C header files not found) ])
185fi
186
187if test "x$enable_timing" != xno; then
188  AC_CHECK_HEADERS(sys/param.h sys/times.h, ,
189    [ AC_MSG_ERROR(sys/times.h or sys/param.h not found.  Try
190                  configure --disable-timing) ])
191fi
192
193#
194# - check for compiler characteristics.
195#
196
197# use C to check compiler characteristics instead of C++.  On
198# nextstep, checking with C++ may fail.
199AC_LANG_C
200
201# cross-compiling ?!
202AC_C_CROSS
203if test "x$cross_compiling" = xyes; then
204  AC_MSG_WARN([you better specify a cache file to get the values for
205                    cross-compiling right (call configure --cache-file=target.cache)])
206fi
207
208AC_C_CONST
209AC_C_INLINE
210
211# arithmetic shift
212AC_MSG_CHECKING(whether your compiler does arithmetic shifts)
213AC_CACHE_VAL(ac_cv_shift,
214  [ AC_TRY_RUN(
215      [ int main() { if (-2 >> 1 == -1) exit(0); else exit(1); } ],
216      ac_cv_shift=yes, ac_cv_shift=no, ac_cv_shift=no) ])
217if test "x$ac_cv_shift" = xyes; then   
218  AC_MSG_RESULT(yes)
219else
220  AC_MSG_RESULT(no)
221fi
222
223#
224# - paths.
225#
226
227# we have to get datadir explicitely for config.h
228save_prefix="$prefix"
229test "x$prefix" = xNONE && prefix="$ac_default_prefix"
230expl_datadir=`eval echo "$datadir"`
231prefix="$save_prefix"
232
233if test "x$with_Singular" = xyes; then
234  gftabledir='${datadir}/Singular/gftables'
235  expl_gftabledir="$expl_datadir/Singular/gftables"
236  templatedir='${includedir}/templates'
237else
238  gftabledir='${datadir}/factory/gftables'
239  expl_gftabledir="$expl_datadir/factory/gftables"
240  templatedir='${includedir}/templates'
241fi
242
243#
244# - the name of the game and the targets to create.
245#
246if test "x$with_Singular" = xyes; then
247  libfactory=libsingcf.a
248
249  factorysrc='$(basefactorysrc) $(singfactorysrc)'
250  factoryincl='$(basefactoryincl) $(singfactoryincl)'
251  memmansrc=
252  memmanincl=
253
254  alltargets=cf
255  installtargets=installcf
256  uninstalltargets=uninstallcf
257else
258  libfactory=libcf.a
259
260  factorysrc='$(basefactorysrc)'
261  factoryincl='$(basefactoryincl)'
262  memmansrc='$(basememmansrc)'
263  memmanincl=
264
265  alltargets=cf
266  installtargets=installcf
267  uninstalltargets=uninstallcf
268fi
269
270#
271# - set defines and variables according to our tests.
272#
273
274# CFLAGS
275if test "x$GCC" = xyes && test "x$cflags_expl_set" = xno; then
276  CFLAGS="-O2 -fomit-frame-pointer"
277fi
278
279# CXXFLAGS
280if test "x$GXX" = xyes && test "x$cxxflags_expl_set" = xno; then
281  CXXFLAGS="-O2 -fomit-frame-pointer"
282fi
283
284# ARFLAGS
285test "${ARFLAGS+set}" = set || ARFLAGS=cr
286
287# Singular
288if test "x$with_Singular" = xyes; then
289  AC_DEFINE(SINGULAR)
290fi
291
292# arithmetic shift
293if test "x$ac_cv_shift" = xyes; then   
294  AC_DEFINE(HAS_ARITHMETIC_SHIFT)
295fi
296
297# gmp-stuff.  we must not set these flags before the tests
298# are finished!
299if test "x$gmp_in_installation" = xyes; then
300  CPPFLAGS="-I\$(includedir) $CPPFLAGS"
301  LDFLAGS="-L\$(libdir) -lgmp $LDFLAGS"
302fi
303
304# memory manager
305if test "x$with_memman" != xno; then
306  alltargets="$alltargets mem"
307  installtargets="$installtargets installmem"
308  uninstalltargets="$uninstalltargets uninstallmem"
309  AC_DEFINE(USE_MEMUTIL)
310
311  if test "x$with_memman" != xnew; then
312    memmansrc="$memmansrc \$(oldmemmansrc)"
313    memmanincl='$(oldmemmanincl)'
314    AC_DEFINE(USE_OLD_MEMMAN)
315  else
316    memmansrc="$memmansrc \$(newmemmansrc)"
317    memmanincl='$(newmemmanincl)'
318
319    if test "x$enable_memdebug" = xfull; then
320      AC_DEFINE(MDEBUG, 1)
321    elif test "x$enable_memdebug" != xno; then
322      AC_DEFINE(MDEBUG, 0)
323    fi
324  fi
325fi
326
327# iostream
328if test "x$enable_streamio" = xno; then
329  AC_DEFINE(NOSTREAMIO)
330else
331  factorysrc="$factorysrc \$(useiofactorysrc)"
332  factoryincl="$factoryincl \$(useiofactoryincl)"
333fi
334
335# assertions
336if test "x$enable_assertions" = xno; then
337  AC_DEFINE(NOASSERT)
338fi
339
340#
341# - debugoutput and timing magic.
342#
343# For those who do not like this: As long as you do not specify
344# --enable-timing or --enable-debugoutput the following code will
345# not be executed.
346#
347timingtargets=/dev/null
348debouttargets=/dev/null
349debtimingtargets=/dev/null
350enhanceddebtime=no
351
352# timing
353if test "x$enable_timing" != xno; then
354  if test "x$enable_timing" = xyes; then
355    AC_DEFINE(TIMING)
356  else
357    echo "$enable_timing" | tr ',' '\n' | sed 's/\..*$//' | sort > conftest.time
358    timingtargets=conftest.time
359    enhanceddebtime=yes
360  fi
361fi
362
363# debugoutput
364if test "x$enable_debugoutput" != xno; then
365  if test "x$enable_debugoutput" = xyes; then
366    AC_DEFINE(DEBUGOUTPUT)
367  else
368    echo "$enable_debugoutput" | tr ',' '\n' | sed 's/\..*$//' | sort > conftest.debout
369    debouttargets=conftest.debout
370    enhanceddebtime=yes
371  fi
372fi
373
374# create makefile fragments
375if test "x$enhanceddebtime" = xyes; then
376  # get the intersection of timingtargets and debouttargets
377  sort "$timingtargets" "$debouttargets" | uniq -d > conftest.debtime
378  if test -s conftest.debtime; then
379    debtimingtargets=conftest.debtime
380  fi
381  if test "x$timingtargets" != x/dev/null; then
382    # get difference of timingtargets and debtimingtargets
383    sort "$timingtargets" "$debtimingtargets" | uniq -u |
384      while read line; do
385        echo "$line.o: $line.cc config.h;" '$(CXX) -c $< -DTIMING $(LIBCXXFLAGS) -o $@'
386      done > conftest.tmp
387    mv conftest.tmp "$timingtargets"
388  fi
389  if test "x$debouttargets" != x/dev/null; then
390    # get difference of debouttargets and debtimingtargets
391    sort "$debouttargets" "$debtimingtargets" | uniq -u |
392      while read line; do
393        echo "$line.o: $line.cc config.h;" '$(CXX) -c $< -DDEBUGOUTPUT $(LIBCXXFLAGS) -o $@'
394      done > conftest.tmp
395    mv conftest.tmp "$debouttargets"
396  fi
397  if test "x$debtimingtargets" != x/dev/null; then
398    while read line; do
399      echo "$line.o: $line.cc config.h;" '$(CXX) -c $< -DTIMING -DDEBUGOUTPUT $(LIBCXXFLAGS) -o $@'
400    done < "$debtimingtargets" > conftest.tmp
401    mv conftest.tmp "$debtimingtargets"
402  fi
403fi
404
405#
406# - complete and substitute variables, defines.
407#
408AC_SUBST(gftabledir)
409AC_SUBST(templatedir)
410
411AC_SUBST(factory_version)
412
413AC_SUBST(libfactory)
414
415AC_SUBST(ARFLAGS)
416AC_SUBST(MAKEHEADERFLAGS)
417
418AC_SUBST(factorysrc)
419AC_SUBST(factoryincl)
420AC_SUBST(memmansrc)
421AC_SUBST(memmanincl)
422
423AC_SUBST(alltargets)
424AC_SUBST(installtargets)
425AC_SUBST(uninstalltargets)
426
427AC_SUBST_FILE(timingtargets)
428AC_SUBST_FILE(debouttargets)
429AC_SUBST_FILE(debtimingtargets)
430
431AC_DEFINE_UNQUOTED(FACTORYVERSION, "$factory_version")
432AC_DEFINE_UNQUOTED(GFTABLEDIR, "$expl_gftabledir")
433
434AC_OUTPUT(GNUmakefile)
Note: See TracBrowser for help on using the repository browser.