[PATCH libxtrans] configure: under glibc define _GNU_SOURCE rather then _BSD_SOURCE

Hans de Goede hdegoede at redhat.com
Sat Mar 8 10:33:25 PST 2014


Hi,

On 03/08/2014 05:31 PM, Mark Kettenis wrote:
>> Date: Sat, 08 Mar 2014 17:11:42 +0100
>> From: Hans de Goede <hdegoede at redhat.com>
>>
>> Hi,
>>
>> On 03/08/2014 05:07 PM, Gaetan Nadon wrote:
>>> On 14-03-08 09:03 AM, Hans de Goede wrote:
>>>> So I've just been looking into using AC_USE_SYSTEM_EXTENSIONS but that seem pretty
>>>> useless, it only adds the relevant defines to confdefs.h, not into cflags,
>>>> and in libxtrans we want to add them to the .pc file, so we need them in a variable.
>>>>
>>>> I'm open to different suggestions, but I think my initial patch might be the best
>>>> way to fix this.
>>>>
>>> Check the pattern in other modules such as libX11. The source code includes the content of the generated config.h (see config.h.in).
>>
>> That won't work for libxtrans, as that provides .c files to be included by other
>> projects (a shared copylib if you want). So there is no config.h, since
>> that would conflict with the config.h from the code including the xtrans
>> .c files.
>>
>> Hence traditionally xtrans.pc had a -D_BSD_SOURCE in its CFLAGS, but that is
>> causing a ton of warnings when building with the latest glibc.
>
> Perhaps you should push this back to te glibc developers, pointing out
> that their change makes it hard to write portable software, pointing
> out that _BSD_SOURCE is a widely used as a way to make available
> certain BSD extensions.  If they really want to deprecate this
> functionality, perhaps they can be convinced not to emit the warning
> if both _GNU_SOURCE and _BSD_SOURCE are defined.  Then you could have
> the .pc file simply contain -D_GNU_SOURCE -D_BSD_SOURCE.

Hmm, certainly worth asking, so I've filed a bug for this:

https://bugzilla.redhat.com/show_bug.cgi?id=1074180

Regards,

Hans


More information about the xorg-devel mailing list