From 320c9497b3a8ab87be68bfb61747bd9d9e088cbc Mon Sep 17 00:00:00 2001 From: Elliot Saba Date: Mon, 29 Jul 2013 12:31:39 -0700 Subject: [PATCH] Add get_pcre_version() and check_pcre() to ensure that the linked libpcre version is what we want. Print out the pcre version when verbosely verioninfo()'ing Do everything with strings and floats to try to avoid actually using PCRE when checking the version number --- base/client.jl | 2 ++ base/util.jl | 17 +++++++++++++++++ 2 files changed, 19 insertions(+) diff --git a/base/client.jl b/base/client.jl index 51fb69b14f3d8..2c0645247c847 100644 --- a/base/client.jl +++ b/base/client.jl @@ -324,6 +324,8 @@ function _start() fdwatcher_reinit() # Initialize RNG Random.librandom_init() + # Check that pcre is the correct version + check_pcre() # Check that BLAS is correctly built check_blas() LinAlg.init() diff --git a/base/util.jl b/base/util.jl index f66e7a04694df..a7f1a550dea0c 100644 --- a/base/util.jl +++ b/base/util.jl @@ -256,6 +256,22 @@ function check_blas() end end +# Returns the PCRE version as a string, in an attempt to avoid using PCRE itself +function get_pcre_version() + version_string = bytestring( ccall((:pcre_version, "libpcre"), Ptr{Uint8}, () )) + return version_string[1:search( version_string, " ")[1]-1] +end + +function check_pcre() + required_version = "8.31" + linked_version = get_pcre_version() + # Check to see if it's a new enough pcre version, without actually using pcre + if float(linked_version) < float(required_version) + println("ERROR: The linked PCRE is too old! PCRE $required_version or higher is required, currently linked against $linked_version") + quit() + end +end + # system information function versioninfo(io::IO=STDOUT, verbose::Bool=false) @@ -288,6 +304,7 @@ function versioninfo(io::IO=STDOUT, verbose::Bool=false) println(io, " LAPACK: ",liblapack_name) println(io, " LIBM: ",libm_name) if verbose + println(io, " libpcre: libpcre (Version $(get_pcre_version()))") println(io, "Environment:") for (k,v) in ENV if !is(match(r"JULIA|PATH|FLAG|^TERM$|HOME",k), nothing)