[master] 791706d Disable the PCRE JIT compiler by default
    Tollef Fog Heen 
    tfheen at varnish-cache.org
       
    Tue Sep  4 08:18:08 CEST 2012
    
    
  
commit 791706d8e535fe1573a6ea5cd515113ddacbac52
Author: Tollef Fog Heen <tfheen at varnish-software.com>
Date:   Tue Sep 4 08:16:50 2012 +0200
    Disable the PCRE JIT compiler by default
    
    The JIT compiler is broken on some versions of PCRE, at least on i386,
    so disable it by default.  It can be enabled using --enable-pcre-jit
    to configure.
    
    Fixes #1191
diff --git a/configure.ac b/configure.ac
index e831b31..87fdaf6 100644
--- a/configure.ac
+++ b/configure.ac
@@ -531,6 +531,17 @@ fi
 
 AC_DEFINE_UNQUOTED([VCC_CC],"$VCC_CC",[C compiler command line for VCL code])
 
+# --enable-pcre-jit
+AC_ARG_ENABLE(pcre-jit,
+    AS_HELP_STRING([--enable-pcre-jit],
+	[use the PCRE JIT compiler (default is NO)]),
+    ,
+    [enable_pcre_jit=no])
+
+if test "$enable_pcre_jit" = yes; then
+   AC_DEFINE([USE_PCRE_JIT],[1],[use the PCRE JIT compiler])
+fi
+
 # Stupid automake needs this
 VTC_TESTS="$(cd $srcdir/bin/varnishtest && echo tests/*.vtc)"
 AC_SUBST(VTC_TESTS)
diff --git a/lib/libvarnish/vre.c b/lib/libvarnish/vre.c
index 2fce5c7..c7eccfa 100644
--- a/lib/libvarnish/vre.c
+++ b/lib/libvarnish/vre.c
@@ -37,8 +37,10 @@
 
 #include "vre.h"
 
-#ifndef PCRE_STUDY_JIT_COMPILE
-#define PCRE_STUDY_JIT_COMPILE 0
+#if USE_PCRE_JIT
+#define VRE_STUDY_JIT_COMPILE PCRE_STUDY_JIT_COMPILE
+#else
+#define VRE_STUDY_JIT_COMPILE 0
 #endif
 
 #if PCRE_MAJOR < 8 || (PCRE_MAJOR == 8 && PCRE_MINOR < 20)
@@ -78,7 +80,7 @@ VRE_compile(const char *pattern, int options,
 		VRE_free(&v);
 		return (NULL);
 	}
-	v->re_extra = pcre_study(v->re, PCRE_STUDY_JIT_COMPILE, errptr);
+	v->re_extra = pcre_study(v->re, VRE_STUDY_JIT_COMPILE, errptr);
 	if (*errptr != NULL) {
 		VRE_free(&v);
 		return (NULL);
    
    
More information about the varnish-commit
mailing list