changeset 8659:9792c26bffc7

configure: check whether qhull works
author Jaroslav Hajek <highegg@gmail.com>
date Wed, 04 Feb 2009 10:18:20 +0100
parents 73c4516fae10
children f274fbc29747
files ChangeLog aclocal.m4 configure.in
diffstat 3 files changed, 52 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Wed Feb 04 00:47:53 2009 -0500
+++ b/ChangeLog	Wed Feb 04 10:18:20 2009 +0100
@@ -1,3 +1,9 @@
+2009-02-03  Jaroslav Hajek  <highegg@gmail.com>
+
+	* aclocal.m4 (AC_CHECK_QHULL_OK): New macro, based on suggestion by
+	Petr Mikulik <mikulik@physics.muni.cz>.
+	* configure.in: Call it.
+
 2009-02-01  Thorsten Meyer  <thorsten.meyier@gmx.de>
 
 	* autogen.sh: Remove printing of cvs motd.
--- a/aclocal.m4	Wed Feb 04 00:47:53 2009 -0500
+++ b/aclocal.m4	Wed Feb 04 10:18:20 2009 +0100
@@ -955,6 +955,44 @@
 fi
 ])
 dnl
+dnl Check whether QHull works (does not crash)
+dnl
+AC_DEFUN(AC_CHECK_QHULL_OK,
+[AC_MSG_CHECKING([whether the qhull library works])
+AC_CACHE_VAL(octave_cv_lib_qhull_ok,
+[
+  save_LIBS="$LIBS"
+  LIBS="$LIBS -lqhull -lm"
+AC_RUN_IFELSE([AC_LANG_SOURCE([[
+#include <stdio.h>
+#include <qhull/qhull.h>
+
+#ifdef NEED_QHULL_VERSION
+char *qh_version = "version";
+#endif
+int main()
+{
+  int dim = 2, n = 4;
+  coordT points[8] = { -0.5, -0.5, -0.5, 0.5, 0.5, -0.5, 0.5, 0.5 };
+  boolT ismalloc = 0;
+
+  return qh_new_qhull (dim, n, points, ismalloc, "qhull ", 0, stderr); 
+}
+]])],
+  [octave_cv_lib_qhull_ok=yes],
+  [octave_cv_lib_qhull_ok=no],
+  [octave_cv_lib_qhull_ok=yes])
+  LIBS="$save_LIBS"
+])
+if test "$octave_cv_lib_qhull_ok" = "yes"; then
+  AC_MSG_RESULT(yes)
+  ifelse([$1], , , [$1])
+else
+  AC_MSG_RESULT(no)
+  ifelse([$2], , , [$2])
+fi
+])
+dnl
 dnl Check for OpenGL. If found, define OPENGL_LIBS
 dnl
 dnl FIXME -- add tests for apple
--- a/configure.in	Wed Feb 04 00:47:53 2009 -0500
+++ b/configure.in	Wed Feb 04 10:18:20 2009 +0100
@@ -425,13 +425,20 @@
     AC_CHECK_QHULL_VERSION(have_qhull=yes, have_qhull=no)
     AC_DEFINE(NEED_QHULL_VERSION, 1, [Define if the QHull library needs a wh_version variable defined.])
   fi
+  if test "$have_qhull" = yes; then
+    AC_CHECK_QHULL_OK(have_qhull=yes, have_qhull=bad)
+  fi
 fi
 if test "$have_qhull" = yes; then
   AC_DEFINE(HAVE_QHULL, 1, [Define if the QHull library is used.])
   QHULL_LIBS="-lqhull"
   TEXINFO_QHULL="@set HAVE_QHULL"
 else
-  warn_qhull="Qhull library not found --- This will result in loss of functionality of some geometry functions."
+  if test "$have_qhull" = bad; then
+    warn_qhull="Qhull library found, but seems not to work properly --- This will result in loss of functionality of some geometry functions. Please try recompiling the library with -fno-strict-aliasing."
+  else
+    warn_qhull="Qhull library not found --- This will result in loss of functionality of some geometry functions."
+  fi
   AC_MSG_WARN($warn_qhull)
 fi