[Mesa-dev] [Mesa-stable] [PATCH] configure.ac: strip _GNU_SOURCE from llvm-config output

Emil Velikov emil.l.velikov at gmail.com
Tue Sep 9 12:03:37 PDT 2014


On 06/09/14 04:10, Jonathan Gray wrote:
> On Fri, Sep 05, 2014 at 09:00:55PM +0100, Emil Velikov wrote:
>> On 05/09/14 16:44, Jonathan Gray wrote:
>>> Mesa already defines _GNU_SOURCE for glibc based systems and defining
>>> _GNU_SOURCE will break the Mesa build on other systems such as OpenBSD.
>>>
>>> _GNU_SOURCE only seems to be included in llvm-config output when
>>> LLVM is built via autoconf and not when it is built by cmake.
>>>
>> While I'm not a llvm aware person this patch makes perfect sense. We already
>> define it, and regardless if the autotools, cmake or both llvm builds define
>> this we are perfectly safe with dropping it.
>>
>> Wild suggestion - might be nice to give a shout to the llvm people about this
>> inconsistency. Who knows they may have erroneously added it in the first place :)
> 
> http://llvm.org/bugs/show_bug.cgi?id=20865
> 
>>
>> Just one small nit - please the DEFINES in the clover state-tracker to
>> AM_CPPFLAGS. This way the other two static archives will not be short of the
>> define.
> 
> I'm not sure what you're getting at here, seems some words are
> missing?  libclllvm_la_CXXFLAGS picks up DEFINES already?
> 
> Many of the GNU_SOURCE related ifdefs in Mesa would be better handled by
> something like 
> 
> #if defined(_GNU_SOURCE) && defined(__GLIBC__)
> 
> instead of the current 
> 
> #if defined(_GNU_SOURCE) && !defined(__CYGWIN__) && !defined(__FreeBSD__) && \
>    !defined(ANDROID) && !defined(__HAIKU__) && !defined(__UCLIBC__) && \
>    !defined(__NetBSD__)
> 
> which quickly turns into a !defined for every platform that doesn't
> use glibc...
> 
Rather than going through all the mesa + llvm sources hunting users of
_GNU_SOURCE I was thinking of adding $(DEFINES) (the ones that contains
_GNU_SOURCE) to libcltgsi_la_CXXFLAGS and libclover_la_CXXFLAGS.

Upon closer seem like it not needed so I'll give the patch a quick test and
push it out.

Cheers,
-Emil

>>
>> Thanks
>> Emil
>>
>>> Cc: "10.2 10.3" <mesa-stable at lists.freedesktop.org>
>>> Signed-off-by: Jonathan Gray <jsg at jsg.id.au>
>>> ---
>>>  configure.ac | 1 +
>>>  1 file changed, 1 insertion(+)
>>>
>>> diff --git a/configure.ac b/configure.ac
>>> index af950e7..0722114 100644
>>> --- a/configure.ac
>>> +++ b/configure.ac
>>> @@ -1650,6 +1650,7 @@ strip_unwanted_llvm_flags() {
>>>      # Use \> (marks the end of the word)
>>>      echo `$1` | sed \
>>>  	-e 's/-DNDEBUG\>//g' \
>>> +	-e 's/-D_GNU_SOURCE\>//g' \
>>>  	-e 's/-pedantic\>//g' \
>>>  	-e 's/-Wcovered-switch-default\>//g' \
>>>  	-e 's/-O.\>//g' \
>>>



More information about the mesa-dev mailing list