git: f1ef83b857f5 - main - math/octave: switch to Qhull8

From: Thierry Thomas <thierry_at_FreeBSD.org>
Date: Fri, 18 Feb 2022 18:45:05 UTC
The branch main has been updated by thierry:

URL: https://cgit.FreeBSD.org/ports/commit/?id=f1ef83b857f555f0c7a6182ca02002b63cfe80f9

commit f1ef83b857f555f0c7a6182ca02002b63cfe80f9
Author:     Thierry Thomas <thierry@FreeBSD.org>
AuthorDate: 2022-02-18 18:36:53 +0000
Commit:     Thierry Thomas <thierry@FreeBSD.org>
CommitDate: 2022-02-18 18:44:54 +0000

    math/octave: switch to Qhull8
    
    Patch obtained from https://savannah.gnu.org/bugs/download.php?file_id=51705
    
    PR:             261281
    Approved by:    stephen (maintainer)
---
 math/octave/Makefile                               |   9 +-
 math/octave/files/patch-Makefile.in                |  54 +++
 math/octave/files/patch-config.in.h                |  43 ++
 math/octave/files/patch-configure                  | 448 ++++++++++++++++++++-
 .../patch-libinterp_dldfcn_____delaunayn____.cc    |  73 ++++
 .../patch-libinterp_dldfcn_____voronoi____.cc      | 100 +++++
 .../files/patch-libinterp_dldfcn_convhulln.cc      | 139 +++++++
 .../files/patch-libinterp_dldfcn_oct-qhull.h       |  47 +++
 .../patch-scripts_pkg_private_configure__make.m    |   4 +-
 9 files changed, 898 insertions(+), 19 deletions(-)

diff --git a/math/octave/Makefile b/math/octave/Makefile
index e0682d9507a4..3c6e4c24b330 100644
--- a/math/octave/Makefile
+++ b/math/octave/Makefile
@@ -2,7 +2,7 @@
 
 PORTNAME=	octave
 PORTVERSION=	${OCTAVE_VERSION}
-PORTREVISION=	1
+PORTREVISION=	2
 CATEGORIES=	math
 MASTER_SITES=	GNU
 
@@ -27,7 +27,7 @@ LIB_DEPENDS=	libGraphicsMagick.so:graphics/GraphicsMagick \
 		libftgl.so:graphics/ftgl \
 		libhdf5.so:science/hdf5 \
 		libpcre.so:devel/pcre \
-		libqhull.so.7:math/qhull \
+		libqhull_r.so:math/qhull8 \
 		libqrupdate.so:math/qrupdate \
 		libamd.so:math/suitesparse-amd \
 		libcamd.so:math/suitesparse-camd \
@@ -46,7 +46,6 @@ LIB_DEPENDS=	libGraphicsMagick.so:graphics/GraphicsMagick \
 		libOSMesa.so:graphics/libosmesa \
 		libsundials_arkode.so:math/sundials \
 		libportaudio.so:audio/portaudio
-#		libsndfile.so:audio/libsndfile # Commented out until this port no longer has vulnerabilities.
 
 USES=		charsetfix fortran gmake libtool perl5 pkgconfig readline \
 		tar:xz compiler:c++14-lang \
@@ -91,6 +90,7 @@ CONFIGURE_ARGS=	--host=${GNU_HOST} \
 INFO=		octave liboctave
 
 INSTALL_TARGET=	install-strip
+TEST_TARGET=	check
 
 OPTIONS_DEFINE=	DOCS JAVA QT5
 
@@ -107,12 +107,13 @@ QT5_LIB_DEPENDS=	libqscintilla2_qt5.so:devel/qscintilla2-qt5
 
 DOCS_USE=	TEX=dvipsk:build,formats:build
 JAVA_USE=	JAVA=yes
+JAVA_CFLAGS=	-I${JAVA_HOME}/include/${OPSYS:tl}
 QT5_USES=	qt:5
 OPENBLAS_USES=	blaslapack:openblas
 NETLIB_USES=	blaslapack:netlib
 ATLAS_USES=		blaslapack:atlas
 
-post-patch:
+pre-configure:
 	${REINPLACE_CMD} 's+"makeinfo"+"${LOCALBASE}/bin/makeinfo"+' ${WRKSRC}/libinterp/corefcn/help.cc
 	${REINPLACE_CMD} 's/"-qt=$$qt_version"/"-qt=qt$$qt_version"/' ${WRKSRC}/configure
 
