Bug in nginx 0.7.xx ./configure procedure

Igor Sysoev is at rambler-co.ru
Tue Mar 24 08:33:44 MSK 2009

On Mon, Mar 23, 2009 at 09:56:45PM +0000, Mark Alan wrote:

> mike wrote:
> >What does this do?
> >
> ># ensure that there is only one -O in CFLAGS and that it is -O2
> When we use --with-cc-opt= to specify any alternative -On C compiler 
> optimization, there seems to be a bug (or is it a designed feature?) in 
> nginx's ./configure that leads to the following line in the created 
> objs/Makefile file:
> CFLAGS =  -O -pipe  -O -W -Wall -Wpointer-arith -Wno-unused-parameter 
> -Wno-unused-function -Wunused-variable -Wunused-value -Werror -g -O2
> If I am not wrong, that line should only have one instance of -O:
> CFLAGS = -pipe -W -Wall -Wpointer-arith -Wno-unused-parameter 
> -Wno-unused-function -Wunused-variable -Wunused-value -Werror -g -O2
> Hence the usage of the command sed -i '/CFLAGS/s/ \-O //g' objs/Makefile 
> to clean the other instances of -O.
> From man cc:
> " -O2 Optimize even more.
> (...)
> As compared to -O, this option increases both compilation time and the 
> performance of the generated code."

As I understand gcc uses the lastest -O option, therefore -O -O2 is the same
as -O2. Also you may disable optimizations using -O -O0. As to -O2 itself,
I believe you would not see any significant changes in nginx with -O2
if compared with just -O. However, -O0 vs -O change is dramatically.

Igor Sysoev

More information about the nginx mailing list