source: git/factory/configure.in @ f0596e

spielwiese
Last change on this file since f0596e was 818045, checked in by Jens Schmidt <schmidt@…>, 27 years ago
* configure.in (expl_datadir): initialization fixed. If $expl_datadir is relative we prepend the current working directory now. git-svn-id: file:///usr/local/Singular/svn/trunk@690 2c84dea3-7e68-4137-9b89-c4e89433aadc
  • Property mode set to 100644
File size: 10.9 KB
Line 
1dnl $Id: configure.in,v 1.8 1997-09-10 13:50:44 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.8 1997-09-10 13:50:44 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# get absolute path of expl_datadir
233if echo "$expl_datadir" | grep -v '^/' > /dev/null 2> /dev/null; then
234  expl_datadir="`pwd`/$expl_datadir"
235fi
236
237if test "x$with_Singular" = xyes; then
238  gftabledir='${datadir}/Singular/gftables'
239  expl_gftabledir="$expl_datadir/Singular/gftables"
240  templatedir='${includedir}/templates'
241else
242  gftabledir='${datadir}/factory/gftables'
243  expl_gftabledir="$expl_datadir/factory/gftables"
244  templatedir='${includedir}/templates'
245fi
246
247#
248# - the name of the game and the targets to create.
249#
250if test "x$with_Singular" = xyes; then
251  libfactory=libsingcf.a
252
253  factorysrc='$(basefactorysrc) $(singfactorysrc)'
254  factoryincl='$(basefactoryincl) $(singfactoryincl)'
255  memmansrc=
256  memmanincl=
257
258  alltargets=cf
259  installtargets=installcf
260  uninstalltargets=uninstallcf
261else
262  libfactory=libcf.a
263
264  factorysrc='$(basefactorysrc)'
265  factoryincl='$(basefactoryincl)'
266  memmansrc='$(basememmansrc)'
267  memmanincl=
268
269  alltargets=cf
270  installtargets=installcf
271  uninstalltargets=uninstallcf
272fi
273
274#
275# - set defines and variables according to our tests.
276#
277
278# CFLAGS
279if test "x$GCC" = xyes && test "x$cflags_expl_set" = xno; then
280  CFLAGS="-O2 -fomit-frame-pointer"
281fi
282
283# CXXFLAGS
284if test "x$GXX" = xyes && test "x$cxxflags_expl_set" = xno; then
285  CXXFLAGS="-O2 -fomit-frame-pointer"
286fi
287
288# ARFLAGS
289test "${ARFLAGS+set}" = set || ARFLAGS=cr
290
291# Singular
292if test "x$with_Singular" = xyes; then
293  AC_DEFINE(SINGULAR)
294fi
295
296# arithmetic shift
297if test "x$ac_cv_shift" = xyes; then   
298  AC_DEFINE(HAS_ARITHMETIC_SHIFT)
299fi
300
301# gmp-stuff.  we must not set these flags before the tests
302# are finished!
303if test "x$gmp_in_installation" = xyes; then
304  CPPFLAGS="-I\$(includedir) $CPPFLAGS"
305  LDFLAGS="-L\$(libdir) -lgmp $LDFLAGS"
306fi
307
308# memory manager
309if test "x$with_memman" != xno; then
310  alltargets="$alltargets mem"
311  installtargets="$installtargets installmem"
312  uninstalltargets="$uninstalltargets uninstallmem"
313  AC_DEFINE(USE_MEMUTIL)
314
315  if test "x$with_memman" != xnew; then
316    memmansrc="$memmansrc \$(oldmemmansrc)"
317    memmanincl='$(oldmemmanincl)'
318    AC_DEFINE(USE_OLD_MEMMAN)
319  else
320    memmansrc="$memmansrc \$(newmemmansrc)"
321    memmanincl='$(newmemmanincl)'
322
323    if test "x$enable_memdebug" = xfull; then
324      AC_DEFINE(MDEBUG, 1)
325    elif test "x$enable_memdebug" != xno; then
326      AC_DEFINE(MDEBUG, 0)
327    fi
328  fi
329fi
330
331# iostream
332if test "x$enable_streamio" = xno; then
333  AC_DEFINE(NOSTREAMIO)
334else
335  factorysrc="$factorysrc \$(useiofactorysrc)"
336  factoryincl="$factoryincl \$(useiofactoryincl)"
337fi
338
339# assertions
340if test "x$enable_assertions" = xno; then
341  AC_DEFINE(NOASSERT)
342fi
343
344#
345# - debugoutput and timing magic.
346#
347# For those who do not like this: As long as you do not specify
348# --enable-timing or --enable-debugoutput the following code will
349# not be executed.
350#
351timingtargets=/dev/null
352debouttargets=/dev/null
353debtimingtargets=/dev/null
354enhanceddebtime=no
355
356# timing
357if test "x$enable_timing" != xno; then
358  if test "x$enable_timing" = xyes; then
359    AC_DEFINE(TIMING)
360  else
361    echo "$enable_timing" | tr ',' '\n' | sed 's/\..*$//' | sort > conftest.time
362    timingtargets=conftest.time
363    enhanceddebtime=yes
364  fi
365fi
366
367# debugoutput
368if test "x$enable_debugoutput" != xno; then
369  if test "x$enable_debugoutput" = xyes; then
370    AC_DEFINE(DEBUGOUTPUT)
371  else
372    echo "$enable_debugoutput" | tr ',' '\n' | sed 's/\..*$//' | sort > conftest.debout
373    debouttargets=conftest.debout
374    enhanceddebtime=yes
375  fi
376fi
377
378# create makefile fragments
379if test "x$enhanceddebtime" = xyes; then
380  # get the intersection of timingtargets and debouttargets
381  sort "$timingtargets" "$debouttargets" | uniq -d > conftest.debtime
382  if test -s conftest.debtime; then
383    debtimingtargets=conftest.debtime
384  fi
385  if test "x$timingtargets" != x/dev/null; then
386    # get difference of timingtargets and debtimingtargets
387    sort "$timingtargets" "$debtimingtargets" | uniq -u |
388      while read line; do
389        echo "$line.o: $line.cc config.h;" '$(CXX) -c $< -DTIMING $(LIBCXXFLAGS) -o $@'
390      done > conftest.tmp
391    mv conftest.tmp "$timingtargets"
392  fi
393  if test "x$debouttargets" != x/dev/null; then
394    # get difference of debouttargets and debtimingtargets
395    sort "$debouttargets" "$debtimingtargets" | uniq -u |
396      while read line; do
397        echo "$line.o: $line.cc config.h;" '$(CXX) -c $< -DDEBUGOUTPUT $(LIBCXXFLAGS) -o $@'
398      done > conftest.tmp
399    mv conftest.tmp "$debouttargets"
400  fi
401  if test "x$debtimingtargets" != x/dev/null; then
402    while read line; do
403      echo "$line.o: $line.cc config.h;" '$(CXX) -c $< -DTIMING -DDEBUGOUTPUT $(LIBCXXFLAGS) -o $@'
404    done < "$debtimingtargets" > conftest.tmp
405    mv conftest.tmp "$debtimingtargets"
406  fi
407fi
408
409#
410# - complete and substitute variables, defines.
411#
412AC_SUBST(gftabledir)
413AC_SUBST(templatedir)
414
415AC_SUBST(factory_version)
416
417AC_SUBST(libfactory)
418
419AC_SUBST(ARFLAGS)
420AC_SUBST(MAKEHEADERFLAGS)
421
422AC_SUBST(factorysrc)
423AC_SUBST(factoryincl)
424AC_SUBST(memmansrc)
425AC_SUBST(memmanincl)
426
427AC_SUBST(alltargets)
428AC_SUBST(installtargets)
429AC_SUBST(uninstalltargets)
430
431AC_SUBST_FILE(timingtargets)
432AC_SUBST_FILE(debouttargets)
433AC_SUBST_FILE(debtimingtargets)
434
435AC_DEFINE_UNQUOTED(FACTORYVERSION, "$factory_version")
436AC_DEFINE_UNQUOTED(GFTABLEDIR, "$expl_gftabledir")
437
438AC_OUTPUT(GNUmakefile)
Note: See TracBrowser for help on using the repository browser.