m4/lx_check_glpk.m4
changeset 981 cdd2c7dad989
parent 980 48e17328c155
child 982 0b9a94956916
     1.1 --- a/m4/lx_check_glpk.m4	Sun Jan 29 22:33:14 2012 +0100
     1.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.3 @@ -1,84 +0,0 @@
     1.4 -AC_DEFUN([LX_CHECK_GLPK],
     1.5 -[
     1.6 -  AC_ARG_WITH([glpk],
     1.7 -AS_HELP_STRING([--with-glpk@<:@=PREFIX@:>@], [search for GLPK under PREFIX or under the default search paths if PREFIX is not given @<:@default@:>@])
     1.8 -AS_HELP_STRING([--without-glpk], [disable checking for GLPK]),
     1.9 -              [], [with_glpk=yes])
    1.10 -
    1.11 -  AC_ARG_WITH([glpk-includedir],
    1.12 -AS_HELP_STRING([--with-glpk-includedir=DIR], [search for GLPK headers in DIR]),
    1.13 -              [], [with_glpk_includedir=no])
    1.14 -
    1.15 -  AC_ARG_WITH([glpk-libdir],
    1.16 -AS_HELP_STRING([--with-glpk-libdir=DIR], [search for GLPK libraries in DIR]),
    1.17 -              [], [with_glpk_libdir=no])
    1.18 -
    1.19 -  lx_glpk_found=no
    1.20 -  if test x"$with_glpk" != x"no"; then
    1.21 -    AC_MSG_CHECKING([for GLPK])
    1.22 -
    1.23 -    if test x"$with_glpk_includedir" != x"no"; then
    1.24 -      GLPK_CFLAGS="-I$with_glpk_includedir"
    1.25 -    elif test x"$with_glpk" != x"yes"; then
    1.26 -      GLPK_CFLAGS="-I$with_glpk/include"
    1.27 -    fi
    1.28 -
    1.29 -    if test x"$with_glpk_libdir" != x"no"; then
    1.30 -      GLPK_LDFLAGS="-L$with_glpk_libdir"
    1.31 -    elif test x"$with_glpk" != x"yes"; then
    1.32 -      GLPK_LDFLAGS="-L$with_glpk/lib"
    1.33 -    fi
    1.34 -    GLPK_LIBS="-lglpk"
    1.35 -
    1.36 -    lx_save_cxxflags="$CXXFLAGS"
    1.37 -    lx_save_ldflags="$LDFLAGS"
    1.38 -    lx_save_libs="$LIBS"
    1.39 -    CXXFLAGS="$GLPK_CFLAGS"
    1.40 -    LDFLAGS="$GLPK_LDFLAGS"
    1.41 -    LIBS="$GLPK_LIBS"
    1.42 -
    1.43 -    lx_glpk_test_prog='
    1.44 -      extern "C" {
    1.45 -      #include <glpk.h>
    1.46 -      }
    1.47 -
    1.48 -      #if (GLP_MAJOR_VERSION < 4) \
    1.49 -         || (GLP_MAJOR_VERSION == 4 && GLP_MINOR_VERSION < 33)
    1.50 -      #error Supported GLPK versions: 4.33 or above
    1.51 -      #endif
    1.52 -
    1.53 -      int main(int argc, char** argv)
    1.54 -      {
    1.55 -        LPX *lp;
    1.56 -        lp = lpx_create_prob();
    1.57 -        lpx_delete_prob(lp);
    1.58 -        return 0;
    1.59 -      }'
    1.60 -
    1.61 -    AC_LANG_PUSH(C++)
    1.62 -    AC_LINK_IFELSE([$lx_glpk_test_prog], [lx_glpk_found=yes], [lx_glpk_found=no])
    1.63 -    AC_LANG_POP(C++)
    1.64 -
    1.65 -    CXXFLAGS="$lx_save_cxxflags"
    1.66 -    LDFLAGS="$lx_save_ldflags"
    1.67 -    LIBS="$lx_save_libs"
    1.68 -
    1.69 -    if test x"$lx_glpk_found" = x"yes"; then
    1.70 -      AC_DEFINE([LEMON_HAVE_GLPK], [1], [Define to 1 if you have GLPK.])
    1.71 -      lx_lp_found=yes
    1.72 -      AC_DEFINE([LEMON_HAVE_LP], [1], [Define to 1 if you have any LP solver.])
    1.73 -      lx_mip_found=yes
    1.74 -      AC_DEFINE([LEMON_HAVE_MIP], [1], [Define to 1 if you have any MIP solver.])
    1.75 -      AC_MSG_RESULT([yes])
    1.76 -    else
    1.77 -      GLPK_CFLAGS=""
    1.78 -      GLPK_LDFLAGS=""
    1.79 -      GLPK_LIBS=""
    1.80 -      AC_MSG_RESULT([no])
    1.81 -    fi
    1.82 -  fi
    1.83 -  GLPK_LIBS="$GLPK_LDFLAGS $GLPK_LIBS"
    1.84 -  AC_SUBST(GLPK_CFLAGS)
    1.85 -  AC_SUBST(GLPK_LIBS)
    1.86 -  AM_CONDITIONAL([HAVE_GLPK], [test x"$lx_glpk_found" = x"yes"])
    1.87 -])