source: git/Singular/configure.in @ 5f9072

spielwiese
Last change on this file since 5f9072 was 5f9072, checked in by Olaf Bachmann <obachman@…>, 27 years ago
Removed Makefile mod2.h from repository. Added configure, configure.in Makefile.in mod2.h.in git-svn-id: file:///usr/local/Singular/svn/trunk@190 2c84dea3-7e68-4137-9b89-c4e89433aadc
  • Property mode set to 100644
File size: 9.2 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
8MAJOR_VERSION=1
9MINOR_VERSION=0
10SUB_VERSION=0
11VERSION_DATE="April 1997"
12AC_SUBST(MAJOR_VERSION)
13AC_SUBST(MINOR_VERSION)
14AC_SUBST(SUB_VERSION)
15AC_DEFINE_UNQUOTED(MAJOR_VERSION, ${MAJOR_VERSION})
16AC_DEFINE_UNQUOTED(MINOR_VERSION, ${MINOR_VERSION})
17AC_DEFINE_UNQUOTED(S_VERSION1, "version: ${MAJOR_VERSION}.${MINOR_VERSION}.${SUB_VERSION}")
18AC_DEFINE_UNQUOTED(S_VERSION2, "${VERSION_DATE}")
19
20dnl
21dnl paths stuff
22dnl
23AC_PREFIX_DEFAULT(`pwd`/..)
24
25if test "x$datadir" = 'x${prefix}/share'; then
26  if test "x${prefix}" = xNONE; then
27    singulardatadir=${ac_default_prefix}/share/Singular;
28  else
29    singulardatadir=${prefix}/share/Singular;
30  fi
31else
32  singulardatadir=${datadir}/Singular;
33fi
34
35AC_DEFINE_UNQUOTED(SINGULAR_DATADIR, "${singulardatadir}")
36
37AC_SUBST(singulardatadir)
38
39dnl
40dnl Checks for programs.
41dnl
42
43dnl compiler stuff
44dnl we do not want to have "-g -O" for CFLAGS 
45if test "${CXXFLAGS+set}" != set; then
46  CXXFLAGS="-O"
47fi
48if test "${CFLAGS+set}" != set; then
49  CFLAGS="-O"
50fi
51
52AC_PROG_CC
53AC_PROG_CXX
54
55dnl we prefer using gcc for compiling C++ files
56if test ${GXX} = yes; then
57  CXX=gcc
58fi 
59
60dnl and add to -I to CPPFLAGS and and -Lto LDFLAGS, just to be sure
61LDFLAGS="-L${libdir} ${LDFLAGS}"
62CPPFLAGS="-I${includedir} ${CPPFLAGS}"
63
64dnl programs to built the grammar/parser
65AC_PROG_LEX
66AC_CHECK_PROG(BISON, bison, bison)
67if test -z ${BISON}; then
68  AC_MSG_ERROR(install bison before Singular)
69fi
70
71dnl check for info
72AC_CHECK_PROG(INFO, info, info)
73if test -n "$INFO"; then
74  AC_DEFINE(HAVE_INFO)
75fi
76
77dnl programs for installation
78ac_save_path=${PATH}
79PATH="$PATH:.." 
80AC_PROG_INSTALL
81AC_PATH_PROG(MKINSTALLDIRS, mkinstalldirs, -mkdir)
82PATH="$ac_save_path"
83
84
85dnl
86dnl CHECK --without arguments
87dnl
88AC_ARG_WITH(
89  readline,
90  [  --without-readline   do not use readline for fancy display])
91
92AC_ARG_WITH(
93  gmp,
94  [  --without-gmp        do not use gmp library])
95   
96AC_ARG_WITH(
97  MP,
98  [  --without-MP         do not use MP (disables MP links)])
99
100AC_ARG_WITH(
101  dbm,
102  [  --without-dbm        do not use dbm (disables DBM links)])
103
104AC_ARG_WITH(
105  dld,
106  [  --without-dld        do not use dld (disables dynamic linking)])
107
108AC_ARG_WITH(
109  factory,
110  [  --without-factory    do not use factory (disables poly factorization)])
111
112AC_ARG_WITH(
113  libfac,
114  [  --without-libfac     do not use libfac (disables primary decompositions)])
115
116dnl
117dnl CHECK VARIOUS LIBRARIES
118dnl for gmp, MP, factory and libfac, we built them in, even if the libs
119dnl and headers were not found under the condition that the respective
120dnl  --enable argument was given
121dnl
122 
123LIBS="-lm $LIBS"
124
125dnl Check -lbsd
126AC_CHECK_LIB(
127  bsd,
128  bzero,
129  LIBS="-lbsd $LIBS"
130)
131
132dnl Check -lreadline
133if test "$with_readline" != no; then
134  AC_CHECK_LIB(ncurses,tgetent,,\
135   AC_CHECK_LIB(curses,tgetent,,\
136   AC_CHECK_LIB(termcap,tgetent)))
137   AC_CHECK_LIB(readline, rl_abort)
138   if test "$ac_cv_lib_readline_rl_abort" = yes; then
139     AC_CHECK_HEADERS(readline/readline.h readline/history.h sys/file.h,ac_readline_ok=yes,ac_readline_ok=no; break)
140   fi
141   if test "$ac_readline_ok" = yes; then
142     AC_DEFINE(HAVE_READLINE)
143   else
144     AC_MSG_WARN(building without readline: disabling fancy display);
145     AC_DEFINE(HAVE_FEREAD)
146   fi
147 else
148   AC_DEFINE(HAVE_FEREAD)
149fi
150 
151dnl Check dbm
152if test "$with_dbm" != no; then
153  AC_CHECK_LIB(
154    dbm,
155    dbminit,
156    AC_DEFINE(HAVE_DBM) LIBS="-ldbm $LIBS",
157    AC_CHECK_LIB(
158      gbm,
159      dbminit,
160      AC_DEFINE(HAVE_DBM) LIBS="-lgdbm $LIBS",
161      AC_MSG_WARN(building without dbm: disabling DBM links)))
162fi
163
164dnl Check dld
165if test "$with_dld" = yes; then
166  AC_CHECK_LIB(dld, dld_init,\
167   AC_MSG_WARN(building without dld: disabling dynamic linking))
168fi
169
170NEED_LIBS=$LIBS
171
172dnl Check gmp
173if test "$with_gmp" != no; then
174  AC_CHECK_LIB(gmp, mpz_init)
175  AC_CHECK_HEADERS(gmp.h)
176  if test "$ac_cv_lib_gmp_mpz_init" = yes && \
177   test "$ac_cv_header_gmp_h" = yes; then
178    AC_DEFINE(HAVE_GMP)
179    NEED_LIBS="-lgmp ${NEED_LIBS}"
180    ac_gmp_ok=yes
181  elif test "$enable_gmp" = yes; then
182    AC_DEFINE(HAVE_GMP)
183    NEED_LIBS="-lgmp ${NEED_LIBS}"
184    ac_gmp_ok=yes
185    AC_MSG_WARN(install gmp before making Singular or configure --without-gmp)
186  else
187    AC_MSG_WARN(building without gmp: using build-in rational arithmetic)
188  fi
189fi
190
191dnl Check MP
192if test "$with_MP" != no; then
193  if test "$ac_gmp_ok" != yes; then
194    AC_MSG_WARN(building without MP: can not use MP without gmp)
195  else
196    if test "$ac_cv_lib_gmp_mpz_init"=yes; then
197      AC_CHECK_LIB(MPT, MPT_GetTree,,,-lMP)
198    fi
199    AC_CHECK_HEADERS(MP.h)
200    if test "$ac_cv_lib_MPT_MPT_GetTree" = yes && \
201     test "$ac_cv_header_MP_h"=yes; then
202      AC_DEFINE(HAVE_MPSR)
203      NEED_LIBS="-lMPT -lMP ${NEED_LIBS}"
204    elif test "$enable_MP" = yes; then
205      AC_DEFINE(HAVE_MPSR)
206      NEED_LIBS="-lMPT -lMP ${NEED_LIBS}"
207      AC_MSG_WARN(install MP before making Singular or configure --without-MP)
208    else
209      AC_MSG_WARN(building without MP: disabling MP links)
210    fi
211  fi
212fi
213
214dnl Check factory
215if test "$with_factory" != no; then
216  if test "$ac_gmp_ok" != yes; then
217    AC_MSG_WARN(building without factory: can not use factory without gmp)
218  else
219    if test "$ac_cv_lib_gmp_mpz_init"=yes;then
220      AC_CHECK_LIB(singcf,initCanonicalForm)
221    fi
222    AC_CHECK_HEADERS(factory.h)
223    if test "$ac_cv_lib_singcf_initCanonicalForm" = yes && \
224     test "$ac_cv_header_factory_h" = yes; then
225      AC_DEFINE(HAVE_FACTORY)
226      NEED_LIBS="-lsingcf ${NEED_LIBS}"
227      ac_factory_ok=yes
228    elif test "$enable_factory" = yes; then
229      NEED_LIBS="-lsingcf ${NEED_LIBS}"
230      AC_DEFINE(HAVE_FACTORY)
231      ac_factory_ok=yes
232      AC_MSG_WARN(install factory before making Singular or configure --without-factory)
233    else
234      AC_MSG_WARN(building without factory: disabling poly factorization)
235    fi
236  fi
237fi
238
239dnl Check libfac
240if test "$with_libfac" != no; then
241  if test "$ac_factory_ok" != yes; then
242    AC_MSG_WARN(building without libfac: can not use libfac without factory)
243  else
244    if test "$ac_cv_lib_singcf_initCanonicalForm" = yes; then
245      AC_CHECK_LIB(singlibfac,IrrCharSeries)
246    fi
247    AC_CHECK_HEADERS(factor.h)
248    if test "$ac_cv_lib_singlibfac_IrrCharSeries" = yes && \
249     test "$ac_cv_header_factor_h" = yes; then
250      NEED_LIBS="-lsinglibfac ${NEED_LIBS}"
251      AC_DEFINE(HAVE_LIBFAC_P)
252    elif test "$enable_libfac" = yes; then
253      NEED_LIBS="-lsinglibfac ${NEED_LIBS}"
254      AC_DEFINE(HAVE_LIBFAC_P)
255      AC_MSG_WARN(install libfac before making Singular or configure --without-libfac)
256    else
257      AC_MSG_WARN(building without libfac: disabling char series)
258    fi
259  fi
260fi
261
262AC_SUBST(NEED_LIBS)
263
264dnl
265dnl CHECKS FOR HEADER FILES.
266dnl
267
268AC_HEADER_STDC
269
270AC_CHECK_HEADERS(limits.h unistd.h,,
271  AC_MSG_ERROR(Can not compile without limits.h unistd.h))
272
273AC_CHECK_HEADERS(sys/file.h sys/ioctl.h sys/time.h)
274
275dnl
276dnl Checks for typedefs, structures, and compiler characteristics.
277dnl 
278AC_C_CONST
279AC_C_INLINE
280AC_TYPE_SIZE_T
281AC_HEADER_TIME
282AC_STRUCT_TM
283
284dnl
285dnl Checks for library functions.
286dnl
287AC_FUNC_ALLOCA
288AC_PROG_GCC_TRADITIONAL
289AC_FUNC_MMAP
290AC_TYPE_SIGNAL
291AC_FUNC_VPRINTF
292AC_CHECK_FUNCS(gettimeofday strstr strtod strtol atexit)
293
294dnl
295dnl System specific tests
296dnl
297
298dnl arithmetic shifts
299AC_MSG_CHECKING(whether your machine has correct arithmetic shifts)
300AC_CACHE_VAL(ac_cv_shift, AC_TRY_RUN(
301  [ int main() { if (-2 >> 1 == -1) exit(0); else exit(1); } ],
302   ac_cv_shift=yes,
303   ac_cv_shift=no,
304   1))
305if test "$ac_cv_shift" = yes; then   
306  AC_MSG_RESULT(yes)
307else
308  AC_MSG_RESULT(no)
309  AC_MSG_ERROR(need  -2 >> 1 == -1)
310fi
311
312
313dnl sizeof(int) == 4
314AC_MSG_CHECKING(whether sizeof int is four bytes)
315AC_CACHE_VAL(ac_cv_sizeof_int_equals_four, AC_TRY_RUN(
316[ int main() {if (sizeof(int) == 4)  exit(0); else exit(1); } ],
317  ac_cv_sizeof_int_equals_four=yes,
318  ac_cv_sizeof_int_equals_four=no,
319  1))
320
321if test "$ac_cv_sizeof_int_equals_four" = yes; then
322  AC_MSG_RESULT(yes)
323else
324  AC_MSG_RESULT(no)
325  AC_MSG_ERROR(need int to be four bytes long)
326fi
327
328dnl sizeof(long) == sizeof (void *)
329AC_MSG_CHECKING(whether sizeof long equals sizeof void*)
330AC_CACHE_VAL(ac_cv_sizeof_long_equals_voidp, AC_TRY_RUN(
331  [ int main() {if (sizeof(long) == sizeof(void*))  exit(0); else exit(1); }],
332    ac_cv_sizeof_long_equals_voidp=yes,
333    ac_cv_sizeof_long_equals_voidp=no,
334    1))
335if test "$ac_cv_sizeof_long_equals_voidp" = yes; then
336  AC_MSG_RESULT(yes)
337else
338  AC_MSG_RESULT(no)
339  AC_MSG_ERROR(need equal sizes for long and void*)
340fi
341
342dnl sprintf returns number of printed chars
343AC_MSG_CHECKING(whether vsprintf returns number of printed chars)
344AC_CACHE_VAL(ac_cv_returns_n_of_chars, AC_TRY_RUN(
345 [#include <stdio.h>
346 main() { char str[21]; if (((int) sprintf(str,"123456789")) == 9) exit(0); else exit(1); }],
347   ac_cv_returns_n_of_chars=yes,
348   ac_cv_returns_n_of_chars=no,
349   1))
350if test "$ac_cv_returns_n_of_chars" = yes; then
351  AC_MSG_RESULT(yes)
352else
353  AC_MSG_RESULT(no)
354  AC_DEFINE(BSD_SPRINTF)
355fi
356
357dnl determine ALIGN_8
358AC_CHECK_SIZEOF(void*,4)
359
360
361dnl
362dnl Last, but not least, customize CFLAGS
363dnl
364if test ${GXX} = yes; then
365  CXXFLAGS="-O3 -w -fomit-frame-pointer -fstrength-reduce"
366  CXXTEMPLFLAGS="-fno-implicit-templates"
367else
368  CXXTEMPFLAGS=""
369fi
370AC_SUBST(CXXTEMPLFLAGS)
371
372if test ${GCC} = yes; then
373  CFLAGS="-O3 -w -fomit-frame-pointer -fstrength-reduce"
374fi
375
376AC_SUBST(ac_configure_args)
377
378AC_OUTPUT(Makefile)
Note: See TracBrowser for help on using the repository browser.