diff --git a/math/octave/files/patch-Makefile.in b/math/octave/files/patch-Makefile.in
new file mode 100644
index 000000000000..6ca32d671ba9
--- /dev/null
+++ b/math/octave/files/patch-Makefile.in
@@ -0,0 +1,54 @@
+--- Makefile.in.orig	2022-01-16 10:49:42 UTC
++++ Makefile.in
+@@ -5282,9 +5282,9 @@ QCOLLECTIONGENERATOR_QTVER = @QCOLLECTIONGENERATOR_QTV
+ QHELPGENERATOR = @QHELPGENERATOR@
+ QHELPGENERATORFLAGS = @QHELPGENERATORFLAGS@
+ QHELPGENERATOR_QTVER = @QHELPGENERATOR_QTVER@
+-QHULL_CPPFLAGS = @QHULL_CPPFLAGS@
+-QHULL_LDFLAGS = @QHULL_LDFLAGS@
+-QHULL_LIBS = @QHULL_LIBS@
++QHULL_R_CPPFLAGS = @QHULL_R_CPPFLAGS@
++QHULL_R_LDFLAGS = @QHULL_R_LDFLAGS@
++QHULL_R_LIBS = @QHULL_R_LIBS@
+ QRUPDATE_CPPFLAGS = @QRUPDATE_CPPFLAGS@
+ QRUPDATE_LDFLAGS = @QRUPDATE_LDFLAGS@
+ QRUPDATE_LIBS = @QRUPDATE_LIBS@
+@@ -8343,9 +8343,9 @@ DLDFCN_SRC = \
+ 
+ DLDFCN_LIBS = $(DLDFCN_SRC:.cc=.la)
+ libinterp_dldfcn___delaunayn___la_SOURCES = libinterp/dldfcn/__delaunayn__.cc
+-libinterp_dldfcn___delaunayn___la_CPPFLAGS = $(libinterp_liboctinterp_la_CPPFLAGS) $(QHULL_CPPFLAGS)
+-libinterp_dldfcn___delaunayn___la_LDFLAGS = -avoid-version -module $(NO_UNDEFINED_LDFLAG) $(QHULL_LDFLAGS) $(OCT_LINK_OPTS) $(WARN_LDFLAGS)
+-libinterp_dldfcn___delaunayn___la_LIBADD = $(DLD_LIBOCTINTERP_LIBADD) $(QHULL_LIBS)
++libinterp_dldfcn___delaunayn___la_CPPFLAGS = $(libinterp_liboctinterp_la_CPPFLAGS) $(QHULL_R_CPPFLAGS)
++libinterp_dldfcn___delaunayn___la_LDFLAGS = -avoid-version -module $(NO_UNDEFINED_LDFLAG) $(QHULL_R_LDFLAGS) $(OCT_LINK_OPTS) $(WARN_LDFLAGS)
++libinterp_dldfcn___delaunayn___la_LIBADD = $(DLD_LIBOCTINTERP_LIBADD) $(QHULL_R_LIBS)
+ libinterp_dldfcn___delaunayn___la_DEPENDENCIES = $(OCT_LINK_DEPS)
+ libinterp_dldfcn___fltk_uigetfile___la_SOURCES = libinterp/dldfcn/__fltk_uigetfile__.cc
+ libinterp_dldfcn___fltk_uigetfile___la_CPPFLAGS = $(libinterp_liboctinterp_la_CPPFLAGS) $(FLTK_CPPFLAGS) $(FT2_CPPFLAGS)
+@@ -8373,9 +8373,9 @@ libinterp_dldfcn___ode15___la_LDFLAGS = -avoid-version
+ libinterp_dldfcn___ode15___la_LIBADD = $(DLD_LIBOCTINTERP_LIBADD) $(SUNDIALS_XLIBS)
+ libinterp_dldfcn___ode15___la_DEPENDENCIES = $(OCT_LINK_DEPS)
+ libinterp_dldfcn___voronoi___la_SOURCES = libinterp/dldfcn/__voronoi__.cc
+-libinterp_dldfcn___voronoi___la_CPPFLAGS = $(libinterp_liboctinterp_la_CPPFLAGS) $(QHULL_CPPFLAGS)
+-libinterp_dldfcn___voronoi___la_LDFLAGS = -avoid-version -module $(NO_UNDEFINED_LDFLAG) $(QHULL_LDFLAGS) $(OCT_LINK_OPTS) $(WARN_LDFLAGS)
+-libinterp_dldfcn___voronoi___la_LIBADD = $(DLD_LIBOCTINTERP_LIBADD) $(QHULL_LIBS)
++libinterp_dldfcn___voronoi___la_CPPFLAGS = $(libinterp_liboctinterp_la_CPPFLAGS) $(QHULL_R_CPPFLAGS)
++libinterp_dldfcn___voronoi___la_LDFLAGS = -avoid-version -module $(NO_UNDEFINED_LDFLAG) $(QHULL_R_LDFLAGS) $(OCT_LINK_OPTS) $(WARN_LDFLAGS)
++libinterp_dldfcn___voronoi___la_LIBADD = $(DLD_LIBOCTINTERP_LIBADD) $(QHULL_R_LIBS)
+ libinterp_dldfcn___voronoi___la_DEPENDENCIES = $(OCT_LINK_DEPS)
+ libinterp_dldfcn_audiodevinfo_la_SOURCES = libinterp/dldfcn/audiodevinfo.cc
+ libinterp_dldfcn_audiodevinfo_la_CPPFLAGS = $(libinterp_liboctinterp_la_CPPFLAGS) $(PORTAUDIO_CPPFLAGS)
+@@ -8388,9 +8388,9 @@ libinterp_dldfcn_audioread_la_LDFLAGS = -avoid-version
+ libinterp_dldfcn_audioread_la_LIBADD = $(DLD_LIBOCTINTERP_LIBADD) $(SNDFILE_LIBS)
+ libinterp_dldfcn_audioread_la_DEPENDENCIES = $(OCT_LINK_DEPS)
+ libinterp_dldfcn_convhulln_la_SOURCES = libinterp/dldfcn/convhulln.cc
+-libinterp_dldfcn_convhulln_la_CPPFLAGS = $(libinterp_liboctinterp_la_CPPFLAGS) $(QHULL_CPPFLAGS)
+-libinterp_dldfcn_convhulln_la_LDFLAGS = -avoid-version -module $(NO_UNDEFINED_LDFLAG) $(QHULL_LDFLAGS) $(OCT_LINK_OPTS) $(WARN_LDFLAGS)
+-libinterp_dldfcn_convhulln_la_LIBADD = $(DLD_LIBOCTINTERP_LIBADD) $(QHULL_LIBS)
++libinterp_dldfcn_convhulln_la_CPPFLAGS = $(libinterp_liboctinterp_la_CPPFLAGS) $(QHULL_R_CPPFLAGS)
++libinterp_dldfcn_convhulln_la_LDFLAGS = -avoid-version -module $(NO_UNDEFINED_LDFLAG) $(QHULL_R_LDFLAGS) $(OCT_LINK_OPTS) $(WARN_LDFLAGS)
++libinterp_dldfcn_convhulln_la_LIBADD = $(DLD_LIBOCTINTERP_LIBADD) $(QHULL_R_LIBS)
+ libinterp_dldfcn_convhulln_la_DEPENDENCIES = $(OCT_LINK_DEPS)
+ libinterp_dldfcn_fftw_la_SOURCES = libinterp/dldfcn/fftw.cc
+ libinterp_dldfcn_fftw_la_CPPFLAGS = $(libinterp_liboctinterp_la_CPPFLAGS) $(FFTW_XCPPFLAGS)
diff --git a/math/octave/files/patch-config.in.h b/math/octave/files/patch-config.in.h
new file mode 100644
index 000000000000..0ed488054fff
--- /dev/null
+++ b/math/octave/files/patch-config.in.h
@@ -0,0 +1,43 @@
+--- config.in.h.orig	2021-10-30 14:20:24 UTC
++++ config.in.h
+@@ -1153,11 +1153,11 @@
+ /* Define to 1 if you have the `m' library (-lm). */
+ #undef HAVE_LIBM
+ 
+-/* Define to 1 if you have the <libqhull.h> header file. */
+-#undef HAVE_LIBQHULL_H
++/* Define to 1 if you have the <libqhull_r.h> header file. */
++#undef HAVE_LIBQHULL_R_H
+ 
+-/* Define to 1 if you have the <libqhull/libqhull.h> header file. */
+-#undef HAVE_LIBQHULL_LIBQHULL_H
++/* Define to 1 if you have the <libqhull_r/libqhull_r.h> header file. */
++#undef HAVE_LIBQHULL_R_LIBQHULL_R_H
+ 
+ /* Define to 1 if you have the `sun' library (-lsun). */
+ #undef HAVE_LIBSUN
+@@ -1493,15 +1493,6 @@
+ /* Define to 1 if Qhull is available. */
+ #undef HAVE_QHULL
+ 
+-/* Define to 1 if you have the <qhull.h> header file. */
+-#undef HAVE_QHULL_H
+-
+-/* Define to 1 if you have the <qhull/libqhull.h> header file. */
+-#undef HAVE_QHULL_LIBQHULL_H
+-
+-/* Define to 1 if you have the <qhull/qhull.h> header file. */
+-#undef HAVE_QHULL_QHULL_H
+-
+ /* Define to 1 if you have the `qInstallMessageHandler' function. */
+ #undef HAVE_QINSTALLMESSAGEHANDLER
+ 
+@@ -2252,7 +2243,7 @@
+ #undef NEED_MKTIME_WORKING
+ 
+ /* Define to 1 if the Qhull library needs a qh_version variable defined. */
+-#undef NEED_QHULL_VERSION
++#undef NEED_QHULL_R_VERSION
+ 
+ /* Define to 1 to enable general improvements of setlocale. */
+ #undef NEED_SETLOCALE_IMPROVED
diff --git a/math/octave/files/patch-configure b/math/octave/files/patch-configure
index c5a23986e06d..b3db17ca0c94 100644
--- a/math/octave/files/patch-configure
+++ b/math/octave/files/patch-configure
@@ -1,16 +1,438 @@
---- configure.orig	2020-11-26 18:20:44 UTC
+--- configure.orig	2022-01-16 10:49:42 UTC
 +++ configure
