comparison m4/acinclude.m4 @ 32049:1c99c8f020f7

gui: Show encodings available with iconv in file editor preferences. * liboctave/wrappers/iconv-wrappers.h, liboctave/wrappers/iconv-wrappers.c (octave_iconvlist_wrapper, octave_iconv_canonicalize_wrapper): Add wrappers for libiconv functions. * liboctave/util/oct-string.h, liboctave/util/oct-string.cc (octave::string::get_encoding_list): Add new function that returns an ordered list of canonicalized encoding names that are available from libiconv. Use list of encoding identifiers as fallback on platforms without the required funcions. * libgui/src/gui-settings.cc, libgui/src/gui-settings.h (octave::gui_settings::get_codecs): Remove function. (octave::gui_settings::combo_encoding): Show list of encoding names that are actually available to the interpreter instead of a list of encodings available in Qt. * libgui/src/qt-interpreter-events.cc (octave::qt_interpreter_events::gui_preference_adjust): Remove logic for mapping between Qt encoding names and iconv encoding names. * libgui/src/settings-dialog.cc: Remove unused header. * m4/acinclude.m4 (OCTAVE_CHECK_ICONVLIST, OCTAVE_CHECK_ICONV_CANONICALIZE): Add checks for functions from libiconv that are not available on all platforms. * configure.ac: Call new functions.
author Markus Mützel <markus.muetzel@gmx.de>
date Sat, 22 Apr 2023 19:01:35 +0200
parents 4d15e1304a48
children 17a09d2bbe0f
comparison
equal deleted inserted replaced
32048:61db3c9377fb 32049:1c99c8f020f7
1254 $2 1254 $2
1255 : 1255 :
1256 fi 1256 fi
1257 ]) 1257 ])
1258 dnl 1258 dnl
1259 dnl Check whether iconv provides the function iconvlist.
1260 dnl
1261 AC_DEFUN([OCTAVE_CHECK_ICONVLIST], [
1262 AC_CACHE_CHECK([whether the function iconvlist is available],
1263 [octave_cv_iconvlist],
1264 [ac_octave_save_LIBS="$LIBS"
1265 LIBS="$LIBICONV $LIBS"
1266 AC_LANG_PUSH(C++)
1267 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
1268 #if HAVE_ICONV
1269 extern "C"
1270 {
1271 # include <iconv.h>
1272 }
1273 #endif
1274 ]], [[
1275 iconvlist (
1276 [] (unsigned int, const char * const *, void *) -> int
1277 {
1278 return 0;
1279 },
1280 nullptr);
1281 ]])],
1282 octave_cv_iconvlist=yes,
1283 octave_cv_iconvlist=no)
1284 AC_LANG_POP(C++)
1285 LIBS="$ac_octave_save_LIBS"
1286 ])
1287 if test $octave_cv_iconvlist = yes; then
1288 AC_DEFINE(HAVE_ICONVLIST, 1, [Define to 1 if iconvlist is available.])
1289 fi
1290 ])
1291 dnl
1292 dnl Check whether iconv provides the function iconv_canonicalize.
1293 dnl
1294 AC_DEFUN([OCTAVE_CHECK_ICONV_CANONICALIZE], [
1295 AC_CACHE_CHECK([whether the function iconv_canonicalize is available],
1296 [octave_cv_iconv_canonicalize],
1297 [ac_octave_save_LIBS="$LIBS"
1298 LIBS="$LIBICONV $LIBS"
1299 AC_LANG_PUSH(C++)
1300 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
1301 #if HAVE_ICONV
1302 extern "C"
1303 {
1304 # include <iconv.h>
1305 }
1306 #endif
1307 ]], [[
1308 iconv_canonicalize ("UTF-8");
1309 ]])],
1310 octave_cv_iconv_canonicalize=yes,
1311 octave_cv_iconv_canonicalize=no)
1312 AC_LANG_POP(C++)
1313 LIBS="$ac_octave_save_LIBS"
1314 ])
1315 if test $octave_cv_iconv_canonicalize = yes; then
1316 AC_DEFINE(HAVE_ICONV_CANONICALIZE, 1,
1317 [Define to 1 if iconv_canonicalize is available.])
1318 fi
1319 ])
1320 dnl
1259 dnl Check whether using HDF5 DLL under Windows. This is done by 1321 dnl Check whether using HDF5 DLL under Windows. This is done by
1260 dnl testing for a data symbol in the HDF5 library, which would 1322 dnl testing for a data symbol in the HDF5 library, which would
1261 dnl require the definition of _HDF5USEDL_ under MSVC compiler. 1323 dnl require the definition of _HDF5USEDL_ under MSVC compiler.
1262 dnl 1324 dnl
1263 AC_DEFUN([OCTAVE_CHECK_LIB_HDF5_DLL], [ 1325 AC_DEFUN([OCTAVE_CHECK_LIB_HDF5_DLL], [