COIN-OR::LEMON - Graph Library

source: lemon/m4/lx_check_glpk.m4 @ 555:861a9d5ff283

Last change on this file since 555:861a9d5ff283 was 482:ed54c0d13df0, checked in by Balazs Dezso <deba@…>, 16 years ago

Thorough redesign of the LP/MIP interface (#44)

  • Redesigned class structure
  • Redesigned iterators
  • Some functions in the basic interface redesigned
  • More complete setting functions
  • Ray retrieving functions
  • Lot of improvements
  • Cplex common env
  • CLP macro definition to config.h.in
  • Update lp.h to also use soplex and clp
  • Remove default_solver_name
  • New solverName() function in solvers
  • Handle exceptions for MipCplex? test
  • Rename tolerance parameter to epsilon
  • Rename MapIt? to CoeffIt?
  • Lot of documentation improvements
  • Various bugfixes
File size: 2.4 KB
Line 
1AC_DEFUN([LX_CHECK_GLPK],
2[
3  AC_ARG_WITH([glpk],
4AS_HELP_STRING([--with-glpk@<:@=PREFIX@:>@], [search for GLPK under PREFIX or under the default search paths if PREFIX is not given @<:@default@:>@])
5AS_HELP_STRING([--without-glpk], [disable checking for GLPK]),
6              [], [with_glpk=yes])
7
8  AC_ARG_WITH([glpk-includedir],
9AS_HELP_STRING([--with-glpk-includedir=DIR], [search for GLPK headers in DIR]),
10              [], [with_glpk_includedir=no])
11
12  AC_ARG_WITH([glpk-libdir],
13AS_HELP_STRING([--with-glpk-libdir=DIR], [search for GLPK libraries in DIR]),
14              [], [with_glpk_libdir=no])
15
16  lx_glpk_found=no
17  if test x"$with_glpk" != x"no"; then
18    AC_MSG_CHECKING([for GLPK])
19
20    if test x"$with_glpk_includedir" != x"no"; then
21      GLPK_CFLAGS="-I$with_glpk_includedir"
22    elif test x"$with_glpk" != x"yes"; then
23      GLPK_CFLAGS="-I$with_glpk/include"
24    fi
25
26    if test x"$with_glpk_libdir" != x"no"; then
27      GLPK_LDFLAGS="-L$with_glpk_libdir"
28    elif test x"$with_glpk" != x"yes"; then
29      GLPK_LDFLAGS="-L$with_glpk/lib"
30    fi
31    GLPK_LIBS="-lglpk"
32
33    lx_save_cxxflags="$CXXFLAGS"
34    lx_save_ldflags="$LDFLAGS"
35    lx_save_libs="$LIBS"
36    CXXFLAGS="$GLPK_CFLAGS"
37    LDFLAGS="$GLPK_LDFLAGS"
38    LIBS="$GLPK_LIBS"
39
40    lx_glpk_test_prog='
41      extern "C" {
42      #include <glpk.h>
43      }
44
45      #if (GLP_MAJOR_VERSION < 4) \
46         || (GLP_MAJOR_VERSION == 4 && GLP_MINOR_VERSION < 33)
47      #error Supported GLPK versions: 4.33 or above
48      #endif
49
50      int main(int argc, char** argv)
51      {
52        LPX *lp;
53        lp = lpx_create_prob();
54        lpx_delete_prob(lp);
55        return 0;
56      }'
57
58    AC_LANG_PUSH(C++)
59    AC_LINK_IFELSE([$lx_glpk_test_prog], [lx_glpk_found=yes], [lx_glpk_found=no])
60    AC_LANG_POP(C++)
61
62    CXXFLAGS="$lx_save_cxxflags"
63    LDFLAGS="$lx_save_ldflags"
64    LIBS="$lx_save_libs"
65
66    if test x"$lx_glpk_found" = x"yes"; then
67      AC_DEFINE([HAVE_GLPK], [1], [Define to 1 if you have GLPK.])
68      lx_lp_found=yes
69      AC_DEFINE([HAVE_LP], [1], [Define to 1 if you have any LP solver.])
70      lx_mip_found=yes
71      AC_DEFINE([HAVE_MIP], [1], [Define to 1 if you have any MIP solver.])
72      AC_MSG_RESULT([yes])
73    else
74      GLPK_CFLAGS=""
75      GLPK_LDFLAGS=""
76      GLPK_LIBS=""
77      AC_MSG_RESULT([no])
78    fi
79  fi
80  GLPK_LIBS="$GLPK_LDFLAGS $GLPK_LIBS"
81  AC_SUBST(GLPK_CFLAGS)
82  AC_SUBST(GLPK_LIBS)
83  AM_CONDITIONAL([HAVE_GLPK], [test x"$lx_glpk_found" = x"yes"])
84])
Note: See TracBrowser for help on using the repository browser.