m4/lx_check_clp.m4
author Peter Kovacs <kpeter@inf.elte.hu>
Fri, 03 Apr 2009 18:59:15 +0200
changeset 608 6ac5d9ae1d3d
permissions -rw-r--r--
Support real types + numerical stability fix in NS (#254)

- Real types are supported by appropriate inicialization.
- A feature of the XTI spanning tree structure is removed to ensure
numerical stability (could cause problems using integer types).
The node potentials are updated always on the lower subtree,
in order to prevent overflow problems.
The former method isn't notably faster during to our tests.
deba@459
     1
AC_DEFUN([LX_CHECK_CLP],
deba@459
     2
[
deba@459
     3
  AC_ARG_WITH([clp],
deba@459
     4
AS_HELP_STRING([--with-clp@<:@=PREFIX@:>@], [search for CLP under PREFIX or under the default search paths if PREFIX is not given @<:@default@:>@])
deba@459
     5
AS_HELP_STRING([--without-clp], [disable checking for CLP]),
deba@459
     6
              [], [with_clp=yes])
deba@459
     7
deba@459
     8
  AC_ARG_WITH([clp-includedir],
deba@459
     9
AS_HELP_STRING([--with-clp-includedir=DIR], [search for CLP headers in DIR]),
deba@459
    10
              [], [with_clp_includedir=no])
deba@459
    11
deba@459
    12
  AC_ARG_WITH([clp-libdir],
deba@459
    13
AS_HELP_STRING([--with-clp-libdir=DIR], [search for CLP libraries in DIR]),
deba@459
    14
              [], [with_clp_libdir=no])
deba@459
    15
deba@459
    16
  lx_clp_found=no
deba@459
    17
  if test x"$with_clp" != x"no"; then
deba@459
    18
    AC_MSG_CHECKING([for CLP])
deba@459
    19
deba@459
    20
    if test x"$with_clp_includedir" != x"no"; then
deba@459
    21
      CLP_CXXFLAGS="-I$with_clp_includedir"
deba@459
    22
    elif test x"$with_clp" != x"yes"; then
deba@459
    23
      CLP_CXXFLAGS="-I$with_clp/include"
deba@459
    24
    fi
deba@459
    25
deba@459
    26
    if test x"$with_clp_libdir" != x"no"; then
deba@459
    27
      CLP_LDFLAGS="-L$with_clp_libdir"
deba@459
    28
    elif test x"$with_clp" != x"yes"; then
deba@459
    29
      CLP_LDFLAGS="-L$with_clp/lib"
deba@459
    30
    fi
deba@459
    31
    CLP_LIBS="-lClp -lCoinUtils -lm"
deba@459
    32
deba@459
    33
    lx_save_cxxflags="$CXXFLAGS"
deba@459
    34
    lx_save_ldflags="$LDFLAGS"
deba@459
    35
    lx_save_libs="$LIBS"
deba@459
    36
    CXXFLAGS="$CLP_CXXFLAGS"
deba@459
    37
    LDFLAGS="$CLP_LDFLAGS"
deba@459
    38
    LIBS="$CLP_LIBS"
deba@459
    39
deba@459
    40
    lx_clp_test_prog='
deba@459
    41
      #include <coin/ClpModel.hpp>
deba@459
    42
deba@459
    43
      int main(int argc, char** argv)
deba@459
    44
      {
deba@459
    45
        ClpModel clp;
deba@459
    46
        return 0;
deba@459
    47
      }'
deba@459
    48
deba@459
    49
    AC_LANG_PUSH(C++)
deba@459
    50
    AC_LINK_IFELSE([$lx_clp_test_prog], [lx_clp_found=yes], [lx_clp_found=no])
deba@459
    51
    AC_LANG_POP(C++)
deba@459
    52
deba@459
    53
    CXXFLAGS="$lx_save_cxxflags"
deba@459
    54
    LDFLAGS="$lx_save_ldflags"
deba@459
    55
    LIBS="$lx_save_libs"
deba@459
    56
deba@459
    57
    if test x"$lx_clp_found" = x"yes"; then
deba@459
    58
      AC_DEFINE([HAVE_CLP], [1], [Define to 1 if you have CLP.])
deba@459
    59
      lx_lp_found=yes
deba@459
    60
      AC_DEFINE([HAVE_LP], [1], [Define to 1 if you have any LP solver.])
deba@459
    61
      AC_MSG_RESULT([yes])
deba@459
    62
    else
deba@459
    63
      CLP_CXXFLAGS=""
deba@459
    64
      CLP_LDFLAGS=""
deba@459
    65
      CLP_LIBS=""
deba@459
    66
      AC_MSG_RESULT([no])
deba@459
    67
    fi
deba@459
    68
  fi
deba@459
    69
  CLP_LIBS="$CLP_LDFLAGS $CLP_LIBS"
deba@459
    70
  AC_SUBST(CLP_CXXFLAGS)
deba@459
    71
  AC_SUBST(CLP_LIBS)
deba@459
    72
  AM_CONDITIONAL([HAVE_CLP], [test x"$lx_clp_found" = x"yes"])
deba@459
    73
])