AC_DEFUN([LX_CHECK_COIN],
AS_HELP_STRING([--with-coin@<:@=PREFIX@:>@], [search for CLP under PREFIX or under the default search paths if PREFIX is not given @<:@default@:>@])
AS_HELP_STRING([--without-coin], [disable checking for CLP]),
AC_ARG_WITH([coin-includedir],
AS_HELP_STRING([--with-coin-includedir=DIR], [search for CLP headers in DIR]),
[], [with_coin_includedir=no])
AC_ARG_WITH([coin-libdir],
AS_HELP_STRING([--with-coin-libdir=DIR], [search for CLP libraries in DIR]),
[], [with_coin_libdir=no])
if test x"$with_coin" != x"no"; then
AC_MSG_CHECKING([for CLP])
if test x"$with_coin_includedir" != x"no"; then
CLP_CXXFLAGS="-I$with_coin_includedir"
elif test x"$with_coin" != x"yes"; then
CLP_CXXFLAGS="-I$with_coin/include"
if test x"$with_coin_libdir" != x"no"; then
CLP_LDFLAGS="-L$with_coin_libdir"
elif test x"$with_coin" != x"yes"; then
CLP_LDFLAGS="-L$with_coin/lib"
CLP_LIBS="-lClp -lCoinUtils -lm"
lx_save_cxxflags="$CXXFLAGS"
lx_save_ldflags="$LDFLAGS"
#include <coin/ClpModel.hpp>
int main(int argc, char** argv)
AC_LINK_IFELSE([$lx_clp_test_prog], [lx_clp_found=yes], [lx_clp_found=no])
CXXFLAGS="$lx_save_cxxflags"
LDFLAGS="$lx_save_ldflags"
if test x"$lx_clp_found" = x"yes"; then
AC_DEFINE([HAVE_CLP], [1], [Define to 1 if you have CLP.])
AC_DEFINE([HAVE_LP], [1], [Define to 1 if you have any LP solver.])
CLP_LIBS="$CLP_LDFLAGS $CLP_LIBS"
AM_CONDITIONAL([HAVE_CLP], [test x"$lx_clp_found" = x"yes"])
if test x"$lx_clp_found" = x"yes"; then
if test x"$with_coin" != x"no"; then
AC_MSG_CHECKING([for CBC])
if test x"$with_coin_includedir" != x"no"; then
CBC_CXXFLAGS="-I$with_coin_includedir"
elif test x"$with_coin" != x"yes"; then
CBC_CXXFLAGS="-I$with_coin/include"
if test x"$with_coin_libdir" != x"no"; then
CBC_LDFLAGS="-L$with_coin_libdir"
elif test x"$with_coin" != x"yes"; then
CBC_LDFLAGS="-L$with_coin/lib"
CBC_LIBS="-lOsi -lCbc -lOsiCbc -lCbcSolver -lClp -lOsiClp -lCoinUtils -lVol -lOsiVol -lCgl -lm -llapack -lblas"
lx_save_cxxflags="$CXXFLAGS"
lx_save_ldflags="$LDFLAGS"
#include <coin/CbcModel.hpp>
int main(int argc, char** argv)
AC_LINK_IFELSE([$lx_cbc_test_prog], [lx_cbc_found=yes], [lx_cbc_found=no])
CXXFLAGS="$lx_save_cxxflags"
LDFLAGS="$lx_save_ldflags"
if test x"$lx_cbc_found" = x"yes"; then
AC_DEFINE([HAVE_CBC], [1], [Define to 1 if you have CBC.])
AC_DEFINE([HAVE_LP], [1], [Define to 1 if you have any LP solver.])
AC_DEFINE([HAVE_MIP], [1], [Define to 1 if you have any MIP solver.])
CBC_LIBS="$CBC_LDFLAGS $CBC_LIBS"
AM_CONDITIONAL([HAVE_CBC], [test x"$lx_cbc_found" = x"yes"])