config/pcre: Improved support for cross-compiling

This commit changes the logic used to determine if pcre_jit_exec is
available from a run-time to a compile-time check.
pull/5356/head
Jeff Lucovsky 6 years ago committed by Victor Julien
parent ff29345527
commit 3e8db21ef3

@ -793,12 +793,14 @@ return 0;
if test "x$pcre_jit_works" = "xyes"; then if test "x$pcre_jit_works" = "xyes"; then
AC_MSG_CHECKING(for PCRE JIT EXEC support usability) AC_MSG_CHECKING(for PCRE JIT exec availability)
AC_RUN_IFELSE([AC_LANG_PROGRAM([[ AC_LINK_IFELSE(
[AC_LANG_PROGRAM(
[
#include <pcre.h> #include <pcre.h>
#include <string.h> #include <string.h>
]], ],
[[ [
const char *error; const char *error;
int err_offset; int err_offset;
pcre *re = pcre_compile("(a|b|c|d)", 0, &error, &err_offset,NULL); pcre *re = pcre_compile("(a|b|c|d)", 0, &error, &err_offset,NULL);
@ -809,16 +811,15 @@ return 0;
if (stack == 0) if (stack == 0)
exit(EXIT_FAILURE); exit(EXIT_FAILURE);
int ret = pcre_jit_exec(re, study, "apple", 5, 0, 0, NULL, 0, stack); int ret = pcre_jit_exec(re, study, "apple", 5, 0, 0, NULL, 0, stack);
if (ret != 0) exit(ret == 0 ? EXIT_SUCCESS : EXIT_FAILURE);
exit(EXIT_FAILURE); ])],
exit(EXIT_SUCCESS); [pcre_jit_exec_available="yes" ],
]])],[ pcre_jit_exec_works=yes ],[:] [pcre_jit_exec_available="no" ])
) if test "x$pcre_jit_exec_available" != "xyes"; then
if test "x$pcre_jit_exec_works" != "xyes"; then
AC_MSG_RESULT(no) AC_MSG_RESULT(no)
else else
AC_MSG_RESULT(yes) AC_MSG_RESULT(yes)
AC_DEFINE([PCRE_HAVE_JIT_EXEC], [1], [Pcre with JIT compiler support enabled supporting pcre_jit_exec]) AC_DEFINE([PCRE_HAVE_JIT_EXEC], [1], [PCRE with JIT compiler support enabled supporting pcre_jit_exec])
fi fi
else else
AC_MSG_RESULT(no) AC_MSG_RESULT(no)

Loading…
Cancel
Save