--- configure.orig	2022-01-16 10:49:42 UTC
+++ configure
@@ -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"
     ;;
     *)
-      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
