m4/lx_check_clp.m4
author Peter Kovacs <kpeter@inf.elte.hu>
Tue, 24 Mar 2009 00:18:25 +0100
changeset 651 8c3112a66878
permissions -rw-r--r--
Use XTI implementation instead of ATI in NetworkSimplex (#234)

XTI (eXtended Threaded Index) is an imporved version of the widely
known ATI (Augmented Threaded Index) method for storing and updating
the spanning tree structure in Network Simplex algorithms.

In the ATI data structure three indices are stored for each node:
predecessor, thread and depth. In the XTI data structure depth is
replaced by the number of successors and the last successor
(according to the thread index).
deba@482
     1
AC_DEFUN([LX_CHECK_CLP],
deba@482
     2
[
deba@482
     3
  AC_ARG_WITH([clp],
deba@482
     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@482
     5
AS_HELP_STRING([--without-clp], [disable checking for CLP]),
deba@482
     6
              [], [with_clp=yes])
deba@482
     7
deba@482
     8
  AC_ARG_WITH([clp-includedir],
deba@482
     9
AS_HELP_STRING([--with-clp-includedir=DIR], [search for CLP headers in DIR]),
deba@482
    10
              [], [with_clp_includedir=no])
deba@482
    11
deba@482
    12
  AC_ARG_WITH([clp-libdir],
deba@482
    13
AS_HELP_STRING([--with-clp-libdir=DIR], [search for CLP libraries in DIR]),
deba@482
    14
              [], [with_clp_libdir=no])
deba@482
    15
deba@482
    16
  lx_clp_found=no
deba@482
    17
  if test x"$with_clp" != x"no"; then
deba@482
    18
    AC_MSG_CHECKING([for CLP])
deba@482
    19
deba@482
    20
    if test x"$with_clp_includedir" != x"no"; then
deba@482
    21
      CLP_CXXFLAGS="-I$with_clp_includedir"
deba@482
    22
    elif test x"$with_clp" != x"yes"; then
deba@482
    23
      CLP_CXXFLAGS="-I$with_clp/include"
deba@482
    24
    fi
deba@482
    25
deba@482
    26
    if test x"$with_clp_libdir" != x"no"; then
deba@482
    27
      CLP_LDFLAGS="-L$with_clp_libdir"
deba@482
    28
    elif test x"$with_clp" != x"yes"; then
deba@482
    29
      CLP_LDFLAGS="-L$with_clp/lib"
deba@482
    30
    fi
deba@482
    31
    CLP_LIBS="-lClp -lCoinUtils -lm"
deba@482
    32
deba@482
    33
    lx_save_cxxflags="$CXXFLAGS"
deba@482
    34
    lx_save_ldflags="$LDFLAGS"
deba@482
    35
    lx_save_libs="$LIBS"
deba@482
    36
    CXXFLAGS="$CLP_CXXFLAGS"
deba@482
    37
    LDFLAGS="$CLP_LDFLAGS"
deba@482
    38
    LIBS="$CLP_LIBS"
deba@482
    39
deba@482
    40
    lx_clp_test_prog='
deba@482
    41
      #include <coin/ClpModel.hpp>
deba@482
    42
deba@482
    43
      int main(int argc, char** argv)
deba@482
    44
      {
deba@482
    45
        ClpModel clp;
deba@482
    46
        return 0;
deba@482
    47
      }'
deba@482
    48
deba@482
    49
    AC_LANG_PUSH(C++)
deba@482
    50
    AC_LINK_IFELSE([$lx_clp_test_prog], [lx_clp_found=yes], [lx_clp_found=no])
deba@482
    51
    AC_LANG_POP(C++)
deba@482
    52
deba@482
    53
    CXXFLAGS="$lx_save_cxxflags"
deba@482
    54
    LDFLAGS="$lx_save_ldflags"
deba@482
    55
    LIBS="$lx_save_libs"
deba@482
    56
deba@482
    57
    if test x"$lx_clp_found" = x"yes"; then
deba@482
    58
      AC_DEFINE([HAVE_CLP], [1], [Define to 1 if you have CLP.])
deba@482
    59
      lx_lp_found=yes
deba@482
    60
      AC_DEFINE([HAVE_LP], [1], [Define to 1 if you have any LP solver.])
deba@482
    61
      AC_MSG_RESULT([yes])
deba@482
    62
    else
deba@482
    63
      CLP_CXXFLAGS=""
deba@482
    64
      CLP_LDFLAGS=""
deba@482
    65
      CLP_LIBS=""
deba@482
    66
      AC_MSG_RESULT([no])
deba@482
    67
    fi
deba@482
    68
  fi
deba@482
    69
  CLP_LIBS="$CLP_LDFLAGS $CLP_LIBS"
deba@482
    70
  AC_SUBST(CLP_CXXFLAGS)
deba@482
    71
  AC_SUBST(CLP_LIBS)
deba@482
    72
  AM_CONDITIONAL([HAVE_CLP], [test x"$lx_clp_found" = x"yes"])
deba@482
    73
])