1# Copyright (C) 2006 International Business Machines.
2# All Rights Reserved.
3# This file is distributed under the Eclipse Public License.
4
5## $Id: configure.ac 2334 2020-01-31 10:48:56Z 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([Osi],[0.108.6],[osi@list.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/Osi/OsiAuxInfo.cpp)
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# A bit of initial setup
41AC_COIN_PROJECTDIR_INIT(Osi,14:6:13)
42
43# Check if user wants to produce debugging code
44AC_COIN_DEBUG_COMPILE(Osi)
45
46# Get the name of the C++ compiler and appropriate compiler options
47AC_COIN_PROG_CXX
48
49# Initialize automake and libtool
50AC_COIN_INIT_AUTO_TOOLS
51
52#############################################################################
53#                              COIN-OR components                           #
54#############################################################################
55
56AC_COIN_CHECK_PACKAGE(CoinUtils, [coinutils], [OsiLib])
57if test $coin_has_coinutils != yes ; then
58  AC_MSG_ERROR([Required package CoinUtils not available.])
59fi
60AC_COIN_CHECK_PACKAGE(Glpk,      [coinglpk],  [OsiGlpkLib])
61AC_COIN_CHECK_PACKAGE(SoPlex,    [coinsoplex < 1.7],[OsiSpxLib])
62AC_COIN_CHECK_PACKAGE(Sample,    [coindatasample])
63AC_COIN_CHECK_PACKAGE(Netlib,    [coindatanetlib])
64
65#############################################################################
66#                            Third party solvers                            #
67#############################################################################
68
69# Check which third party solvers are available. Cplex detection has been
70# tested on a semi-regular basis, and Mosek detection most likely works. For
71# the rest, it's anyone's guess.  -- lh, 080529 --
72# fixed detection of Mosek and Xpress -- stefan, 091003 (linux32, gcc) --
73
74AC_COIN_CHECK_USER_LIBRARY([Cplex], [CPX],[cplex.h],   [CPXgetstat])
75AC_COIN_CHECK_USER_LIBRARY([Mosek], [MSK],[mosek.h],   [MSK_makeenv])
76AC_COIN_CHECK_USER_LIBRARY([Xpress],[XPR],[xprs.h],    [XPRSinit])
77AC_COIN_CHECK_USER_LIBRARY([Gurobi],[GRB],[gurobi_c.h],[GRBloadenv])
78
79#############################################################################
80#                            Examples solver                                #
81#############################################################################
82
83# choose a solver interface that can be used in the examples
84
85if test $coin_has_glpk = yes ; then
86  OSI_EXAMPLES_SOLVER_NAME=OsiGlpkSolverInterface
87  OSI_EXAMPLES_SOLVER_CFLAGS="$GLPK_CFLAGS"
88  OSI_EXAMPLES_SOLVER_LIBS="-lOsiGlpk $GLPK_LIBS_INSTALLED"
89  OSI_EXAMPLES_SOLVER_PCNAME=osi-glpk
90elif test $coin_has_cpx = true ; then
91  OSI_EXAMPLES_SOLVER_NAME=OsiCpxSolverInterface
92  OSI_EXAMPLES_SOLVER_CFLAGS="-I$CPXINCDIR"
93  OSI_EXAMPLES_SOLVER_LIBS="-lOsiCpx $CPXLIB"
94  OSI_EXAMPLES_SOLVER_PCNAME=osi-cplex
95elif test $coin_has_grb = true ; then
96  OSI_EXAMPLES_SOLVER_NAME=OsiGrbSolverInterface
97  OSI_EXAMPLES_SOLVER_CFLAGS="-I$GRBINCDIR"
98  OSI_EXAMPLES_SOLVER_LIBS="-lOsiGrb $GRBLIB"
99  OSI_EXAMPLES_SOLVER_PCNAME=osi-gurobi
100elif test $coin_has_msk = true ; then
101  OSI_EXAMPLES_SOLVER_NAME=OsiMskSolverInterface
102  OSI_EXAMPLES_SOLVER_CFLAGS="-I$MSKINCDIR"
103  OSI_EXAMPLES_SOLVER_LIBS="-lOsiMsk $MSKLIB"
104  OSI_EXAMPLES_SOLVER_PCNAME=osi-mosek
105elif test $coin_has_xpr = true ; then
106  OSI_EXAMPLES_SOLVER_NAME=OsiXprSolverInterface
107  OSI_EXAMPLES_SOLVER_CFLAGS="-I$XPRINCDIR"
108  OSI_EXAMPLES_SOLVER_LIBS="-lOsiXpr $XPRLIB"
109  OSI_EXAMPLES_SOLVER_PCNAME=osi-xpress
110elif test $coin_has_soplex = yes ; then
111  OSI_EXAMPLES_SOLVER_NAME=OsiSpxSolverInterface
112  OSI_EXAMPLES_SOLVER_CFLAGS="$SOPLEX_CFLAGS"
113  OSI_EXAMPLES_SOLVER_LIBS="-lOsiSpx $SOPLEX_LIBS_INSTALLED"
114  OSI_EXAMPLES_SOLVER_PCNAME=osi-soplex
115else
116  AC_MSG_WARN([No solver available, examples will not work.])
117fi
118
119# adjust linker flags for (i)cl compiler
120if test x$coin_cxx_is_cl = xtrue || test x$coin_cc_is_cl = xtrue ;
121then
122  [OSI_EXAMPLES_SOLVER_LIBS=`echo " $OSI_EXAMPLES_SOLVER_LIBS" | sed -e 's/ -l\([^ ]*\)/ lib\1.lib/g' -e 's/ -L\([^ ]*\)/ -libpath:\`$(CYGPATH_W) \1\`/g'`]
123fi
124
125AC_SUBST(OSI_EXAMPLES_SOLVER_NAME)
126AC_SUBST(OSI_EXAMPLES_SOLVER_CFLAGS)
127AC_SUBST(OSI_EXAMPLES_SOLVER_LIBS)
128AC_SUBST(OSI_EXAMPLES_SOLVER_PCNAME)
129
130
131#############################################################################
132#                 Configuration options for individual OSIs                 #
133#############################################################################
134
135# If any of the tests performed in this section actually require the presence
136# of the solver (file presence, link checks, etc.) be sure to guard the call.
137
138# We assume that GLPK is not too old
139
140AC_DEFINE(GLPK_HAS_INTOPT, [1],
141	  [Define to 1 if GLPK has the advanced B&B solver lpx_intopt])
142
143#############################################################################
144#                  Check for doxygen                                        #
145#############################################################################
146
147AC_COIN_DOXYGEN(CoinUtils)
148
149#############################################################################
150#                  System header                                            #
151#############################################################################
152
153AC_COIN_CHECK_CXX_CHEADER(math)
154AC_COIN_CHECK_CXX_CHEADER(float)
155AC_COIN_CHECK_CXX_CHEADER(ieeefp)
156
157##############################################################################
158#                   Finishing up by writing all the output                   #
159##############################################################################
160
161# Here list all the files that configure should create (except for the
162# configuration header file)
163AC_CONFIG_FILES([Makefile
164                 examples/Makefile
165                 src/Osi/Makefile
166                 src/OsiCpx/Makefile
167                 src/OsiGlpk/Makefile
168                 src/OsiMsk/Makefile
169                 src/OsiXpr/Makefile
170                 src/OsiGrb/Makefile
171                 src/OsiSpx/Makefile
172                 src/OsiCommonTest/Makefile
173                 test/Makefile
174                 osi.pc osi-uninstalled.pc
175                 osi-unittests.pc osi-unittests-uninstalled.pc])
176
177if test $coin_has_cpx = true ; then
178  AC_CONFIG_FILES([osi-cplex.pc:src/OsiCpx/osi-cplex.pc.in
179                   osi-cplex-uninstalled.pc:src/OsiCpx/osi-cplex-uninstalled.pc.in])
180fi
181
182if test $coin_has_glpk = yes ; then
183  AC_CONFIG_FILES([osi-glpk.pc:src/OsiGlpk/osi-glpk.pc.in
184                   osi-glpk-uninstalled.pc:src/OsiGlpk/osi-glpk-uninstalled.pc.in])
185fi
186
187if test $coin_has_grb = true ; then
188  AC_CONFIG_FILES([osi-gurobi.pc:src/OsiGrb/osi-gurobi.pc.in
189                   osi-gurobi-uninstalled.pc:src/OsiGrb/osi-gurobi-uninstalled.pc.in])
190fi
191
192if test $coin_has_msk = true ; then
193  AC_CONFIG_FILES([osi-mosek.pc:src/OsiMsk/osi-mosek.pc.in
194                   osi-mosek-uninstalled.pc:src/OsiMsk/osi-mosek-uninstalled.pc.in])
195fi
196
197if test $coin_has_xpr = true ; then
198  AC_CONFIG_FILES([osi-xpress.pc:src/OsiXpr/osi-xpress.pc.in
199                   osi-xpress-uninstalled.pc:src/OsiXpr/osi-xpress-uninstalled.pc.in])
200fi
201
202if test $coin_has_soplex = yes ; then
203  AC_CONFIG_FILES([osi-soplex.pc:src/OsiSpx/osi-soplex.pc.in
204                   osi-soplex-uninstalled.pc:src/OsiSpx/osi-soplex-uninstalled.pc.in])
205fi
206
207AC_CONFIG_FILES([doxydoc/doxygen.conf])
208
209# Here put the location and name of the configuration header file
210AC_CONFIG_HEADER([src/Osi/config.h src/Osi/config_osi.h])
211
212# Finally, we let configure write all the output...
213AC_COIN_FINALIZE
214