diff m4/acinclude.m4 @ 17241:03a666018e0f

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.
author Mike Miller <mtmiller@ieee.org>
date Tue, 13 Aug 2013 21:38:12 -0400
parents fbee0d312af5
children 3a7d5d655749
line wrap: on
line diff
--- 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 <glpk/glpk.h>
+        #else
+        #include <glpk.h>
+        #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.