From 2faa605e3935f2d2048309934c307b7dc8546241 Mon Sep 17 00:00:00 2001 From: Morgan Deters Date: Mon, 16 Jun 2014 23:26:49 -0400 Subject: [PATCH] Clean up glpk detection a little, fix a detection bug. --- config/glpk.m4 | 25 +++++-------------------- src/theory/arith/approx_simplex.cpp | 8 +------- 2 files changed, 6 insertions(+), 27 deletions(-) diff --git a/config/glpk.m4 b/config/glpk.m4 index c5592ab19..cc2a3be71 100644 --- a/config/glpk.m4 +++ b/config/glpk.m4 @@ -34,10 +34,7 @@ elif test "$with_glpk" = yes; then dnl Try a bunch of combinations until something works :-/ GLPK_LIBS= - AC_CHECK_HEADERS([glpk/glpk.h glpk.h], [break]) - if test x$ac_cv_header_glpk_glpk_h = xno && test x$ac_cv_header_glpk_h = xno; then - AC_MSG_FAILURE([cannot find glpk.h, the GLPK header!]) - fi + AC_CHECK_HEADER([glpk.h], [], [AC_MSG_FAILURE([cannot find glpk.h, the GLPK header!])]) AC_MSG_CHECKING([how to link glpk]) CVC4_TRY_GLPK_WITH([]) CVC4_TRY_GLPK_WITH([-lgmp]) @@ -115,11 +112,7 @@ if test -z "$GLPK_LIBS"; then CPPFLAGS="$CVC4CPPFLAGS $CPPFLAGS" LDFLAGS="$GLPK_LDFLAGS $LDFLAGS" LIBS="-lglpk $1" - AC_LINK_IFELSE([AC_LANG_PROGRAM([#ifdef HAVE_GLPK_GLPK_H] - [#include ] - [#else] - [#include ] - [#endif], + AC_LINK_IFELSE([AC_LANG_PROGRAM([#include ], [int i = glp_ios_get_cut(NULL, 0, NULL, NULL, NULL, NULL, NULL)])], [GLPK_LIBS="-lglpk $1"], []) @@ -139,22 +132,14 @@ if test -z "$GLPK_LIBS"; then cvc4_save_LIBS="$LIBS" cvc4_save_CPPFLAGS="$CPPFLAGS" cvc4_save_LDFLAGS="$LDFLAGS" - CPPFLAGS="$CVC4_CPPFLAGS $CPPFLAGS" + CPPFLAGS="$CVC4CPPFLAGS $CPPFLAGS" LDFLAGS="-static $GLPK_LDFLAGS $LDFLAGS" LIBS="-lglpk-static $1" - AC_LINK_IFELSE([AC_LANG_PROGRAM([#ifdef HAVE_GLPK_GLPK_H] - [#include ] - [#else] - [#include ] - [#endif], + AC_LINK_IFELSE([AC_LANG_PROGRAM([#include ], [int i = glp_ios_get_cut(NULL, 0, NULL, NULL, NULL, NULL, NULL)])], [GLPK_LIBS="-lglpk-static $1"], [ LIBS="-lglpk $1" - AC_LINK_IFELSE([AC_LANG_PROGRAM([#ifdef HAVE_GLPK_GLPK_H] - [#include ] - [#else] - [#include ] - [#endif], + AC_LINK_IFELSE([AC_LANG_PROGRAM([#include ], [int i = glp_ios_get_cut(NULL, 0, NULL, NULL, NULL, NULL, NULL)])], [GLPK_LIBS="-lglpk $1"]) ]) diff --git a/src/theory/arith/approx_simplex.cpp b/src/theory/arith/approx_simplex.cpp index 9f6b1796e..676c5cb25 100644 --- a/src/theory/arith/approx_simplex.cpp +++ b/src/theory/arith/approx_simplex.cpp @@ -431,13 +431,7 @@ public: /* Begin the declaration of GLPK specific code. */ #ifdef CVC4_USE_GLPK extern "C" { -/* Sometimes the header is in a subdirectory glpk/, sometimes not. - * The configure script figures it out. */ -#ifdef HAVE_GLPK_GLPK_H -# include -#else /* HAVE_GLPK_GLPK_H */ -# include -#endif /* HAVE_GLPK_GLPK_H */ +#include }/* extern "C" */ namespace CVC4 { -- 2.30.2