source: stable/2.9/Cbc/configure.ac @ 2175

Last change on this file since 2175 was 2175, checked in by tkr, 3 years ago

temporarily committing release candidate

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