source: git/Singular/configure.in @ 5480da

spielwiese
Last change on this file since 5480da was df3f4f, checked in by Olaf Bachmann <obachman@…>, 26 years ago
* fixed AC_CHECK_PROG(perl...) git-svn-id: file:///usr/local/Singular/svn/trunk@1288 2c84dea3-7e68-4137-9b89-c4e89433aadc
  • Property mode set to 100644
File size: 13.4 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=8
11VERSION_DATE="April 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
397
398AC_CHECK_HEADERS(limits.h unistd.h,,
399  AC_MSG_ERROR(Can not compile without limits.h unistd.h))
400
401AC_CHECK_HEADERS(sys/file.h sys/ioctl.h sys/time.h sys/times.h sys/types.h sys/stat.h fcntl.h)
402
403dnl Check dbm
404WITH_DBM=no
405AC_MSG_CHECKING(whether to build with dbm links)
406if test "$with_dbm" != no; then
407  AC_DEFINE(HAVE_DBM)
408  WITH_DBM=yes
409  AC_SUBST(WITH_DBM)
410  AC_MSG_RESULT(yes)
411else
412  AC_MSG_RESULT(no)
413fi
414
415dnl
416dnl Checks for typedefs, structures, and compiler characteristics.
417dnl 
418AC_C_CONST
419AC_C_INLINE
420AC_TYPE_SIZE_T
421AC_HEADER_TIME
422AC_STRUCT_TM
423
424dnl
425dnl Checks for library functions.
426dnl
427AC_FUNC_ALLOCA
428AC_PROG_GCC_TRADITIONAL
429AC_FUNC_MMAP
430AC_TYPE_SIGNAL
431AC_FUNC_VPRINTF
432AC_CHECK_FUNCS(gettimeofday strstr strtod strtol atexit bcopy)
433
434dnl
435dnl System specific tests
436dnl
437
438dnl arithmetic shifts
439AC_MSG_CHECKING(whether your machine has correct arithmetic shifts)
440AC_CACHE_VAL(ac_cv_shift, AC_TRY_RUN(
441  [ int main() { if (-2 >> 1 == -1) exit(0); else exit(1); } ],
442   ac_cv_shift=yes,
443   ac_cv_shift=no,
444   if test "$ac_c_cross_dos" = yes; then
445     ac_cv_shift=yes;
446   else
447     AC_MSG_RESULT(no)
448     AC_MSG_ERROR(cross compilation without default value)
449   fi))
450
451if test "$ac_cv_shift" = yes; then   
452  AC_MSG_RESULT(yes)
453else
454  AC_MSG_RESULT(no)
455  AC_MSG_ERROR(need  -2 >> 1 == -1)
456fi
457
458dnl sprintf returns number of printed chars
459AC_MSG_CHECKING(whether vsprintf returns number of printed chars)
460AC_CACHE_VAL(ac_cv_returns_n_of_chars, AC_TRY_RUN(
461 [#include <stdio.h>
462 main() { char *str=(char*)malloc(20); if (((int) sprintf(str,"123456789")) == 9) exit(0); else exit(1); }],
463   ac_cv_returns_n_of_chars=yes,
464   ac_cv_returns_n_of_chars=no,
465   ac_cv_returns_n_of_chars=no))
466if test "$ac_cv_returns_n_of_chars" = yes; then
467  AC_MSG_RESULT(yes)
468else
469  AC_MSG_RESULT(no)
470  AC_DEFINE(BSD_SPRINTF)
471fi
472
473dnl determine ALIGN_8
474
475AC_CHECK_SIZEOF(char,1)
476AC_CHECK_SIZEOF(short,2)
477AC_CHECK_SIZEOF(int,4)
478AC_CHECK_SIZEOF(long,4)
479AC_CHECK_SIZEOF(void*,4)
480AC_C_BIGENDIAN
481
482if test "$ac_cv_sizeof_int" != 4; then
483  AC_MSG_ERROR(need int to be four bytes long)
484fi
485
486if test "$ac_cv_sizeof_long" != "$ac_cv_sizeof_voidp"; then
487  AC_MSG_ERROR(need equal sizes for long and void*)
488fi
489
490dnl
491dnl figure out Exponent_t and Order_t
492dnl make sure that 2*sizeof(Exponent_t) + sizeof(Order_t) is aligned
493dnl
494AC_MSG_CHECKING(which exponent types to use)
495if test "$with_exp_type" = "char"; then
496  AC_MSG_RESULT(char)
497  AC_DEFINE(EXPONENT_TYPE, char)
498  AC_DEFINE(SIZEOF_EXPONENT, SIZEOF_CHAR)
499elif test "with_exp_type" = "int"; then
500  AC_MSG_RESULT(int)
501  AC_DEFINE(EXPONENT_TYPE, int)
502  AC_DEFINE(SIZEOF_EXPONENT, SIZEOF_INT)
503else
504  AC_MSG_RESULT(short)
505  AC_DEFINE(EXPONENT_TYPE, short)
506  AC_DEFINE(SIZEOF_TYPE, SIZEOF_SHORT)
507fi
508
509dnl
510dnl Last, but not least, customize CFLAGS
511dnl
512AC_MSG_CHECKING(whether _AIX is defined)
513AC_CACHE_VAL(ac_cv_is_aix,
514AC_EGREP_CPP(yes,
515[#ifdef _AIX
516    yes
517#endif
518], ac_cv_is_aix=yes, ac_cv_is_aix=no, 1))
519if test "$ac_cv_is_aix" = yes; then
520  AC_MSG_RESULT(yes)
521else
522  AC_MSG_RESULT(no)
523fi
524
525if test ${GXX} = yes; then
526  if test "$ac_cxxflags_set" = no; then
527    CXXFLAGS="-O3 -w -fomit-frame-pointer"
528  fi
529  CXXTEMPLFLAGS="-fno-implicit-templates"
530  if test "$ac_cv_is_aix" = yes; then
531    CXXNOOPTFLAGS="-w"
532  else
533    CXXNOOPTFLAGS=$CXXFLAGS
534  fi
535  STATIC_LDFLAGS="-Xlinker -Bstatic"
536else
537  CXXTEMPFLAGS=""
538  CXXNOOPTFLAGS=$CXXFLAGS
539  STATIC_LDFLAGS=""
540fi
541AC_SUBST(CXXTEMPLFLAGS)
542AC_SUBST(CXXNOOPTFLAGS)
543AC_SUBST(STATIC_LDFLAGS)
544
545if test ${GCC} = yes && test "$ac_cflags_set" = no ; then
546  CFLAGS="-O3 -w -fomit-frame-pointer"
547fi
548
549AC_OUTPUT(Makefile doc/Makefile, \
550 if test "$CONFIG_HEADERS"; then echo timestamp > stamp-h; fi)
551
552
553
554
Note: See TracBrowser for help on using the repository browser.