# HG changeset patch # User Mike Miller # Date 1376444292 14400 # Node ID 03a666018e0f2bed9d53da61166aa82c56dcfd21 # Parent d757c98636d82ab84fcef67b7718e475babfad18 build: Detect new GLPK API features required since changeset 54e251e699bb * m4/acinclude.m4 (OCTAVE_CHECK_LIB_GLPK_OK): New macro to detect the newest GLPK API features required by Octave. * configure.ac: Call it and disable glpk if the library is not ok. diff -r d757c98636d8 -r 03a666018e0f configure.ac --- a/configure.ac Wed Aug 14 01:54:34 2013 +0100 +++ b/configure.ac Tue Aug 13 21:38:12 2013 -0400 @@ -886,7 +886,12 @@ LIBS="$Z_LDFLAGS $Z_LIBS $LIBS" OCTAVE_CHECK_LIB(glpk, GLPK, [GLPK library not found. The glpk function for solving linear programs will be disabled.], - [glpk/glpk.h glpk.h], [glp_simplex]) + [glpk/glpk.h glpk.h], [glp_simplex], [], [], + [warn_glpk= + OCTAVE_CHECK_LIB_GLPK_OK( + [TEXINFO_GLPK="@set HAVE_GLPK" + AC_DEFINE(HAVE_GLPK, 1, [Define to 1 if GLPK is available.])], + [warn_glpk="GLPK library found, but does not seem to work properly -- disabling glpk function"])]) LIBS="$save_LIBS" CPPFLAGS="$save_CPPFLAGS" diff -r d757c98636d8 -r 03a666018e0f m4/acinclude.m4 --- a/m4/acinclude.m4 Wed Aug 14 01:54:34 2013 +0100 +++ b/m4/acinclude.m4 Tue Aug 13 21:38:12 2013 -0400 @@ -598,6 +598,42 @@ fi ]) dnl +dnl Check whether GLPK provides the latest API functions required +dnl for the glpk function. The glp_iptcp structure was introduced +dnl in GLPK version 4.38. +dnl +AC_DEFUN([OCTAVE_CHECK_LIB_GLPK_OK], [ + AC_CACHE_CHECK([whether the glpk library has glp_interior(glp_prob*, glp_iptcp*)], + [octave_cv_lib_glpk_ok], + [AC_LANG_PUSH(C++) + AC_LINK_IFELSE([AC_LANG_PROGRAM([[ + extern "C" + { + #if defined (HAVE_GLPK_GLPK_H) + #include + #else + #include + #endif + } + ]], [[ + glp_prob *lp = glp_create_prob (); + glp_iptcp iptcp; + glp_init_iptcp (&iptcp); + int retval = glp_interior (lp, &iptcp); + ]])], + octave_cv_lib_glpk_ok=yes, + octave_cv_lib_glpk_ok=no) + AC_LANG_POP(C++) + ]) + if test $octave_cv_lib_glpk_ok = yes; then + $1 + : + else + $2 + : + fi +]) +dnl dnl Check whether using HDF5 DLL under Windows. This is done by dnl testing for a data symbol in the HDF5 library, which would dnl require the definition of _HDF5USEDL_ under MSVC compiler.