[SSSD] [PATCH] Only set _GNU_SOURCE if not already set
Stephen Gallagher
sgallagh at redhat.com
Sun May 22 21:21:23 UTC 2011
On May 22, 2011, at 12:37 PM, Jakub Hrozek <jhrozek at redhat.com> wrote:
> On 05/20/2011 09:44 AM, Sumit Bose wrote:
>> On Fri, May 20, 2011 at 09:34:06AM +0200, Jakub Hrozek wrote:
>>> On 05/19/2011 05:12 PM, Sumit Bose wrote:
>>>> Hi,
>>>>
>>>> there are a couple of places where we set _GNU_SOURCE in the source
>>>> files to enable glibc specific extensions. If by chance
>>>> '-D_GNU_SOURCE=1' is set on the gcc command line, e.g. by using the
>>>> CFLAGS from a pkg-config output (yes, there are examples :-), we get
>>>> '"_GNU_SOURCE" redefined' message during compilation. With the attached
>>>> patch _GNU_SOURCE is only defined in the sources if not already set.
>>>>
>>>> An alternative fix would be to remove all defines of _GNU_SOURCE from
>>>> the source code and add AC_USE_SYSTEM_EXTENSIONS/AC_GNU_SOURCE to
>>>> configure.ac . I'm not sure if there is a recommended way how to handle
>>>> _GNU_SOURCE and friends.
>>>>
>>>> bye,
>>>> Sumit
>>>>
>>>>
>>>
>>> This patch works fine.
>>>
>>> I think I would prefer to use something like
>>> AC_USE_SYSTEM_EXTENSIONS/AC_GNU_SOURCE simply because it would rule out
>>> the possibility of forgetting to ifdef _GNU_SOURCE.
>>>
>>> But the problem seems to be that AC_GNU_SOURCE is obsolete in newer
>>> versions of autoconf (and also throws an error on F14). At the same
>>> time, AC_USE_SYSTEM_EXTENSIONS requires autoconf>= 2.60 while RHEL5 is
>>> still on 2.59
>>>
>>
>> To solve this I have found the following:
>>
>> m4_ifdef([AC_USE_SYSTEM_EXTENSIONS],
>> [AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS])],
>> [AC_REQUIRE([AC_GNU_SOURCE])])
>>
>> Shall I prepare a patch with this in configure.ac?
>>
>
> To me this seems like a more systematic solution. So unless anyone
> objects, I vote for this little autoconf trickery.
>
I concur
More information about the sssd-devel
mailing list