COIN-OR::LEMON - Graph Library

source: lemon/m4/lx_check_cbc.m4 @ 614:3314f58e7b25

Last change on this file since 614:3314f58e7b25 was 614:3314f58e7b25, checked in by Balazs Dezso <deba@…>, 11 years ago

Add CBC support (#204)

File size: 2.1 KB
Line 
1AC_DEFUN([LX_CHECK_CBC],
2[
3  AC_ARG_WITH([cbc],
4AS_HELP_STRING([--with-cbc@<:@=PREFIX@:>@], [search for CBC under PREFIX or under the default search paths if PREFIX is not given @<:@default@:>@])
5AS_HELP_STRING([--without-cbc], [disable checking for CBC]),
6              [], [with_cbc=yes])
7
8  AC_ARG_WITH([cbc-includedir],
9AS_HELP_STRING([--with-cbc-includedir=DIR], [search for CBC headers in DIR]),
10              [], [with_cbc_includedir=no])
11
12  AC_ARG_WITH([cbc-libdir],
13AS_HELP_STRING([--with-cbc-libdir=DIR], [search for CBC libraries in DIR]),
14              [], [with_cbc_libdir=no])
15
16  lx_cbc_found=no
17  if test x"$with_cbc" != x"no"; then
18    AC_MSG_CHECKING([for CBC])
19
20    if test x"$with_cbc_includedir" != x"no"; then
21      CBC_CXXFLAGS="-I$with_cbc_includedir"
22    elif test x"$with_cbc" != x"yes"; then
23      CBC_CXXFLAGS="-I$with_cbc/include"
24    fi
25
26    if test x"$with_cbc_libdir" != x"no"; then
27      CBC_LDFLAGS="-L$with_cbc_libdir"
28    elif test x"$with_cbc" != x"yes"; then
29      CBC_LDFLAGS="-L$with_cbc/lib"
30    fi
31    CBC_LIBS="-lOsi -lCbc -lOsiCbc -lCbcSolver -lClp -lOsiClp -lCoinUtils -lVol -lOsiVol -lCgl -lm -llapack -lblas"
32
33    lx_save_cxxflags="$CXXFLAGS"
34    lx_save_ldflags="$LDFLAGS"
35    lx_save_libs="$LIBS"
36    CXXFLAGS="$CBC_CXXFLAGS"
37    LDFLAGS="$CBC_LDFLAGS"
38    LIBS="$CBC_LIBS"
39
40    lx_cbc_test_prog='
41      #include <coin/CbcModel.hpp>
42
43      int main(int argc, char** argv)
44      {
45        CbcModel cbc;
46        return 0;
47      }'
48
49    AC_LANG_PUSH(C++)
50    AC_LINK_IFELSE([$lx_cbc_test_prog], [lx_cbc_found=yes], [lx_cbc_found=no])
51    AC_LANG_POP(C++)
52
53    CXXFLAGS="$lx_save_cxxflags"
54    LDFLAGS="$lx_save_ldflags"
55    LIBS="$lx_save_libs"
56
57    if test x"$lx_cbc_found" = x"yes"; then
58      AC_DEFINE([HAVE_CBC], [1], [Define to 1 if you have CBC.])
59      lx_lp_found=yes
60      AC_DEFINE([HAVE_LP], [1], [Define to 1 if you have any LP solver.])
61      AC_MSG_RESULT([yes])
62    else
63      CBC_CXXFLAGS=""
64      CBC_LDFLAGS=""
65      CBC_LIBS=""
66      AC_MSG_RESULT([no])
67    fi
68  fi
69  CBC_LIBS="$CBC_LDFLAGS $CBC_LIBS"
70  AC_SUBST(CBC_CXXFLAGS)
71  AC_SUBST(CBC_LIBS)
72  AM_CONDITIONAL([HAVE_CBC], [test x"$lx_cbc_found" = x"yes"])
73])
Note: See TracBrowser for help on using the repository browser.