This is the mail archive of the mailing list for the GCC project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: is _GNU_SOURCE defined by gcc ?

Tried also defining _GNU_SOURCE to get some of the dlsym(RTLD_NEXT,) definitions.
But that broke more things in compiling source.  Just wound up  editing the
__USE_GNU out of dlfcn.h so i can use  struct DL_info !

Levente Farkas wrote:

> Florian Weimer wrote:
> >
> > Levente Farkas <> writes:
> >
> > > the followning simple code can prodcuce non-gnu both on red hat 6.2 and
> > > 7.0 (with the default gcc) at the same time with the latest cvs gcc
> > > it's print gnu. what is the difference and how can I force gcc to
> > > define _GNU_SOURCE (-D_GNU_SOURCE seems to be a solution but I don't
> > > know whether is there any reason that it's not defined by default or not)?
> >
> > When you use the GNU C Library, you have to define _GNU_SOURCE if you
> > want to use certain extensions.  These extensions are not available on
> > some non-GNU systems; the idea is that this prevents you from
> > accidently using them and making your software less portable.
> >
> > It's even documented in the GNU C Library manual ("Feature Test
> > Macros"):
> >
> > |  - Macro: _GNU_SOURCE
> > |      If you define this macro, everything is included: ISO C89,
> > |      ISO C99, POSIX.1, POSIX.2, BSD, SVID, X/Open, LFS, and GNU
> > |      extensions.  In the cases where POSIX.1 conflicts with BSD, the
> > |      POSIX definitions take precedence.
> >
> > BTW: This hasn't much to do with GCC (the compiler itself), so
> > is not appropriate for this kind of discussion.
> this's not that simple since if I try the current gcc
> ( with the following configure
> options (and I assume there is not any sepcial in this):
> ----------------------
> configure --prefix=/tmp/gcc-20001124-root/usr/local --enable-shared
> --enable-threads --disable-checking i386-pc-linux-gnu
> ----------------------
> than it's produce a gcc/g++ which DO define _GNU_SOURCE! why ? or why
> redhat's gcc doesn't define it ??? what other macros defined by the
> default and rh's gcc ?
> what's more if redhat use their gcc (which doesn't define _GNU_SOURCE)
> to compile other packages like glibc than it can cause further problems
> eg. I can't use those "extended" features even if I define _GNU_SOURCE
> in my source (but not defined is compiled libs). am I wrong ?
>  -- Levente              
>  "The only thing worse than not knowing the truth is
>   ruining the bliss of ignorance."
> _______________________________________________
> Redhat-devel-list mailing list

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]