muthusuba / serf

Automatically exported from code.google.com/p/serf
Apache License 2.0
0 stars 0 forks source link

SConstruct should not force -O2 #133

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
Handling of CFLAGS etc. is misdesigned. Environmental variables are ignored. 
Even when I explicitly specify CFLAGS on command line, then they are not fully 
respected:

$ scons CFLAGS="-march=native -O3"
scons: Reading SConscript files ...
scons: done reading SConscript files.
scons: Building targets ...
gcc -o context.o -c -march=native -O3 -std=c89 -Wdeclaration-after-statement 
-Wmissing-prototypes -Wall -O2 -pthread -DNDEBUG -DLINUX -D_REENTRANT 
-D_GNU_SOURCE -I. -I/usr/include/apr-1 -I/usr/include/db5.2 -I/usr/include 
context.c
gcc -o incoming.o -c -march=native -O3 -std=c89 -Wdeclaration-after-statement 
-Wmissing-prototypes -Wall -O2 -pthread -DNDEBUG -DLINUX -D_REENTRANT 
-D_GNU_SOURCE -I. -I/usr/include/apr-1 -I/usr/include/db5.2 -I/usr/include 
incoming.c
gcc -o outgoing.o -c -march=native -O3 -std=c89 -Wdeclaration-after-statement 
-Wmissing-prototypes -Wall -O2 -pthread -DNDEBUG -DLINUX -D_REENTRANT 
-D_GNU_SOURCE -I. -I/usr/include/apr-1 -I/usr/include/db5.2 -I/usr/include 
outgoing.c
gcc -o ssltunnel.o -c -march=native -O3 -std=c89 -Wdeclaration-after-statement 
-Wmissing-prototypes -Wall -O2 -pthread -DNDEBUG -DLINUX -D_REENTRANT 
-D_GNU_SOURCE -I. -I/usr/include/apr-1 -I/usr/include/db5.2 -I/usr/include 
ssltunnel.c
...

-O2 is appended and overrides flags set by user (which include -O3 in above 
example).

Original issue reported on code.google.com by Arfrever...@gmail.com on 4 Oct 2013 at 3:42

GoogleCodeExporter commented 9 years ago
Yeah, there are some flags that we explicitly add in SConstruct.

At first sight we should be able to fix this issue by using env.MergeFlags 
instead of env.Append to make scons do the right thing.

Original comment by lieven.govaerts@gmail.com on 4 Oct 2013 at 9:28