# HG changeset patch # User Akos Ladanyi # Date 1238774302 -3600 # Node ID b53a9068e3e433be1336c000857f73f38c605c60 # Parent 3314f58e7b255e03ab9a6a65c66dffbffab77ff7 Single check macro for all COIN-OR dependencies (#204) diff -r 3314f58e7b25 -r b53a9068e3e4 INSTALL --- a/INSTALL Wed Apr 01 22:58:58 2009 +0200 +++ b/INSTALL Fri Apr 03 16:58:22 2009 +0100 @@ -150,3 +150,26 @@ --without-soplex Disable SoPlex support. + +--with-coin[=PREFIX] + + Enable support for COIN-OR solvers (CLP and CBC). You should + specify the prefix too. (by default, COIN-OR tools install + themselves to the source code directory). This command enables the + solvers that are actually found. + +--with-coin-includedir=DIR + + The directory where the COIN-OR header files are located. This is + only useful when the COIN-OR headers and libraries are not under + the same prefix (which is unlikely). + +--with-coin-libdir=DIR + + The directory where the COIN-OR libraries are located. This is only + useful when the COIN-OR headers and libraries are not under the + same prefix (which is unlikely). + +--without-coin + + Disable COIN-OR support. diff -r 3314f58e7b25 -r b53a9068e3e4 configure.ac --- a/configure.ac Wed Apr 01 22:58:58 2009 +0200 +++ b/configure.ac Fri Apr 03 16:58:22 2009 +0100 @@ -59,8 +59,7 @@ LX_CHECK_GLPK LX_CHECK_CPLEX LX_CHECK_SOPLEX -LX_CHECK_CLP -LX_CHECK_CBC +LX_CHECK_COIN AM_CONDITIONAL([HAVE_LP], [test x"$lx_lp_found" = x"yes"]) AM_CONDITIONAL([HAVE_MIP], [test x"$lx_mip_found" = x"yes"]) diff -r 3314f58e7b25 -r b53a9068e3e4 m4/lx_check_cbc.m4 --- a/m4/lx_check_cbc.m4 Wed Apr 01 22:58:58 2009 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,73 +0,0 @@ -AC_DEFUN([LX_CHECK_CBC], -[ - AC_ARG_WITH([cbc], -AS_HELP_STRING([--with-cbc@<:@=PREFIX@:>@], [search for CBC under PREFIX or under the default search paths if PREFIX is not given @<:@default@:>@]) -AS_HELP_STRING([--without-cbc], [disable checking for CBC]), - [], [with_cbc=yes]) - - AC_ARG_WITH([cbc-includedir], -AS_HELP_STRING([--with-cbc-includedir=DIR], [search for CBC headers in DIR]), - [], [with_cbc_includedir=no]) - - AC_ARG_WITH([cbc-libdir], -AS_HELP_STRING([--with-cbc-libdir=DIR], [search for CBC libraries in DIR]), - [], [with_cbc_libdir=no]) - - lx_cbc_found=no - if test x"$with_cbc" != x"no"; then - AC_MSG_CHECKING([for CBC]) - - if test x"$with_cbc_includedir" != x"no"; then - CBC_CXXFLAGS="-I$with_cbc_includedir" - elif test x"$with_cbc" != x"yes"; then - CBC_CXXFLAGS="-I$with_cbc/include" - fi - - if test x"$with_cbc_libdir" != x"no"; then - CBC_LDFLAGS="-L$with_cbc_libdir" - elif test x"$with_cbc" != x"yes"; then - CBC_LDFLAGS="-L$with_cbc/lib" - fi - CBC_LIBS="-lOsi -lCbc -lOsiCbc -lCbcSolver -lClp -lOsiClp -lCoinUtils -lVol -lOsiVol -lCgl -lm -llapack -lblas" - - lx_save_cxxflags="$CXXFLAGS" - lx_save_ldflags="$LDFLAGS" - lx_save_libs="$LIBS" - CXXFLAGS="$CBC_CXXFLAGS" - LDFLAGS="$CBC_LDFLAGS" - LIBS="$CBC_LIBS" - - lx_cbc_test_prog=' - #include - - int main(int argc, char** argv) - { - CbcModel cbc; - return 0; - }' - - AC_LANG_PUSH(C++) - AC_LINK_IFELSE([$lx_cbc_test_prog], [lx_cbc_found=yes], [lx_cbc_found=no]) - AC_LANG_POP(C++) - - CXXFLAGS="$lx_save_cxxflags" - LDFLAGS="$lx_save_ldflags" - LIBS="$lx_save_libs" - - if test x"$lx_cbc_found" = x"yes"; then - AC_DEFINE([HAVE_CBC], [1], [Define to 1 if you have CBC.]) - lx_lp_found=yes - AC_DEFINE([HAVE_LP], [1], [Define to 1 if you have any LP solver.]) - AC_MSG_RESULT([yes]) - else - CBC_CXXFLAGS="" - CBC_LDFLAGS="" - CBC_LIBS="" - AC_MSG_RESULT([no]) - fi - fi - CBC_LIBS="$CBC_LDFLAGS $CBC_LIBS" - AC_SUBST(CBC_CXXFLAGS) - AC_SUBST(CBC_LIBS) - AM_CONDITIONAL([HAVE_CBC], [test x"$lx_cbc_found" = x"yes"]) -]) diff -r 3314f58e7b25 -r b53a9068e3e4 m4/lx_check_clp.m4 --- a/m4/lx_check_clp.m4 Wed Apr 01 22:58:58 2009 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,73 +0,0 @@ -AC_DEFUN([LX_CHECK_CLP], -[ - AC_ARG_WITH([clp], -AS_HELP_STRING([--with-clp@<:@=PREFIX@:>@], [search for CLP under PREFIX or under the default search paths if PREFIX is not given @<:@default@:>@]) -AS_HELP_STRING([--without-clp], [disable checking for CLP]), - [], [with_clp=yes]) - - AC_ARG_WITH([clp-includedir], -AS_HELP_STRING([--with-clp-includedir=DIR], [search for CLP headers in DIR]), - [], [with_clp_includedir=no]) - - AC_ARG_WITH([clp-libdir], -AS_HELP_STRING([--with-clp-libdir=DIR], [search for CLP libraries in DIR]), - [], [with_clp_libdir=no]) - - lx_clp_found=no - if test x"$with_clp" != x"no"; then - AC_MSG_CHECKING([for CLP]) - - if test x"$with_clp_includedir" != x"no"; then - CLP_CXXFLAGS="-I$with_clp_includedir" - elif test x"$with_clp" != x"yes"; then - CLP_CXXFLAGS="-I$with_clp/include" - fi - - if test x"$with_clp_libdir" != x"no"; then - CLP_LDFLAGS="-L$with_clp_libdir" - elif test x"$with_clp" != x"yes"; then - CLP_LDFLAGS="-L$with_clp/lib" - fi - CLP_LIBS="-lClp -lCoinUtils -lm" - - lx_save_cxxflags="$CXXFLAGS" - lx_save_ldflags="$LDFLAGS" - lx_save_libs="$LIBS" - CXXFLAGS="$CLP_CXXFLAGS" - LDFLAGS="$CLP_LDFLAGS" - LIBS="$CLP_LIBS" - - lx_clp_test_prog=' - #include - - int main(int argc, char** argv) - { - ClpModel clp; - return 0; - }' - - AC_LANG_PUSH(C++) - AC_LINK_IFELSE([$lx_clp_test_prog], [lx_clp_found=yes], [lx_clp_found=no]) - AC_LANG_POP(C++) - - CXXFLAGS="$lx_save_cxxflags" - LDFLAGS="$lx_save_ldflags" - LIBS="$lx_save_libs" - - if test x"$lx_clp_found" = x"yes"; then - AC_DEFINE([HAVE_CLP], [1], [Define to 1 if you have CLP.]) - lx_lp_found=yes - AC_DEFINE([HAVE_LP], [1], [Define to 1 if you have any LP solver.]) - AC_MSG_RESULT([yes]) - else - CLP_CXXFLAGS="" - CLP_LDFLAGS="" - CLP_LIBS="" - AC_MSG_RESULT([no]) - fi - fi - CLP_LIBS="$CLP_LDFLAGS $CLP_LIBS" - AC_SUBST(CLP_CXXFLAGS) - AC_SUBST(CLP_LIBS) - AM_CONDITIONAL([HAVE_CLP], [test x"$lx_clp_found" = x"yes"]) -]) diff -r 3314f58e7b25 -r b53a9068e3e4 m4/lx_check_coin.m4 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/m4/lx_check_coin.m4 Fri Apr 03 16:58:22 2009 +0100 @@ -0,0 +1,136 @@ +AC_DEFUN([LX_CHECK_COIN], +[ + AC_ARG_WITH([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]), + [], [with_coin=yes]) + + 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]) + + lx_clp_found=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" + fi + + 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" + fi + CLP_LIBS="-lClp -lCoinUtils -lm" + + lx_save_cxxflags="$CXXFLAGS" + lx_save_ldflags="$LDFLAGS" + lx_save_libs="$LIBS" + CXXFLAGS="$CLP_CXXFLAGS" + LDFLAGS="$CLP_LDFLAGS" + LIBS="$CLP_LIBS" + + lx_clp_test_prog=' + #include + + int main(int argc, char** argv) + { + ClpModel clp; + return 0; + }' + + AC_LANG_PUSH(C++) + AC_LINK_IFELSE([$lx_clp_test_prog], [lx_clp_found=yes], [lx_clp_found=no]) + AC_LANG_POP(C++) + + CXXFLAGS="$lx_save_cxxflags" + LDFLAGS="$lx_save_ldflags" + LIBS="$lx_save_libs" + + if test x"$lx_clp_found" = x"yes"; then + AC_DEFINE([HAVE_CLP], [1], [Define to 1 if you have CLP.]) + lx_lp_found=yes + AC_DEFINE([HAVE_LP], [1], [Define to 1 if you have any LP solver.]) + AC_MSG_RESULT([yes]) + else + CLP_CXXFLAGS="" + CLP_LDFLAGS="" + CLP_LIBS="" + AC_MSG_RESULT([no]) + fi + fi + CLP_LIBS="$CLP_LDFLAGS $CLP_LIBS" + AC_SUBST(CLP_CXXFLAGS) + AC_SUBST(CLP_LIBS) + AM_CONDITIONAL([HAVE_CLP], [test x"$lx_clp_found" = x"yes"]) + + + lx_cbc_found=no + 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" + fi + + 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" + fi + CBC_LIBS="-lOsi -lCbc -lOsiCbc -lCbcSolver -lClp -lOsiClp -lCoinUtils -lVol -lOsiVol -lCgl -lm -llapack -lblas" + + lx_save_cxxflags="$CXXFLAGS" + lx_save_ldflags="$LDFLAGS" + lx_save_libs="$LIBS" + CXXFLAGS="$CBC_CXXFLAGS" + LDFLAGS="$CBC_LDFLAGS" + LIBS="$CBC_LIBS" + + lx_cbc_test_prog=' + #include + + int main(int argc, char** argv) + { + CbcModel cbc; + return 0; + }' + + AC_LANG_PUSH(C++) + AC_LINK_IFELSE([$lx_cbc_test_prog], [lx_cbc_found=yes], [lx_cbc_found=no]) + AC_LANG_POP(C++) + + CXXFLAGS="$lx_save_cxxflags" + LDFLAGS="$lx_save_ldflags" + LIBS="$lx_save_libs" + + if test x"$lx_cbc_found" = x"yes"; then + AC_DEFINE([HAVE_CBC], [1], [Define to 1 if you have CBC.]) + lx_lp_found=yes + AC_DEFINE([HAVE_LP], [1], [Define to 1 if you have any LP solver.]) + lx_mip_found=yes + AC_DEFINE([HAVE_MIP], [1], [Define to 1 if you have any MIP solver.]) + AC_MSG_RESULT([yes]) + else + CBC_CXXFLAGS="" + CBC_LDFLAGS="" + CBC_LIBS="" + AC_MSG_RESULT([no]) + fi + fi + fi + CBC_LIBS="$CBC_LDFLAGS $CBC_LIBS" + AC_SUBST(CBC_CXXFLAGS) + AC_SUBST(CBC_LIBS) + AM_CONDITIONAL([HAVE_CBC], [test x"$lx_cbc_found" = x"yes"]) +])