[Mesa-dev] [PATCH] configure.ac: Save user {C, CXX}FLAGS and append them at end.

Dan Nicholson dbn.lists at gmail.com
Sat Dec 22 15:34:48 PST 2012


On Sat, Dec 22, 2012 at 10:47 AM, Johannes Obermayr
<johannesobermayr at gmx.de> wrote:
> Am Samstag, 22. Dezember 2012, 09:21:33 schrieb Matt Turner:
>> On Sat, Dec 22, 2012 at 9:16 AM, Johannes Obermayr
>> <johannesobermayr at gmx.de> wrote:
>> > This way the user has the privilege of last decision and so the option to build an optimized debug build again.
>> > ---
>>
>> You can just do CFLAGS="-g -O2" ./configure can't you?
>
> Nope.
>
> CXXFLAGS='-fmessage-length=0 -O2 -Wall -D_FORTIFY_SOURCE=2 -fstack-protector -funwind-tables -fasynchronous-unwind-tables -g' CFLAGS='-fmessage-length=0 -O2 -Wall -D_FORTIFY_SOURCE=2 -fstack-protector -funwind-tables -fasynchronous-unwind-tables -g' ./autogen.sh --host=x86_64-suse-linux-gnu --build=x86_64-suse-linux-gnu --program-prefix= --prefix=/usr --exec-prefix=/usr --bindir=/usr/bin --sbindir=/usr/sbin --sysconfdir=/etc --datadir=/usr/share --includedir=/usr/include --libdir=/usr/lib64 --libexecdir=/usr/lib --localstatedir=/var --sharedstatedir=/usr/com --mandir=/usr/share/man --infodir=/usr/share/info --disable-dependency-tracking --enable-xvmc --enable-vdpau --enable-texture-float --enable-debug --with-dri-drivers=i915,i965,nouveau,r200,radeon,swrast --with-gallium-drivers=i915,nouveau,r300,r600,svga,swrast --enable-dri --enable-glx --enable-osmesa --enable-gles1 --enable-gles2 --enable-openvg --enable-shared-glapi --enable-shared-gallium --enable-gbm --enable-xa --ena
>  ble-gallium-egl --enable-gallium-llvm --enable-gallium-gbm --enable-opencl --enable-r600-llvm-compiler --enable-gallium-g3dvl --enable-glx-tls
>
> Resulting Makefile:
> before:
> CFLAGS = -fmessage-length=0 -O2 -Wall -D_FORTIFY_SOURCE=2 -fstack-protector -funwind-tables -fasynchronous-unwind-tables -g -Wall -std=c99 -Werror=implicit-function-declaration -Werror=missing-prototypes -fno-strict-aliasing -fno-builtin-memcmp -g -O0
>
> after:
> CFLAGS =  -Wall -std=c99 -Werror=implicit-function-declaration -Werror=missing-prototypes -fno-strict-aliasing -fno-builtin-memcmp -g -O0 -fmessage-length=0 -O2 -Wall -D_FORTIFY_SOURCE=2 -fstack-protector -funwind-tables -fasynchronous-unwind-tables -g
>
> You see configure CFLAGS and initial CFLAGS are vice versa.

The real fix here is not to have configure.ac touch CFLAGS at all like
any reasonable autotools project. That was an unfortunate shortcut
during the initial work. That would be a lot more effort, though.

However, the typical convention is that the user's CFLAGS come first
(see any automake COMPILE or LTCOMPILE definition), mostly so that any
user specified -I paths take precedence. That's unfortunate when -O
options to gcc are last one wins, but that's how things have typically
been. I would make this change very cautiously.

--
Dan


More information about the mesa-dev mailing list