[Mesa-dev] [PATCH] configure.ac: set -O0 on --enable-debug

Miklós Máté mtmkls at gmail.com
Mon Oct 16 18:31:34 UTC 2017


On 16/10/17 13:21, Emil Velikov wrote:
> Hi Miklós,
>
> On 15 October 2017 at 18:46, Miklós Máté <mtmkls at gmail.com> wrote:
>> Autoconf sets CFLAGS="-g -O2" by default.
>>
>> Signed-off-by: Miklós Máté <mtmkls at gmail.com>
>> ---
>>   configure.ac | 4 ++++
>>   1 file changed, 4 insertions(+)
>>
>> diff --git a/configure.ac b/configure.ac
>> index 62d33a1941..c833d258ed 100644
>> --- a/configure.ac
>> +++ b/configure.ac
>> @@ -522,6 +522,8 @@ if test "x$enable_debug" = xyes; then
>>           fi
>>           if ! echo "$CFLAGS" | grep -q -e '-O'; then
>>               CFLAGS="$CFLAGS -O0"
>> +        else
>> +            CFLAGS=`echo $CFLAGS | sed -e s/-O./-O0/`
>>           fi
>>       fi
>>       if test "x$GXX" = xyes; then
>> @@ -530,6 +532,8 @@ if test "x$enable_debug" = xyes; then
>>           fi
>>           if ! echo "$CXXFLAGS" | grep -q -e '-O'; then
>>               CXXFLAGS="$CXXFLAGS -O0"
>> +        else
>> +            CXXFLAGS=`echo $CXXFLAGS | sed -e s/-O./-O0/`
> Being the person who added -O0 in the first place I have to agree with others.
> I don't think this is a good idea. But let me try to explain it from
> another angle:
>
> Regardless of the build system used, a general rule should apply - the
> user has the final say.
> Namely: if the user has set a optimisation level/flags in C*FLAGS
> those must be honoured.
>
> Yes it may be a bit confusing, if the use asks for "debug" build, yet
> they explicitly set -O2/etc.
>
> HTH
> Emil

I thought the intent was to always set -O0 when called with --enable-debug.

Sorry for the misunderstanding.

MM



More information about the mesa-dev mailing list