-glpk=0
-AC_CHECK_HEADERS([glpk.h])
-if test "$ac_cv_header_glpk_h" = yes; then
-AM_CONDITIONAL(HAVE_GLPK, 1)
-AC_DEFINE_UNQUOTED([HAVE_GLPK], test x$glpk = xtrue, [We have GLPK])
-else
-AM_CONDITIONAL(HAVE_GLPK, test x$glpk = xtrue)
-AC_MSG_WARN([GLPK not installed.])
-fi
+#AC_CHECK_HEADERS(glpk.h, glpk=true)
+#AM_CONDITIONAL(HAVE_GLPK, test x$glpk = xtrue)
+#AC_CHECK_LIB([glpk],[glp_create_prob])
+
+glpk=true
+AC_CHECK_HEADERS(glpk.h, ,[gplk=false])
+AC_CHECK_LIB([glpk],[glp_create_prob], , [gplk=false])
+# GLPK must support atm MLP presolving, version >= 4.32
+AC_CHECK_MEMBERS(glp_iocp.presolve, ,[gplk=false],[[#include <glpk.h>]])
+if test $gplk = false
+then
+ AM_CONDITIONAL(HAVE_GLPK, [test x$gplk = xtrue])
+ AM_CONDITIONAL(HAVE_LIBGLPK, [test x$gplk != x$gplk])
+ AC_MSG_WARN([GNUnet requires GLPK >= 4.32])
+else
+ AM_CONDITIONAL(HAVE_GLPK, [test x$gplk = xtrue])
+ AM_CONDITIONAL(HAVE_LIBGLPK, [test x$gplk = x$gplk])
+fi