[Mesa-dev] [PATCH 1/2] configure: allow C{,XX}FLAGS override

Dan Nicholson dbn.lists at gmail.com
Thu Jul 14 09:25:13 PDT 2011


2011/7/14 Brian Paul <brianp at vmware.com>:
> On 07/13/2011 01:26 PM, Marcin Baczyński wrote:
>>
>> ---
>>
>>  Without this patch CFLAGS=-fstrict-aliasing ./autogen.sh ... has no
>> effect,
>>  as the flag is followed by -fno-strict-aliasing added by configure.
>>
>>  configure.ac |    8 ++++++++
>>  1 files changed, 8 insertions(+), 0 deletions(-)
>>
>> diff --git a/configure.ac b/configure.ac
>> index eace790..ef9f4b2 100644
>> --- a/configure.ac
>> +++ b/configure.ac
>> @@ -17,6 +17,10 @@ AC_INIT([Mesa],[mesa_version],
>>  AC_CONFIG_AUX_DIR([bin])
>>  AC_CANONICAL_HOST
>>
>> +dnl Save user CFLAGS and CXXFLAGS so one can override the default ones
>> +USER_CFLAGS="$CFLAGS"
>> +USER_CXXFLAGS="$CXXFLAGS"
>> +
>>  dnl Versions for external dependencies
>>  LIBDRM_REQUIRED=2.4.24
>>  LIBDRM_RADEON_REQUIRED=2.4.24
>> @@ -1906,6 +1910,10 @@ dnl Restore LDFLAGS and CPPFLAGS
>>  LDFLAGS="$_SAVE_LDFLAGS"
>>  CPPFLAGS="$_SAVE_CPPFLAGS"
>>
>> +dnl Add user CFLAGS and CXXFLAGS
>> +CFLAGS="$CFLAGS $USER_CFLAGS"
>> +CXXFLAGS="$CXXFLAGS $USER_CXXFLAGS"
>> +
>>  dnl Substitute the config
>>  AC_CONFIG_FILES([configs/autoconf])
>>
>
> Looks OK to me, but an autoconf expert should probably verify that this is
> the right fix.  Anyone???

I _think_ it's OK, but I'm not sure why it's necessary. The way CFLAGS
is constructed now it should have the user's CFLAGS prepended to the
ones we add for mesa, e.g. -std c99, -fno-strict-aliasing. It's a
little unfortunate that we don't have two separate variables: CFLAGS
under total control of the user and MESA_CFLAGS (or something) that
keeps the settings we make for mesa. But that shouldn't stop people
from doing what Marcin is trying to do at configure time.

Oh, now I see. Marcin wants his CFLAGS to follow the ones we set for
mesa so he can override them. I guess I'm not really opposed to
allowing that, but it's sort of a big hammer to overcome flags that
(at some point) were decided they were needed to build mesa.

Feel free to push it if you like.

--
Dan


More information about the mesa-dev mailing list