Maxim P. Dementiev commented on ZOOKEEPER-636:

Dear Patrick,

You've mentioned only one possible usage.
Please, try to think wider.

ZooKeeper C client library uses autoconf framework 
Try to run "./configure --help" on any version of C client library, it says:
"Some influential environment variables: CFLAGS - C compiler flags"
It means that the way like this:
------------- beginning -------------------
m...@localhost ~/sources/zookeeper-3.2.2/src/c $ export CFLAGS="-march=k8 -Os 
-pipe -fomit-frame-pointer"
m...@localhost ~/sources/zookeeper-3.2.2/src/c $ ./configure
checking for doxygen... /usr/bin/doxygen
------------- end -------------------
This way is perfectly legal, intentional and must influence the result of 
configure script.

Of course, nothing can prevent a developer to do the trick like this in a 
configure script:
------------- beginning -------------------
CFLAGS="-g -O0";CXXFLAGS="-g -O0"
------------- end -------------------
This is quote from zookeeper-3.2.2/src/c/configure.ac, line 57.
The end-user of "configure" command doesn't expect this behaviour, it violates 
that "configure --help" states.

More, there is no open source project in widespread usage which does this 
overriding in its configure scripts.

The value of CFLAGS environment variable is usually used in configure script 
itself, if it is present, to check some functionality.
For example, "gcc -march=XXX" can turn on atomic intrinsics 
(http://gcc.gnu.org/onlinedocs/gcc-4.4.1/gcc/Atomic-Builtins.html), "g++ 
-std=std+0x" can turn on moving methods in STL implementation, and so on.

> configure.ac has instructions which override the contents of CFLAGS and 
> ---------------------------------------------------------------------------------
>                 Key: ZOOKEEPER-636
>                 URL: https://issues.apache.org/jira/browse/ZOOKEEPER-636
>             Project: Zookeeper
>          Issue Type: Improvement
>          Components: c client
>    Affects Versions: 3.2.1
>            Reporter: Maxim P. Dementiev
>             Fix For: 3.3.0
> The information mustn't be overridden.
> The template like «CFLAGS="$CFLAGS -some-option"» should be used.

This message is automatically generated by JIRA.
You can reply to this email to add a comment to the issue online.

Reply via email to