[vlc-devel] [PATCH 2/2] contrib: mfx: don't force a level optimization even on non optimized builds
martin at martin.st
Fri Mar 30 10:36:05 CEST 2018
On Fri, 30 Mar 2018, Steve Lhomme wrote:
> Le 29/03/2018 à 22:01, Martin Storsjö a écrit :
>> On Thu, 29 Mar 2018, Steve Lhomme wrote:
>>> No other contrib need it and we use the same compiler for them.
>>> contrib/src/mfx/rules.mak | 2 +-
>>> 1 file changed, 1 insertion(+), 1 deletion(-)
>>> diff --git a/contrib/src/mfx/rules.mak b/contrib/src/mfx/rules.mak
>>> index a5b1fdaa61..f3b1287db5 100644
>>> --- a/contrib/src/mfx/rules.mak
>>> +++ b/contrib/src/mfx/rules.mak
>>> @@ -23,6 +23,6 @@ mfx: mfx-$(MFX_GITHASH).tar.xz .sum-mfx
>>> .mfx: mfx
>>> - cd $< && $(HOSTVARS) ./configure $(HOSTCONF)
>>> CXXFLAGS="$(CXXFLAGS) -std=c++98 -O2"
>>> + cd $< && $(HOSTVARS) ./configure $(HOSTCONF)
>>> CXXFLAGS="$(CXXFLAGS) -std=c++98"
>> The reason for this is, if you don't override configure's CXXFLAGS, it
>> will implicitly contain -O2. If you do override it, it will clear all
>> the defaults and you'll end up with a build with no optimization flags
>> whatsoever, and you need to manually add the -O2 that would otherwise
>> have been there.
> I think if it's placed after the env CXXFLAGS it will override whatever
> value was set before. It may depend on the compiler though.
There's no difference between if I do "./configure CXXFLAGS=-foo" or
"CXXFLAGS=-foo ./configure" or "export CXXFLAGS=-foo; ./configure", both
of them will override things that you had in $CXXFLAGS from before - this
has nothing to do with the compiler.
> In any case it's not a good idea to discard the env flags. For example
> you may lose the forced _WIN32_WINNT version and WINAPI_FAMILY when
> building on Windows.
So yes, in that aspect, it will override whatever was set before - I
wasn't aware that it was commonly used in the contribs build system to set
CFLAGS/CXXFLAGS globally. Now I see that this is done, and the default
flags there include -g -O2 as well.
In any case, this change isn't needed any longer since I fixed libmfx to
build with clang in C++11 mode and got rid of overriding the flags.
More information about the vlc-devel