-@@ -83764,6 +83764,13 @@ $as_echo_n "checking for include file <jni.h>... " >&6
-         JAVA_CPPFLAGS="-I${JAVA_HOME}/include -I${JAVA_HOME}/include/darwin"
-       fi
+@@ -851,9 +851,9 @@ TERM_LIBS
+ PCRE_LIBS
+ PCRE_LDFLAGS
+ PCRE_CPPFLAGS
+-QHULL_LIBS
+-QHULL_LDFLAGS
+-QHULL_CPPFLAGS
++QHULL_R_LIBS
++QHULL_R_LDFLAGS
++QHULL_R_CPPFLAGS
+ gltests_WITNESS
+ REPLACE_TOWLOWER
+ REPLACE_ISWCNTRL
+@@ -2452,9 +2452,9 @@ with_linux_crypto
+ with_openssl
+ enable_rpath
+ with_libiconv_prefix
+-with_qhull_includedir
+-with_qhull_libdir
+-with_qhull
++with_qhull_r_includedir
++with_qhull_r_libdir
++with_qhull_r
+ with_pcre_includedir
+ with_pcre_libdir
+ with_pcre
+@@ -3318,10 +3318,10 @@ Optional Packages:
+   --with-gnu-ld           assume the C compiler uses GNU ld [default=no]
+   --with-libiconv-prefix[=DIR]  search for libiconv in DIR/include and DIR/lib
+   --without-libiconv-prefix     don't search for libiconv in includedir and libdir
+-  --with-qhull-includedir=DIR
++  --with-qhull_r-includedir=DIR
+                           look for QHull include files in DIR
+-  --with-qhull-libdir=DIR look for QHull libraries in DIR
+-  --without-qhull         don't use QHull library
++  --with-qhull_r-libdir=DIR look for QHull libraries in DIR
++  --without-qhull_r         don't use QHull library
+   --with-pcre-includedir=DIR
+                           look for PCRE include files in DIR
+   --with-pcre-libdir=DIR  look for PCRE libraries in DIR
+@@ -70844,79 +70844,79 @@ _ACEOF
+ 
+ 
+ 
+-# Check whether --with-qhull-includedir was given.
+-if test "${with_qhull_includedir+set}" = set; then :
+-  withval=$with_qhull_includedir; QHULL_CPPFLAGS="-I$withval"
++# Check whether --with-qhull_r-includedir was given.
++if test "${with_qhull_r_includedir+set}" = set; then :
++  withval=$with_qhull_r_includedir; QHULL_R_CPPFLAGS="-I$withval"
+ fi
+ 
+ 
+ 
+ 
+-# Check whether --with-qhull-libdir was given.
+-if test "${with_qhull_libdir+set}" = set; then :
+-  withval=$with_qhull_libdir; QHULL_LDFLAGS="-L$withval"
++# Check whether --with-qhull_r-libdir was given.
++if test "${with_qhull_r_libdir+set}" = set; then :
++  withval=$with_qhull_r_libdir; QHULL_R_LDFLAGS="-L$withval"
+ fi
+ 
+ 
+ 
+ 
+-# Check whether --with-qhull was given.
+-if test "${with_qhull+set}" = set; then :
+-  withval=$with_qhull; with_qhull=$withval
++# Check whether --with-qhull_r was given.
++if test "${with_qhull_r+set}" = set; then :
++  withval=$with_qhull_r; with_qhull_r=$withval
+ else
+-  with_qhull=yes
++  with_qhull_r=yes
+ fi
+ 
+ 
+-  ac_octave_qhull_pkg_check=no
+-  QHULL_LIBS=
+-  warn_qhull="Qhull library not found.  This will result in loss of functionality for some geometry functions."
+-  case $with_qhull in
++  ac_octave_qhull_r_pkg_check=no
++  QHULL_R_LIBS=
++  warn_qhull_r="Qhull library not found.  This will result in loss of functionality for some geometry functions."
++  case $with_qhull_r in
+     no)
+-      warn_qhull="--without-qhull specified.  Functions or features that depend on QHull will be disabled."
+-         QHULL_LIBS=
++      warn_qhull_r="--without-qhull_r specified.  Functions or features that depend on QHull will be disabled."
++         QHULL_R_LIBS=
+     ;;
+     yes | "")
+-      ac_octave_qhull_pkg_check=yes
+-      QHULL_LIBS="-lqhull"
++      ac_octave_qhull_r_pkg_check=yes
++      QHULL_R_LIBS="-lqhull_r"
+     ;;
+     -* | */* | *.a | *.so | *.so.* | *.o)
+-      QHULL_LIBS="$with_qhull"
++      QHULL_R_LIBS="$with_qhull_r"
      ;;
-+    freebsd*)
-+      if test -n "$JAVA_CPPFLAGS"; then
-+        JAVA_CPPFLAGS="-I${JAVA_CPPFLAGS} -I${JAVA_CPPFLAGS}/freebsd"
-+      else
-+        JAVA_CPPFLAGS="-I${JAVA_HOME}/include -I${JAVA_HOME}/include/freebsd"
-+      fi
-+    ;;
      *)
-       if test -n "$JAVA_CPPFLAGS"; then
-         JAVA_CPPFLAGS="-I${JAVA_CPPFLAGS} -I${JAVA_CPPFLAGS}/linux"
+-      QHULL_LIBS="-l$with_qhull"
++      QHULL_R_LIBS="-l$with_qhull_r"
+     ;;
+   esac
+ 
+-  if test $ac_octave_qhull_pkg_check = yes; then
++  if test $ac_octave_qhull_r_pkg_check = yes; then
+     if test -n "$PKG_CONFIG" && \
+-    { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"qhull\""; } >&5
+-  ($PKG_CONFIG --exists --print-errors "qhull") 2>&5
++    { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"qhull_r\""; } >&5
++  ($PKG_CONFIG --exists --print-errors "qhull_r") 2>&5
+   ac_status=$?
+   $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+   test $ac_status = 0; }; then
+ 
+-      if test -z "$QHULL_CPPFLAGS"; then
+-        QHULL_CPPFLAGS="$($PKG_CONFIG --cflags-only-I qhull | $SED -e 's/^ *$//')"
++      if test -z "$QHULL_R_CPPFLAGS"; then
++        QHULL_R_CPPFLAGS="$($PKG_CONFIG --cflags-only-I qhull_r | $SED -e 's/^ *$//')"
+       fi
+-      if test -z "$QHULL_LDFLAGS"; then
+-        QHULL_LDFLAGS="$($PKG_CONFIG --libs-only-L qhull | $SED -e 's/^ *$//')"
++      if test -z "$QHULL_R_LDFLAGS"; then
++        QHULL_R_LDFLAGS="$($PKG_CONFIG --libs-only-L qhull_r | $SED -e 's/^ *$//')"
+       fi
+-      QHULL_LIBS="$($PKG_CONFIG --libs-only-l qhull | $SED -e 's/^ *$//')"
++      QHULL_R_LIBS="$($PKG_CONFIG --libs-only-l qhull_r | $SED -e 's/^ *$//')"
+ 
+ fi
+   fi
+ 
+-  if test -n "$QHULL_LIBS"; then
++  if test -n "$QHULL_R_LIBS"; then
+     ac_octave_save_CPPFLAGS="$CPPFLAGS"
+     ac_octave_save_LDFLAGS="$LDFLAGS"
+     ac_octave_save_LIBS="$LIBS"
+-    CPPFLAGS="$QHULL_CPPFLAGS $CPPFLAGS"
+-    LDFLAGS="$QHULL_LDFLAGS $LDFLAGS"
+-    LIBS="$QHULL_LIBS $LIBS"
++    CPPFLAGS="$QHULL_R_CPPFLAGS $CPPFLAGS"
++    LDFLAGS="$QHULL_R_LDFLAGS $LDFLAGS"
++    LIBS="$QHULL_R_LIBS $LIBS"
+ 
+-    ac_octave_qhull_check_for_lib=no
+-    for ac_header in libqhull/libqhull.h qhull/libqhull.h libqhull.h qhull/qhull.h qhull.h
++    ac_octave_qhull_r_check_for_lib=no
++    for ac_header in libqhull_r/libqhull_r.h libqhull_r.h
+ do :
+   as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
+ ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default"
+@@ -70924,15 +70924,15 @@ if eval test \"x\$"$as_ac_Header"\" = x"yes"; then :
+   cat >>confdefs.h <<_ACEOF
+ #define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1
+ _ACEOF
+- ac_octave_qhull_check_for_lib=yes; break
++ ac_octave_qhull_r_check_for_lib=yes; break
+ fi
+ 
+ done
+ 
+-    if test $ac_octave_qhull_check_for_lib = yes; then
+-      { $as_echo "$as_me:${as_lineno-$LINENO}: checking for qh_qhull in $QHULL_LIBS" >&5
+-$as_echo_n "checking for qh_qhull in $QHULL_LIBS... " >&6; }
+-if ${octave_cv_lib_qhull+:} false; then :
++    if test $ac_octave_qhull_r_check_for_lib = yes; then
++      { $as_echo "$as_me:${as_lineno-$LINENO}: checking for qh_qhull in $QHULL_R_LIBS" >&5
++$as_echo_n "checking for qh_qhull in $QHULL_R_LIBS... " >&6; }
++if ${octave_cv_lib_qhull_r+:} false; then :
+   $as_echo_n "(cached) " >&6
+ else
+   cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+@@ -70962,54 +70962,40 @@ return qh_qhull ();
+ }
+ _ACEOF
+ if ac_fn_c_try_link "$LINENO"; then :
+-  octave_cv_lib_qhull=yes
++  octave_cv_lib_qhull_r=yes
+ else
+-  octave_cv_lib_qhull=no
++  octave_cv_lib_qhull_r=no
+ fi
+ rm -f core conftest.err conftest.$ac_objext \
+     conftest$ac_exeext conftest.$ac_ext
+ 
+ fi
+-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $octave_cv_lib_qhull" >&5
+-$as_echo "$octave_cv_lib_qhull" >&6; }
+-      if test "$octave_cv_lib_qhull" = yes; then
+-        warn_qhull=
++{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $octave_cv_lib_qhull_r" >&5
++$as_echo "$octave_cv_lib_qhull_r" >&6; }
++      if test "$octave_cv_lib_qhull_r" = yes; then
++        warn_qhull_r=
+ 
+-  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for qh_version in $QHULL_LIBS" >&5
+-$as_echo_n "checking for qh_version in $QHULL_LIBS... " >&6; }
+-if ${octave_cv_lib_qhull_version+:} false; then :
++  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for qh_version in $QHULL_R_LIBS" >&5
++$as_echo_n "checking for qh_version in $QHULL_R_LIBS... " >&6; }
++if ${octave_cv_lib_qhull_r_version+:} false; then :
+   $as_echo_n "(cached) " >&6
+ else
+   cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+ /* end confdefs.h.  */
+ 
+         #include <stdio.h>
+-        #if defined (HAVE_LIBQHULL_LIBQHULL_H)
+-        # include <libqhull/libqhull.h>
+-        # include <libqhull/qset.h>
+-        # include <libqhull/geom.h>
+-        # include <libqhull/poly.h>
+-        # include <libqhull/io.h>
+-        #elif defined (HAVE_QHULL_LIBQHULL_H) || defined (HAVE_QHULL_QHULL_H)
+-        # if defined (HAVE_QHULL_LIBQHULL_H)
+-        #  include <qhull/libqhull.h>
+-        # else
+-        #  include <qhull/qhull.h>
+-        # endif
+-        # include <qhull/qset.h>
+-        # include <qhull/geom.h>
+-        # include <qhull/poly.h>
+-        # include <qhull/io.h>
+-        #elif defined (HAVE_LIBQHULL_H) || defined (HAVE_QHULL_H)
+-        # if defined (HAVE_LIBQHULL_H)
+-        #  include <libqhull.h>
+-        # else
+-        #  include <qhull.h>
+-        # endif
+-        # include <qset.h>
+-        # include <geom.h>
+-        # include <poly.h>
+-        # include <io.h>
++        #if defined (HAVE_LIBQHULL_R_LIBQHULL_R_H)
++        # include <libqhull_r/libqhull_r.h>
++        # include <libqhull_r/qset_r.h>
++        # include <libqhull_r/geom_r.h>
++        # include <libqhull_r/poly_r.h>
++        # include <libqhull_r/io_r.h>
++        #elif defined (HAVE_LIBQHULL_R_H)
++        # include <libqhull_r.h>
++        # include <qset_r.h>
++        # include <geom_r.h>
++        # include <poly_r.h>
++        # include <io_r.h>
+         #endif
+ 
+ #ifdef F77_DUMMY_MAIN
+@@ -71031,63 +71017,49 @@ main ()
+ }
+ _ACEOF
+ if ac_fn_c_try_link "$LINENO"; then :
+-  octave_cv_lib_qhull_version=yes
++  octave_cv_lib_qhull_r_version=yes
+ else
+-  octave_cv_lib_qhull_version=no
++  octave_cv_lib_qhull_r_version=no
+ fi
+ rm -f core conftest.err conftest.$ac_objext \
+     conftest$ac_exeext conftest.$ac_ext
+ 
+ fi
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $octave_cv_lib_qhull_version" >&5
+-$as_echo "$octave_cv_lib_qhull_version" >&6; }
+-  if test $octave_cv_lib_qhull_version = no; then
++$as_echo "$octave_cv_lib_qhull_r_version" >&6; }
++  if test $octave_cv_lib_qhull_r_version = no; then
+ 
+-$as_echo "#define NEED_QHULL_VERSION 1" >>confdefs.h
++$as_echo "#define NEED_QHULL_R_VERSION 1" >>confdefs.h
+ 
+   fi
+ 
+ 
+-  { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the qhull library works" >&5
+-$as_echo_n "checking whether the qhull library works... " >&6; }
+-if ${octave_cv_lib_qhull_ok+:} false; then :
++  { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the qhull_r library works" >&5
++$as_echo_n "checking whether the qhull_r library works... " >&6; }
++if ${octave_cv_lib_qhull_r_ok+:} false; then :
+   $as_echo_n "(cached) " >&6
+ else
+   if test "$cross_compiling" = yes; then :
+-  octave_cv_lib_qhull_ok=yes
++  octave_cv_lib_qhull_r_ok=yes
+ else
+   cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+ /* end confdefs.h.  */
+ 
+         #include <stdio.h>
+-        #if defined (HAVE_LIBQHULL_LIBQHULL_H)
+-        # include <libqhull/libqhull.h>
+-        # include <libqhull/qset.h>
+-        # include <libqhull/geom.h>
+-        # include <libqhull/poly.h>
+-        # include <libqhull/io.h>
+-        #elif defined (HAVE_QHULL_LIBQHULL_H) || defined (HAVE_QHULL_QHULL_H)
+-        # if defined (HAVE_QHULL_LIBQHULL_H)
+-        #  include <qhull/libqhull.h>
+-        # else
+-        #  include <qhull/qhull.h>
+-        # endif
+-        # include <qhull/qset.h>
+-        # include <qhull/geom.h>
+-        # include <qhull/poly.h>
+-        # include <qhull/io.h>
+-        #elif defined (HAVE_LIBQHULL_H) || defined (HAVE_QHULL_H)
+-        # if defined (HAVE_LIBQHULL_H)
+-        #  include <libqhull.h>
+-        # else
+-        #  include <qhull.h>
+-        # endif
+-        # include <qset.h>
+-        # include <geom.h>
+-        # include <poly.h>
+-        # include <io.h>
++        #if defined (HAVE_LIBQHULL_R_LIBQHULL_R_H)
++        # include <libqhull_r/libqhull_r.h>
++        # include <libqhull_r/qset_r.h>
++        # include <libqhull_r/geom_r.h>
++        # include <libqhull_r/poly_r.h>
++        # include <libqhull_r/io_r.h>
++        #elif defined (HAVE_LIBQHULL_R_H)
++        # include <libqhull_r.h>
++        # include <qset_r.h>
++        # include <geom_r.h>
++        # include <poly_r.h>
++        # include <io_r.h>
+         #endif
+-        #if defined (NEED_QHULL_VERSION)
++        #if defined (NEED_QHULL_R_VERSION)
+           char *qh_version = "version";
+         #endif
+ 
+@@ -71107,16 +71079,18 @@ main ()
+         int 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);
++        qhT context = { 0 };
++        qhT* qh = &context;
++        return qh_new_qhull (qh, dim, n, points, ismalloc, "qhull ", 0, stderr);
+ 
+   ;
+   return 0;
+ }
+ _ACEOF
+ if ac_fn_c_try_run "$LINENO"; then :
+-  octave_cv_lib_qhull_ok=yes
++  octave_cv_lib_qhull_r_ok=yes
+ else
+-  octave_cv_lib_qhull_ok=no
++  octave_cv_lib_qhull_r_ok=no
+ fi
+ rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
+   conftest.$ac_objext conftest.beam conftest.$ac_ext
+@@ -71124,39 +71098,39 @@ fi
+ 
+ 
+ fi
+-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $octave_cv_lib_qhull_ok" >&5
+-$as_echo "$octave_cv_lib_qhull_ok" >&6; }
+-  if test $octave_cv_lib_qhull_ok = yes; then
++{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $octave_cv_lib_qhull_r_ok" >&5
++$as_echo "$octave_cv_lib_qhull_r_ok" >&6; }
++  if test $octave_cv_lib_qhull_r_ok = yes; then
+ 
+ $as_echo "#define HAVE_QHULL 1" >>confdefs.h
+ 
+     :
+   else
+-    warn_qhull="Qhull library found, but does not seem to work properly.  This will result in loss of functionality for some geometry functions.  Please try recompiling the library with -fno-strict-aliasing."
++    warn_qhull_r="Qhull library found, but does not seem to work properly.  This will result in loss of functionality for some geometry functions.  Please try recompiling the library with -fno-strict-aliasing."
+     :
+   fi
+ 
+       else
+-        QHULL_LIBS=
++        QHULL_R_LIBS=
+       fi
+     else
+-      octave_cv_lib_qhull=no
+-      QHULL_LIBS=
++      octave_cv_lib_qhull_r=no
++      QHULL_R_LIBS=
+     fi
+ 
+     CPPFLAGS="$ac_octave_save_CPPFLAGS"
+     LDFLAGS="$ac_octave_save_LDFLAGS"
+     LIBS="$ac_octave_save_LIBS"
+   else
+-    octave_cv_lib_qhull=no
++    octave_cv_lib_qhull_r=no
+   fi
+ 
+ 
+ 
+-  if test -n "$warn_qhull"; then
++  if test -n "$warn_qhull_r"; then
+ 
+-  { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $warn_qhull" >&5
+-$as_echo "$as_me: WARNING: $warn_qhull" >&2;}
++  { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $warn_qhull_r" >&5
++$as_echo "$as_me: WARNING: $warn_qhull_r" >&2;}
+ 
+ 
+   fi
+@@ -88430,9 +88404,9 @@ Octave is now configured for $canonical_host_type
+   PortAudio libraries:           $PORTAUDIO_LIBS
+   PTHREAD flags:                 $PTHREAD_CFLAGS
+   PTHREAD libraries:             $PTHREAD_LIBS
+-  QHULL CPPFLAGS:                $QHULL_CPPFLAGS
+-  QHULL LDFLAGS:                 $QHULL_LDFLAGS
+-  QHULL libraries:               $QHULL_LIBS
++  QHULL CPPFLAGS:                $QHULL_R_CPPFLAGS
++  QHULL LDFLAGS:                 $QHULL_R_LDFLAGS
++  QHULL libraries:               $QHULL_R_LIBS
+   QRUPDATE CPPFLAGS:             $QRUPDATE_CPPFLAGS
+   QRUPDATE LDFLAGS:              $QRUPDATE_LDFLAGS
+   QRUPDATE libraries:            $QRUPDATE_LIBS
+@@ -88723,9 +88697,9 @@ $as_echo "$as_me: WARNING: $warn_64_bit" >&2;}
+ $as_echo "$as_me: WARNING: $warn_bounds_check" >&2;}
+       warn_msg_printed=true
+     fi
+-    if test -n "$warn_qhull"; then
+-      { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $warn_qhull" >&5
+-$as_echo "$as_me: WARNING: $warn_qhull" >&2;}
++    if test -n "$warn_qhull_r"; then
++      { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $warn_qhull_r" >&5
++$as_echo "$as_me: WARNING: $warn_qhull_r" >&2;}
+       warn_msg_printed=true
+     fi
+     if test -n "$warn_pcre"; then
diff --git a/math/octave/files/patch-libinterp_dldfcn_____delaunayn____.cc b/math/octave/files/patch-libinterp_dldfcn_____delaunayn____.cc
new file mode 100644
index 000000000000..973f01f0de83
--- /dev/null
+++ b/math/octave/files/patch-libinterp_dldfcn_____delaunayn____.cc
@@ -0,0 +1,73 @@
+--- libinterp/dldfcn/__delaunayn__.cc.orig	2021-10-30 14:20:24 UTC
++++ libinterp/dldfcn/__delaunayn__.cc
+@@ -65,7 +65,7 @@
+ 
+ #  include "oct-qhull.h"
+ 
+-#  if defined (NEED_QHULL_VERSION)
++#  if defined (NEED_QHULL_R_VERSION)
+ char qh_version[] = "__delaunayn__.oct 2007-08-21";
+ #  endif
+ 
+@@ -76,12 +76,12 @@ close_fcn (FILE *f)
+ }
+ 
+ static void
+-free_qhull_memory ()
++free_qhull_memory (qhT *qh)
+ {
+-  qh_freeqhull (! qh_ALL);
++  qh_freeqhull (qh, ! qh_ALL);
+ 
+   int curlong, totlong;
+-  qh_memfreeshort (&curlong, &totlong);
++  qh_memfreeshort (qh, &curlong, &totlong);
+ 
+   if (curlong || totlong)
+     warning ("__delaunayn__: did not free %d bytes of long memory (%d pieces)",
+@@ -161,11 +161,8 @@ Undocumented internal function.
+       double *pt_array = p.fortran_vec ();
+       boolT ismalloc = false;
+ 
+-      // Qhull flags argument is not const char*
+-      OCTAVE_LOCAL_BUFFER (char, flags, 9 + options.length ());
++      std::string cmd = "qhull d " + options;
+ 
+-      sprintf (flags, "qhull d %s", options.c_str ());
+-
+       octave::unwind_protect frame;
+ 
+       // Replace the outfile pointer with stdout for debugging information.
+@@ -181,16 +178,19 @@ Undocumented internal function.
+ 
+       frame.add_fcn (close_fcn, outfile);
+ 
+-      int exitcode = qh_new_qhull (dim, n, pt_array,
+-                                   ismalloc, flags, outfile, errfile);
++      qhT context = { 0 };
++      qhT *qh = &context;
+ 
+-      frame.add_fcn (free_qhull_memory);
++      int exitcode = qh_new_qhull (qh, dim, n, pt_array, ismalloc, &cmd[0],
++                                   outfile, errfile);
+ 
++      octave::unwind_action free_memory ([qh] () { free_qhull_memory (qh); });
++
+       if (exitcode)
+         error ("__delaunayn__: qhull failed");
+ 
+       // triangulate non-simplicial facets
+-      qh_triangulate ();
++      qh_triangulate (qh);
+ 
+       facetT *facet;
+       vertexT *vertex, **vertexp;
+@@ -217,7 +217,7 @@ Undocumented internal function.
+ 
+               FOREACHvertex_ (facet->vertices)
+                 {
+-                  simpl(i, j++) = 1 + qh_pointid(vertex->point);
++                  simpl(i, j++) = 1 + qh_pointid(qh, vertex->point);
+                 }
+               i++;
+             }
diff --git a/math/octave/files/patch-libinterp_dldfcn_____voronoi____.cc b/math/octave/files/patch-libinterp_dldfcn_____voronoi____.cc
new file mode 100644
index 000000000000..9f811e09bc12
--- /dev/null
+++ b/math/octave/files/patch-libinterp_dldfcn_____voronoi____.cc
@@ -0,0 +1,100 @@
+--- libinterp/dldfcn/__voronoi__.cc.orig	2021-10-30 14:20:24 UTC
++++ libinterp/dldfcn/__voronoi__.cc
+@@ -60,7 +60,7 @@ qhull command
+ 
+ #  include "oct-qhull.h"
+ 
+-#  if defined (NEED_QHULL_VERSION)
++#  if defined (NEED_QHULL_R_VERSION)
+ char qh_version[] = "__voronoi__.oct 2007-07-24";
+ #  endif
+ 
+@@ -71,12 +71,12 @@ close_fcn (FILE *f)
+ }
+ 
+ static void
+-free_qhull_memory ()
++free_qhull_memory (qhT *qh)
+ {
+-  qh_freeqhull (! qh_ALL);
++  qh_freeqhull (qh, ! qh_ALL);
+ 
+   int curlong, totlong;
+-  qh_memfreeshort (&curlong, &totlong);
++  qh_memfreeshort (qh, &curlong, &totlong);
+ 
+   if (curlong || totlong)
+     warning ("__voronoi__: did not free %d bytes of long memory (%d pieces)",
+@@ -173,35 +173,32 @@ Undocumented internal function.
+ 
+   frame.add_fcn (close_fcn, outfile);
+ 
+-  // qh_new_qhull command and points arguments are not const...
++  qhT context = { 0 };
++  qhT *qh = &context;
+ 
+   std::string cmd = "qhull v" + options;
+ 
+-  OCTAVE_LOCAL_BUFFER (char, cmd_str, cmd.length () + 1);
++  int exitcode = qh_new_qhull (qh, dim, num_points, points.fortran_vec (),
++                               ismalloc, &cmd[0], outfile, errfile);
+ 
+-  strcpy (cmd_str, cmd.c_str ());
++  octave::unwind_action free_memory ([qh] () { free_qhull_memory (qh); });
+ 
+-  int exitcode = qh_new_qhull (dim, num_points, points.fortran_vec (),
+-                               ismalloc, cmd_str, outfile, errfile);
+-
+-  frame.add_fcn (free_qhull_memory);
+-
+   if (exitcode)
+     error ("%s: qhull failed", caller.c_str ());
+ 
+   // Calling findgood_all provides the number of Voronoi vertices
+-  // (sets qh num_good).
++  // (sets qh->num_good).
+ 
+-  qh_findgood_all (qh facet_list);
++  qh_findgood_all (qh, qh->facet_list);
+ 
+   octave_idx_type num_voronoi_regions
+-    = qh num_vertices - qh_setsize (qh del_vertices);
++    = qh->num_vertices - qh_setsize (qh, qh->del_vertices);
+ 
+-  octave_idx_type num_voronoi_vertices = qh num_good;
++  octave_idx_type num_voronoi_vertices = qh->num_good;
+ 
+   // Find the voronoi centers for all facets.
+ 
+-  qh_setvoronoi_all ();
++  qh_setvoronoi_all (qh);
+ 
+   facetT *facet;
+   vertexT *vertex;
+@@ -224,8 +221,8 @@ Undocumented internal function.
+ 
+   FORALLvertices
+     {
+-      if (qh hull_dim == 3)
+-        qh_order_vertexneighbors (vertex);
++      if (qh->hull_dim == 3)
++        qh_order_vertexneighbors (qh, vertex);
+ 
+       bool infinity_seen = false;
+ 
+@@ -289,12 +286,12 @@ Undocumented internal function.
+ 
+   FORALLvertices
+     {
+-      if (qh hull_dim == 3)
+-        qh_order_vertexneighbors (vertex);
++      if (qh->hull_dim == 3)
++        qh_order_vertexneighbors (qh, vertex);
+ 
+       bool infinity_seen = false;
+ 
+-      octave_idx_type idx = qh_pointid (vertex->point);
++      octave_idx_type idx = qh_pointid (qh, vertex->point);
+ 
+       octave_idx_type num_vertices = ni[k++];
+ 
diff --git a/math/octave/files/patch-libinterp_dldfcn_convhulln.cc b/math/octave/files/patch-libinterp_dldfcn_convhulln.cc
new file mode 100644
index 000000000000..4025bd7c7623
--- /dev/null
+++ b/math/octave/files/patch-libinterp_dldfcn_convhulln.cc
@@ -0,0 +1,139 @@
+--- libinterp/dldfcn/convhulln.cc.orig	2021-10-30 14:20:24 UTC
++++ libinterp/dldfcn/convhulln.cc
+@@ -53,7 +53,7 @@
+ 
+ #  include "oct-qhull.h"
+ 
+-#  if defined (NEED_QHULL_VERSION)
++#  if defined (NEED_QHULL_R_VERSION)
+ char qh_version[] = "convhulln.oct 2007-07-24";
+ #  endif
+ 
+@@ -64,12 +64,12 @@ close_fcn (FILE *f)
+ }
+ 
+ static void
+-free_qhull_memory ()
++free_qhull_memory (qhT *qh)
+ {
+-  qh_freeqhull (! qh_ALL);
++  qh_freeqhull (qh, ! qh_ALL);
+ 
+   int curlong, totlong;
+-  qh_memfreeshort (&curlong, &totlong);
++  qh_memfreeshort (qh, &curlong, &totlong);
+ 
+   if (curlong || totlong)
+     warning ("convhulln: did not free %d bytes of long memory (%d pieces)",
+@@ -188,25 +188,22 @@ convex hull is calculated.
+ 
+   frame.add_fcn (close_fcn, outfile);
+ 
+-  // qh_new_qhull command and points arguments are not const...
++  qhT context = { 0 };
++  qhT *qh = &context;
+ 
+   std::string cmd = "qhull" + options;
+ 
+-  OCTAVE_LOCAL_BUFFER (char, cmd_str, cmd.length () + 1);
++  int exitcode = qh_new_qhull (qh, dim, num_points, points.fortran_vec (),
++                               ismalloc, &cmd[0], outfile, errfile);
+ 
+-  strcpy (cmd_str, cmd.c_str ());
++  octave::unwind_action free_memory ([qh] () { free_qhull_memory (qh); });
+ 
+-  int exitcode = qh_new_qhull (dim, num_points, points.fortran_vec (),
+-                               ismalloc, cmd_str, outfile, errfile);
+-
+-  frame.add_fcn (free_qhull_memory);
+-
+   if (exitcode)
+     error ("convhulln: qhull failed");
+ 
+   bool nonsimp_seen = false;
+ 
+-  octave_idx_type nf = qh num_facets;
++  octave_idx_type nf = qh->num_facets;
+ 
+   Matrix idx (nf, dim + 1);
+ 
+@@ -218,7 +215,7 @@ convex hull is calculated.
+     {
+       octave_idx_type j = 0;
+ 
+-      if (! (nonsimp_seen || facet->simplicial || qh hull_dim == 2))
++      if (! (nonsimp_seen || facet->simplicial || qh->hull_dim == 2))
+         {
+           nonsimp_seen = true;
+ 
+@@ -229,14 +226,14 @@ convex hull is calculated.
+ 
+       if (dim == 3)
+         {
+-          setT *vertices = qh_facet3vertex (facet);
++          setT *vertices = qh_facet3vertex (qh, facet);
+ 
+           vertexT *vertex, **vertexp;
+ 
+           FOREACHvertex_ (vertices)
+-            idx(i, j++) = 1 + qh_pointid(vertex->point);
++            idx(i, j++) = 1 + qh_pointid(qh, vertex->point);
+ 
+-          qh_settempfree (&vertices);
++          qh_settempfree (qh, &vertices);
+         }
+       else
+         {
+@@ -245,14 +242,14 @@ convex hull is calculated.
+               vertexT *vertex, **vertexp;
+ 
+               FOREACHvertex_ (facet->vertices)
+-                idx(i, j++) = 1 + qh_pointid(vertex->point);
++                idx(i, j++) = 1 + qh_pointid(qh, vertex->point);
+             }
+           else
+             {
+               vertexT *vertex, **vertexp;
+ 
+               FOREACHvertexreverse12_ (facet->vertices)
+-                idx(i, j++) = 1 + qh_pointid(vertex->point);
++                idx(i, j++) = 1 + qh_pointid(qh, vertex->point);
+             }
+         }
+       if (j < dim)
+@@ -280,26 +277,26 @@ convex hull is calculated.
+           if (! facet->normal)
+             continue;
+ 
+-          if (facet->upperdelaunay && qh ATinfinity)
++          if (facet->upperdelaunay && qh->ATinfinity)
+             continue;
+ 
+-          facet->f.area = area = qh_facetarea (facet);
++          facet->f.area = area = qh_facetarea (qh, facet);
+           facet->isarea = True;
+ 
+-          if (qh DELAUNAY)
++          if (qh->DELAUNAY)
+             {
+-              if (facet->upperdelaunay == qh UPPERdelaunay)
+-                qh totarea += area;
++              if (facet->upperdelaunay == qh->UPPERdelaunay)
++                qh->totarea += area;
+             }
+           else
+             {
+-              qh totarea += area;
+-              qh_distplane (qh interior_point, facet, &dist);
+-              qh totvol += -dist * area/ qh hull_dim;
++              qh->totarea += area;
++              qh_distplane (qh, qh->interior_point, facet, &dist);
++              qh->totvol += -dist * area / qh->hull_dim;
+             }
+         }
+ 
+-      retval(1) = octave_value (qh totvol);
++      retval(1) = octave_value (qh->totvol);
+     }
+ 
+   retval(0) = idx;
diff --git a/math/octave/files/patch-libinterp_dldfcn_oct-qhull.h b/math/octave/files/patch-libinterp_dldfcn_oct-qhull.h
new file mode 100644
index 000000000000..22338c7298a5
--- /dev/null
+++ b/math/octave/files/patch-libinterp_dldfcn_oct-qhull.h
@@ -0,0 +1,47 @@
+--- libinterp/dldfcn/oct-qhull.h.orig	2021-10-30 14:20:24 UTC
++++ libinterp/dldfcn/oct-qhull.h
+@@ -32,32 +32,18 @@
+ 
+ extern "C" {
*** 55 LINES SKIPPED ***