source: git/configure.in @ 9bc556

spielwiese
Last change on this file since 9bc556 was 9bc556, checked in by Olaf Bachmann <obachman@…>, 26 years ago
* improvments/bug fixes of configure, etc git-svn-id: file:///usr/local/Singular/svn/trunk@2068 2c84dea3-7e68-4137-9b89-c4e89433aadc
  • Property mode set to 100644
File size: 15.3 KB
Line 
1dnl Process this file with autoconf to produce a configure script
2AC_INIT(Singular/matpol.h)
3AC_PREFIX_DEFAULT(`pwd`)
4OUTPUT_MAKEFILES="Makefile doc/Makefile"
5
6
7dnl lllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllll
8dnl Version business --  set these here
9dnl
10# make them to env variables
11# pass them indirectly to subsequent configures
12SINGULAR_MAJOR_VERSION=1
13SINGULAR_MINOR_VERSION=2
14SINGULAR_SUB_VERSION=0
15SINGULAR_VERSION="${SINGULAR_MAJOR_VERSION}.${SINGULAR_MINOR_VERSION}.${SINGULAR_SUB_VERSION}"
16VERSION_DATE="June 1998"
17export SINGULAR_MINOR_VERSION
18export SINGULAR_MAJOR_VERSION
19export SINGULAR_SUB_VERSION
20export SINGULAR_VERSION
21export VERSION_DATE
22
23dnl substitue them into the Makefiles
24AC_SUBST(SINGULAR_MAJOR_VERSION)
25AC_SUBST(SINGULAR_MINOR_VERSION)
26AC_SUBST(SINGULAR_SUB_VERSION)
27
28
29dnl lllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllll
30dnl Those are needed to check for libs and headers, later on
31dnl
32AC_PROG_CC
33AC_PROG_CPP
34AC_AIX
35
36
37dnl lllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllll
38dnl Set exec_prefix, bindir, libdir, includedir to some sensible values
39dnl
40# expand prefix and pass it to subsequent configures
41if test "x$prefix" = xNONE; then
42  prefix=${ac_default_prefix}
43  ac_configure_args="$ac_configure_args --prefix=${prefix}"
44fi
45
46# expand exec_prefix
47if test "x$exec_prefix" = xNONE; then
48  if test -r "singuname.sh"; then
49    if (/bin/sh singuname.sh >/dev/null 2>&1) then
50        exec_prefix=${prefix}/`/bin/sh singuname.sh`
51        ac_configure_args="$ac_configure_args --exec_prefix=${exec_prefix}"
52    else
53      AC_MSG_ERROR(Unknown architecture: Check singuname.sh)
54    fi
55  else
56    AC_MSG_ERROR(Need singuname.sh)
57  fi
58fi
59
60# expand bindir
61if test "x$bindir" = 'x${exec_prefix}/bin'; then
62  bindir="${exec_prefix}/bin"
63  ac_configure_args="$ac_configure_args --bindir=${bindir}"
64fi
65
66# expand libdir
67if test "x$libdir" = 'x${exec_prefix}/lib'; then
68  libdir="${exec_prefix}/lib/${SINGULAR_VERSION}"
69  ac_configure_args="$ac_configure_args --libdir=${libdir}"
70fi
71
72# expand includedir
73if test "x$includedir" = 'x${prefix}/include'; then
74  includedir="${exec_prefix}/include/${SINGULAR_VERSION}"
75  ac_configure_args="$ac_configure_args --includedir=${includedir}"
76fi
77
78# construct name of installed Singular executable
79SINGULAR=${bindir}/Singular-${SINGULAR_MAJOR_VERSION}.${SINGULAR_MINOR_VERSION}.${SINGULAR_SUB_VERSION}
80export SINGULAR
81AC_SUBST(SINGULAR)
82
83dnl lllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllll
84dnl Check for various libraries and headers
85dnl
86dnl After this part, the variables 'ac_<package>_ok' is 'yes'
87dnl if '<package>' is already existent on the system, otherwise
88dnl undefined.
89dnl
90
91# add -I to CPPFLAGS and -L to LDFLAGS, just to be sure
92LDFLAGS="-L${libdir} ${LDFLAGS}"
93CPPFLAGS="-I${includedir} ${CPPFLAGS}"
94
95# check for AIX
96AC_MSG_CHECKING(whether _AIX is defined)
97AC_CACHE_VAL(ac_cv_is_aix,
98AC_EGREP_CPP(yes,
99[#ifdef _AIX
100    yes
101#endif
102], ac_cv_is_aix=yes, ac_cv_is_aix=no, 1))
103if test "$ac_cv_is_aix" = yes; then
104  AC_MSG_RESULT(yes)
105else
106  AC_MSG_RESULT(no)
107fi
108
109AC_CHECK_LIB(m, atof)
110AC_CHECK_LIB(bsd, socket)
111AC_CHECK_LIB(socket, listen)
112AC_CHECK_LIB(nsl, gethostbyname)
113AC_CHECK_LIB(gmp, mpq_init)
114AC_CHECK_LIB(smallgmp, mpz_init)
115AC_CHECK_LIB(MP, IMP_PutGmpInt)
116AC_CHECK_LIB(MPT, MPT_GetTree)
117AC_CHECK_LIB(singcf, atof)
118AC_CHECK_LIB(singfac, atof)
119
120AC_CHECK_HEADERS(gmp.h smallgmp.h MP.h  MPT.h factory.h factor.h)
121
122if test "$ac_cv_lib_gmp_mpq_init" = yes && \
123 test "$ac_cv_header_gmp_h" = yes; then
124  ac_gmp_ok=yes
125fi
126
127if test "$ac_cv_lib_smallgmp_mpz_init" = yes && \
128 test "$ac_cv_header_smallgmp_h" = yes && \
129 test "$ac_cv_header_gmp_h" = yes; then
130  ac_smallgmp_ok=yes
131fi
132
133if test "$ac_cv_lib_MP_IMP_PutGmpInt" = yes && \
134 test "$ac_cv_lib_MPT_MPT_GetTree" && \
135 test "$ac_cv_header_MP_h" = yes && \
136 test "$ac_cv_header_MPT_h" = yes; then
137  ac_MP_ok=yes
138fi
139
140if test "$ac_cv_lib_singcf_atof" = yes && \
141 test "$ac_cv_header_factory_h" = yes; then
142  ac_factory_ok=yes
143fi
144
145if test "$ac_cv_lib_singfac_atof" = yes && \
146 test "$ac_cv_header_factor_h" = yes; then
147  ac_libfac_ok=yes
148fi
149
150 
151dnl lllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllll
152dnl Check command line arguments
153dnl
154AC_ARG_ENABLE(smallgmp, \
155 [ --enable-PACKAGE        configure and build PACKAGE
156  --disable-PACKAGE       do not configure and build PACKAGE
157   where PACKAGE can be:
158     smallgmp             minimal version of gmp written in C only])
159AC_ARG_ENABLE(gmp, \
160 [    gmp                  Gnu Multiple Precision package])
161AC_ARG_ENABLE(MP, \
162 [    MP                   Multi Protocol library])
163AC_ARG_ENABLE(factory, \
164 [    factory              polynomial factorization library])
165AC_ARG_ENABLE(libfac, \
166 [    libfac               char set and modp poly factorization library])
167AC_ARG_ENABLE(sgroup, \
168 [    sgroup               numerical semigroup computations])
169AC_ARG_ENABLE(Singular, \
170 [    Singular             CAS for Polynomial Computations])
171
172AC_ARG_WITH(MP,\
173 [ --with-PACKAGE          use PACKAGE, provide dependent functionality
174  --without-PACKAGE       do not use PACKAGE, disable dependent functionality
175   where PACKAGE can be:
176     MP                   Multi Protocol library])
177AC_ARG_WITH(factory, \
178 [    factory              polynomial factorization library])
179AC_ARG_WITH(libfac, \
180 [    libfac               char set and modp poly factorization library])
181AC_ARG_WITH(gmp, \
182 [ --with-apint=PACKAGE    use PACKAGE for arbitary integer arithmetic
183                          where PACKAGE can be gmp or smallgmp
184All additional --enable and --with options are passed to subsequent calls
185to configure of the packages to be built. See also configure --help in
186these packages (resp. subdirs). ])
187
188dnl lllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllll
189dnl Check whether or not to configure and build various packages
190dnl
191AC_MSG_CHECKING(whether to configure and build gmp lib)
192if test "$enable_gmp" != yes && test "$enable_gmp" != no; then
193  if test "$ac_gmp_ok" != yes && test -d gmp; then
194    AC_MSG_RESULT(yes)
195    enable_gmp=yes
196    CONFIG_SUBDIRS="$CONFIG_SUBDIRS gmp"
197    ac_configure_args="$ac_configure_args --enable-gmp"
198    OUTPUT_MAKEFILES="$OUTPUT_MAKEFILES gmp/Makefile.in"
199  else
200    AC_MSG_RESULT(no)
201    enable_gmp=no
202  fi
203elif test "$enable_gmp" = yes; then
204  if test ! -d gmp; then
205    AC_MSG_RESULT(no)
206    AC_MSG_ERROR(Can not find gmp subdir)
207  else
208    AC_MSG_RESULT(yes)
209    CONFIG_SUBDIRS="$CONFIG_SUBDIRS gmp"
210    OUTPUT_MAKEFILES="$OUTPUT_MAKEFILES gmp/Makefile.in"
211  fi
212else
213  AC_MSG_RESULT(no)
214fi
215
216AC_MSG_CHECKING(whether to configure and build smallgmp lib)
217if test "$enable_smallgmp" != yes && test "$enable_smallgmp" != no; then
218  if test "$ac_smallgmp_ok" != yes && test "$ac_gmp_ok" != yes && \
219     test "$enable_gmp" != yes && test -d smallgmp; then
220    AC_MSG_RESULT(yes)
221    enable_smallgmp=yes
222    CONFIG_SUBDIRS="$CONFIG_SUBDIRS smallgmp"
223    ac_configure_args="$ac_configure_args --enable-smallgmp --enable-gmp"
224  else
225    AC_MSG_RESULT(no)
226    enable_smallgmp=no
227  fi
228elif test "$enable_smallgmp" = yes; then
229  if test ! -d smallgmp; then
230    AC_MSG_RESULT(no)
231    AC_MSG_ERROR(Can not find smallgmp subdir)
232  else
233    AC_MSG_RESULT(yes)
234    CONFIG_SUBDIRS="$CONFIG_SUBDIRS smallgmp"
235    if test "$ac_gmp_ok" != yes && test "$enable_gmp" != yes; then
236      ac_configure_args="$ac_configure_args --enable-gmp"
237    fi
238  fi
239else
240  AC_MSG_RESULT(${enable_smallgmp})
241fi
242
243# Check whether we have at least one of smallgmp or gmp
244if test "$ac_smallgmp_ok" != yes && test "$ac_gmp_ok" != yes && \
245   test "$enable_smallgmp" != yes && test "$enable_gmp" != yes; then
246  AC_MSG_ERROR(can neither find nor built gmp or smallgmp)
247fi
248
249# Check whether we need to cheat subsequent configures with --enable-gmp
250if test "$ac_smallgmp_ok" != yes && test "$ac_gmp_ok" != yes; then
251  ac_configure_args="$ac_configure_args --enable-gmp"
252fi
253
254AC_MSG_CHECKING(whether to configure and build MP lib)
255if test "$enable_MP" != yes && test "$enable_MP" != no; then
256  if test "$with_MP" != no && test "$ac_MP_ok" != yes && test -d MP && \
257     (test "$enable_gmp" = yes || test "$ac_gmp_ok" = yes); then
258    AC_MSG_RESULT(yes)
259    enable_MP=yes
260    CONFIG_SUBDIRS="$CONFIG_SUBDIRS MP"
261    ac_configure_args="$ac_configure_args --enable-MP"
262  else
263    AC_MSG_RESULT(no)
264    enable_MP=no
265  fi
266elif test "$enable_MP" = yes; then
267  if test ! -d MP; then
268    AC_MSG_RESULT(no)
269    AC_MSG_ERROR(can not build MP without MP directory)
270  fi
271  if test "$enable_gmp" = yes || test "$ac_gmp_ok" = yes; then
272    AC_MSG_RESULT(yes)
273    CONFIG_SUBDIRS="$CONFIG_SUBDIRS MP"
274  else
275    AC_MSG_RESULT(no)
276    AC_MSG_ERROR(can not build MP without gmp)
277  fi
278else
279  AC_MSG_RESULT(no)
280fi
281 
282AC_MSG_CHECKING(whether to configure and build factory lib)
283if test "$enable_factory" != yes && test "$enable_factory" != no; then
284  if test "$with_factory" != no && test "$ac_factory_ok" != yes && \
285     test -d factory; then
286    enable_factory=yes
287    AC_MSG_RESULT(yes)
288    CONFIG_SUBDIRS="$CONFIG_SUBDIRS factory"
289    ac_configure_args="$ac_configure_args --enable-factory"
290  else
291    enable_factory=no
292    AC_MSG_RESULT(no)
293  fi
294elif test "$enable_factory" = yes; then
295  if test -d factory; then
296    AC_MSG_RESULT(yes)
297    CONFIG_SUBDIRS="$CONFIG_SUBDIRS factory"
298  else
299    AC_MSG_RESULT(no)
300    AC_MSG_ERROR(can not build factory without factory directory)
301  fi
302else
303  AC_MSG_RESULT(no)
304fi
305
306AC_MSG_CHECKING(whether to configure and build libfac lib)
307if test "$enable_libfac" != yes && test "$enable_libfac" != no; then
308  if test "$with_libfac" != no && test "$ac_libfac_ok" != yes && \
309     test -d libfac && \
310     (test "$ac_factory_ok" = yes || test "$enable_factory" = yes); then
311    enable_libfac=yes
312    AC_MSG_RESULT(yes)
313    CONFIG_SUBDIRS="$CONFIG_SUBDIRS libfac"
314    ac_configure_args="$ac_configure_args --enable-libfac"
315  else
316    enable_libfac=no
317    AC_MSG_RESULT(no)
318  fi
319elif  test "$enable_libfac" = yes; then
320  if test ! -d libfac; then
321    AC_MSG_RESULT(no)
322    AC_MSG_ERROR(can not build libfac without libfac directory)
323  fi
324  if test "$ac_factory_ok" = yes || test "$enable_factory" = yes; then
325    AC_MSG_RESULT(yes)
326    CONFIG_SUBDIRS="$CONFIG_SUBDIRS libfac"
327  else
328    AC_MSG_RESULT(no)
329    AC_MSG_ERROR(Can not build libfac without factory)
330  fi
331else
332  AC_MSG_RESULT(no)
333fi
334
335AC_MSG_CHECKING(whether to configure and build sgroup lib)
336if test "$enable_sgroup" != yes && test "$enable_sgroup" != no; then
337  if test "$with_sgroup" != no && test "$ac_sgroup_ok" != yes && \
338     test -d sgroup && \
339     (test "$ac_MP_ok" = yes || test "$enable_MP" = yes); then
340    enable_sgroup=yes
341    AC_MSG_RESULT(yes)
342    CONFIG_SUBDIRS="$CONFIG_SUBDIRS sgroup"
343    ac_configure_args="$ac_configure_args --enable-sgroup"
344  else
345    enable_sgroup=no
346    AC_MSG_RESULT(no)
347  fi
348elif  test "$enable_sgroup" = yes; then
349  if test ! -d sgroup; then
350    AC_MSG_RESULT(no)
351    AC_MSG_ERROR(can not build sgroup without sgroup directory)
352  fi
353  if test "$ac_MP_ok" = yes || test "$enable_MP" = yes; then
354    AC_MSG_RESULT(yes)
355    CONFIG_SUBDIRS="$CONFIG_SUBDIRS sgroup"
356  else
357    AC_MSG_RESULT(no)
358    AC_MSG_ERROR(Can not build sgroup without MP)
359  fi
360else
361  AC_MSG_RESULT(no)
362fi
363
364AC_MSG_CHECKING(whether to configure and build Singular)
365if test "$enable_Singular" != yes && test "$enable_Singular" != no; then
366  if test "$with_Singular" != no && test -d Singular; then
367    enable_Singular=yes
368    AC_MSG_RESULT(yes)
369    CONFIG_SUBDIRS="$CONFIG_SUBDIRS Singular"
370    ac_configure_args="$ac_configure_args --enable-Singular"
371  else
372    enable_Singular=no
373    AC_MSG_RESULT(no)
374  fi
375elif test "$enable_Singular" = yes; then
376  if test -d Singular; then
377    AC_MSG_RESULT(yes)
378    CONFIG_SUBDIRS="$CONFIG_SUBDIRS Singular"
379  else
380    AC_MSG_RESULT(no)
381    AC_MSG_ERROR(can not build Singular without Singular directory)
382  fi
383else
384  AC_MSG_RESULT(no)
385fi
386
387
388dnl lllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllll
389dnl Check whether or not to use various packages
390dnl
391AC_MSG_CHECKING(which apint package to use)
392if test "$with_apint" = gmp; then
393  if test "$ac_gmp_ok" = yes || test "$enable_gmp" = yes; then
394    AC_MSG_RESULT(gmp)
395  else
396    AC_MSG_RESULT(none)
397    AC_MSG_ERROR(can not use with gmp without finding or building it)
398  fi
399elif test "$with_apint" = smallgmp; then
400  if test "$ac_smallgmp_ok" = yes || test "$enable_smallgmp" = yes; then
401    AC_MSG_RESULT(smallgmp)
402  else
403    AC_MSG_RESULT(none)
404    AC_MSG_ERROR(can not use with smallgmp without finding or building it)
405  fi
406elif test "$ac_gmp_ok" = yes || test "$enable_gmp"; then
407    AC_MSG_RESULT(gmp)
408    ac_configure_args="$ac_configure_args --with-apint=gmp"
409else
410dnl now we are sure that we have the smallgmp --otherwise enable
411dnl checks had thrown an error
412   AC_MSG_RESULT(smallgmp)
413   ac_configure_args="$ac_configure_args --with-apint=smallgmp"
414fi
415
416AC_MSG_CHECKING(whether to use with MP)
417if test "$with_MP" = yes; then
418  if test "$ac_MP_ok" = yes || test "$enable_MP" = yes; then
419    AC_MSG_RESULT(yes)
420  else
421    AC_MSG_RESULT(none)
422    AC_MSG_ERROR(can not use with MP without finding or building it)
423  fi
424elif test "$with_MP" = no; then
425  AC_MSG_RESULT(no)
426elif test "$ac_MP_ok" = yes || test "$enable_MP" = yes; then
427  AC_MSG_RESULT(yes)
428  ac_configure_args="$ac_configure_args --with-MP"
429else
430  AC_MSG_RESULT(no)
431  ac_configure_args="$ac_configure_args --without-MP"
432fi
433
434AC_MSG_CHECKING(whether to use with factory)
435if test "$with_factory" = yes; then
436  if test "$ac_factory_ok" = yes || test "$enable_factory" = yes; then
437    AC_MSG_RESULT(yes)
438  else
439    AC_MSG_RESULT(none)
440    AC_MSG_ERROR(can not use with factory without finding or building it)
441  fi
442elif test "$with_factory" = no; then
443  AC_MSG_RESULT(no)
444elif test "$ac_factory_ok" = yes || test "$enable_factory" = yes; then
445  AC_MSG_RESULT(yes)
446  ac_configure_args="$ac_configure_args --with-factory"
447else
448  AC_MSG_RESULT(no)
449  ac_configure_args="$ac_configure_args --without-factory"
450fi
451 
452AC_MSG_CHECKING(whether to use with libfac)
453if test "$with_libfac" = yes; then
454  if test "$ac_libfac_ok" = yes || test "$enable_libfac" = yes; then
455    AC_MSG_RESULT(yes)
456  else
457    AC_MSG_RESULT(none)
458    AC_MSG_ERROR(can not use with libfac without finding or building it)
459  fi
460elif test "$with_libfac" = no; then
461  AC_MSG_RESULT(no)
462elif test "$ac_libfac_ok" = yes || test "$enable_libfac" = yes; then
463  AC_MSG_RESULT(yes)
464  ac_configure_args="$ac_configure_args --with-libfac"
465else
466  AC_MSG_RESULT(no)
467  ac_configure_args="$ac_configure_args --without-libfac"
468fi
469
470AC_MSG_CHECKING(whether to use with Singular)
471if test "$with_Singular" != no && test "$with_Singular" != yes; then
472  if test "$enable_Singular" = yes; then
473    with_Singular=yes
474  else
475    with_Singular=no
476  fi
477  ac_configure_args="$ac_configure_args --with-Singular=$with_Singular"
478fi
479
480if test "$with_Singular" != no; then
481  AC_MSG_RESULT(yes)
482else
483  AC_MSG_RESULT(no)
484fi
485
486
487dnl lllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllll
488dnl Check for known subdirs
489dnl
490SUBDIRS=""
491if test -d smallgmp; then
492  SUBDIRS="$SUBDIRS smallgmp"
493fi
494if test -d gmp; then
495  SUBDIRS="$SUBDIRS gmp"
496fi
497if test -d MP; then
498  SUBDIRS="$SUBDIRS MP"
499fi
500if test -d factory; then
501  SUBDIRS="$SUBDIRS factory"
502fi
503if test -d libfac; then
504  SUBDIRS="$SUBDIRS libfac"
505fi
506if test -d sgroup; then
507  SUBDIRS="$SUBDIRS sgroup"
508fi
509if test -d Singular; then
510  SUBDIRS="$SUBDIRS Singular"
511fi
512 
513
514dnl lllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllll
515dnl Enough -- wrap it up
516dnl
517AC_PROG_MAKE_SET
518AC_SUBST(SUBDIRS)
519AC_SUBST(CONFIG_SUBDIRS)
520AC_CONFIG_SUBDIRS($CONFIG_SUBDIRS)
521
522AC_OUTPUT(${OUTPUT_MAKEFILES})
523
Note: See TracBrowser for help on using the repository browser.