source: trunk/Cbc/configure.ac @ 1660

Last change on this file since 1660 was 1660, checked in by stefan, 8 years ago

change to new way of using and installing configuration header files

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