1 AC_DEFUN([LX_CHECK_GLPK],
4 AS_HELP_STRING([--with-glpk@<:@=PREFIX@:>@], [Search for GLPK under PREFIX or under the default search paths if PREFIX is not given @<:@default@:>@])
5 AS_HELP_STRING([--without-glpk], [Disable checking for GLPK]),
8 AC_ARG_WITH([glpk-includedir],
9 AS_HELP_STRING([--with-glpk-includedir=DIR], [Search for GLPK headers in DIR]),
10 [], [with_glpk_includedir=no])
12 AC_ARG_WITH([glpk-libdir],
13 AS_HELP_STRING([--with-glpk-libdir=DIR], [Search for GLPK libraries in DIR]),
14 [], [with_glpk_libdir=no])
16 if test x"$with_glpk" != x"no"; then
17 AC_MSG_CHECKING([for GLPK])
19 if test x"$with_glpk_includedir" != x"no"; then
20 GLPK_CFLAGS="-I$with_glpk_includedir"
21 elif test x"$with_glpk" != x"yes"; then
22 GLPK_CFLAGS="-I$with_glpk/include"
25 if test x"$with_glpk_libdir" != x"no"; then
26 GLPK_LDFLAGS="-L$with_glpk_libdir"
27 elif test x"$with_glpk" != x"yes"; then
28 GLPK_LDFLAGS="-L$with_glpk/lib"
32 lx_save_cxxflags="$CXXFLAGS";
33 lx_save_ldflags="$LDFLAGS";
35 CXXFLAGS="$GLPK_CFLAGS"
36 LDFLAGS="$GLPK_LDFLAGS"
44 int main(int argc, char* argv[])
47 lp = lpx_create_prob();
53 AC_LINK_IFELSE([$lx_glpk_test_prog], [lx_glpk_found=yes], [])
56 CXXFLAGS="$lx_save_cxxflags"
57 LDFLAGS="$lx_save_ldflags"
60 if test x"$lx_glpk_found" = x"yes"; then
61 AC_DEFINE([HAVE_GLPK], [1], [Define to 1 if you have GLPK.])
67 GLPK_LIBS="$GLPK_LDFLAGS $GLPK_LIBS"
70 AM_CONDITIONAL([HAVE_GLPK], [test x"$lx_glpk_found" = x"yes"])