[PATCH] Fix PCRE detection on OSX.

Matthieu Tourne matthieu.tourne at gmail.com
Fri Dec 7 23:01:04 UTC 2012


On Fri, Dec 7, 2012 at 2:21 PM, Ruslan Ermilov <ru at nginx.com> wrote:

> On Fri, Dec 07, 2012 at 12:24:49PM -0800, Piotr Sikora wrote:
> > Fix PCRE detection on OSX.
> >
> > OSX ships with PCRE library in /usr, but without headers for it.
> >
> > OSX default search paths includes both /usr and /usr/local, which
> > results in library (from /usr) and headers (from /usr/include)
> > mismatch when PCRE is installed via Homebrew and we try to compile
> > nginx without "-L/usr/local" parameter.
> >
> > The solution is to skip the detection using default search paths
> > on OSX and let ./configure script detect PCRE installed in /usr/local
> > or other common prefixes.
>
> OS X is known to be broken in that respect.  That's why MacPorts
> installs stuff into /opt/local by default, instead of /usr/local.
>
> https://trac.macports.org/wiki/FAQ#defaultprefix
> https://trac.macports.org/wiki/FAQ#usrlocal
>
> But why should nginx care to "fix" this?


They don't, but there is already an exception line in the auto/conf for #
Macports, and adding a bit more just makes it easier for people using the
other concurrent (and newer) system of packages on Mac OS: Homebrew.

Actually it's worse than that.
When using homebrew the included pcre.h looks like it will support
PCRE_JIT, but the library used for the link doesn't export those symbols.
It results in a bad linking error, which might throw off some users that
have no idea why this is happening ..

I don't really have a way to fix Mac OS, or homebrew. But we can help
making sure Nginx will compile everywhere.

An alternative is to specifically look for PCRE_JIT functions, and test if
the linking will work (see example below), and either throw off an error at
./configure time, or add some exceptions.
And I believe this stays in the style of Nginx to handle "exotic" systems.

Regards,
Matthieu.



Config example for PCRE_JIT detection :

# Check version of PCRE to turn on PCRE_JIT

ngx_feature="PCRE_JIT capable PCRE library"
ngx_feature_name="NGX_PCRE"
ngx_feature_run=no
ngx_feature_incs="#include <pcre.h>"
ngx_feature_path=
ngx_feature_libs="-lpcre"
ngx_feature_test="
/* PCRE_JIT starts after 8.21 */
#if (PCRE_MAJOR > 8) || (PCRE_MAJOR == 8 && PCRE_MINOR >= 21)
    printf(\"%p\", pcre_free_study);
#endif
"
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.nginx.org/pipermail/nginx-devel/attachments/20121207/5aed8ad8/attachment.html>


More information about the nginx-devel mailing list