dnl Try a bunch of combinations until something works :-/
GLPK_LIBS=
- AC_CHECK_HEADER([glpk.h], [],
- [AC_MSG_FAILURE([cannot find glpk.h, the GLPK header!])])
+ 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_MSG_CHECKING([how to link glpk])
CVC4_TRY_GLPK_WITH([])
CVC4_TRY_GLPK_WITH([-lgmp])
AC_LANG_PUSH([C++])
cvc4_save_LIBS="$LIBS"
LIBS="-lglpk $1"
- AC_LINK_IFELSE([AC_LANG_PROGRAM([#include <glpk.h>],
+ AC_LINK_IFELSE([AC_LANG_PROGRAM([#ifdef HAVE_GLPK_GLPK_H]
+ [#include <glpk/glpk.h>]
+ [#else]
+ [#include <glpk.h>]
+ [#endif],
[int i = lpx_get_int_parm(NULL, LPX_K_ITCNT)])],
[GLPK_LIBS="-lglpk $1"],
[])
cvc4_save_LDFLAGS="$LDFLAGS"
LDFLAGS="-static $LDFLAGS"
LIBS="-lglpk $1"
- AC_LINK_IFELSE([AC_LANG_PROGRAM([#include <glpk.h>],
+ AC_LINK_IFELSE([AC_LANG_PROGRAM([#ifdef HAVE_GLPK_GLPK_H]
+ [#include <glpk/glpk.h>]
+ [#else]
+ [#include <glpk.h>]
+ [#endif],
[int i = lpx_get_int_parm(NULL, LPX_K_ITCNT)])],
[GLPK_LIBS="-lglpk $1"],
[])
/* Begin the declaration of GLPK specific code. */
#ifdef CVC4_USE_GLPK
extern "C" {
-#include <glpk.h>
-}
+/* Sometimes the header is in a subdirectory glpk/, sometimes not.
+ * The configure script figures it out. */
+#ifdef HAVE_GLPK_GLPK_H
+# include <glpk/glpk.h>
+#else /* HAVE_GLPK_GLPK_H */
+# include <glpk.h>
+#endif /* HAVE_GLPK_GLPK_H */
+}/* extern "C" */
namespace CVC4 {
namespace theory {