source: trunk/Cbc/configure.ac @ 1489

Last change on this file since 1489 was 1489, checked in by stefan, 9 years ago

COIN_HAS_MODULE_FALLBACK is now always called by COIN_HAS_MODULE and checks dependencies, thus simplify configure.ac; rerun autotools

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