[PATCH] Configure: don't test alternatives if preferred feature is found

Maxim Dounin mdounin at mdounin.ru
Tue Jun 28 13:25:36 UTC 2016


Hello!

On Tue, Jun 28, 2016 at 03:54:34PM +0300, Ruslan Ermilov wrote:

> Hi Piotr,
> 
> On Mon, Jun 27, 2016 at 07:55:17PM -0700, Piotr Sikora wrote:
> > # HG changeset patch
> > # User Piotr Sikora <piotrsikora at google.com>
> > # Date 1467064812 25200
> > #      Mon Jun 27 15:00:12 2016 -0700
> > # Node ID e4375e338d9acf927ffdc4cd18c704bb7ea1fd4e
> > # Parent  d452cb27639f714bc43b7f3ede417e3e7f8efdd6
> > Configure: don't test alternatives if preferred feature is found.
> > 
> > Signed-off-by: Piotr Sikora <piotrsikora at google.com>

[...]

> > diff -r d452cb27639f -r e4375e338d9a auto/unix
> > --- a/auto/unix
> > +++ b/auto/unix
> > @@ -184,14 +184,18 @@ ngx_feature_test="fcntl(0, F_READAHEAD, 
> >  . auto/feature
> >  
> >  
> > -ngx_feature="posix_fadvise()"
> > -ngx_feature_name="NGX_HAVE_POSIX_FADVISE"
> > -ngx_feature_run=no
> > -ngx_feature_incs="#include <fcntl.h>"
> > -ngx_feature_path=
> > -ngx_feature_libs=
> > -ngx_feature_test="posix_fadvise(0, 0, 0, POSIX_FADV_SEQUENTIAL);"
> > -. auto/feature
> > +if [ $ngx_found = no ]; then
> > +
> > +    ngx_feature="posix_fadvise()"
> > +    ngx_feature_name="NGX_HAVE_POSIX_FADVISE"
> > +    ngx_feature_run=no
> > +    ngx_feature_incs="#include <fcntl.h>"
> > +    ngx_feature_path=
> > +    ngx_feature_libs=
> > +    ngx_feature_test="posix_fadvise(0, 0, 0, POSIX_FADV_SEQUENTIAL);"
> > +    . auto/feature
> > +
> > +fi
> 
> So far I have mixed feelings about this patch, but if it gets
> accepted then the compile-time condition for ngx_read_ahead()
> in src/os/unix/ngx_files.c can be simplified to only test
> NGX_HAVE_POSIX_FADVISE.  Also, there is the currently unused
> macro NGX_HAVE_READ_AHEAD.

There was at least one attempt to introduce a code using both 
fcntl(F_READAHEAD) and posix_fadvise() depending on a 
configuration.  And I don't think this should be prevented at 
configure stage.

-- 
Maxim Dounin
http://nginx.org/



More information about the nginx-devel mailing list