source: trunk/configure.ac

Last change on this file was 2922, checked in by stefan, 2 months ago

rename defines to be project specific; rerun autotools

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 15.3 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 2922 2020-03-24 16:29:04Z 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],[https://github.com/coin-or/Cbc/issues/new],[coin-or-cbc],[https://github.com/coin-or/Cbc])
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.
25
26AC_CONFIG_SRCDIR(src/CbcTree.hpp)
27
28# Do some initialization work (version numbers, change prefix default, ...)
29
30AC_COIN_INITIALIZE
31
32#############################################################################
33#                         Standard build tool stuff                         #
34#############################################################################
35
36# Get the name of the C++ compiler and appropriate compiler options
37
38AC_COIN_PROG_CXX
39
40# Initialize libtool
41
42AC_COIN_PROG_LIBTOOL
43
44# set RPATH_FLAGS to the compiler link flags required to hardcode location
45# of the shared objects (expanded_libdir is set somewhere in configure before)
46# (use in examples Makefile)
47AC_COIN_RPATH_FLAGS([$expanded_libdir])
48
49#############################################################################
50#                   Math headers                                            #
51#############################################################################
52
53# Check for cmath/math.h, cfloat/float.h, cieeefp/ieeefp.h
54
55AC_COIN_CHECK_MATH_HDRS
56
57#############################################################################
58#                            COIN-OR components                             #
59#############################################################################
60
61m4_foreach_w([myvar],[CoinUtils Osi Cgl Clp],
62  [ AC_COIN_CHK_PKG(myvar,[CbcLib CbcSolverLib CbcGeneric OsiCbcLib])
63    if test $coin_has_[]m4_tolower(myvar) != yes ; then
64      AC_MSG_ERROR([Required package myvar is not available.])
65    fi
66  ])
67
68AC_COIN_CHK_PKG(OsiClp,[CbcLib CbcSolverLib CbcGeneric OsiCbcLib],[osi-clp])
69if test $coin_has_osiclp != yes ; then
70  AC_MSG_ERROR("Required package OsiClp unavailable.")
71fi
72
73# Optional package for command line edit support
74
75AC_COIN_CHK_GNU_READLINE([CbcLib CbcGeneric])
76
77#############################################################################
78#                       Other third party software                          #
79#############################################################################
80
81# Ampl Solver library
82
83AC_COIN_CHK_PKG(ASL,[CbcSolverLib],[coinasl])
84
85# Nauty library (for symmetry detection).
86
87AC_COIN_CHK_LIB([Nauty],[CbcLib CbcSolverLib],[-lnauty],[],[],[nauty])
88
89#############################################################################
90
91# The rest are not required for linking against Cbc but are used for the unit
92# test. For the data packages, we just want XXX_DATA for use in Makefile.am.
93
94AC_COIN_CHK_PKG(OsiTests,[CbcUnitTest],[osi-unittests])
95AC_COIN_CHK_PKG(Sample,,[coindatasample],,dataonly)
96AC_COIN_CHK_PKG(Netlib,,[coindatanetlib],,dataonly)
97AC_COIN_CHK_PKG(Miplib3,,[coindatamiplib3],,dataonly)
98
99#############################################################################
100#                    LP solvers other than CLP                              #
101#############################################################################
102
103# Check which other LP solvers are available, some of them become a dependency
104# of CbcGeneric
105
106AC_COIN_CHK_PKG(OsiDyLP,[CbcGeneric OsiCbcLib],[osi-dylp])
107AC_COIN_CHK_PKG(OsiCpx,[CbcLib CbcGeneric CbcSolverLib OsiCbcLib],[osi-cplex])
108AC_COIN_CHK_PKG(OsiGlpk,[CbcGeneric OsiCbcLib],[osi-glpk])
109#AC_COIN_CHK_PKG(OsiGrb,,[osi-gurobi])
110AC_COIN_CHK_PKG(OsiMsk,[CbcGeneric OsiCbcLib],[osi-mosek])
111AC_COIN_CHK_PKG(OsiSpx,[CbcGeneric OsiCbcLib],[osi-soplex])
112#AC_COIN_CHK_PKG(OsiXpr,,[osi-xpress])
113
114AC_COIN_CHK_LIB(Cplex,[CbcLib],[-lcplex -lpthread -lm -ldl],[],[],[CPXgetstat])
115AC_COIN_CHK_PKG(Glpk,[CbcSolverLib],,[build])
116
117AC_COIN_FINALIZE_FLAGS([CbcLib CbcSolverLib CbcGeneric OsiCbcLib CbcUnitTest])
118
119#############################################################################
120#                       CbcGeneric configuration                            #
121#############################################################################
122
123# Are we building cbc-generic? Default is no (false).
124
125AC_ARG_ENABLE([cbc-generic],
126  AS_HELP_STRING([--enable-cbc-generic],[enables build of cbc-generic]),
127  [cbc_generic=$enableval],
128  [cbc_generic=no])
129AM_CONDITIONAL(CBC_BUILD_CBC_GENERIC, test "$cbc_generic" = yes)
130
131if test "$cbc_generic" = yes ; then
132  # Set the default solver for cbc-generic. In theory, any OsiXXX should work.
133  # In practice, only thoselisted below have had any testing long long ago or never.
134
135  AC_MSG_CHECKING(for cbc-generic default solver)
136  AC_ARG_WITH([cbc-generic-solver],
137              AC_HELP_STRING([--with-cbc-generic-solver],
138                             [specify default solver for cbc-generic in lower case letters (if not given, clp is assumed)]),
139              [cbc_default_solver=$withval],
140              [cbc_default_solver=clp])
141  AC_MSG_RESULT($cbc_default_solver)
142
143  case $cbc_default_solver in
144      clp) ;;
145    cplex) ;;
146     dylp) ;;
147     glpk) ;;
148    highs) ;;
149    mosek) ;;
150   soplex) ;;
151        *) AC_MSG_WARN([Unrecognised solver $cbc_default_solver chosen as cbc-generic default solver.])
152          ;;
153  esac
154  AC_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  AC_MSG_NOTICE([building cbc-generic with default solver $cbc_default_solver])
158fi
159
160#############################################################################
161#                       Cbc parallel configuration                               #
162#############################################################################
163
164# First we define a new option, --enable-cbc-parallel
165
166AC_ARG_ENABLE([cbc-parallel],
167  [AC_HELP_STRING([--disable-cbc-parallel],
168                  [disables compilation of the SMP version of Cbc])],
169  [enable_cbc_parallel=$enableval],
170  [enable_cbc_parallel=auto])
171
172if test "$enable_cbc_parallel" != no; then
173  # Define the preprocessor macro
174  case "$CXX" in
175  *cl) # Windows / cl: look for pthreadsw32 lib
176    AC_COIN_CHK_LIB(pthreadsw32,[CbcLib],[pthreadVCE2.lib],[],[],[pthread_create])
177    if test "$coin_has_pthreadsw32" = yes ; then
178      enable_cbc_parallel=yes
179    elif test "$enable_cbc_parallel" = yes ; then
180      AC_MSG_ERROR([--enable-cbc-parallel selected, but pthreads-w32 unavailable])
181    else
182      enable_cbc_parallel=no
183    fi
184    ;;
185  *) # not Windows / cl: look for pthread lib
186    AC_CHECK_LIB([pthread],[pthread_create],
187      [CBCLIB_LFLAGS="-lpthread $CBCLIB_LFLAGS"
188       enable_cbc_parallel=yes],
189      [if test "$enable_cbc_parallel" = yes ; then
190         AC_MSG_ERROR([--enable-cbc-parallel selected, but -lpthreads unavailable])
191       else
192         enable_cbc_parallel=no
193       fi])
194    if test "$enable_cbc_parallel" = yes ; then
195      AC_CHECK_LIB([rt],[clock_gettime],
196        [CBCLIB_LFLAGS="-lrt $CBCLIB_LFLAGS"
197         AC_DEFINE([HAVE_CLOCK_GETTIME],[1],[Define if clock_gettime and rt library is available])],
198        [AC_MSG_WARN([SMP version of Cbc selected, but -lrt unavailable; using gettimeofday instead of clock_gettime])])
199    fi
200    AM_CONDITIONAL(COIN_HAS_PTHREADSW32, false)
201  ;;
202  esac
203else
204  AM_CONDITIONAL(COIN_HAS_PTHREADSW32, false)
205fi
206if test "$enable_cbc_parallel" = yes ; then
207  AC_DEFINE([CBC_THREAD],[1],[Define to 1 if the SMP version of Cbc should be compiled])
208  AC_MSG_NOTICE([Cbc multithreading enabled]);
209fi
210
211##############################################################################
212#                            OsiCbc configuration                            #
213##############################################################################
214
215# Handles configuration of the underlying default solver in OsiCbc. The issue
216# is that OsiCbc defines a default solver, used when the client does not     
217# specify a solver in the constructor. The default solver must, therefore,   
218# be present in the build. This macro checks that this is true, and sets the
219# compile-time symbols OSICBC_DFLT_SOLVER, OSICBC_CLP_DFLT_SOLVER, and
220# OSICBC_DFLT_SOLVER_HPP that control the build. The parameter default_solver
221# should normally be clp, unless you're working on some other solver.
222
223# Ideally, this macro would not require enumeration of solvers, but the
224# effort required to avoid it is just not justified at present. One enumeration
225# is hidden in AC_OSI_CANONICAL. The other is visible, the AM_CONDITIONAL
226# list at the end.                                                             
227
228# In an ideal world this macro would do absolutely nothing if Cbc is not
229# present, but autotools is not an ideal world and we have to satisfy its
230# requirements. In particular, the AM_CONDITIONAL macros need to execute or
231# automake will complain. Really the only thing we need to suppress is the
232# check that the default solver exists. All the rest is irrelevant when Cbc
233# isn't present (hence OsiCbc will be configured but not actually compiled).
234
235# Process the with-osicbc-default-solver option.
236
237AC_ARG_WITH([osicbc-default-solver],
238  AS_HELP_STRING([--with-osicbc-default-solver],
239     [specify underlying solver for OsiCbc (default clp)]),
240     [osicbc_with_solver=$withval],
241     [osicbc_with_solver=clp])
242
243case "${osicbc_with_solver}" in
244  @<:@Cc@:>@@<:@Ll@:>@@<:@Pp@:>@*)
245    osi_lc_solver=clp ;           
246    osi_mc_solver=Clp ;           
247    osi_uc_solver=CLP ;           
248    osi_exists_solver=${coin_has_osiclp-"unavailable"}
249    ;;                                             
250  @<:@Dd@:>@@<:@Yy@:>@@<:@Ll@:>@@<:@Pp@:>@*)       
251    osi_lc_solver=dylp ;                           
252    osi_mc_solver=Dylp                             
253    osi_uc_solver=DYLP                             
254    osi_exists_solver=${coin_has_osidylp-"unavailable"}
255    ;;                                             
256  @<:@Cc@:>@@<:@Pp@:>@@<:@Xx@:>@*)                 
257    osi_lc_solver=cpx ;                             
258    osi_mc_solver=Cpx                               
259    osi_uc_solver=CPX                               
260    osi_exists_solver=${coin_has_osicpx-"unavailable"}
261    ;;
262  @<:@Gg@:>@@<:@Ll@:>@@<:@Pp@:>@@<:@Kk@:>@*)       
263    osi_lc_solver=glpk ;                           
264    osi_mc_solver=Glpk                             
265    osi_uc_solver=GLPK                             
266    osi_exists_solver=${coin_has_osiglpk-"unavailable"}
267    ;;
268  @<:@Gg@:>@@<:@Rr@:>@@<:@Bb@:>@*)
269    osi_lc_solver=grb ;
270    osi_mc_solver=Grb ;           
271    osi_uc_solver=GRB ;           
272    osi_exists_solver=${coin_has_osigrb-"unavailable"}
273    ;;                                             
274  @<:@H@:>@@<:@i@:>@@<:@g@:>@@<:@h@:>@@<:@s@:>@*)       
275    osi_lc_solver=highs ;                           
276    osi_mc_solver=HiGHS ;                           
277    osi_uc_solver=HIGHS ;                             
278    osi_exists_solver=${coin_has_highs-"unavailable"}
279    ;;
280  @<:@Mm@:>@@<:@Ss@:>@@<:@Kk@:>@*)
281    osi_lc_solver=msk ;
282    osi_mc_solver=Msk
283    osi_uc_solver=MSK
284    osi_exists_solver=${coin_has_osimsk-"unavailable"}
285    ;;
286  @<:@Ss@:>@@<:@Pp@:>@@<:@Xx@:>@*)
287    osi_lc_solver=spx ;
288    osi_mc_solver=Spx
289    osi_uc_solver=SPX
290    osi_exists_solver=${coin_has_osispx-"unavailable"}
291    ;;
292  @<:@Ss@:>@@<:@Yy@:>@@<:@Mm@:>@*)
293    osi_lc_solver=sym ;
294    osi_mc_solver=Sym
295    osi_uc_solver=SYM
296    osi_exists_solver=${coin_has_osisym-"unavailable"}
297    ;;
298  @<:@Xx@:>@@<:@Pp@:>@@<:@Rr@:>@*)
299    osi_lc_solver=xpr ;
300    osi_mc_solver=Xpr
301    osi_uc_solver=XPR
302    osi_exists_solver=${coin_has_osixpr-"unavailable"}
303    ;;
304  *)
305    osi_lc_solver=clp ;
306    osi_mc_solver=Clp ;
307    osi_uc_solver=CLP ;
308    osi_exists_solver=${coin_has_osiclp-"unavailable"}
309    AC_MSG_WARN([Unrecognised solver $1; defaulting to $osi_lc_solver.])
310    ;;
311esac
312
313# Check that the requested solver is available.
314if test $osi_exists_solver = no; then
315  AC_MSG_ERROR([selected default solver $osicbc_with_solver is unavailable.
316  Please select an available solver using the --with-osicbc-default-solver option.])
317fi
318
319# State the result.
320AC_MSG_NOTICE([OsiCbc default solver is $osi_lc_solver])
321
322# And set the configuration variables.
323AC_DEFINE_UNQUOTED([OSICBC_DFLT_SOLVER],
324  [Osi${osi_mc_solver}SolverInterface],
325  [define to the name of the default solver interface class, e.g., OsiClpSolverInterface])
326AC_DEFINE_UNQUOTED([OSICBC_DFLT_SOLVER_HPP],
327  ["Osi${osi_mc_solver}SolverInterface.hpp"],
328  [define to the name of the .hpp file for the default solver interface class, e.g., "OsiClpSolverInterface.hpp" (include quotes)])
329if test $osi_mc_solver = "Clp"; then
330  AC_DEFINE([OSICBC_DFLT_SOLVER_CLP],[1],[define this symbol if clp is the default solver])
331fi
332
333# Last but not least, we need automake conditionals.
334AM_CONDITIONAL([OSICBC_DFLT_SOLVER_CLP],[test $osi_mc_solver = Clp])
335AM_CONDITIONAL([OSICBC_DFLT_SOLVER_CPX],[test $osi_mc_solver = Cpx])
336AM_CONDITIONAL([OSICBC_DFLT_SOLVER_DYLP],[test $osi_mc_solver = Dylp])
337AM_CONDITIONAL([OSICBC_DFLT_SOLVER_GLPK],[test $osi_mc_solver = Glpk])
338#AM_CONDITIONAL([OSICBC_DFLT_SOLVER_GRB],[test $osi_mc_solver = Grb])
339AM_CONDITIONAL([OSICBC_DFLT_SOLVER_HIGHS],[test $osi_mc_solver = HiGHS])
340AM_CONDITIONAL([OSICBC_DFLT_SOLVER_MSK],[test $osi_mc_solver = Msk])
341AM_CONDITIONAL([OSICBC_DFLT_SOLVER_SPX],[test $osi_mc_solver = Spx])
342AM_CONDITIONAL([OSICBC_DFLT_SOLVER_SYM],[test $osi_mc_solver = Sym])
343#AM_CONDITIONAL([OSICBC_DFLT_SOLVER_XPR],[test $osi_mc_solver = Xpr])
344
345##############################################################################
346#                   VPATH links for example input files                      #
347##############################################################################
348
349# In case this is a VPATH configuration we need to make sure that the
350# input files for the examples are available in the VPATH directory.
351
352# AC_COIN_VPATH_LINK(examples/sudoku_sample.csv)
353# AC_COIN_VPATH_LINK(examples/quad.mps)
354# AC_COIN_VPATH_LINK(examples/quad2.mps)
355
356#############################################################################
357#                  Check for doxygen                                        #
358#############################################################################
359
360AC_COIN_DOXYGEN([CoinUtils Osi Clp DyLP Cgl])
361
362##############################################################################
363#                   Finishing up by writing all the output                   #
364##############################################################################
365
366# Here list all the files that configure should create (except for the
367# configuration header file)
368AC_CONFIG_FILES([Makefile
369                 examples/Makefile
370                 src/Makefile
371                 src/OsiCbc/Makefile
372                 test/Makefile
373                 cbc.pc
374                 osi-cbc.pc])
375AC_CONFIG_FILES([doxydoc/doxygen.conf])
376
377# Here put the location and name of the configuration header file
378AC_CONFIG_HEADER([src/config.h src/config_cbc.h src/config_cbcsolver.h src/OsiCbc/config_osicbc.h])
379
380# Finally, we let configure write all the output...
381AC_COIN_FINALIZE
Note: See TracBrowser for help on using the repository browser.