source: git/Singular/configure.in @ 4e595a7

spielwiese
Last change on this file since 4e595a7 was 4e595a7, checked in by Olaf Bachmann <obachman@…>, 27 years ago
Thu Jun 5 15:16:19 1997 Olaf Bachmann <obachman@ratchwum.mathematik.uni-kl.de (Olaf Bachmann)> * added MPtcp fork link mode, which is now default MPtcp mode; documented it; included in mpcheck git-svn-id: file:///usr/local/Singular/svn/trunk@371 2c84dea3-7e68-4137-9b89-c4e89433aadc
  • Property mode set to 100644
File size: 10.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=0
11VERSION_DATE="June 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  gmp,
119  [  --without-gmp        do not use gmp library])
120   
121AC_ARG_WITH(
122  MP,
123  [  --without-MP         do not use MP (disables MP links)])
124
125AC_ARG_WITH(
126  dbm,
127  [  --without-dbm        do not use dbm (disables DBM links)])
128AC_ARG_WITH(
129  info,
130  [  --without-info       do not use info for help (use buildin help, instead)])
131AC_ARG_WITH(
132  dld,
133  [  --without-dld        do not use dld (disables dynamic linking)])
134
135AC_ARG_WITH(
136  factory,
137  [  --without-factory    do not use factory (disables poly factorization)])
138
139AC_ARG_WITH(
140  libfac,
141  [  --without-libfac     do not use libfac (disables primary decompositions)])
142
143dnl without info !
144
145dnl
146dnl CHECK VARIOUS LIBRARIES
147dnl for gmp, MP, factory and libfac, we built them in, even if the libs
148dnl and headers were not found under the condition that the respective
149dnl  --enable argument was given
150dnl
151 
152AC_CHECK_LIB(m, atof)
153AC_CHECK_LIB(bsd, socket)
154AC_CHECK_LIB(socket, listen)
155AC_CHECK_LIB(nsl, gethostbyname)
156
157dnl Check -lreadline
158if test "$with_readline" != no; then
159  AC_CHECK_LIB(ncurses,tgetent,,\
160   AC_CHECK_LIB(curses,tgetent,,\
161   AC_CHECK_LIB(termcap,tgetent)))
162  AC_CHECK_LIB(readline, rl_abort)
163  if test "$ac_cv_lib_readline_rl_abort" = yes; then
164     AC_CHECK_HEADERS(readline/readline.h readline/history.h sys/file.h,ac_readline_ok=yes,ac_readline_ok=no; break)
165   fi
166   if test "$ac_readline_ok" = yes; then
167     AC_DEFINE(HAVE_READLINE)
168   else
169     AC_MSG_WARN(building without readline: disabling fancy display);
170     AC_DEFINE(HAVE_FEREAD)
171   fi
172 else
173   AC_DEFINE(HAVE_FEREAD)
174fi
175 
176dnl Check dbm
177if test "$with_dbm" != no; then
178  AC_CHECK_LIB(
179    dbm,
180    dbminit,
181    AC_DEFINE(HAVE_DBM) LIBS="-ldbm $LIBS",
182    AC_CHECK_LIB(
183      gdbm,
184      dbminit,
185      AC_DEFINE(HAVE_DBM) LIBS="-lgdbm $LIBS",
186      AC_MSG_WARN(building without dbm: disabling DBM links)))
187fi
188
189dnl Check dld
190if test "$with_dld" = yes; then
191  AC_CHECK_LIB(dld, dld_init,\
192   AC_MSG_WARN(building without dld: disabling dynamic linking))
193fi
194
195NEED_LIBS=$LIBS
196
197dnl Check gmp
198if test "$with_builtingmp" = yes; then
199  AC_DEFINE(HAVE_BUILTIN_GMP)
200  AC_DEFINE(HAVE_GMP)
201  ac_gmp_ok=yes
202elif test "$with_gmp" != no; then
203  AC_CHECK_LIB(gmp, mpz_init)
204  AC_CHECK_HEADER(gmp.h)
205  if test "$ac_cv_lib_gmp_mpz_init" = yes && \
206   test "$ac_cv_header_gmp_h" = yes; then
207    AC_DEFINE(HAVE_GMP)
208    NEED_LIBS="-lgmp ${NEED_LIBS}"
209    ac_gmp_ok=yes
210  elif test "$enable_gmp" = yes; then
211    AC_DEFINE(HAVE_GMP)
212    NEED_LIBS="-lgmp ${NEED_LIBS}"
213    ac_gmp_ok=yes
214    AC_MSG_WARN(install gmp before making Singular or configure --without-gmp)
215  else
216    AC_MSG_WARN(building without gmp: using build-in rational arithmetic)
217  fi
218fi
219
220dnl Check MP
221WITH_MP=no
222if test "$with_MP" != no; then
223  if test "$ac_gmp_ok" != yes; then
224    AC_MSG_WARN(building without MP: can not use MP without gmp)
225  else
226    if test "$ac_cv_lib_gmp_mpz_init"=yes; then
227      AC_CHECK_LIB(MP, IMP_PutGmpInt)
228      AC_CHECK_LIB(MPT, MPT_GetTree)
229    fi
230    AC_CHECK_HEADERS(MP.h MPT.h)
231    if test "$ac_cv_lib_MPT_MPT_GetTree" = yes && \
232     test "$ac_cv_header_MP_h" = yes && \
233     test "$ac_cv_lib_MP_IMP_PutGmpInt" = yes && \
234     test "$ac_cv_header_MPT_h" = yes; then
235      AC_DEFINE(HAVE_MPSR)
236      NEED_LIBS="-lMPT -lMP ${NEED_LIBS}"
237      WITH_MP=yes
238    elif test "$enable_MP" = yes; then
239      AC_DEFINE(HAVE_MPSR)
240      NEED_LIBS="-lMPT -lMP ${NEED_LIBS}"
241      WITH_MP=yes
242      AC_MSG_WARN(install MP before making Singular or configure --without-MP)
243    else
244      AC_MSG_WARN(building without MP: disabling MP links)
245    fi
246  fi
247fi
248AC_SUBST(WITH_MP)
249
250dnl Check factory
251WITH_FACTORY=no
252if test "$with_factory" != no; then
253  if test "$ac_gmp_ok" != yes; then
254    AC_MSG_WARN(building without factory: can not use factory without gmp)
255  else
256    if test "$ac_cv_lib_gmp_mpz_init"=yes;then
257      AC_CHECK_LIB(singcf,atof)
258    fi
259    AC_CHECK_HEADERS(factory.h)
260    if test "$ac_cv_lib_singcf_atof" = yes && \
261     test "$ac_cv_header_factory_h" = yes; then
262      AC_DEFINE(HAVE_FACTORY)
263      NEED_LIBS="-lsingcf ${NEED_LIBS}"
264      WITH_FACTORY=yes
265    elif test "$enable_factory" = yes; then
266      NEED_LIBS="-lsingcf ${NEED_LIBS}"
267      AC_DEFINE(HAVE_FACTORY)
268      WITH_FACTORY=yes
269      AC_MSG_WARN(install factory before making Singular or configure --without-factory)
270    else
271      AC_MSG_WARN(building without factory: disabling poly factorization)
272    fi
273  fi
274fi
275AC_SUBST(WITH_FACTORY)
276
277dnl Check libfac
278WITH_LIBFAC=no
279if test "$with_libfac" != no; then
280  if test "${WITH_FACTORY}" != yes; then
281    AC_MSG_WARN(building without libfac: can not use libfac without factory)
282  else
283    if test "$ac_cv_lib_singcf_atof" = yes; then
284      AC_CHECK_LIB(singfac,atof)
285    fi
286    AC_CHECK_HEADERS(factor.h)
287    if test "$ac_cv_lib_singfac_atof" = yes && \
288     test "$ac_cv_header_factor_h" = yes; then
289      NEED_LIBS="-lsingfac ${NEED_LIBS}"
290      AC_DEFINE(HAVE_LIBFAC_P)
291      WITH_LIBFAC=yes
292    elif test "$enable_libfac" = yes; then
293      NEED_LIBS="-lsingfac ${NEED_LIBS}"
294      AC_DEFINE(HAVE_LIBFAC_P)
295      WITH_LIBFAC=yes
296      AC_MSG_WARN(install libfac before making Singular or configure --without-libfac)
297    else
298      AC_MSG_WARN(building without libfac: disabling char series)
299    fi
300  fi
301fi
302AC_SUBST(WITH_LIBFAC)
303
304AC_SUBST(NEED_LIBS)
305
306dnl
307dnl CHECKS FOR HEADER FILES.
308dnl
309
310AC_HEADER_STDC
311
312AC_CHECK_HEADERS(limits.h unistd.h,,
313  AC_MSG_ERROR(Can not compile without limits.h unistd.h))
314
315AC_CHECK_HEADERS(sys/file.h sys/ioctl.h sys/time.h sys/times.h)
316
317dnl
318dnl Checks for typedefs, structures, and compiler characteristics.
319dnl 
320AC_C_CONST
321AC_C_INLINE
322AC_TYPE_SIZE_T
323AC_HEADER_TIME
324AC_STRUCT_TM
325
326dnl
327dnl Checks for library functions.
328dnl
329AC_FUNC_ALLOCA
330AC_PROG_GCC_TRADITIONAL
331AC_FUNC_MMAP
332AC_TYPE_SIGNAL
333AC_FUNC_VPRINTF
334AC_CHECK_FUNCS(gettimeofday strstr strtod strtol atexit)
335
336dnl
337dnl System specific tests
338dnl
339
340dnl arithmetic shifts
341AC_MSG_CHECKING(whether your machine has correct arithmetic shifts)
342AC_CACHE_VAL(ac_cv_shift, AC_TRY_RUN(
343  [ int main() { if (-2 >> 1 == -1) exit(0); else exit(1); } ],
344   ac_cv_shift=yes,
345   ac_cv_shift=no,
346   1))
347if test "$ac_cv_shift" = yes; then   
348  AC_MSG_RESULT(yes)
349else
350  AC_MSG_RESULT(no)
351  AC_MSG_ERROR(need  -2 >> 1 == -1)
352fi
353
354
355dnl sizeof(int) == 4
356AC_MSG_CHECKING(whether sizeof int is four bytes)
357AC_CACHE_VAL(ac_cv_sizeof_int_equals_four, AC_TRY_RUN(
358[ int main() {if (sizeof(int) == 4)  exit(0); else exit(1); } ],
359  ac_cv_sizeof_int_equals_four=yes,
360  ac_cv_sizeof_int_equals_four=no,
361  1))
362
363if test "$ac_cv_sizeof_int_equals_four" = yes; then
364  AC_MSG_RESULT(yes)
365else
366  AC_MSG_RESULT(no)
367  AC_MSG_ERROR(need int to be four bytes long)
368fi
369
370dnl sizeof(long) == sizeof (void *)
371AC_MSG_CHECKING(whether sizeof long equals sizeof void*)
372AC_CACHE_VAL(ac_cv_sizeof_long_equals_voidp, AC_TRY_RUN(
373  [ int main() {if (sizeof(long) == sizeof(void*))  exit(0); else exit(1); }],
374    ac_cv_sizeof_long_equals_voidp=yes,
375    ac_cv_sizeof_long_equals_voidp=no,
376    1))
377if test "$ac_cv_sizeof_long_equals_voidp" = yes; then
378  AC_MSG_RESULT(yes)
379else
380  AC_MSG_RESULT(no)
381  AC_MSG_ERROR(need equal sizes for long and void*)
382fi
383
384dnl sprintf returns number of printed chars
385AC_MSG_CHECKING(whether vsprintf returns number of printed chars)
386AC_CACHE_VAL(ac_cv_returns_n_of_chars, AC_TRY_RUN(
387 [#include <stdio.h>
388 main() { char *str=(char*)malloc(20); if (((int) sprintf(str,"123456789")) == 9) exit(0); else exit(1); }],
389   ac_cv_returns_n_of_chars=yes,
390   ac_cv_returns_n_of_chars=no,
391   1))
392if test "$ac_cv_returns_n_of_chars" = yes; then
393  AC_MSG_RESULT(yes)
394else
395  AC_MSG_RESULT(no)
396  AC_DEFINE(BSD_SPRINTF)
397fi
398
399dnl determine ALIGN_8
400AC_CHECK_SIZEOF(void*,4)
401
402
403dnl
404dnl Last, but not least, customize CFLAGS
405dnl
406AC_MSG_CHECKING(whether _AIX is defined)
407AC_CACHE_VAL(ac_cv_is_aix,
408AC_EGREP_CPP(yes,
409[#ifdef _AIX
410    yes
411#endif
412], ac_cv_is_aix=yes, ac_cv_is_aix=no, 1))
413if test "$ac_cv_is_aix" = yes; then
414  AC_MSG_RESULT(yes)
415else
416  AC_MSG_RESULT(no)
417fi
418
419
420if test ${GXX} = yes; then
421  if test "$ac_cxxflags_set" = no; then
422    CXXFLAGS="-O3 -w -fomit-frame-pointer"
423  fi
424  CXXTEMPLFLAGS="-fno-implicit-templates"
425  if test "$ac_cv_is_aix" = yes; then
426    CXXNOOPTFLAGS="-w"
427  else
428    CXXNOOPTFLAGS=$CXXFLAGS
429  fi
430else
431  CXXTEMPFLAGS=""
432  CXXNOOPTFLAGS=$CXXFLAGS
433fi
434AC_SUBST(CXXTEMPLFLAGS)
435AC_SUBST(CXXNOOPTFLAGS)
436
437if test ${GCC} = yes && test "$ac_cflags_set" = no ; then
438  CFLAGS="-O3 -w -fomit-frame-pointer"
439fi
440
441AC_OUTPUT(Makefile doc/Makefile, \
442 if test "$CONFIG_HEADERS"; then echo timestamp > stamp-h; fi)
Note: See TracBrowser for help on using the repository browser.