diff m4/acinclude.m4 @ 30243:a4061ae5ff79

Use UTF-8 file API if supported by HDF5 library. * m4/acinclude.m4 (OCTAVE_CHECK_HDF5_HAS_UTF8_API): Add test to check if HDF5 library uses UTF-8 file API on Windows (version 1.12 or newer). * configure.ac (HDF5): Run new configure test. * libinterp/corefcn/ls-hdf5.cc (hdf5_fstreambase::open_create), libinterp/corefcn/load-save.cc (load_save_system::get_file_format, load_save_system::save): The kludge that was used to work with non-ASCII characters in HDF5 file names can be removed if the used version of HDF5 supports UTF-8 encoded file names.
author Markus Mützel <markus.muetzel@gmx.de>
date Tue, 19 Oct 2021 14:26:04 +0200
parents 72adc88bc674
children 8a341cf6773d
line wrap: on
line diff
--- a/m4/acinclude.m4	Sun Oct 17 12:28:51 2021 +0200
+++ b/m4/acinclude.m4	Tue Oct 19 14:26:04 2021 +0200
@@ -780,6 +780,33 @@
   fi
 ])
 dnl
+dnl Check whether HDF5 library has UTF-8 file API.
+dnl
+AC_DEFUN([OCTAVE_CHECK_HDF5_HAS_UTF8_API], [
+  AC_CACHE_CHECK([whether HDF5 library has UTF-8 file API],
+    [octave_cv_hdf5_has_utf8_api],
+    [case $host_os in
+      msdosmsvc | mingw*)
+        AC_LINK_IFELSE([AC_LANG_PROGRAM([[
+          #include <stddef.h>
+          const wchar_t *H5_get_utf16_str(const char *s);
+          ]], [[
+          H5_get_utf16_str ("");
+          ]])],
+          octave_cv_hdf5_has_utf8_api=yes,
+          octave_cv_hdf5_has_utf8_api=no)
+      ;;
+      *)
+        ## Assume yes on all other platforms
+        octave_cv_hdf5_has_utf8_api=yes
+      ;;
+     esac
+    ])
+  if test $octave_cv_hdf5_has_utf8_api = yes; then
+    AC_DEFINE(HAVE_HDF5_UTF8, 1, [Define to 1 if HDF5 has UTF-8 file API.])
+  fi
+])
+dnl
 dnl Usage:
 dnl OCTAVE_CHECK_LIB(LIBRARY, DOC-NAME, WARN-MSG, HEADER, FUNC,
 dnl                  LANG, DOC-STRING, EXTRA-CHECK, PKG-CONFIG-NAME,