source: stable/2.6/Cbc/configure.ac

Last change on this file was 1630, checked in by tkr, 8 years ago

restoring Cbc/stable/2.6

  • Property svn:keywords set to Author Date Id Revision
File size: 13.8 KB
Line 
1# Copyright (C) 2006, 2007 International Business Machines.
2# All Rights Reserved.
3# This file is distributed under the Common Public License.
4
5## $Id: configure.ac 1630 2011-03-26 17:18:25Z unxusr $
6
7# Author:  Andreas Waechter            IBM    2006-04-13
8
9#############################################################################
10#                       Names and other basic things                        #
11#############################################################################
12
13AC_PREREQ(2.59)
14
15AC_INIT([Cbc],[2.6],[cbc@lists.coin-or.org])
16
17AC_COPYRIGHT([
18Copyright 2006 International Business Machines and others.
19All Rights Reserved.
20This file is part of the open source package Coin which is distributed
21under 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
25AC_CONFIG_SRCDIR(src/CbcTree.hpp)
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.
31AC_PREFIX_DEFAULT([`pwd`])
32
33#############################################################################
34#                         Standard build tool stuff                         #
35#############################################################################
36
37# Get the system type
38AC_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.
44AC_COIN_PROJECTDIR_INIT(Cbc)
45
46# Check if user wants to produce debugging code
47AC_COIN_DEBUG_COMPILE(Cbc)
48
49# Get the name of the C++ compiler and appropriate compiler options
50AC_COIN_PROG_CXX
51
52# Initialize automake and libtool
53AC_COIN_INIT_AUTO_TOOLS
54
55#############################################################################
56#                            COIN-OR components                             #
57#############################################################################
58
59AC_COIN_CHECK_PACKAGE(CoinDepend, [cgl osi coinutils], [CbcLib CbcGeneric])
60if test $coin_has_coindepend != yes ; then
61  AC_MSG_ERROR([One or more required packages CoinUtils, Osi, and Cgl are not available.])
62fi
63
64# Clp and OsiClp are inseparable here.
65
66AC_COIN_CHECK_PACKAGE(Clp, [osi-clp], [CbcLib CbcGeneric])
67if test $coin_has_clp != yes ; then
68  AC_MSG_ERROR("Required package Clp unavailable.")
69fi
70
71# The rest are not required for linking against Cbc
72
73AC_COIN_CHECK_PACKAGE(OsiTests, [osi-unittests])
74AC_COIN_CHECK_PACKAGE(Sample,   [coindatasample])
75AC_COIN_CHECK_PACKAGE(Netlib,   [coindatanetlib])
76AC_COIN_CHECK_PACKAGE(Miplib3,  [coindatamiplib3])
77
78#############################################################################
79#                    LP solvers other than CLP                              #
80#############################################################################
81
82# Check which other LP solvers are available, some of them become a dependency of CbcGeneric
83AC_COIN_CHECK_PACKAGE(DyLP, [osi-dylp],   [CbcGeneric])
84AC_COIN_CHECK_PACKAGE(Vol,  [osi-vol])
85AC_COIN_CHECK_PACKAGE(Cpx,  [osi-cplex],  [CbcLib CbcGeneric])
86AC_COIN_CHECK_PACKAGE(Glpk, [osi-glpk],   [CbcGeneric])
87AC_COIN_CHECK_PACKAGE(Grb,  [osi-gurobi])
88AC_COIN_CHECK_PACKAGE(Msk,  [osi-mosek],  [CbcGeneric])
89AC_COIN_CHECK_PACKAGE(Spx,  [osi-soplex], [CbcGeneric])
90AC_COIN_CHECK_PACKAGE(Xpr,  [osi-xpress])
91
92#############################################################################
93#                       Other third party software                          #
94#############################################################################
95
96# Ampl Solver library
97AC_COIN_CHECK_PACKAGE(ASL, [coinasl])
98
99#############################################################################
100#                       CbcGeneric configuration                            #
101#############################################################################
102
103# Are we building cbc-generic? Default is no (false).
104
105AC_ARG_WITH([cbc-generic],
106  AS_HELP_STRING([--with-cbc-generic],
107                 [specify whether to build cbc-generic (default: no)]),
108  [case $withval in
109    yes) cbc_with_cbc_generic=true ;;
110      *) cbc_with_cbc_generic=false ;;
111   esac],
112  [cbc_with_cbc_generic=false])
113if test x"$cbc_with_cbc_generic" = xyes ; then
114  AC_MSG_NOTICE([building cbc-generic])
115fi
116AM_CONDITIONAL(CBC_BUILD_CBC_GENERIC,
117               test x"$cbc_with_cbc_generic" = xtrue)
118
119# Set the default solver for cbc-generic. In theory, any OsiXXX should work.
120# In practice, only the three listed below have had any testing.
121
122AC_MSG_CHECKING(for cbc-generic default solver)
123AC_ARG_WITH([cbc-generic-solver],
124            AC_HELP_STRING([--with-cbc-generic-solver],
125                           [specify default solver for cbc-generic in lower
126                            case letters (if not given, clp is assumed)]),
127            [cbc_default_solver=$withval],
128            [cbc_default_solver=clp])
129AC_MSG_RESULT($cbc_default_solver)
130
131# FIXME what about cplex and mosek here?
132case $cbc_default_solver in
133    clp)
134      ;;
135   dylp)
136      ;;
137   glpk)
138      ;;
139 soplex)
140      ;;
141      *)
142      AC_MSG_WARN([Unrecognised solver $cbc_default_solver chosen as cbc-generic default solver.])
143      ;;
144esac
145AC_DEFINE_UNQUOTED([CBC_DEFAULT_SOLVER],"$cbc_default_solver",
146  [Define to the name of the default solver to be used in cbc-generic in small letters])
147
148
149#############################################################################
150#                       Cbc parallel configuration                          #
151#############################################################################
152
153# First we define a new option, --enable-cbc-parallel
154
155AC_ARG_ENABLE([cbc-parallel],
156[AC_HELP_STRING([--enable-cbc-parallel],
157                [enables compilation of the SMP version of Cbc])])
158
159if test "$enable_cbc_parallel" = yes; then
160  # Define the preprocessor macro
161  AC_DEFINE([CBC_THREAD],[1],[Define to 1 if the SMP version of Cbc should be compiled])
162  AC_CHECK_LIB([rt],[clock_gettime],
163               [CBCLIB_LIBS="-lrt $CBCLIB_LIBS"
164                CBCLIB_PCLIBS="-lrt $CBCLIB_PCLIBS"
165                AC_DEFINE([HAVE_CLOCK_GETTIME],[1],[Define if clock_gettime and rt library is available])
166               ],
167               [AC_MSG_WARN([--enable-cbc-parallel selected, but -lrt unavailable; using gettimeofday instead of clock_gettime])])
168  AC_CHECK_LIB([pthread],[pthread_create],
169               [CBCLIB_LIBS="-lpthread $CBCLIB_LIBS"
170                CBCLIB_PCLIBS="-lpthread $CBCLIB_PCLIBS"
171               ],
172               [AC_MSG_ERROR([--enable-cbc-parallel selected, but -lpthreads unavailable])])
173fi
174
175##############################################################################
176#                            OsiCbc configuration                            #
177##############################################################################
178
179# Handles configuration of the underlying default solver in OsiCbc. The issue
180# is that OsiCbc defines a default solver, used when the client does not     
181# specify a solver in the constructor. The default solver must, therefore,   
182# be present in the build. This macro checks that this is true, and sets the
183# compile-time symbols OSICBC_DFLT_SOLVER, OSICBC_CLP_DFLT_SOLVER, and
184# OSICBC_DFLT_SOLVER_HPP that control the build. The parameter default_solver
185# should normally be clp, unless you're working on some other solver.
186
187# Ideally, this macro would not require enumeration of solvers, but the
188# effort required to avoid it is just not justified at present. One enumeration
189# is hidden in AC_OSI_CANONICAL. The other is visible, the AM_CONDITIONAL
190# list at the end.                                                             
191
192# In an ideal world this macro would do absolutely nothing if Cbc is not
193# present, but autotools is not an ideal world and we have to satisfy its
194# requirements. In particular, the AM_CONDITIONAL macros need to execute or
195# automake will complain. Really the only thing we need to suppress is the
196# check that the default solver exists. All the rest is irrelevant when Cbc
197# isn't present (hence OsiCbc will be configured but not actually compiled).
198
199# Process the with-osicbc-default-solver option.
200
201AC_ARG_WITH([osicbc-default-solver],
202  AS_HELP_STRING([--with-osicbc-default-solver],
203     [specify underlying solver for OsiCbc (default clp)]),
204     [osicbc_with_solver=$withval],
205     [osicbc_with_solver=clp])
206
207case "${osicbc_with_solver}" in
208  @<:@Cc@:>@@<:@Ll@:>@@<:@Pp@:>@*)
209    osi_lc_solver=clp ;           
210    osi_mc_solver=Clp ;           
211    osi_uc_solver=CLP ;           
212    osi_exists_solver=${coin_has_clp-"unavailable"}
213    ;;                                             
214  @<:@Dd@:>@@<:@Yy@:>@@<:@Ll@:>@@<:@Pp@:>@*)       
215    osi_lc_solver=dylp ;                           
216    osi_mc_solver=Dylp                             
217    osi_uc_solver=DYLP                             
218    osi_exists_solver=${coin_has_dylp-"unavailable"}
219    ;;                                             
220  @<:@Cc@:>@@<:@Pp@:>@@<:@Xx@:>@*)                 
221    osi_lc_solver=cpx ;                             
222    osi_mc_solver=Cpx                               
223    osi_uc_solver=CPX                               
224    osi_exists_solver=${coin_has_cpx-"unavailable"}
225    ;;
226  @<:@Gg@:>@@<:@Ll@:>@@<:@Pp@:>@@<:@Kk@:>@*)       
227    osi_lc_solver=glpk ;                           
228    osi_mc_solver=Glpk                             
229    osi_uc_solver=GLPK                             
230    osi_exists_solver=${coin_has_glpk-"unavailable"}
231    ;;
232  @<:@Gg@:>@@<:@Rr@:>@@<:@Bb@:>@*)
233    osi_lc_solver=grb ;
234    osi_mc_solver=Grb ;           
235    osi_uc_solver=GRB ;           
236    osi_exists_solver=${coin_has_grb-"unavailable"}
237    ;;                                             
238  @<:@Mm@:>@@<:@Ss@:>@@<:@Kk@:>@*)
239    osi_lc_solver=msk ;
240    osi_mc_solver=Msk
241    osi_uc_solver=MSK
242    osi_exists_solver=${coin_has_msk-"unavailable"}
243    ;;
244  @<:@Ss@:>@@<:@Pp@:>@@<:@Xx@:>@*)
245    osi_lc_solver=spx ;
246    osi_mc_solver=Spx
247    osi_uc_solver=SPX
248    osi_exists_solver=${coin_has_spx-"unavailable"}
249    ;;
250  @<:@Ss@:>@@<:@Yy@:>@@<:@Mm@:>@*)
251    osi_lc_solver=sym ;
252    osi_mc_solver=Sym
253    osi_uc_solver=SYM
254    osi_exists_solver=${coin_has_sym-"unavailable"}
255    ;;
256  @<:@Vv@:>@@<:@Oo@:>@@<:@Ll@:>@*)
257    osi_lc_solver=vol ;
258    osi_mc_solver=Vol
259    osi_uc_solver=VOL
260    osi_exists_solver=${coin_has_vol-"unavailable"}
261    ;;
262  @<:@Xx@:>@@<:@Pp@:>@@<:@Rr@:>@*)
263    osi_lc_solver=xpr ;
264    osi_mc_solver=Xpr
265    osi_uc_solver=XPR
266    osi_exists_solver=${coin_has_xpr-"unavailable"}
267    ;;
268  *)
269    osi_lc_solver=clp ;
270    osi_mc_solver=Clp ;
271    osi_uc_solver=CLP ;
272    osi_exists_solver=${coin_has_clp-"unavailable"}
273    AC_MSG_WARN([Unrecognised solver $1; defaulting to $osi_lc_solver.])
274    ;;
275esac
276
277# Check that the requested solver is available.
278if test $osi_exists_solver = no; then
279  AC_MSG_ERROR([selected default solver $osicbc_with_solver is unavailable.
280  Please select an available solver using the --with-osicbc-default-solver option.])
281fi
282
283# State the result.
284AC_MSG_NOTICE([OsiCbc default solver is $osi_lc_solver])
285
286# And set the configuration variables.
287AC_DEFINE_UNQUOTED([OSICBC_DFLT_SOLVER],
288  [Osi${osi_mc_solver}SolverInterface],
289  [define to the name of the default solver interface class, e.g., OsiClpSolverInterface])
290AC_DEFINE_UNQUOTED([OSICBC_DFLT_SOLVER_HPP],
291  ["Osi${osi_mc_solver}SolverInterface.hpp"],
292  [define to the name of the .hpp file for the default solver interface class, e.g., "OsiClpSolverInterface.hpp" (include quotes)])
293if test $osi_mc_solver = "Clp"; then
294  AC_DEFINE([OSICBC_DFLT_SOLVER_CLP],[1],[define this symbol if clp is the default solver])
295fi
296
297# Last but not least, we need automake conditionals.
298AM_CONDITIONAL([OSICBC_DFLT_SOLVER_CLP],[test $osi_mc_solver = Clp])
299AM_CONDITIONAL([OSICBC_DFLT_SOLVER_CPX],[test $osi_mc_solver = Cpx])
300AM_CONDITIONAL([OSICBC_DFLT_SOLVER_DYLP],[test $osi_mc_solver = Dylp])
301AM_CONDITIONAL([OSICBC_DFLT_SOLVER_GLPK],[test $osi_mc_solver = Glpk])
302AM_CONDITIONAL([OSICBC_DFLT_SOLVER_GRB],[test $osi_mc_solver = Grb])
303AM_CONDITIONAL([OSICBC_DFLT_SOLVER_MSK],[test $osi_mc_solver = Msk])
304AM_CONDITIONAL([OSICBC_DFLT_SOLVER_SPX],[test $osi_mc_solver = Spx])
305AM_CONDITIONAL([OSICBC_DFLT_SOLVER_SYM],[test $osi_mc_solver = Sym])
306AM_CONDITIONAL([OSICBC_DFLT_SOLVER_VOL],[test $osi_mc_solver = Vol])
307AM_CONDITIONAL([OSICBC_DFLT_SOLVER_XPR],[test $osi_mc_solver = Xpr])
308
309##############################################################################
310#                   VPATH links for example input files                      #
311##############################################################################
312
313# In case this is a VPATH configuration we need to make sure that the
314# input files for the examples are available in the VPATH directory.
315
316AC_COIN_VPATH_LINK(examples/sudoku_sample.csv)
317AC_COIN_VPATH_LINK(examples/quad.mps)
318AC_COIN_VPATH_LINK(examples/quad2.mps)
319
320#############################################################################
321#                  Check for doxygen                                        #
322#############################################################################
323
324AC_COIN_DOXYGEN(CoinUtils Osi Clp DyLP Cgl Vol)
325
326##############################################################################
327#                   Finishing up by writing all the output                   #
328##############################################################################
329
330# Here list all the files that configure should create (except for the
331# configuration header file)
332AC_CONFIG_FILES([Makefile
333                 examples/Makefile
334                 src/Makefile
335                 src/OsiCbc/Makefile
336                 test/Makefile
337                 cbc.pc cbc-uninstalled.pc
338                 osi-cbc.pc osi-cbc-uninstalled.pc])
339AC_CONFIG_FILES([doxydoc/doxygen.conf])
340
341# Here put the location and name of the configuration header file
342AC_CONFIG_HEADER([inc/config_cbc.h])
343
344# Finally, we let configure write all the output...
345AC_COIN_FINALIZE
Note: See TracBrowser for help on using the repository browser.