source: trunk/Cbc/configure.ac @ 1490

Last change on this file since 1490 was 1490, checked in by lou, 9 years ago

New doxygen documentation configuration.

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