Mercurial > octave
changeset 27543:d7b18d44ae4e
Check if PCRE was compiled with --enable-utf (bug #35910).
* acinclude.m4 (OCTAVE_CHECK_LIB_PCRE_OK): Add macro to check whether PCRE was
compiled with --enable-utf.
* configure.ac: Require that the new test passes.
author | Markus Mützel <markus.muetzel@gmx.de> |
---|---|
date | Thu, 17 Oct 2019 22:01:28 +0200 |
parents | b8aa62c1deb5 |
children | ca4ab81a5601 |
files | configure.ac m4/acinclude.m4 |
diffstat | 2 files changed, 38 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/configure.ac Tue Oct 22 13:38:02 2019 -0400 +++ b/configure.ac Thu Oct 17 22:01:28 2019 +0200 @@ -1316,7 +1316,10 @@ ### Check for PCRE regex library. OCTAVE_CHECK_LIB(pcre, PCRE, - [], [pcre.h pcre/pcre.h], [pcre_compile], [], [], [], + [], [pcre.h pcre/pcre.h], [pcre_compile], [], [], + [OCTAVE_CHECK_LIB_PCRE_OK([], + [AC_MSG_ERROR([PCRE library must be built with UTF support (--enable-utf)])]) + ], [libpcre], [REQUIRED]) ### Check for readline library.
--- a/m4/acinclude.m4 Tue Oct 22 13:38:02 2019 -0400 +++ b/m4/acinclude.m4 Thu Oct 17 22:01:28 2019 +0200 @@ -1456,6 +1456,40 @@ fi ]) dnl +dnl Check whether PCRE is compiled with --enable-utf. +dnl +AC_DEFUN([OCTAVE_CHECK_LIB_PCRE_OK], [ + AC_CACHE_CHECK([whether PCRE library was compiled with UTF support], + [octave_cv_lib_pcre_ok], + [AC_LANG_PUSH(C++) + AC_RUN_IFELSE([AC_LANG_PROGRAM([[ + #include <stdio.h> + #if defined (HAVE_PCRE_H) + # include <pcre.h> + #elif defined (HAVE_PCRE_PCRE_H) + # include <pcre/pcre.h> + #endif + ]], [[ + const char *pattern = "test"; + const char *err; + int erroffset; + pcre *data = pcre_compile (pattern, PCRE_UTF8, &err, &erroffset, nullptr); + return (! data); + ]])], + octave_cv_lib_pcre_ok=yes, + octave_cv_lib_pcre_ok=no, + octave_cv_lib_pcre_ok=yes) + AC_LANG_POP(C++) + ]) + if test $octave_cv_lib_pcre_ok = yes; then + $1 + : + else + $2 + : + fi +]) +dnl dnl Check whether sndfile library is modern enough to include things like Ogg dnl AC_DEFUN([OCTAVE_CHECK_LIB_SNDFILE_OK], [