# HG changeset patch # User John W. Eaton # Date 1323813202 18000 # Node ID f913363318e005e0e0329b8697e39ff4ac39f9df # Parent 57e19c30b7d6f6900c2e1b94c5788452eb81426f handle new names and locations of qhull include files (bug #33712) * src/DLD-FUNCTIONS/oct-qhull.h: New file. Handle details of which Qhull header files to include here. * src/DLD-FUNCTIONS/config-module.awk: Include oct-qhull.h in list of EXTRA_DIST files. * configure.ac: Check for qhull/libqhull.h, libqhull.h, qhull/qhull.h, and qhull.h instead of qhull/libqhull_a.h. * __delaunayn__.cc, __voronoi__.cc, convhulln.cc: Include oct-qhull.h instead of qhull/qhull_a.h. * acinclude.m4 (OCTAVE_CHECK_QHULL_VERSION, OCTAVE_CHECK_QHULL_OK): Look for various qhull header files. diff --git a/configure.ac b/configure.ac --- a/configure.ac +++ b/configure.ac @@ -649,7 +649,7 @@ OCTAVE_CHECK_LIBRARY(qhull, QHull, [Qhull library not found -- this will result in loss of functionality of some geometry functions.], - [qhull/qhull_a.h], [qh_qhull], [], [], + [qhull/libqhull.h libqhull.h qhull/qhull.h qhull.h], [qh_qhull], [], [], [warn_qhull= OCTAVE_CHECK_QHULL_VERSION OCTAVE_CHECK_QHULL_OK([TEXINFO_QHULL="@set HAVE_QHULL" diff --git a/m4/acinclude.m4 b/m4/acinclude.m4 --- a/m4/acinclude.m4 +++ b/m4/acinclude.m4 @@ -936,7 +936,28 @@ [AC_CACHE_CHECK([for qh_version in $QHULL_LIBS], octave_cv_lib_qhull_version, [ AC_LINK_IFELSE([AC_LANG_PROGRAM([[ -#include +#include +#if defined (HAVE_QHULL_LIBQHULL_H) || defined (HAVE_QHULL_QHULL_H) +# if defined (HAVE_QHULL_LIBQHULL_H) +# include +# else +# include +# endif +# include +# include +# include +# include +#elif defined (HAVE_LIBQHULL_H) || defined (HAVE_QHULL_H) +# if defined (HAVE_LIBQHULL_H) +# include +# else +# include +# endif +# include +# include +# include +# include +#endif ]], [[ const char *tmp = qh_version; ]])], [octave_cv_lib_qhull_version=yes], [octave_cv_lib_qhull_version=no])]) @@ -953,7 +974,27 @@ octave_cv_lib_qhull_ok, [ AC_RUN_IFELSE([AC_LANG_PROGRAM([[ #include -#include +#if defined (HAVE_QHULL_LIBQHULL_H) || defined (HAVE_QHULL_QHULL_H) +# if defined (HAVE_QHULL_LIBQHULL_H) +# include +# else +# include +# endif +# include +# include +# include +# include +#elif defined (HAVE_LIBQHULL_H) || defined (HAVE_QHULL_H) +# if defined (HAVE_LIBQHULL_H) +# include +# else +# include +# endif +# include +# include +# include +# include +#endif #ifdef NEED_QHULL_VERSION char *qh_version = "version"; #endif diff --git a/src/DLD-FUNCTIONS/__delaunayn__.cc b/src/DLD-FUNCTIONS/__delaunayn__.cc --- a/src/DLD-FUNCTIONS/__delaunayn__.cc +++ b/src/DLD-FUNCTIONS/__delaunayn__.cc @@ -50,14 +50,11 @@ #include "error.h" #include "oct-obj.h" -#ifdef HAVE_QHULL -extern "C" { -#include -} - -#ifdef NEED_QHULL_VERSION +#if defined (HAVE_QHULL) +# include "oct-qhull.h" +# if defined (NEED_QHULL_VERSION) char qh_version[] = "__delaunayn__.oct 2007-08-21"; -#endif +# endif #endif DEFUN_DLD (__delaunayn__, args, , @@ -70,7 +67,7 @@ { octave_value_list retval; -#ifdef HAVE_QHULL +#if defined (HAVE_QHULL) retval(0) = 0.0; diff --git a/src/DLD-FUNCTIONS/__voronoi__.cc b/src/DLD-FUNCTIONS/__voronoi__.cc --- a/src/DLD-FUNCTIONS/__voronoi__.cc +++ b/src/DLD-FUNCTIONS/__voronoi__.cc @@ -45,14 +45,11 @@ #include "error.h" #include "oct-obj.h" -#ifdef HAVE_QHULL -extern "C" { -#include -} - -#ifdef NEED_QHULL_VERSION +#if defined (HAVE_QHULL) +# include "oct-qhull.h" +# if defined (NEED_QHULL_VERSION) char qh_version[] = "__voronoi__.oct 2007-07-24"; -#endif +# endif #endif DEFUN_DLD (__voronoi__, args, , @@ -67,7 +64,7 @@ std::string caller = args(0).string_value (); -#ifdef HAVE_QHULL +#if defined (HAVE_QHULL) retval(0) = 0.0; diff --git a/src/DLD-FUNCTIONS/config-module.awk b/src/DLD-FUNCTIONS/config-module.awk --- a/src/DLD-FUNCTIONS/config-module.awk +++ b/src/DLD-FUNCTIONS/config-module.awk @@ -7,7 +7,8 @@ print "EXTRA_DIST += \\" print " DLD-FUNCTIONS/config-module.sh \\" print " DLD-FUNCTIONS/config-module.awk \\" - print " DLD-FUNCTIONS/module-files" + print " DLD-FUNCTIONS/module-files \\" + print " DLD-FUNCTIONS/oct-qhull.h" print "" } /^#.*/ { next; } diff --git a/src/DLD-FUNCTIONS/convhulln.cc b/src/DLD-FUNCTIONS/convhulln.cc --- a/src/DLD-FUNCTIONS/convhulln.cc +++ b/src/DLD-FUNCTIONS/convhulln.cc @@ -41,15 +41,12 @@ #include "oct-obj.h" #include "parse.h" -#ifdef HAVE_QHULL -extern "C" { -#include -} - -# ifdef NEED_QHULL_VERSION +#if defined (HAVE_QHULL) +# include "oct-qhull.h" +# if defined (NEED_QHULL_VERSION) char qh_version[] = "convhulln.oct 2007-07-24"; # endif -#endif /* HAVE_QHULL */ +#endif DEFUN_DLD (convhulln, args, nargout, "-*- texinfo -*-\n\ @@ -85,7 +82,7 @@ { octave_value_list retval; -#ifdef HAVE_QHULL +#if defined (HAVE_QHULL) int nargin = args.length (); if (nargin < 1 || nargin > 2) diff --git a/src/DLD-FUNCTIONS/oct-qhull.h b/src/DLD-FUNCTIONS/oct-qhull.h new file mode 100644 --- /dev/null +++ b/src/DLD-FUNCTIONS/oct-qhull.h @@ -0,0 +1,54 @@ +/* + +Copyright (C) 2011 John W. Eaton + +This file is part of Octave. + +Octave is free software; you can redistribute it and/or modify it +under the terms of the GNU General Public License as published by the +Free Software Foundation; either version 3 of the License, or (at your +option) any later version. + +Octave is distributed in the hope that it will be useful, but WITHOUT +ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +for more details. + +You should have received a copy of the GNU General Public License +along with Octave; see the file COPYING. If not, see +. + +*/ + +#if !defined (octave_oct_qhull_h) +#define octave_oct_qhull_h 1 + +#include + +extern "C" { + +#if defined (HAVE_QHULL_LIBQHULL_H) || defined (HAVE_QHULL_QHULL_H) +# if defined (HAVE_QHULL_LIBQHULL_H) +# include +# else +# include +# endif +# include +# include +# include +# include +#elif defined (HAVE_LIBQHULL_H) || defined (HAVE_QHULL_H) +# if defined (HAVE_LIBQHULL_H) +# include +# else +# include +# endif +# include +# include +# include +# include +#endif + +} + +#endif