1 | # Copyright (C) 2006 International Business Machines. |
---|
2 | # All Rights Reserved. |
---|
3 | # This file is distributed under the Common Public License. |
---|
4 | |
---|
5 | ## $Id: configure.ac 640 2006-10-25 20:09:18Z andreasw $ |
---|
6 | |
---|
7 | # Author: Andreas Waechter IBM 2006-04-13 |
---|
8 | |
---|
9 | ############################################################################# |
---|
10 | # Names and other basic things # |
---|
11 | ############################################################################# |
---|
12 | |
---|
13 | AC_PREREQ(2.59) |
---|
14 | |
---|
15 | AC_INIT([CoinUtils],[0.1],[http://projects.coin-or.org/CoinUtils]) |
---|
16 | |
---|
17 | AC_COPYRIGHT([ |
---|
18 | Copyright 2006 International Business Machines and others. |
---|
19 | All Rights Reserved. |
---|
20 | This file is part of the open source package Coin which is distributed |
---|
21 | under the Common Public License.]) |
---|
22 | |
---|
23 | # List one file in the package so that the configure script can test |
---|
24 | # whether the package is actually there |
---|
25 | AC_CONFIG_SRCDIR(src/CoinError.cpp) |
---|
26 | |
---|
27 | # Where should everything be installed by default? Here, we want it |
---|
28 | # to be installed directly in 'bin', 'lib', 'include' subdirectories |
---|
29 | # of the directory where configure is run. The default would be |
---|
30 | # /usr/local. |
---|
31 | AC_PREFIX_DEFAULT([`pwd`]) |
---|
32 | |
---|
33 | ############################################################################# |
---|
34 | # Standard build tool stuff # |
---|
35 | ############################################################################# |
---|
36 | |
---|
37 | # Get the system type |
---|
38 | AC_CANONICAL_BUILD |
---|
39 | |
---|
40 | # If this project depends on external projects, the Externals file in |
---|
41 | # the source root directory contains definition of where to find those |
---|
42 | # externals. The following macro ensures that those externals are |
---|
43 | # retrieved by svn if they are not there yet. |
---|
44 | AC_COIN_PROJECTDIR_INIT |
---|
45 | |
---|
46 | # Check if user wants to produce debugging code |
---|
47 | AC_COIN_DEBUG_COMPILE(CoinUtils) |
---|
48 | |
---|
49 | # Get the name of the C++ compiler and appropriate compiler options |
---|
50 | AC_COIN_PROG_CXX |
---|
51 | |
---|
52 | # Check if we have a Fortran compiler; if we do, acquire the appropriate |
---|
53 | # options. This has to be done before we call AC_COIN_INIT_AUTO_TOOLS, else |
---|
54 | # it will helpfully set FFLAGS to an incorrect value. |
---|
55 | |
---|
56 | AC_COIN_FIND_F77 |
---|
57 | if test "$F77" != unavailable ; then |
---|
58 | AC_COIN_PROG_F77 |
---|
59 | fi |
---|
60 | |
---|
61 | # Initialize automake and libtool |
---|
62 | AC_COIN_INIT_AUTO_TOOLS |
---|
63 | |
---|
64 | ############################################################################ |
---|
65 | # Stuff that we need for finite and isnan # |
---|
66 | ############################################################################ |
---|
67 | |
---|
68 | AC_LANG_PUSH(C++) |
---|
69 | |
---|
70 | ################ |
---|
71 | # Header Files # |
---|
72 | ################ |
---|
73 | AC_COIN_CHECK_CXX_CHEADER(math) |
---|
74 | AC_COIN_CHECK_CXX_CHEADER(float) |
---|
75 | AC_COIN_CHECK_CXX_CHEADER(ieeefp) |
---|
76 | #case $build in |
---|
77 | # *-cygwin*) ;; |
---|
78 | # *) AC_COIN_CHECK_CXX_CHEADER([ieeefp]) ;; |
---|
79 | #esac |
---|
80 | |
---|
81 | ################### |
---|
82 | # Function finite # |
---|
83 | ################### |
---|
84 | MY_C_FINITE= |
---|
85 | AC_CHECK_DECL([finite],[MY_C_FINITE=finite],,[ |
---|
86 | #ifdef HAVE_CMATH |
---|
87 | # include <cmath> |
---|
88 | #else |
---|
89 | # ifdef HAVE_MATH_H |
---|
90 | # include <math.h> |
---|
91 | # endif |
---|
92 | #endif |
---|
93 | #ifdef HAVE_CFLOAT |
---|
94 | # include <cfloat> |
---|
95 | #else |
---|
96 | # ifdef HAVE_FLOAT_H |
---|
97 | # include <float.h> |
---|
98 | # endif |
---|
99 | #endif |
---|
100 | #ifdef HAVE_CIEEEFP |
---|
101 | # include <cieeefp> |
---|
102 | #else |
---|
103 | # ifdef HAVE_IEEEFP_H |
---|
104 | # include <ieeefp.h> |
---|
105 | # endif |
---|
106 | #endif]) |
---|
107 | if test -z "$MY_C_FINITE"; then |
---|
108 | AC_CHECK_DECL([_finite],[MY_C_FINITE=_finite],,[ |
---|
109 | #ifdef HAVE_CMATH |
---|
110 | # include <cmath> |
---|
111 | #else |
---|
112 | # ifdef HAVE_MATH_H |
---|
113 | # include <math.h> |
---|
114 | # endif |
---|
115 | #endif |
---|
116 | #ifdef HAVE_CFLOAT |
---|
117 | # include <cfloat> |
---|
118 | #else |
---|
119 | # ifdef HAVE_FLOAT_H |
---|
120 | # include <float.h> |
---|
121 | # endif |
---|
122 | #endif |
---|
123 | #ifdef HAVE_CIEEEFP |
---|
124 | # include <cieeefp> |
---|
125 | #else |
---|
126 | # ifdef HAVE_IEEEFP_H |
---|
127 | # include <ieeefp.h> |
---|
128 | # endif |
---|
129 | #endif]) |
---|
130 | if test -z "$MY_C_FINITE"; then |
---|
131 | AC_CHECK_DECL([isfinite],[MY_C_FINITE=isfinite],,[ |
---|
132 | #ifdef HAVE_CMATH |
---|
133 | # include <cmath> |
---|
134 | #else |
---|
135 | # ifdef HAVE_MATH_H |
---|
136 | # include <math.h> |
---|
137 | # endif |
---|
138 | #endif |
---|
139 | #ifdef HAVE_CFLOAT |
---|
140 | # include <cfloat> |
---|
141 | #else |
---|
142 | # ifdef HAVE_FLOAT_H |
---|
143 | # include <float.h> |
---|
144 | # endif |
---|
145 | #endif |
---|
146 | #ifdef HAVE_CIEEEFP |
---|
147 | # include <cieeefp> |
---|
148 | #else |
---|
149 | # ifdef HAVE_IEEEFP_H |
---|
150 | # include <ieeefp.h> |
---|
151 | # endif |
---|
152 | #endif]) |
---|
153 | fi |
---|
154 | fi |
---|
155 | if test -z "$MY_C_FINITE"; then |
---|
156 | AC_MSG_WARN(Cannot find C-function for checking Inf. Check will test whether the value is different from DBL_MAX) |
---|
157 | else |
---|
158 | AC_DEFINE_UNQUOTED([MY_C_FINITE],[$MY_C_FINITE], |
---|
159 | [Define to be the name of C-function for Inf check]) |
---|
160 | fi |
---|
161 | |
---|
162 | ################### |
---|
163 | # Function isnan # |
---|
164 | ################### |
---|
165 | MY_C_ISNAN= |
---|
166 | AC_CHECK_DECL([isnan],[MY_C_ISNAN=isnan],,[ |
---|
167 | #ifdef HAVE_CMATH |
---|
168 | # include <cmath> |
---|
169 | #else |
---|
170 | # ifdef HAVE_MATH_H |
---|
171 | # include <math.h> |
---|
172 | # endif |
---|
173 | #endif |
---|
174 | #ifdef HAVE_CFLOAT |
---|
175 | # include <cfloat> |
---|
176 | #else |
---|
177 | # ifdef HAVE_FLOAT_H |
---|
178 | # include <float.h> |
---|
179 | # endif |
---|
180 | #endif |
---|
181 | #ifdef HAVE_CIEEEFP |
---|
182 | # include <cieeefp> |
---|
183 | #else |
---|
184 | # ifdef HAVE_IEEEFP_H |
---|
185 | # include <ieeefp.h> |
---|
186 | # endif |
---|
187 | #endif]) |
---|
188 | if test -z "$MY_C_ISNAN"; then |
---|
189 | AC_CHECK_DECL([_isnan],[MY_C_ISNAN=_isnan],,[ |
---|
190 | #ifdef HAVE_CMATH |
---|
191 | # include <cmath> |
---|
192 | #else |
---|
193 | # ifdef HAVE_MATH_H |
---|
194 | # include <math.h> |
---|
195 | # endif |
---|
196 | #endif |
---|
197 | #ifdef HAVE_CFLOAT |
---|
198 | # include <cfloat> |
---|
199 | #else |
---|
200 | # ifdef HAVE_FLOAT_H |
---|
201 | # include <float.h> |
---|
202 | # endif |
---|
203 | #endif |
---|
204 | #ifdef HAVE_CIEEEFP |
---|
205 | # include <cieeefp> |
---|
206 | #else |
---|
207 | # ifdef HAVE_IEEEFP_H |
---|
208 | # include <ieeefp.h> |
---|
209 | # endif |
---|
210 | #endif]) |
---|
211 | fi |
---|
212 | if test -z "$MY_C_ISNAN"; then |
---|
213 | AC_CHECK_DECL([isnand],[MY_C_ISNAN=isnand],,[ |
---|
214 | #ifdef HAVE_CMATH |
---|
215 | # include <cmath> |
---|
216 | #else |
---|
217 | # ifdef HAVE_MATH_H |
---|
218 | # include <math.h> |
---|
219 | # endif |
---|
220 | #endif |
---|
221 | #ifdef HAVE_CFLOAT |
---|
222 | # include <cfloat> |
---|
223 | #else |
---|
224 | # ifdef HAVE_FLOAT_H |
---|
225 | # include <float.h> |
---|
226 | # endif |
---|
227 | #endif |
---|
228 | #ifdef HAVE_CIEEEFP |
---|
229 | # include <cieeefp> |
---|
230 | #else |
---|
231 | # ifdef HAVE_IEEEFP_H |
---|
232 | # include <ieeefp.h> |
---|
233 | # endif |
---|
234 | #endif]) |
---|
235 | fi |
---|
236 | if test -z "$MY_C_ISNAN"; then |
---|
237 | AC_MSG_WARN(Cannot find C-function for checking NaN. Check will return false) |
---|
238 | else |
---|
239 | AC_DEFINE_UNQUOTED([MY_C_ISNAN],[$MY_C_ISNAN], |
---|
240 | [Define to be the name of C-function for NaN check]) |
---|
241 | fi |
---|
242 | |
---|
243 | ############################################################################# |
---|
244 | # Finding certain integer types # |
---|
245 | ############################################################################# |
---|
246 | |
---|
247 | AC_COIN_CHECK_CXX_CHEADER(inttypes) |
---|
248 | |
---|
249 | ##### 64bit Integer type |
---|
250 | CoinInt64= |
---|
251 | |
---|
252 | # try int64_t |
---|
253 | AC_CHECK_TYPE([int64_t],[CoinInt64=int64_t],[],[ |
---|
254 | #ifdef HAVE_CINTTYPES |
---|
255 | # include <cinttypes> |
---|
256 | #else |
---|
257 | # ifdef HAVE_INTTYPES_H |
---|
258 | # include <inttypes.h> |
---|
259 | # endif |
---|
260 | #endif |
---|
261 | ]) |
---|
262 | |
---|
263 | # We need to use the C compiler in the AC_CHECK_SIZEOF since otherwise the |
---|
264 | # MSCV compiler complains about redefinition of "exit" |
---|
265 | AC_LANG_PUSH(C) |
---|
266 | # try long long |
---|
267 | if test x"$CoinInt64" = x; then |
---|
268 | AC_CHECK_SIZEOF([long long]) |
---|
269 | case $ac_cv_sizeof_long_long in |
---|
270 | 8 | 8?) CoinInt64="long long" ;; # We do this funny test, since sometimes ^M is added in ac_cv_sizeof_long_long |
---|
271 | esac |
---|
272 | fi |
---|
273 | |
---|
274 | #try long |
---|
275 | if test x"$CoinInt64" = x; then |
---|
276 | AC_CHECK_SIZEOF([long]) |
---|
277 | case $ac_cv_sizeof_long in |
---|
278 | 8 | 8?) CoinInt64="long" ;; # We do this funny test, since sometimes ^M is added in ac_cv_sizeof_long |
---|
279 | esac |
---|
280 | fi |
---|
281 | |
---|
282 | #try int |
---|
283 | if test x"$CoinInt64" = x; then |
---|
284 | AC_CHECK_SIZEOF([int]) |
---|
285 | case $ac_cv_sizeof_int in |
---|
286 | 8 | 8?) CoinInt64="int" ;; # We do this funny test, since sometimes ^M is added in ac_cv_sizeof_int |
---|
287 | esac |
---|
288 | fi |
---|
289 | AC_LANG_POP(C) |
---|
290 | |
---|
291 | if test x"$CoinInt64" = x; then |
---|
292 | AC_MSG_ERROR([Cannot find integer type with 64 bits]) |
---|
293 | fi |
---|
294 | AC_DEFINE_UNQUOTED([COIN_INT64_T],[$CoinInt64],[Define to 64bit integer type]) |
---|
295 | |
---|
296 | |
---|
297 | ##### Integer type for Pointer |
---|
298 | CoinIntPtr= |
---|
299 | |
---|
300 | # try intptr_t |
---|
301 | AC_CHECK_TYPE([intptr_t],[CoinIntPtr=intptr_t],[],[ |
---|
302 | #ifdef HAVE_CINTTYPES |
---|
303 | # include <cinttypes> |
---|
304 | #else |
---|
305 | # ifdef HAVE_INTTYPES_H |
---|
306 | # include <inttypes.h> |
---|
307 | # endif |
---|
308 | #endif |
---|
309 | ]) |
---|
310 | |
---|
311 | AC_LANG_PUSH(C) |
---|
312 | # try long long |
---|
313 | if test x"$CoinIntPtr" = x; then |
---|
314 | AC_CHECK_SIZEOF([int *]) |
---|
315 | AC_CHECK_SIZEOF([long long]) |
---|
316 | if test "$ac_cv_sizeof_long_long" = "$ac_cv_sizeof_int_p"; then |
---|
317 | CoinIntPtr="long long" |
---|
318 | fi |
---|
319 | fi |
---|
320 | |
---|
321 | # try long |
---|
322 | if test x"$CoinIntPtr" = x; then |
---|
323 | AC_CHECK_SIZEOF([long]) |
---|
324 | if test "$ac_cv_sizeof_long" = "$ac_cv_sizeof_int_p"; then |
---|
325 | CoinIntPtr="long" |
---|
326 | fi |
---|
327 | fi |
---|
328 | |
---|
329 | # try int |
---|
330 | if test x"$CoinIntPtr" = x; then |
---|
331 | AC_CHECK_SIZEOF([int]) |
---|
332 | if test "$ac_cv_sizeof_int" = "$ac_cv_sizeof_int_p"; then |
---|
333 | CoinIntPtr="int" |
---|
334 | fi |
---|
335 | fi |
---|
336 | AC_LANG_POP(C) |
---|
337 | |
---|
338 | if test x"$CoinIntPtr" = x; then |
---|
339 | AC_MSG_ERROR([Cannot find integer type capturing pointer]) |
---|
340 | fi |
---|
341 | AC_DEFINE_UNQUOTED([COIN_INTPTR_T],[$CoinIntPtr],[Define to integer type capturing pointer]) |
---|
342 | |
---|
343 | ############################################################################# |
---|
344 | # COIN components # |
---|
345 | ############################################################################# |
---|
346 | |
---|
347 | AC_COIN_HAS_PROJECT(CoinUtils) |
---|
348 | |
---|
349 | ############################################################################# |
---|
350 | # Other dependencies # |
---|
351 | ############################################################################# |
---|
352 | |
---|
353 | AC_COIN_HAS_USER_LIBRARY([Gmpl],[GMPL],[glpmpl.h],[mpl_initialize]) |
---|
354 | |
---|
355 | # Check for Ampl Solver Library |
---|
356 | |
---|
357 | AC_COIN_HAS_ASL |
---|
358 | |
---|
359 | # Check for BLAS and LAPACK. If there's no Fortran compiler available, skip |
---|
360 | # this entirely, otherwise configuration will fail when we try to do a Fortran |
---|
361 | # link. The check cannot be embedded in AC_COIN_HAS_BLAS because the offending |
---|
362 | # macro is AC_REQUIRE'd from somewhere inside AC_TRY_LINK and ends up out in |
---|
363 | # front of all the code in AC_COIN_HAS_BLAS. This will need to be revisited if |
---|
364 | # we run up against a situation where a prebuilt BLAS/LAPACK is linkable but |
---|
365 | # there's no Fortran compiler. This code has the unfortunate property that |
---|
366 | # calls to AM_CONDITIONAL are exposed here and still occur in AC_COIN_HAS_BLAS |
---|
367 | # and AC_COIN_HAS_LAPACK. With some thought, it should be possible to separate |
---|
368 | # BLAS and LAPACK configuration into two steps that would maintain information |
---|
369 | # hiding and still avoid attempting a Fortran link when no compiler is |
---|
370 | # present. |
---|
371 | |
---|
372 | |
---|
373 | if test "$F77" = unavailable ; then |
---|
374 | coin_has_blas=no |
---|
375 | AM_CONDITIONAL([COIN_HAS_BLAS],[false]) |
---|
376 | AM_CONDITIONAL([COIN_BUILD_BLAS],[false]) |
---|
377 | else |
---|
378 | AC_COIN_HAS_BLAS |
---|
379 | fi |
---|
380 | if test $coin_has_blas = no ; then |
---|
381 | AC_MSG_WARN([Cannot find BLAS - no dense factorisation.]) |
---|
382 | coin_has_lapack=no |
---|
383 | AM_CONDITIONAL([COIN_HAS_LAPACK],[false]) |
---|
384 | AM_CONDITIONAL([COIN_BUILD_LAPACK],[false]) |
---|
385 | else |
---|
386 | AC_COIN_HAS_LAPACK |
---|
387 | if test $coin_has_lapack = no ; then |
---|
388 | AC_MSG_WARN([Cannot find LAPACK - no dense factorisation.]) |
---|
389 | else |
---|
390 | AC_COIN_F77_WRAPPERS |
---|
391 | fi |
---|
392 | fi |
---|
393 | |
---|
394 | AC_COIN_CHECK_GNU_ZLIB |
---|
395 | AC_COIN_CHECK_GNU_BZLIB |
---|
396 | AC_COIN_CHECK_GNU_READLINE |
---|
397 | |
---|
398 | ############################################################################## |
---|
399 | # Finishing up by writing all the output # |
---|
400 | ############################################################################## |
---|
401 | |
---|
402 | # Here list all the files that configure should create (except for the |
---|
403 | # configuration header file) |
---|
404 | AC_CONFIG_FILES([Makefile |
---|
405 | src/Makefile |
---|
406 | test/Makefile |
---|
407 | coinutils_addlibs.txt]) |
---|
408 | |
---|
409 | # Here put the location and name of the configuration header file |
---|
410 | AC_CONFIG_HEADER([inc/config_coinutils.h]) |
---|
411 | |
---|
412 | # Finally, we let configure write all the output... |
---|
413 | AC_COIN_FINALIZE |
---|