source: git/Singular/configure.in @ 3bb3e6a

spielwiese
Last change on this file since 3bb3e6a was 3bb3e6a, checked in by Olaf Bachmann <obachman@…>, 25 years ago
* status with sleep git-svn-id: file:///usr/local/Singular/svn/trunk@1961 2c84dea3-7e68-4137-9b89-c4e89433aadc
  • Property mode set to 100644
File size: 13.5 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=2
10SINGULAR_SUB_VERSION=0
11VERSION_DATE="May 1998"
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}")
19AC_DEFINE_UNQUOTED(SINGULAR_SUB_VERSION, ${SINGULAR_SUB_VERSION})
20
21dnl
22dnl paths stuff
23dnl
24AC_PREFIX_DEFAULT(`pwd`/..)
25
26dnl
27if test "x$datadir" = 'x${prefix}/share'; then
28  if test "x${prefix}" = xNONE; then
29    singulardatadir=${ac_default_prefix}/share/Singular;
30  else
31    singulardatadir=${prefix}/share/Singular;
32  fi
33else
34  singulardatadir=${datadir}/Singular;
35fi
36
37if test "x$infodir" = 'x${prefix}/info'; then
38  if test "x${prefix}" = xNONE; then
39    singularinfodir=${ac_default_prefix}/info;
40  else
41    singularinfodir=${prefix}/info;
42  fi
43else
44  singularinfodir=$infodir;
45fi
46
47dnl
48dnl Checks for programs.
49dnl
50
51dnl compiler stuff
52dnl we do not want to have "-g -O" for CFLAGS 
53if test "${CXXFLAGS+set}" != set; then
54  ac_cxxflags_set=no
55  CXXFLAGS="-O"
56fi
57if test "${CFLAGS+set}" != set; then
58  CFLAGS="-O"
59  ac_cflags_set=no
60fi
61
62# check whether CXX was set by user as env variable
63if test "${CXX+set}" != set; then
64  ac_cxx_set=no
65else
66  ac_cxx_set=yes
67fi
68
69AC_PROG_LEX
70# make sure lex accepts -P option
71if test "${ac_cv_prog_LEX+set}" = set; then
72  AC_MSG_CHECKING(whether ${ac_cv_prog_LEX} accepts -P)
73  if ${ac_cv_prog_LEX} -P < /dev/null 2>&1| grep flag > /dev/null 2>&1; then
74    AC_MSG_RESULT(no)
75    AC_MSG_WARN(Can not run ${ac_cv_prog_LEX} with -P; make might fail)
76    LEXP=touch
77  else
78    AC_MSG_RESULT(yes)
79    LEXP=${ac_cv_prog_LEX}
80  fi
81fi
82AC_SUBST(LEXP)
83AC_PROG_CC
84AC_PROG_CPP
85AC_PROG_CXX
86AC_SET_MAKE
87AC_C_CROSS
88
89if test "$ac_cv_c_cross" = yes && test "$target" = "i386-unknown-msdos"; then
90  ac_c_cross_dos=yes
91  DOS_CROSS=yes
92else
93  ac_c_cross_dos=no
94  DOS_CROSS=no
95fi
96AC_SUBST(DOS_CROSS)
97
98if test "$ac_c_cross_dos" = yes; then
99  AC_DEFINE(SINGULAR_DATADIR, "share\\Singular")
100  AC_DEFINE(SINGULAR_INFODIR, "info")
101else
102  AC_DEFINE_UNQUOTED(SINGULAR_DATADIR, "${singulardatadir}")
103  AC_DEFINE_UNQUOTED(SINGULAR_INFODIR, "${singularinfodir}")
104fi
105AC_SUBST(singulardatadir)
106
107
108dnl we prefer using gcc for compiling C++ files, provided the user did
109dnl not overwrite it explicitely
110if test ${GXX} = yes && test "${ac_cxx_set}" = no; then
111  CXX=gcc
112fi 
113
114dnl and add to -I to CPPFLAGS and and -Lto LDFLAGS, just to be sure
115if test "$libdir" = '${exec_prefix}/lib'; then
116  if test "x$exec_prefix" = xNONE; then
117    if test "x$prefix" = xNONE; then
118      LDFLAGS="-L${ac_default_prefix}/lib ${LDFLAGS}"
119    else
120      LDFLAGS="-L${prefix}/lib ${LDFLAGS}"
121    fi
122  else
123    LDFLAGS="-L${exec_prefix}/lib ${LDFLAGS}"
124  fi
125else
126  LDFLAGS="-L${libdir} ${LDFLAGS}"
127fi
128
129if test "$includedir" = '${prefix}/include'; then
130  if test "x$prefix" = xNONE; then
131    CPPFLAGS="-I${ac_default_prefix}/include ${CPPFLAGS}"
132  else
133    CPPFLAGS="-I${prefix}/include ${CPPFLAGS}"
134  fi
135else
136  CPPFLAGS="-I${includedir} ${CPPFLAGS}"
137fi
138
139dnl check for info
140if test "$with_info" != no; then
141  AC_CHECK_PROG(INFO, info, info)
142  if test -n "$INFO"; then
143    AC_DEFINE(HAVE_INFO)
144  fi
145fi
146
147dnl check for perl
148AC_CHECK_PROG(PERL, perl5, perl5, perl)
149 
150dnl
151dnl CHECK --without arguments
152dnl
153AC_ARG_WITH(
154  readline,
155  [  --without-readline   do not use readline for fancy display])
156
157AC_ARG_WITH(
158  MP,
159  [  --without-MP         do not use MP (disables MP links)])
160
161AC_ARG_WITH(
162  dbm,
163  [  --without-dbm        do not use dbm (disables DBM links)])
164AC_ARG_WITH(
165  info,
166  [  --without-info       do not use info for help (use buildin help, instead)])
167AC_ARG_WITH(
168  dld,
169  [  --without-dld        do not use dld (disables dynamic linking)])
170
171AC_ARG_WITH(
172  factory,
173  [  --without-factory    do not use factory (disables poly factorization)])
174
175AC_ARG_WITH(
176  libfac,
177  [  --without-libfac     do not use libfac (disables primary decompositions)])
178AC_ARG_WITH(apint, \
179 [ --with-apint=PACKAGE    use PACKAGE for arbitary integer arithmetic
180                          where PACKAGE can be gmp, smallgmp, or buildin])
181AC_ARG_WITH(
182  exp_type,
183  [  --with-exp_type=TYPE uses TYPE as type of exponents in polynomials
184                          -- default type is short
185                          -- possible other types are char and int])
186
187dnl
188dnl CHECK VARIOUS LIBRARIES
189dnl for gmp, MP, factory and libfac, we built them in, even if the libs
190dnl and headers were not found under the condition that the respective
191dnl  --enable argument was given
192dnl
193 
194AC_CHECK_LIB(m, atof)
195AC_CHECK_LIB(bsd, socket)
196AC_CHECK_LIB(socket, listen)
197AC_CHECK_LIB(nsl, gethostbyname)
198AC_CHECK_LIB(ucb, index)
199
200dnl Check -lreadline
201if test "$with_readline" != no; then
202  AC_CHECK_LIB(ncurses,tgetent,,\
203   AC_CHECK_LIB(curses,tgetent,,\
204   AC_CHECK_LIB(termcap,tgetent)))
205  AC_CHECK_LIB(readline, rl_abort)
206  if test "$ac_cv_lib_readline_rl_abort" = yes; then
207     AC_CHECK_HEADERS(readline/readline.h readline/history.h sys/file.h,ac_readline_ok=yes,ac_readline_ok=no; break)
208   fi
209   if test "$ac_readline_ok" = yes; then
210     AC_DEFINE(HAVE_READLINE)
211   else
212     AC_MSG_WARN(building without readline: disabling fancy display);
213     AC_DEFINE(HAVE_FEREAD)
214   fi
215 else
216   AC_DEFINE(HAVE_FEREAD)
217fi
218 
219dnl Check dld
220if test "$with_dld" = yes; then
221  AC_CHECK_LIB(dld, dld_init,\
222   AC_MSG_WARN(building without dld: disabling dynamic linking))
223fi
224
225NEED_LIBS=$LIBS
226
227AC_CHECK_LIB(gmp, mpq_init)
228if test "ac_cv_lib_gmp_mpq_init" = yes && test "$with-apint" = smallgmp; then
229  LIBS=NEED_LIBS
230fi
231AC_CHECK_LIB(smallgmp, mpz_init)
232AC_CHECK_LIB(MP, IMP_PutGmpInt)
233AC_CHECK_LIB(MPT, MPT_GetTree)
234AC_CHECK_LIB(singcf, atof)
235AC_CHECK_LIB(singfac, atof)
236
237AC_CHECK_HEADERS(gmp.h smallgmp.h MP.h  MPT.h factory.h factor.h)
238
239if test "$ac_cv_lib_gmp_mpq_init" = yes && \
240 test "$ac_cv_header_gmp_h" = yes; then
241    ac_gmp_ok=yes
242fi
243
244if test "$ac_cv_lib_smallgmp_mpz_init" = yes && \
245 test "$ac_cv_header_smallgmp_h" = yes && \
246 test "$ac_cv_header_gmp_h" = yes; then
247    ac_smallgmp_ok=yes
248fi
249
250if test "$ac_cv_lib_MP_IMP_PutGmpInt" = yes && \
251 test "$ac_cv_lib_MPT_MPT_GetTree" && \
252 test "$ac_cv_header_MP_h" = yes && \
253 test "$ac_cv_header_MPT_h" = yes; then
254  ac_MP_ok=yes
255fi
256
257if test "$ac_cv_lib_singcf_atof" = yes && \
258 test "$ac_cv_header_factory_h" = yes; then
259  ac_factory_ok=yes
260fi
261
262if test "$ac_cv_lib_singfac_atof" = yes && \
263 test "$ac_cv_header_factor_h" = yes; then
264  ac_libfac_ok=yes
265fi
266
267dnl Check gmp
268if test "$with_apint" != buildin; then
269  if test "$with_apint" = gmp; then
270    if test "$ac_gmp_ok" = yes; then
271      ac_will_have_gmp=yes
272    elif test "$enable_gmp" = yes; then
273      ac_will_have_gmp=yes
274      AC_MSG_WARN(install gmp before making Singular)
275    else
276      AC_MSG_ERROR(Can not use with gmp: lib/header not found)
277    fi
278  elif test "$with_apint" = smallgmp; then
279    if test "$ac_smallgmp_ok" = yes; then
280      ac_will_have_gmp=yes
281      ac_will_have_smallgmp=yes
282    elif test "$enable_smallgmp" = yes; then
283      ac_will_have_gmp=yes
284      ac_will_have_smallgmp=yes
285      AC_MSG_WARN(install smallgmp before making Singular)
286    else
287      AC_MSG_ERROR(Can not use with smallgmp: lib/header not found)
288    fi
289  elif test "$ac_gmp_ok" = yes; then
290    ac_will_have_gmp=yes
291  elif test "$ac_smallgmp_ok" = yes || test "$enable_smallgmp" = yes; then
292    ac_will_have_gmp=yes
293    ac_will_have_smallgmp=yes
294  elif test "$enable_gmp" = yes; then
295    ac_will_have_gmp=yes
296  fi
297fi
298AC_MSG_CHECKING(which apint package to use)
299if test "$ac_will_have_gmp" = yes; then
300  AC_DEFINE(HAVE_GMP)
301  if test "$ac_will_have_smallgmp" = yes; then
302    NEED_LIBS="-lsmallgmp ${NEED_LIBS}"
303    AC_MSG_RESULT(smallgmp)
304    AC_DEFINE(HAVE_SMALLGMP)
305  else
306    NEED_LIBS="-lgmp ${NEED_LIBS}"
307    AC_MSG_RESULT(gmp)
308  fi
309else
310  AC_MSG_RESULT(buildin)
311fi
312
313dnl Check MP
314WITH_MP=no
315if test "$with_MP" != no; then
316  if test "$ac_will_have_gmp" != yes; then
317    AC_MSG_WARN(Need gmp to build with MP)
318  else
319    if test "$ac_MP_ok" = yes; then
320      WITH_MP=yes
321    elif test "$enable_MP" = yes; then
322      WITH_MP=yes
323      AC_MSG_WARN(Install MP before making Singular)
324    else
325      AC_MSG_WARN(Need MP library to build with MP)
326    fi
327  fi
328fi
329AC_MSG_CHECKING(whether to use with MP)
330AC_SUBST(WITH_MP)
331if test "$WITH_MP" = yes; then
332  AC_DEFINE(HAVE_MPSR)
333  NEED_LIBS="-lMPT -lMP ${NEED_LIBS}"
334  AC_MSG_RESULT(yes)
335else
336  AC_MSG_RESULT(no)
337fi
338
339dnl Check factory
340WITH_FACTORY=no
341if test "$with_factory" != no; then
342  if test "$ac_will_have_gmp" != yes; then
343    AC_MSG_WARN(Need gmp to build with factory)
344  else
345    if test "$ac_factory_ok" = yes; then
346      WITH_FACTORY=yes
347    elif test "$enable_factory" = yes; then
348      WITH_FACTORY=yes
349      AC_MSG_WARN(Install factory before making Singular)
350    else
351      AC_MSG_WARN(Need factory library to build with factory)
352    fi
353  fi
354fi
355AC_MSG_CHECKING(whether to use with factory)
356AC_SUBST(WITH_FACTORY)
357if test "$WITH_FACTORY" = yes; then
358  AC_DEFINE(HAVE_FACTORY)
359  NEED_LIBS="-lsingcf ${NEED_LIBS}"
360  AC_MSG_RESULT(yes)
361else
362  AC_MSG_RESULT(no)
363fi
364
365dnl Check libfac
366WITH_LIBFAC=no
367if test "$with_libfac" != no; then
368  if test "$WITH_FACTORY" != yes; then
369    AC_MSG_WARN(Need factory to build with libfac)
370  else
371    if test "$ac_libfac_ok" = yes; then
372      WITH_LIBFAC=yes
373    elif test "$enable_libfac" = yes; then
374      WITH_LIBFAC=yes
375      AC_MSG_WARN(Install libfac before making Singular)
376    else
377      AC_MSG_WARN(Need libfac library to build with libfac)
378    fi
379  fi
380fi
381AC_MSG_CHECKING(whether to use with libfac)
382AC_SUBST(WITH_LIBFAC)
383if test "$WITH_LIBFAC" = yes; then
384  AC_DEFINE(HAVE_LIBFAC_P)
385  NEED_LIBS="-lsingfac ${NEED_LIBS}"
386  AC_MSG_RESULT(yes)
387else
388  AC_MSG_RESULT(no)
389fi
390AC_SUBST(NEED_LIBS)
391
392dnl
393dnl CHECKS FOR HEADER FILES.
394dnl
395
396AC_HEADER_STDC
397AC_CHECK_HEADERS(limits.h unistd.h,,
398  AC_MSG_ERROR(Can not compile without limits.h unistd.h))
399
400AC_CHECK_HEADERS(sys/file.h sys/ioctl.h sys/time.h sys/times.h sys/types.h sys/stat.h fcntl.h sys/param.h pwd.h)
401
402dnl Check dbm
403WITH_DBM=no
404AC_MSG_CHECKING(whether to build with dbm links)
405if test "$with_dbm" != no; then
406  AC_DEFINE(HAVE_DBM)
407  WITH_DBM=yes
408  AC_SUBST(WITH_DBM)
409  AC_MSG_RESULT(yes)
410else
411  AC_MSG_RESULT(no)
412fi
413
414dnl
415dnl Checks for typedefs, structures, and compiler characteristics.
416dnl 
417AC_C_CONST
418AC_C_INLINE
419AC_TYPE_SIZE_T
420AC_HEADER_TIME
421AC_STRUCT_TM
422
423dnl
424dnl Checks for library functions.
425dnl
426AC_FUNC_ALLOCA
427AC_PROG_GCC_TRADITIONAL
428AC_FUNC_MMAP
429AC_TYPE_SIGNAL
430AC_FUNC_VPRINTF
431AC_CHECK_FUNCS(gettimeofday atexit bcopy getcwd getwd sbrk readlink sleep)
432
433dnl
434dnl System specific tests
435dnl
436
437dnl arithmetic shifts
438AC_MSG_CHECKING(whether your machine has correct arithmetic shifts)
439AC_CACHE_VAL(ac_cv_shift, AC_TRY_RUN(
440  [ int main() { if (-2 >> 1 == -1) exit(0); else exit(1); } ],
441   ac_cv_shift=yes,
442   ac_cv_shift=no,
443   if test "$ac_c_cross_dos" = yes; then
444     ac_cv_shift=yes;
445   else
446     AC_MSG_RESULT(no)
447     AC_MSG_ERROR(cross compilation without default value)
448   fi))
449
450if test "$ac_cv_shift" = yes; then   
451  AC_MSG_RESULT(yes)
452else
453  AC_MSG_RESULT(no)
454  AC_MSG_ERROR(need  -2 >> 1 == -1)
455fi
456
457dnl sprintf returns number of printed chars
458AC_MSG_CHECKING(whether vsprintf returns number of printed chars)
459AC_CACHE_VAL(ac_cv_returns_n_of_chars, AC_TRY_RUN(
460 [#include <stdio.h>
461 main() { char *str=(char*)malloc(20); if (((int) sprintf(str,"123456789")) == 9) exit(0); else exit(1); }],
462   ac_cv_returns_n_of_chars=yes,
463   ac_cv_returns_n_of_chars=no,
464   ac_cv_returns_n_of_chars=no))
465if test "$ac_cv_returns_n_of_chars" = yes; then
466  AC_MSG_RESULT(yes)
467else
468  AC_MSG_RESULT(no)
469  AC_DEFINE(BSD_SPRINTF)
470fi
471
472dnl determine ALIGN_8
473
474AC_CHECK_SIZEOF(char,1)
475AC_CHECK_SIZEOF(short,2)
476AC_CHECK_SIZEOF(int,4)
477AC_CHECK_SIZEOF(long,4)
478AC_CHECK_SIZEOF(void*,4)
479AC_C_BIGENDIAN
480
481if test "$ac_cv_sizeof_int" != 4; then
482  AC_MSG_ERROR(need int to be four bytes long)
483fi
484
485if test "$ac_cv_sizeof_long" != "$ac_cv_sizeof_voidp"; then
486  AC_MSG_ERROR(need equal sizes for long and void*)
487fi
488
489dnl
490dnl figure out Exponent_t and Order_t
491dnl make sure that 2*sizeof(Exponent_t) + sizeof(Order_t) is aligned
492dnl
493AC_MSG_CHECKING(which exponent types to use)
494if test "$with_exp_type" = "char"; then
495  AC_MSG_RESULT(char)
496  AC_DEFINE(EXPONENT_TYPE, char)
497  AC_DEFINE(SIZEOF_EXPONENT, SIZEOF_CHAR)
498elif test "with_exp_type" = "int"; then
499  AC_MSG_RESULT(int)
500  AC_DEFINE(EXPONENT_TYPE, int)
501  AC_DEFINE(SIZEOF_EXPONENT, SIZEOF_INT)
502else
503  AC_MSG_RESULT(short)
504  AC_DEFINE(EXPONENT_TYPE, short)
505  AC_DEFINE(SIZEOF_TYPE, SIZEOF_SHORT)
506fi
507
508dnl
509dnl Last, but not least, customize CFLAGS
510dnl
511AC_MSG_CHECKING(whether _AIX is defined)
512AC_CACHE_VAL(ac_cv_is_aix,
513AC_EGREP_CPP(yes,
514[#ifdef _AIX
515    yes
516#endif
517], ac_cv_is_aix=yes, ac_cv_is_aix=no, 1))
518if test "$ac_cv_is_aix" = yes; then
519  AC_MSG_RESULT(yes)
520else
521  AC_MSG_RESULT(no)
522fi
523
524if test ${GXX} = yes; then
525  if test "$ac_cxxflags_set" = no; then
526    CXXFLAGS="-O3 -w -fomit-frame-pointer"
527  fi
528  CXXTEMPLFLAGS="-fno-implicit-templates"
529  if test "$ac_cv_is_aix" = yes; then
530    CXXNOOPTFLAGS="-w"
531  else
532    CXXNOOPTFLAGS=$CXXFLAGS
533  fi
534  STATIC_LDFLAGS="-Xlinker -Bstatic"
535else
536  CXXTEMPFLAGS=""
537  CXXNOOPTFLAGS=$CXXFLAGS
538  STATIC_LDFLAGS=""
539fi
540AC_SUBST(CXXTEMPLFLAGS)
541AC_SUBST(CXXNOOPTFLAGS)
542AC_SUBST(STATIC_LDFLAGS)
543
544if test ${GCC} = yes && test "$ac_cflags_set" = no ; then
545  CFLAGS="-O3 -w -fomit-frame-pointer"
546fi
547
548AC_OUTPUT(Makefile doc/Makefile newdoc/Makefile, \
549 if test "$CONFIG_HEADERS"; then echo timestamp > stamp-h; fi)
550
551
552
553
Note: See TracBrowser for help on using the repository browser.