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