Single check macro for all COIN-OR dependencies (#204)
authorAkos Ladanyi <ladanyi@tmit.bme.hu>
Fri, 03 Apr 2009 16:58:22 +0100
changeset 560b53a9068e3e4
parent 559 3314f58e7b25
child 561 24682336c38e
child 562 ab6da8cf5ab2
Single check macro for all COIN-OR dependencies (#204)
INSTALL
configure.ac
m4/lx_check_cbc.m4
m4/lx_check_clp.m4
m4/lx_check_coin.m4
     1.1 --- a/INSTALL	Wed Apr 01 22:58:58 2009 +0200
     1.2 +++ b/INSTALL	Fri Apr 03 16:58:22 2009 +0100
     1.3 @@ -150,3 +150,26 @@
     1.4  --without-soplex
     1.5  
     1.6     Disable SoPlex support.
     1.7 +
     1.8 +--with-coin[=PREFIX]
     1.9 +
    1.10 +   Enable support for COIN-OR solvers (CLP and CBC). You should
    1.11 +   specify the prefix too. (by default, COIN-OR tools install
    1.12 +   themselves to the source code directory). This command enables the
    1.13 +   solvers that are actually found.
    1.14 +
    1.15 +--with-coin-includedir=DIR
    1.16 +
    1.17 +   The directory where the COIN-OR header files are located. This is
    1.18 +   only useful when the COIN-OR headers and libraries are not under
    1.19 +   the same prefix (which is unlikely).
    1.20 +
    1.21 +--with-coin-libdir=DIR
    1.22 +
    1.23 +   The directory where the COIN-OR libraries are located. This is only
    1.24 +   useful when the COIN-OR headers and libraries are not under the
    1.25 +   same prefix (which is unlikely).
    1.26 +
    1.27 +--without-coin
    1.28 +
    1.29 +   Disable COIN-OR support.
     2.1 --- a/configure.ac	Wed Apr 01 22:58:58 2009 +0200
     2.2 +++ b/configure.ac	Fri Apr 03 16:58:22 2009 +0100
     2.3 @@ -59,8 +59,7 @@
     2.4  LX_CHECK_GLPK
     2.5  LX_CHECK_CPLEX
     2.6  LX_CHECK_SOPLEX
     2.7 -LX_CHECK_CLP
     2.8 -LX_CHECK_CBC
     2.9 +LX_CHECK_COIN
    2.10  
    2.11  AM_CONDITIONAL([HAVE_LP], [test x"$lx_lp_found" = x"yes"])
    2.12  AM_CONDITIONAL([HAVE_MIP], [test x"$lx_mip_found" = x"yes"])
     3.1 --- a/m4/lx_check_cbc.m4	Wed Apr 01 22:58:58 2009 +0200
     3.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     3.3 @@ -1,73 +0,0 @@
     3.4 -AC_DEFUN([LX_CHECK_CBC],
     3.5 -[
     3.6 -  AC_ARG_WITH([cbc],
     3.7 -AS_HELP_STRING([--with-cbc@<:@=PREFIX@:>@], [search for CBC under PREFIX or under the default search paths if PREFIX is not given @<:@default@:>@])
     3.8 -AS_HELP_STRING([--without-cbc], [disable checking for CBC]),
     3.9 -              [], [with_cbc=yes])
    3.10 -
    3.11 -  AC_ARG_WITH([cbc-includedir],
    3.12 -AS_HELP_STRING([--with-cbc-includedir=DIR], [search for CBC headers in DIR]),
    3.13 -              [], [with_cbc_includedir=no])
    3.14 -
    3.15 -  AC_ARG_WITH([cbc-libdir],
    3.16 -AS_HELP_STRING([--with-cbc-libdir=DIR], [search for CBC libraries in DIR]),
    3.17 -              [], [with_cbc_libdir=no])
    3.18 -
    3.19 -  lx_cbc_found=no
    3.20 -  if test x"$with_cbc" != x"no"; then
    3.21 -    AC_MSG_CHECKING([for CBC])
    3.22 -
    3.23 -    if test x"$with_cbc_includedir" != x"no"; then
    3.24 -      CBC_CXXFLAGS="-I$with_cbc_includedir"
    3.25 -    elif test x"$with_cbc" != x"yes"; then
    3.26 -      CBC_CXXFLAGS="-I$with_cbc/include"
    3.27 -    fi
    3.28 -
    3.29 -    if test x"$with_cbc_libdir" != x"no"; then
    3.30 -      CBC_LDFLAGS="-L$with_cbc_libdir"
    3.31 -    elif test x"$with_cbc" != x"yes"; then
    3.32 -      CBC_LDFLAGS="-L$with_cbc/lib"
    3.33 -    fi
    3.34 -    CBC_LIBS="-lOsi -lCbc -lOsiCbc -lCbcSolver -lClp -lOsiClp -lCoinUtils -lVol -lOsiVol -lCgl -lm -llapack -lblas"
    3.35 -
    3.36 -    lx_save_cxxflags="$CXXFLAGS"
    3.37 -    lx_save_ldflags="$LDFLAGS"
    3.38 -    lx_save_libs="$LIBS"
    3.39 -    CXXFLAGS="$CBC_CXXFLAGS"
    3.40 -    LDFLAGS="$CBC_LDFLAGS"
    3.41 -    LIBS="$CBC_LIBS"
    3.42 -
    3.43 -    lx_cbc_test_prog='
    3.44 -      #include <coin/CbcModel.hpp>
    3.45 -
    3.46 -      int main(int argc, char** argv)
    3.47 -      {
    3.48 -        CbcModel cbc;
    3.49 -        return 0;
    3.50 -      }'
    3.51 -
    3.52 -    AC_LANG_PUSH(C++)
    3.53 -    AC_LINK_IFELSE([$lx_cbc_test_prog], [lx_cbc_found=yes], [lx_cbc_found=no])
    3.54 -    AC_LANG_POP(C++)
    3.55 -
    3.56 -    CXXFLAGS="$lx_save_cxxflags"
    3.57 -    LDFLAGS="$lx_save_ldflags"
    3.58 -    LIBS="$lx_save_libs"
    3.59 -
    3.60 -    if test x"$lx_cbc_found" = x"yes"; then
    3.61 -      AC_DEFINE([HAVE_CBC], [1], [Define to 1 if you have CBC.])
    3.62 -      lx_lp_found=yes
    3.63 -      AC_DEFINE([HAVE_LP], [1], [Define to 1 if you have any LP solver.])
    3.64 -      AC_MSG_RESULT([yes])
    3.65 -    else
    3.66 -      CBC_CXXFLAGS=""
    3.67 -      CBC_LDFLAGS=""
    3.68 -      CBC_LIBS=""
    3.69 -      AC_MSG_RESULT([no])
    3.70 -    fi
    3.71 -  fi
    3.72 -  CBC_LIBS="$CBC_LDFLAGS $CBC_LIBS"
    3.73 -  AC_SUBST(CBC_CXXFLAGS)
    3.74 -  AC_SUBST(CBC_LIBS)
    3.75 -  AM_CONDITIONAL([HAVE_CBC], [test x"$lx_cbc_found" = x"yes"])
    3.76 -])
     4.1 --- a/m4/lx_check_clp.m4	Wed Apr 01 22:58:58 2009 +0200
     4.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     4.3 @@ -1,73 +0,0 @@
     4.4 -AC_DEFUN([LX_CHECK_CLP],
     4.5 -[
     4.6 -  AC_ARG_WITH([clp],
     4.7 -AS_HELP_STRING([--with-clp@<:@=PREFIX@:>@], [search for CLP under PREFIX or under the default search paths if PREFIX is not given @<:@default@:>@])
     4.8 -AS_HELP_STRING([--without-clp], [disable checking for CLP]),
     4.9 -              [], [with_clp=yes])
    4.10 -
    4.11 -  AC_ARG_WITH([clp-includedir],
    4.12 -AS_HELP_STRING([--with-clp-includedir=DIR], [search for CLP headers in DIR]),
    4.13 -              [], [with_clp_includedir=no])
    4.14 -
    4.15 -  AC_ARG_WITH([clp-libdir],
    4.16 -AS_HELP_STRING([--with-clp-libdir=DIR], [search for CLP libraries in DIR]),
    4.17 -              [], [with_clp_libdir=no])
    4.18 -
    4.19 -  lx_clp_found=no
    4.20 -  if test x"$with_clp" != x"no"; then
    4.21 -    AC_MSG_CHECKING([for CLP])
    4.22 -
    4.23 -    if test x"$with_clp_includedir" != x"no"; then
    4.24 -      CLP_CXXFLAGS="-I$with_clp_includedir"
    4.25 -    elif test x"$with_clp" != x"yes"; then
    4.26 -      CLP_CXXFLAGS="-I$with_clp/include"
    4.27 -    fi
    4.28 -
    4.29 -    if test x"$with_clp_libdir" != x"no"; then
    4.30 -      CLP_LDFLAGS="-L$with_clp_libdir"
    4.31 -    elif test x"$with_clp" != x"yes"; then
    4.32 -      CLP_LDFLAGS="-L$with_clp/lib"
    4.33 -    fi
    4.34 -    CLP_LIBS="-lClp -lCoinUtils -lm"
    4.35 -
    4.36 -    lx_save_cxxflags="$CXXFLAGS"
    4.37 -    lx_save_ldflags="$LDFLAGS"
    4.38 -    lx_save_libs="$LIBS"
    4.39 -    CXXFLAGS="$CLP_CXXFLAGS"
    4.40 -    LDFLAGS="$CLP_LDFLAGS"
    4.41 -    LIBS="$CLP_LIBS"
    4.42 -
    4.43 -    lx_clp_test_prog='
    4.44 -      #include <coin/ClpModel.hpp>
    4.45 -
    4.46 -      int main(int argc, char** argv)
    4.47 -      {
    4.48 -        ClpModel clp;
    4.49 -        return 0;
    4.50 -      }'
    4.51 -
    4.52 -    AC_LANG_PUSH(C++)
    4.53 -    AC_LINK_IFELSE([$lx_clp_test_prog], [lx_clp_found=yes], [lx_clp_found=no])
    4.54 -    AC_LANG_POP(C++)
    4.55 -
    4.56 -    CXXFLAGS="$lx_save_cxxflags"
    4.57 -    LDFLAGS="$lx_save_ldflags"
    4.58 -    LIBS="$lx_save_libs"
    4.59 -
    4.60 -    if test x"$lx_clp_found" = x"yes"; then
    4.61 -      AC_DEFINE([HAVE_CLP], [1], [Define to 1 if you have CLP.])
    4.62 -      lx_lp_found=yes
    4.63 -      AC_DEFINE([HAVE_LP], [1], [Define to 1 if you have any LP solver.])
    4.64 -      AC_MSG_RESULT([yes])
    4.65 -    else
    4.66 -      CLP_CXXFLAGS=""
    4.67 -      CLP_LDFLAGS=""
    4.68 -      CLP_LIBS=""
    4.69 -      AC_MSG_RESULT([no])
    4.70 -    fi
    4.71 -  fi
    4.72 -  CLP_LIBS="$CLP_LDFLAGS $CLP_LIBS"
    4.73 -  AC_SUBST(CLP_CXXFLAGS)
    4.74 -  AC_SUBST(CLP_LIBS)
    4.75 -  AM_CONDITIONAL([HAVE_CLP], [test x"$lx_clp_found" = x"yes"])
    4.76 -])
     5.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     5.2 +++ b/m4/lx_check_coin.m4	Fri Apr 03 16:58:22 2009 +0100
     5.3 @@ -0,0 +1,136 @@
     5.4 +AC_DEFUN([LX_CHECK_COIN],
     5.5 +[
     5.6 +  AC_ARG_WITH([coin],
     5.7 +AS_HELP_STRING([--with-coin@<:@=PREFIX@:>@], [search for CLP under PREFIX or under the default search paths if PREFIX is not given @<:@default@:>@])
     5.8 +AS_HELP_STRING([--without-coin], [disable checking for CLP]),
     5.9 +              [], [with_coin=yes])
    5.10 +
    5.11 +  AC_ARG_WITH([coin-includedir],
    5.12 +AS_HELP_STRING([--with-coin-includedir=DIR], [search for CLP headers in DIR]),
    5.13 +              [], [with_coin_includedir=no])
    5.14 +
    5.15 +  AC_ARG_WITH([coin-libdir],
    5.16 +AS_HELP_STRING([--with-coin-libdir=DIR], [search for CLP libraries in DIR]),
    5.17 +              [], [with_coin_libdir=no])
    5.18 +
    5.19 +  lx_clp_found=no
    5.20 +  if test x"$with_coin" != x"no"; then
    5.21 +    AC_MSG_CHECKING([for CLP])
    5.22 +
    5.23 +    if test x"$with_coin_includedir" != x"no"; then
    5.24 +      CLP_CXXFLAGS="-I$with_coin_includedir"
    5.25 +    elif test x"$with_coin" != x"yes"; then
    5.26 +      CLP_CXXFLAGS="-I$with_coin/include"
    5.27 +    fi
    5.28 +
    5.29 +    if test x"$with_coin_libdir" != x"no"; then
    5.30 +      CLP_LDFLAGS="-L$with_coin_libdir"
    5.31 +    elif test x"$with_coin" != x"yes"; then
    5.32 +      CLP_LDFLAGS="-L$with_coin/lib"
    5.33 +    fi
    5.34 +    CLP_LIBS="-lClp -lCoinUtils -lm"
    5.35 +
    5.36 +    lx_save_cxxflags="$CXXFLAGS"
    5.37 +    lx_save_ldflags="$LDFLAGS"
    5.38 +    lx_save_libs="$LIBS"
    5.39 +    CXXFLAGS="$CLP_CXXFLAGS"
    5.40 +    LDFLAGS="$CLP_LDFLAGS"
    5.41 +    LIBS="$CLP_LIBS"
    5.42 +
    5.43 +    lx_clp_test_prog='
    5.44 +      #include <coin/ClpModel.hpp>
    5.45 +
    5.46 +      int main(int argc, char** argv)
    5.47 +      {
    5.48 +        ClpModel clp;
    5.49 +        return 0;
    5.50 +      }'
    5.51 +
    5.52 +    AC_LANG_PUSH(C++)
    5.53 +    AC_LINK_IFELSE([$lx_clp_test_prog], [lx_clp_found=yes], [lx_clp_found=no])
    5.54 +    AC_LANG_POP(C++)
    5.55 +
    5.56 +    CXXFLAGS="$lx_save_cxxflags"
    5.57 +    LDFLAGS="$lx_save_ldflags"
    5.58 +    LIBS="$lx_save_libs"
    5.59 +
    5.60 +    if test x"$lx_clp_found" = x"yes"; then
    5.61 +      AC_DEFINE([HAVE_CLP], [1], [Define to 1 if you have CLP.])
    5.62 +      lx_lp_found=yes
    5.63 +      AC_DEFINE([HAVE_LP], [1], [Define to 1 if you have any LP solver.])
    5.64 +      AC_MSG_RESULT([yes])
    5.65 +    else
    5.66 +      CLP_CXXFLAGS=""
    5.67 +      CLP_LDFLAGS=""
    5.68 +      CLP_LIBS=""
    5.69 +      AC_MSG_RESULT([no])
    5.70 +    fi
    5.71 +  fi
    5.72 +  CLP_LIBS="$CLP_LDFLAGS $CLP_LIBS"
    5.73 +  AC_SUBST(CLP_CXXFLAGS)
    5.74 +  AC_SUBST(CLP_LIBS)
    5.75 +  AM_CONDITIONAL([HAVE_CLP], [test x"$lx_clp_found" = x"yes"])
    5.76 +
    5.77 +
    5.78 +  lx_cbc_found=no
    5.79 +  if test x"$lx_clp_found" = x"yes"; then
    5.80 +    if test x"$with_coin" != x"no"; then
    5.81 +      AC_MSG_CHECKING([for CBC])
    5.82 +
    5.83 +      if test x"$with_coin_includedir" != x"no"; then
    5.84 +        CBC_CXXFLAGS="-I$with_coin_includedir"
    5.85 +      elif test x"$with_coin" != x"yes"; then
    5.86 +        CBC_CXXFLAGS="-I$with_coin/include"
    5.87 +      fi
    5.88 +
    5.89 +      if test x"$with_coin_libdir" != x"no"; then
    5.90 +        CBC_LDFLAGS="-L$with_coin_libdir"
    5.91 +      elif test x"$with_coin" != x"yes"; then
    5.92 +        CBC_LDFLAGS="-L$with_coin/lib"
    5.93 +      fi
    5.94 +      CBC_LIBS="-lOsi -lCbc -lOsiCbc -lCbcSolver -lClp -lOsiClp -lCoinUtils -lVol -lOsiVol -lCgl -lm -llapack -lblas"
    5.95 +
    5.96 +      lx_save_cxxflags="$CXXFLAGS"
    5.97 +      lx_save_ldflags="$LDFLAGS"
    5.98 +      lx_save_libs="$LIBS"
    5.99 +      CXXFLAGS="$CBC_CXXFLAGS"
   5.100 +      LDFLAGS="$CBC_LDFLAGS"
   5.101 +      LIBS="$CBC_LIBS"
   5.102 +
   5.103 +      lx_cbc_test_prog='
   5.104 +        #include <coin/CbcModel.hpp>
   5.105 +
   5.106 +        int main(int argc, char** argv)
   5.107 +        {
   5.108 +          CbcModel cbc;
   5.109 +          return 0;
   5.110 +        }'
   5.111 +
   5.112 +      AC_LANG_PUSH(C++)
   5.113 +      AC_LINK_IFELSE([$lx_cbc_test_prog], [lx_cbc_found=yes], [lx_cbc_found=no])
   5.114 +      AC_LANG_POP(C++)
   5.115 +
   5.116 +      CXXFLAGS="$lx_save_cxxflags"
   5.117 +      LDFLAGS="$lx_save_ldflags"
   5.118 +      LIBS="$lx_save_libs"
   5.119 +
   5.120 +      if test x"$lx_cbc_found" = x"yes"; then
   5.121 +        AC_DEFINE([HAVE_CBC], [1], [Define to 1 if you have CBC.])
   5.122 +        lx_lp_found=yes
   5.123 +        AC_DEFINE([HAVE_LP], [1], [Define to 1 if you have any LP solver.])
   5.124 +        lx_mip_found=yes
   5.125 +        AC_DEFINE([HAVE_MIP], [1], [Define to 1 if you have any MIP solver.])
   5.126 +        AC_MSG_RESULT([yes])
   5.127 +      else
   5.128 +        CBC_CXXFLAGS=""
   5.129 +        CBC_LDFLAGS=""
   5.130 +        CBC_LIBS=""
   5.131 +        AC_MSG_RESULT([no])
   5.132 +      fi
   5.133 +    fi
   5.134 +  fi
   5.135 +  CBC_LIBS="$CBC_LDFLAGS $CBC_LIBS"
   5.136 +  AC_SUBST(CBC_CXXFLAGS)
   5.137 +  AC_SUBST(CBC_LIBS)
   5.138 +  AM_CONDITIONAL([HAVE_CBC], [test x"$lx_cbc_found" = x"yes"])
   5.139 +])