source: git/Singular/configure.in @ 1a5756

fieker-DuValspielwiese
Last change on this file since 1a5756 was 07dacd, checked in by Hans Schönemann <hannes@…>, 27 years ago
* hannes: clean up unused code: binom.cc extra.cc scanner.cc scanner.l numbers.cc numbers.h recovery with setjmp/longjmp: tesths.cc cntrlc.cc cntrlc.h changed error messages: ipassign.cc git-svn-id: file:///usr/local/Singular/svn/trunk@479 2c84dea3-7e68-4137-9b89-c4e89433aadc
  • Property mode set to 100644
File size: 11.9 KB
Line 
1dnl Process this file with autoconf to produce a configure script.
2AC_INIT(matpol.h)
3AC_CONFIG_HEADER(mod2.h)
4
5dnl
6dnl set the version here
7dnl
8SINGULAR_MAJOR_VERSION=1
9SINGULAR_MINOR_VERSION=1
10SINGULAR_SUB_VERSION=1
11VERSION_DATE="July 1997"
12AC_SUBST(SINGULAR_MAJOR_VERSION)
13AC_SUBST(SINGULAR_MINOR_VERSION)
14AC_SUBST(SINGULAR_SUB_VERSION)
15AC_DEFINE_UNQUOTED(SINGULAR_MAJOR_VERSION, ${SINGULAR_MAJOR_VERSION})
16AC_DEFINE_UNQUOTED(SINGULAR_MINOR_VERSION, ${SINGULAR_MINOR_VERSION})
17AC_DEFINE_UNQUOTED(S_VERSION1, "version: ${SINGULAR_MAJOR_VERSION}.${SINGULAR_MINOR_VERSION}.${SINGULAR_SUB_VERSION}")
18AC_DEFINE_UNQUOTED(S_VERSION2, "${VERSION_DATE}")
19
20dnl
21dnl paths stuff
22dnl
23AC_PREFIX_DEFAULT(`pwd`/..)
24
25dnl
26if test "x$datadir" = 'x${prefix}/share'; then
27  if test "x${prefix}" = xNONE; then
28    singulardatadir=${ac_default_prefix}/share/Singular;
29  else
30    singulardatadir=${prefix}/share/Singular;
31  fi
32else
33  singulardatadir=${datadir}/Singular;
34fi
35
36if test "x$infodir" = 'x${prefix}/info'; then
37  if test "x${prefix}" = xNONE; then
38    singularinfodir=${ac_default_prefix}/info;
39  else
40    singularinfodir=${prefix}/info;
41  fi
42else
43  singularinfodir=$infodir;
44fi
45AC_DEFINE_UNQUOTED(SINGULAR_DATADIR, "${singulardatadir}")
46AC_DEFINE_UNQUOTED(SINGULAR_INFODIR, "${singularinfodir}")
47
48AC_SUBST(singulardatadir)
49
50dnl
51dnl Checks for programs.
52dnl
53
54dnl compiler stuff
55dnl we do not want to have "-g -O" for CFLAGS 
56if test "${CXXFLAGS+set}" != set; then
57  ac_cxxflags_set=no
58  CXXFLAGS="-O"
59fi
60if test "${CFLAGS+set}" != set; then
61  CFLAGS="-O"
62  ac_cflags_set=no
63fi
64
65AC_PROG_CC
66AC_PROG_CPP
67AC_PROG_CXX
68AC_SET_MAKE
69
70dnl we prefer using gcc for compiling C++ files
71if test ${GXX} = yes; then
72  CXX=gcc
73fi 
74
75dnl and add to -I to CPPFLAGS and and -Lto LDFLAGS, just to be sure
76if test "$libdir" = '${exec_prefix}/lib'; then
77  if test "x$exec_prefix" = xNONE; then
78    if test "x$prefix" = xNONE; then
79      LDFLAGS="-L${ac_default_prefix}/lib ${LDFLAGS}"
80    else
81      LDFLAGS="-L${prefix}/lib ${LDFLAGS}"
82    fi
83  else
84    LDFLAGS="-L${exec_prefix}/lib ${LDFLAGS}"
85  fi
86else
87  LDFLAGS="-L${libdir} ${LDFLAGS}"
88fi
89
90if test "$includedir" = '${prefix}/include'; then
91  if test "x$prefix" = xNONE; then
92    CPPFLAGS="-I${ac_default_prefix}/include ${CPPFLAGS}"
93  else
94    CPPFLAGS="-I${prefix}/include ${CPPFLAGS}"
95  fi
96else
97  CPPFLAGS="-I${includedir} ${CPPFLAGS}"
98fi
99
100dnl programs to built the grammar/parser
101dnl check for info
102if test "$with_info" != no; then
103  AC_CHECK_PROG(INFO, info, info)
104  if test -n "$INFO"; then
105    AC_DEFINE(HAVE_INFO)
106  fi
107fi
108
109 
110dnl
111dnl CHECK --without arguments
112dnl
113AC_ARG_WITH(
114  readline,
115  [  --without-readline   do not use readline for fancy display])
116
117AC_ARG_WITH(
118  MP,
119  [  --without-MP         do not use MP (disables MP links)])
120
121AC_ARG_WITH(
122  dbm,
123  [  --without-dbm        do not use dbm (disables DBM links)])
124AC_ARG_WITH(
125  info,
126  [  --without-info       do not use info for help (use buildin help, instead)])
127AC_ARG_WITH(
128  dld,
129  [  --without-dld        do not use dld (disables dynamic linking)])
130
131AC_ARG_WITH(
132  factory,
133  [  --without-factory    do not use factory (disables poly factorization)])
134
135AC_ARG_WITH(
136  libfac,
137  [  --without-libfac     do not use libfac (disables primary decompositions)])
138AC_ARG_WITH(apint, \
139 [ --with-apint=PACKAGE    use PACKAGE for arbitary integer arithmetic
140                          where PACKAGE can be gmp, smallgmp, or buildin])
141
142dnl
143dnl CHECK VARIOUS LIBRARIES
144dnl for gmp, MP, factory and libfac, we built them in, even if the libs
145dnl and headers were not found under the condition that the respective
146dnl  --enable argument was given
147dnl
148 
149AC_CHECK_LIB(m, atof)
150AC_CHECK_LIB(bsd, socket)
151AC_CHECK_LIB(socket, listen)
152AC_CHECK_LIB(nsl, gethostbyname)
153
154dnl Check -lreadline
155if test "$with_readline" != no; then
156  AC_CHECK_LIB(ncurses,tgetent,,\
157   AC_CHECK_LIB(curses,tgetent,,\
158   AC_CHECK_LIB(termcap,tgetent)))
159  AC_CHECK_LIB(readline, rl_abort)
160  if test "$ac_cv_lib_readline_rl_abort" = yes; then
161     AC_CHECK_HEADERS(readline/readline.h readline/history.h sys/file.h,ac_readline_ok=yes,ac_readline_ok=no; break)
162   fi
163   if test "$ac_readline_ok" = yes; then
164     AC_DEFINE(HAVE_READLINE)
165   else
166     AC_MSG_WARN(building without readline: disabling fancy display);
167     AC_DEFINE(HAVE_FEREAD)
168   fi
169 else
170   AC_DEFINE(HAVE_FEREAD)
171fi
172 
173dnl Check dbm
174if test "$with_dbm" != no; then
175  AC_CHECK_LIB(
176    dbm,
177    dbminit,
178    AC_DEFINE(HAVE_DBM) LIBS="-ldbm $LIBS",
179    AC_CHECK_LIB(
180      gdbm,
181      dbminit,
182      AC_DEFINE(HAVE_DBM) LIBS="-lgdbm $LIBS",
183      AC_MSG_WARN(building without dbm: disabling DBM links)))
184fi
185
186dnl Check dld
187if test "$with_dld" = yes; then
188  AC_CHECK_LIB(dld, dld_init,\
189   AC_MSG_WARN(building without dld: disabling dynamic linking))
190fi
191
192NEED_LIBS=$LIBS
193
194AC_CHECK_LIB(gmp, mpq_init)
195AC_CHECK_LIB(smallgmp, mpz_init)
196AC_CHECK_LIB(MP, IMP_PutGmpInt)
197AC_CHECK_LIB(MPT, MPT_GetTree)
198AC_CHECK_LIB(singcf, atof)
199AC_CHECK_LIB(singfac, atof)
200
201AC_CHECK_HEADERS(gmp.h smallgmp.h MP.h  MPT.h factory.h factor.h)
202
203if test "$ac_cv_lib_gmp_mpq_init" = yes && \
204 test "$ac_cv_header_gmp_h" = yes; then
205    ac_gmp_ok=yes
206fi
207
208if test "$ac_cv_lib_smallgmp_mpz_init" = yes && \
209 test "$ac_cv_header_smallgmp_h" = yes && \
210 test "$ac_cv_header_gmp_h" = yes; then
211    ac_smallgmp_ok=yes
212fi
213
214if test "$ac_cv_lib_MP_IMP_PutGmpInt" = yes && \
215 test "$ac_cv_lib_MPT_MPT_GetTree" && \
216 test "$ac_cv_header_MP_h" = yes && \
217 test "$ac_cv_header_MPT_h" = yes; then
218  ac_MP_ok=yes
219fi
220
221if test "$ac_cv_lib_singcf_atof" = yes && \
222 test "$ac_cv_header_factory_h" = yes; then
223  ac_factory_ok=yes
224fi
225
226if test "$ac_cv_lib_singfac_atof" = yes && \
227 test "$ac_cv_header_factor_h" = yes; then
228  ac_libfac_ok=yes
229fi
230
231dnl Check gmp
232if test "$with_apint" != buildin; then
233  if test "$with_apint" = gmp; then
234    if test "$ac_gmp_ok" = yes; then
235      ac_will_have_gmp=yes
236    elif test "$enable_gmp" = yes; then
237      ac_will_have_gmp=yes
238      AC_MSG_WARN(install gmp before making Singular)
239    else
240      AC_MSG_ERROR(Can not use with gmp: lib/header not found)
241    fi
242  elif test "$with_apint" = smallgmp; then
243    if test "$ac_smallgmp_ok" = yes; then
244      ac_will_have_gmp=yes
245      ac_will have_smallgmp=yes
246    elif test "$enable_gmp" = yes; then
247      ac_will_have_gmp=yes
248      ac_will_have_smallgmp=yes
249      AC_MSG_WARN(install smallgmp before making Singular)
250    else
251      AC_MSG_ERROR(Can not use with smallgmp: lib/header not found)
252    fi
253  elif test "$ac_gmp_ok" = yes; then
254    ac_will_have_gmp=yes
255  elif test "$ac_smallgmp_ok" = yes || test "$enable_smallgmp" = yes; then
256    ac_will_have_gmp=yes
257    ac_will_have_smallgmp=yes
258  elif test "$enable_gmp" = yes; then
259    ac_will_have_gmp=yes
260  fi
261fi
262AC_MSG_CHECKING(which apint package to use)
263if test "$ac_will_have_gmp" = yes; then
264  AC_DEFINE(HAVE_GMP)
265  if test "$ac_will_have_smallgmp" = yes; then
266    NEED_LIBS="-lsmallgmp ${NEED_LIBS}"
267    AC_MSG_RESULT(smallgmp)
268    AC_DEFINE(HAVE_SMALLGMP)
269  else
270    NEED_LIBS="-lgmp ${NEED_LIBS}"
271    AC_MSG_RESULT(gmp)
272  fi
273else
274  AC_MSG_RESULT(buildin)
275fi
276
277dnl Check MP
278WITH_MP=no
279if test "$with_MP" != no; then
280  if test "$ac_will_have_gmp" != yes; then
281    AC_MSG_WARN(Need gmp to build with MP)
282  else
283    if test "$ac_MP_ok" = yes; then
284      WITH_MP=yes
285    elif test "$enable_MP" = yes; then
286      WITH_MP=yes
287      AC_MSG_WARN(Install MP before making Singular)
288    else
289      AC_MSG_WARN(Need MP library to build with MP)
290    fi
291  fi
292fi
293AC_MSG_CHECKING(whether to use with MP)
294AC_SUBST(WITH_MP)
295if test "$WITH_MP" = yes; then
296  AC_DEFINE(HAVE_MPSR)
297  NEED_LIBS="-lMPT -lMP ${NEED_LIBS}"
298  AC_MSG_RESULT(yes)
299else
300  AC_MSG_RESULT(no)
301fi
302
303dnl Check factory
304WITH_FACTORY=no
305if test "$with_factory" != no; then
306  if test "$ac_will_have_gmp" != yes; then
307    AC_MSG_WARN(Need gmp to build with factory)
308  else
309    if test "$ac_factory_ok" = yes; then
310      WITH_FACTORY=yes
311    elif test "$enable_factory" = yes; then
312      WITH_FACTORY=yes
313      AC_MSG_WARN(Install factory before making Singular)
314    else
315      AC_MSG_WARN(Need factory library to build with factory)
316    fi
317  fi
318fi
319AC_MSG_CHECKING(whether to use with factory)
320AC_SUBST(WITH_FACTORY)
321if test "$WITH_FACTORY" = yes; then
322  AC_DEFINE(HAVE_FACTORY)
323  NEED_LIBS="-lsingcf ${NEED_LIBS}"
324  AC_MSG_RESULT(yes)
325else
326  AC_MSG_RESULT(no)
327fi
328
329dnl Check libfac
330WITH_LIBFAC=no
331if test "$with_libfac" != no; then
332  if test "$WITH_FACTORY" != yes; then
333    AC_MSG_WARN(Need factory to build with libfac)
334  else
335    if test "$ac_libfac_ok" = yes; then
336      WITH_LIBFAC=yes
337    elif test "$enable_libfac" = yes; then
338      WITH_LIBFAC=yes
339      AC_MSG_WARN(Install libfac before making Singular)
340    else
341      AC_MSG_WARN(Need libfac library to build with libfac)
342    fi
343  fi
344fi
345AC_MSG_CHECKING(whether to use with libfac)
346AC_SUBST(WITH_LIBFAC)
347if test "$WITH_LIBFAC" = yes; then
348  AC_DEFINE(HAVE_LIBFAC_P)
349  NEED_LIBS="-lsingfac ${NEED_LIBS}"
350  AC_MSG_RESULT(yes)
351else
352  AC_MSG_RESULT(no)
353fi
354AC_SUBST(NEED_LIBS)
355
356dnl
357dnl CHECKS FOR HEADER FILES.
358dnl
359
360AC_HEADER_STDC
361
362AC_CHECK_HEADERS(limits.h unistd.h,,
363  AC_MSG_ERROR(Can not compile without limits.h unistd.h))
364
365AC_CHECK_HEADERS(sys/file.h sys/ioctl.h sys/time.h sys/times.h)
366
367dnl
368dnl Checks for typedefs, structures, and compiler characteristics.
369dnl 
370AC_C_CONST
371AC_C_INLINE
372AC_TYPE_SIZE_T
373AC_HEADER_TIME
374AC_STRUCT_TM
375
376dnl
377dnl Checks for library functions.
378dnl
379AC_FUNC_ALLOCA
380AC_PROG_GCC_TRADITIONAL
381AC_FUNC_MMAP
382AC_TYPE_SIGNAL
383AC_FUNC_VPRINTF
384AC_CHECK_FUNCS(gettimeofday strstr strtod strtol atexit)
385
386dnl
387dnl System specific tests
388dnl
389
390dnl arithmetic shifts
391AC_MSG_CHECKING(whether your machine has correct arithmetic shifts)
392AC_CACHE_VAL(ac_cv_shift, AC_TRY_RUN(
393  [ int main() { if (-2 >> 1 == -1) exit(0); else exit(1); } ],
394   ac_cv_shift=yes,
395   ac_cv_shift=no,
396   1))
397if test "$ac_cv_shift" = yes; then   
398  AC_MSG_RESULT(yes)
399else
400  AC_MSG_RESULT(no)
401  AC_MSG_ERROR(need  -2 >> 1 == -1)
402fi
403
404
405dnl sizeof(int) == 4
406AC_MSG_CHECKING(whether sizeof int is four bytes)
407AC_CACHE_VAL(ac_cv_sizeof_int_equals_four, AC_TRY_RUN(
408[ int main() {if (sizeof(int) == 4)  exit(0); else exit(1); } ],
409  ac_cv_sizeof_int_equals_four=yes,
410  ac_cv_sizeof_int_equals_four=no,
411  1))
412
413if test "$ac_cv_sizeof_int_equals_four" = yes; then
414  AC_MSG_RESULT(yes)
415else
416  AC_MSG_RESULT(no)
417  AC_MSG_ERROR(need int to be four bytes long)
418fi
419
420dnl sizeof(long) == sizeof (void *)
421AC_MSG_CHECKING(whether sizeof long equals sizeof void*)
422AC_CACHE_VAL(ac_cv_sizeof_long_equals_voidp, AC_TRY_RUN(
423  [ int main() {if (sizeof(long) == sizeof(void*))  exit(0); else exit(1); }],
424    ac_cv_sizeof_long_equals_voidp=yes,
425    ac_cv_sizeof_long_equals_voidp=no,
426    1))
427if test "$ac_cv_sizeof_long_equals_voidp" = yes; then
428  AC_MSG_RESULT(yes)
429else
430  AC_MSG_RESULT(no)
431  AC_MSG_ERROR(need equal sizes for long and void*)
432fi
433
434dnl sprintf returns number of printed chars
435AC_MSG_CHECKING(whether vsprintf returns number of printed chars)
436AC_CACHE_VAL(ac_cv_returns_n_of_chars, AC_TRY_RUN(
437 [#include <stdio.h>
438 main() { char *str=(char*)malloc(20); if (((int) sprintf(str,"123456789")) == 9) exit(0); else exit(1); }],
439   ac_cv_returns_n_of_chars=yes,
440   ac_cv_returns_n_of_chars=no,
441   1))
442if test "$ac_cv_returns_n_of_chars" = yes; then
443  AC_MSG_RESULT(yes)
444else
445  AC_MSG_RESULT(no)
446  AC_DEFINE(BSD_SPRINTF)
447fi
448
449dnl determine ALIGN_8
450AC_CHECK_SIZEOF(void*,4)
451
452
453dnl
454dnl Last, but not least, customize CFLAGS
455dnl
456AC_MSG_CHECKING(whether _AIX is defined)
457AC_CACHE_VAL(ac_cv_is_aix,
458AC_EGREP_CPP(yes,
459[#ifdef _AIX
460    yes
461#endif
462], ac_cv_is_aix=yes, ac_cv_is_aix=no, 1))
463if test "$ac_cv_is_aix" = yes; then
464  AC_MSG_RESULT(yes)
465else
466  AC_MSG_RESULT(no)
467fi
468
469
470if test ${GXX} = yes; then
471  if test "$ac_cxxflags_set" = no; then
472    CXXFLAGS="-O3 -w -fomit-frame-pointer"
473  fi
474  CXXTEMPLFLAGS="-fno-implicit-templates"
475  if test "$ac_cv_is_aix" = yes; then
476    CXXNOOPTFLAGS="-w"
477  else
478    CXXNOOPTFLAGS=$CXXFLAGS
479  fi
480else
481  CXXTEMPFLAGS=""
482  CXXNOOPTFLAGS=$CXXFLAGS
483fi
484AC_SUBST(CXXTEMPLFLAGS)
485AC_SUBST(CXXNOOPTFLAGS)
486
487if test ${GCC} = yes && test "$ac_cflags_set" = no ; then
488  CFLAGS="-O3 -w -fomit-frame-pointer"
489fi
490
491AC_OUTPUT(Makefile doc/Makefile, \
492 if test "$CONFIG_HEADERS"; then echo timestamp > stamp-h; fi)
Note: See TracBrowser for help on using the repository browser.