1 | dnl Process this file with autoconf to produce a configure script |
---|
2 | AC_INIT(Singular/matpol.h) |
---|
3 | AC_PREFIX_DEFAULT(`pwd`) |
---|
4 | |
---|
5 | AC_CANONICAL_HOST |
---|
6 | AC_SUBST(host) |
---|
7 | |
---|
8 | |
---|
9 | dnl lllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllll |
---|
10 | dnl those are needed to check for libs and headers, later on |
---|
11 | dnl |
---|
12 | AC_PROG_CC |
---|
13 | AC_PROG_CPP |
---|
14 | AC_AIX |
---|
15 | |
---|
16 | dnl and add to -I to CPPFLAGS and and -Lto LDFLAGS, just to be sure |
---|
17 | if test "$libdir" = '${exec_prefix}/lib'; then |
---|
18 | if test "x$exec_prefix" = xNONE; then |
---|
19 | if test "x$prefix" = xNONE; then |
---|
20 | LDFLAGS="-L${ac_default_prefix}/lib ${LDFLAGS}" |
---|
21 | else |
---|
22 | LDFLAGS="-L${prefix}/lib ${LDFLAGS}" |
---|
23 | fi |
---|
24 | else |
---|
25 | LDFLAGS="-L${exec_prefix}/lib ${LDFLAGS}" |
---|
26 | fi |
---|
27 | else |
---|
28 | LDFLAGS="-L${libdir} ${LDFLAGS}" |
---|
29 | fi |
---|
30 | |
---|
31 | if test "$includedir" = '${prefix}/include'; then |
---|
32 | if test "x$prefix" = xNONE; then |
---|
33 | CPPFLAGS="-I${ac_default_prefix}/include ${CPPFLAGS}" |
---|
34 | else |
---|
35 | CPPFLAGS="-I${prefix}/include ${CPPFLAGS}" |
---|
36 | fi |
---|
37 | else |
---|
38 | CPPFLAGS="-I${includedir} ${CPPFLAGS}" |
---|
39 | fi |
---|
40 | |
---|
41 | dnl pass default prefix on to subdirs, if not explicitely given as an option |
---|
42 | if test "x$prefix" = xNONE; then |
---|
43 | ac_configure_args="$ac_configure_args --prefix=$ac_default_prefix" |
---|
44 | fi |
---|
45 | |
---|
46 | AC_MSG_CHECKING(whether _AIX is defined) |
---|
47 | AC_CACHE_VAL(ac_cv_is_aix, |
---|
48 | AC_EGREP_CPP(yes, |
---|
49 | [#ifdef _AIX |
---|
50 | yes |
---|
51 | #endif |
---|
52 | ], ac_cv_is_aix=yes, ac_cv_is_aix=no, 1)) |
---|
53 | if test "$ac_cv_is_aix" = yes; then |
---|
54 | AC_MSG_RESULT(yes) |
---|
55 | else |
---|
56 | AC_MSG_RESULT(no) |
---|
57 | fi |
---|
58 | |
---|
59 | |
---|
60 | dnl lllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllll |
---|
61 | dnl check for various libraries and headers |
---|
62 | dnl |
---|
63 | AC_CHECK_LIB(m, atof) |
---|
64 | AC_CHECK_LIB(gmp, mpz_init) |
---|
65 | AC_CHECK_LIB(MP, IMP_PutGmpInt) |
---|
66 | AC_CHECK_LIB(MPT, MPT_GetTree) |
---|
67 | AC_CHECK_LIB(singcf, atof) |
---|
68 | AC_CHECK_LIB(singfac, atof) |
---|
69 | |
---|
70 | AC_CHECK_HEADERS(gmp.h MP.h MPT.h factory.h factor.h) |
---|
71 | |
---|
72 | if test "$ac_cv_lib_gmp_mpz_init" = yes && \ |
---|
73 | test "$ac_cv_header_gmp_h" = yes; then |
---|
74 | ac_gmp_ok=yes |
---|
75 | fi |
---|
76 | |
---|
77 | if test "$ac_cv_lib_MP_IMP_PutGmpInt" = yes && \ |
---|
78 | test "$ac_cv_lib_MPT_MPT_GetTree" && \ |
---|
79 | test "$ac_cv_header_MP_h" = yes && \ |
---|
80 | test "$ac_cv_header_MPT_h" = yes; then |
---|
81 | ac_MP_ok=yes |
---|
82 | fi |
---|
83 | |
---|
84 | if test "$ac_cv_lib_singcf_atof" = yes && \ |
---|
85 | test "$ac_cv_header_factory_h" = yes; then |
---|
86 | ac_factory_ok=yes |
---|
87 | fi |
---|
88 | |
---|
89 | if test "$ac_cv_lib_singfac_atof" = yes && \ |
---|
90 | test "$ac_cv_header_factor_h" = yes; then |
---|
91 | ac_libfac_ok=yes |
---|
92 | fi |
---|
93 | |
---|
94 | |
---|
95 | |
---|
96 | dnl lllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllll |
---|
97 | dnl Check whether or not to built various packages |
---|
98 | dnl |
---|
99 | AC_ARG_ENABLE(gmp, \ |
---|
100 | [ --enable-PACKAGE configure and build PACKAGE |
---|
101 | --disable-PACKAGE do not configure and build PACKAGE |
---|
102 | --with-PACKAGE use PACKAGE, provide dependent functionality |
---|
103 | --without-PACKAGE do not use PACKAGE, disable dependent functionality |
---|
104 | where PACKAGE can be: |
---|
105 | gmp GNU multiple precision library]) |
---|
106 | AC_ARG_ENABLE(MP, \ |
---|
107 | [ MP Multi Protocol library]) |
---|
108 | AC_ARG_ENABLE(factory, \ |
---|
109 | [ factory polynomial factorization library]) |
---|
110 | AC_ARG_ENABLE(libfac, \ |
---|
111 | [ libfac char set and modp poly factorization library]) |
---|
112 | AC_ARG_ENABLE(Singular, \ |
---|
113 | [ Singular, CAS for commutative algebra]) |
---|
114 | |
---|
115 | AC_MSG_CHECKING(whether to configure and build gmp lib) |
---|
116 | if test "$enable_gmp" != yes && test "$enable_gmp" != no; then |
---|
117 | if test "$with_gmp" != no && test "$ac_gmp_ok" != yes; then |
---|
118 | enable_gmp=yes |
---|
119 | else |
---|
120 | enable_gmp=no |
---|
121 | fi |
---|
122 | fi |
---|
123 | if test "$enable_gmp" = yes && test -d gmp; then |
---|
124 | if test "$ac_cv_is_aix" = yes && test "$GCC" = yes; then |
---|
125 | AC_MSG_RESULT(no) |
---|
126 | AC_MSG_WARN(Building gmp v2 with gcc results in a gmp lib with bugs) |
---|
127 | AC_MSG_WARN(Install gmp v2 with another compiler first or use gmp v1.3) |
---|
128 | AC_MSG_WARN(For the time being gmp is neither configured/built nor used) |
---|
129 | enable_gmp=no |
---|
130 | ac_configure_args="$ac_configure_args --disable-gmp" |
---|
131 | else |
---|
132 | AC_MSG_RESULT(yes) |
---|
133 | CONFIG_SUBDIRS="gmp" |
---|
134 | ac_configure_args="$ac_configure_args --enable-gmp" |
---|
135 | fi |
---|
136 | else |
---|
137 | AC_MSG_RESULT(no) |
---|
138 | if test "$enable_gmp" = yes && test ! -d gmp; then |
---|
139 | AC_MSG_WARN(Did not find gmp subdirectory) |
---|
140 | fi |
---|
141 | enable_gmp=no |
---|
142 | ac_configure_args="$ac_configure_args --disable-gmp" |
---|
143 | fi |
---|
144 | |
---|
145 | AC_MSG_CHECKING(whether to configure and build MP lib) |
---|
146 | if test "$enable_MP" != yes && test "$enable_MP" != no; then |
---|
147 | if test "$with_MP" != no && test "$ac_MP_ok" != yes; then |
---|
148 | enable_MP=yes |
---|
149 | else |
---|
150 | enable_MP=no |
---|
151 | fi |
---|
152 | fi |
---|
153 | if test "$enable_MP" = yes && test -d MP; then |
---|
154 | if test "$ac_gmp_ok" = yes || test "$enable_gmp" = yes; then |
---|
155 | AC_MSG_RESULT(yes) |
---|
156 | CONFIG_SUBDIRS="$CONFIG_SUBDIRS MP" |
---|
157 | ac_configure_args="$ac_configure_args --enable-MP" |
---|
158 | else |
---|
159 | AC_MSG_RESULT(no) |
---|
160 | AC_MSG_WARN(Can not build MP for Singular without having gmp) |
---|
161 | enable_MP=no |
---|
162 | ac_configure_args="$ac_configure_args --disable-MP" |
---|
163 | fi |
---|
164 | else |
---|
165 | AC_MSG_RESULT(no) |
---|
166 | if test "$enable_MP" = yes && test ! -d MP; then |
---|
167 | AC_MSG_WARN(Did not find MP subdirectory) |
---|
168 | fi |
---|
169 | enable_MP=no |
---|
170 | ac_configure_args="$ac_configure_args --disable-MP" |
---|
171 | fi |
---|
172 | |
---|
173 | if test "$with_builtingmp" = yes; then |
---|
174 | enable_gmp=yes |
---|
175 | ac_configure_args="$ac_configure_args --enable-gmp" |
---|
176 | fi |
---|
177 | |
---|
178 | AC_MSG_CHECKING(whether to configure and build factory lib) |
---|
179 | if test "$enable_factory" != yes && test "$enable_factory" != no; then |
---|
180 | if test "$with_factory" != no && test "$ac_factory_ok" != yes; then |
---|
181 | enable_factory=yes |
---|
182 | else |
---|
183 | enable_factory=no |
---|
184 | fi |
---|
185 | fi |
---|
186 | if test "$enable_factory" = yes && test -d factory; then |
---|
187 | if test "$ac_gmp_ok" = yes || test "$enable_gmp" = yes; then |
---|
188 | AC_MSG_RESULT(yes) |
---|
189 | CONFIG_SUBDIRS="$CONFIG_SUBDIRS factory" |
---|
190 | ac_configure_args="$ac_configure_args --enable-factory" |
---|
191 | else |
---|
192 | AC_MSG_RESULT(no) |
---|
193 | AC_MSG_WARN(Can not build factory without having gmp) |
---|
194 | enable_factory=no |
---|
195 | ac_configure_args="$ac_configure_args --disable-factory" |
---|
196 | fi |
---|
197 | else |
---|
198 | AC_MSG_RESULT(no) |
---|
199 | if test "$enable_factory" = yes && test ! -d factory; then |
---|
200 | AC_MSG_WARN(Did not find factory subdirectory) |
---|
201 | fi |
---|
202 | enable_factory=no |
---|
203 | ac_configure_args="$ac_configure_args --disable-factory" |
---|
204 | fi |
---|
205 | |
---|
206 | AC_MSG_CHECKING(whether to configure and build libfac lib) |
---|
207 | if test "$enable_libfac" != yes && test "$enable_libfac" != no; then |
---|
208 | if test "$with_libfac" != no && test "$ac_libfac_ok" != yes; then |
---|
209 | enable_libfac=yes |
---|
210 | else |
---|
211 | enable_libfac=no |
---|
212 | fi |
---|
213 | fi |
---|
214 | if test "$enable_libfac" = yes && test -d libfac; then |
---|
215 | if test "$ac_factory_ok" = yes || test "$enable_factory" = yes; then |
---|
216 | AC_MSG_RESULT(yes) |
---|
217 | CONFIG_SUBDIRS="$CONFIG_SUBDIRS libfac" |
---|
218 | ac_configure_args="$ac_configure_args --enable-libfac" |
---|
219 | else |
---|
220 | AC_MSG_RESULT(no) |
---|
221 | AC_MSG_WARN(Can not build libfac without factory) |
---|
222 | enable_libfac=no |
---|
223 | ac_configure_args="$ac_configure_args --disable-libfac" |
---|
224 | fi |
---|
225 | else |
---|
226 | AC_MSG_RESULT(no) |
---|
227 | if test "$enable_libfac" = yes && test ! -d libfac; then |
---|
228 | AC_MSG_WARN(Did not find libfac subdirectory) |
---|
229 | fi |
---|
230 | enable_libfac=no |
---|
231 | ac_configure_args="$ac_configure_args --disable-libfac" |
---|
232 | fi |
---|
233 | |
---|
234 | AC_MSG_CHECKING(whether to configure and build Singular) |
---|
235 | if test "$enable_Singular" != yes && test "$enable_Singular" != no; then |
---|
236 | if test "$with_Singular" != no; then |
---|
237 | enable_Singular=yes |
---|
238 | else |
---|
239 | enable_Singular=no |
---|
240 | fi |
---|
241 | fi |
---|
242 | if test "$enable_Singular" = yes && test -d Singular; then |
---|
243 | AC_MSG_RESULT(yes) |
---|
244 | CONFIG_SUBDIRS="$CONFIG_SUBDIRS Singular" |
---|
245 | ac_configure_args="$ac_configure_args --enable-Singular" |
---|
246 | else |
---|
247 | AC_MSG_RESULT(no) |
---|
248 | if test "$enable_Singular" = yes && test ! -d Singular; then |
---|
249 | AC_MSG_WARN(Did not find Singular subdirectory) |
---|
250 | fi |
---|
251 | enable_Singular=no |
---|
252 | ac_configure_args="$ac_configure_args --disable-Singular" |
---|
253 | fi |
---|
254 | |
---|
255 | |
---|
256 | dnl lllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllll |
---|
257 | dnl Check whether or not to use various packages |
---|
258 | dnl |
---|
259 | AC_MSG_CHECKING(whether to use with gmp) |
---|
260 | if test "$with_gmp" != no && test "$with_gmp" != yes; then |
---|
261 | if test "$ac_gmp_ok" = yes || test "$enable_gmp" = yes; then |
---|
262 | with_gmp=yes |
---|
263 | else |
---|
264 | with_gmp=no |
---|
265 | fi |
---|
266 | ac_configure_args="$ac_configure_args --with-gmp=$with_gmp" |
---|
267 | fi |
---|
268 | if test "$with_gmp" = yes; then |
---|
269 | AC_MSG_RESULT(yes) |
---|
270 | else |
---|
271 | AC_MSG_RESULT(no) |
---|
272 | fi |
---|
273 | |
---|
274 | AC_MSG_CHECKING(whether to use with MP) |
---|
275 | if test "$with_MP" != no && test "$with_MP" != yes; then |
---|
276 | if test "$ac_MP_ok" = yes || test "$enable_MP" = yes; then |
---|
277 | with_MP=yes |
---|
278 | else |
---|
279 | with_MP=no |
---|
280 | fi |
---|
281 | ac_configure_args="$ac_configure_args --with-MP=$with_MP" |
---|
282 | fi |
---|
283 | if test "$with_MP" = yes; then |
---|
284 | AC_MSG_RESULT(yes) |
---|
285 | else |
---|
286 | AC_MSG_RESULT(no) |
---|
287 | fi |
---|
288 | |
---|
289 | AC_MSG_CHECKING(whether to use with factory) |
---|
290 | if test "$with_factory" != no && test "$with_factory" != yes; then |
---|
291 | if test "$ac_factory_ok" = yes || test "$enable_factory" = yes; then |
---|
292 | with_factory=yes |
---|
293 | else |
---|
294 | with_factory=no |
---|
295 | fi |
---|
296 | ac_configure_args="$ac_configure_args --with-factory=$with_factory" |
---|
297 | fi |
---|
298 | if test "$with_factory" = yes; then |
---|
299 | AC_MSG_RESULT(yes) |
---|
300 | else |
---|
301 | AC_MSG_RESULT(no) |
---|
302 | fi |
---|
303 | |
---|
304 | AC_MSG_CHECKING(whether to use with libfac) |
---|
305 | if test "$with_libfac" != no && test "$with_libfac" != yes; then |
---|
306 | if test "$ac_libfac_ok" = yes || test "$enable_libfac" = yes; then |
---|
307 | with_libfac=yes |
---|
308 | else |
---|
309 | with_libfac=no |
---|
310 | fi |
---|
311 | ac_configure_args="$ac_configure_args --with-libfac=$with_libfac" |
---|
312 | fi |
---|
313 | if test "$with_libfac" = yes; then |
---|
314 | AC_MSG_RESULT(yes) |
---|
315 | else |
---|
316 | AC_MSG_RESULT(no) |
---|
317 | fi |
---|
318 | |
---|
319 | AC_MSG_CHECKING(whether to use with Singular) |
---|
320 | if test "$with_Singular" != no && test "$with_Singular" != yes; then |
---|
321 | if test "$enable_Singular" = yes; then |
---|
322 | with_Singular=yes |
---|
323 | else |
---|
324 | with_Singular=no |
---|
325 | fi |
---|
326 | ac_configure_args="$ac_configure_args --with-Singular=$with_Singular" |
---|
327 | fi |
---|
328 | |
---|
329 | if test "$with_Singular" != no; then |
---|
330 | AC_MSG_RESULT(yes) |
---|
331 | else |
---|
332 | AC_MSG_RESULT(no) |
---|
333 | fi |
---|
334 | |
---|
335 | dnl lllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllll |
---|
336 | dnl Check for known subdirs |
---|
337 | dnl |
---|
338 | if test -d gmp; then |
---|
339 | SUBDIRS="gmp" |
---|
340 | fi |
---|
341 | if test -d MP; then |
---|
342 | SUBDIRS="$SUBDIRS MP" |
---|
343 | fi |
---|
344 | if test -d factory; then |
---|
345 | SUBDIRS="$SUBDIRS factory" |
---|
346 | fi |
---|
347 | if test -d libfac; then |
---|
348 | SUBDIRS="$SUBDIRS libfac" |
---|
349 | fi |
---|
350 | if test -d Singular; then |
---|
351 | SUBDIRS="$SUBDIRS Singular" |
---|
352 | fi |
---|
353 | |
---|
354 | |
---|
355 | dnl lllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllll |
---|
356 | dnl Enough --wrap it up |
---|
357 | dnl |
---|
358 | AC_PROG_MAKE_SET |
---|
359 | AC_SUBST(SUBDIRS) |
---|
360 | AC_SUBST(CONFIG_SUBDIRS) |
---|
361 | AC_CONFIG_SUBDIRS($CONFIG_SUBDIRS) |
---|
362 | |
---|
363 | AC_OUTPUT(Makefile) |
---|