What do gcc options like -D_XOPEN_SOURCE=500 mean?

What do gcc options like -D_XOPEN_SOURCE=500 mean?

Post by Chung Ha-nyun » Fri, 14 Dec 2001 16:15:28



  Although this question is not proper to this group, please forgive me.
  I can't find out the right group, not mailing list, for gcc. :(

  Anyway... I should use -D_XOPEN_SOURCE=500 options when compiling
  a program that uses POSIX rwlock. It seems that -D_GNU_SOURCE do well.
  But, with D_XOPEN_SOURCE=500 option, u_long is no more defined.
  After look into /usr/include/sys/types.h I came to know that u_long
  is defined only if __USE_BSD is defined.

  Then, _XOPEN_SOURCE=500 undefine, or doesn't define, __USE_BSD?
  If so, what does this option mean?

  And, when I use -D_GNU_SOURCE u_long is defined. What's the difference
  between _GNU_SOURCE and _XOPEN_SOURCE=500?

--

  SayClub <http://www.sayclub.com>
  NeoWiz <http://www.neowiz.com>

 
 
 

What do gcc options like -D_XOPEN_SOURCE=500 mean?

Post by bowma » Sat, 15 Dec 2001 00:19:28



> And,?when?I?use?-D_GNU_SOURCE?u_long?is?defined.?What's?the?difference
> between?_GNU_SOURCE?and?_XOPEN_SOURCE=500?

You would have to look through the source for a specific answer. You will
probably see something like

#ifdef _GNU_SOURCE
#   include <sys/types.h>
#else
#   include <some_other_header.h>
#endif

Usually it will be more complex. Further, headers that are included based
on a defined flag may define other things like __USE_BSD.

All this allows for great flexibility by setting various flags on the
command line, but can also result in many headaches as incompatible headers
redefine or undefine stuff.

 
 
 

What do gcc options like -D_XOPEN_SOURCE=500 mean?

Post by Philip Armstro » Sat, 15 Dec 2001 03:25:36



Quote:>  And, when I use -D_GNU_SOURCE u_long is defined. What's the difference
>  between _GNU_SOURCE and _XOPEN_SOURCE=500?

Read /usr/include/features.h and the libc / gcc info documentation.

cheers,

Phil

--
http://www.kantaka.co.uk/ .oOo. public key: http://www.kantaka.co.uk/gpg.txt

 
 
 

What do gcc options like -D_XOPEN_SOURCE=500 mean?

Post by Ra » Sat, 15 Dec 2001 05:45:23



>   Then, _XOPEN_SOURCE=500 undefine, or doesn't define, __USE_BSD?
>   If so, what does this option mean?

This is covered in The GNU C Library Reference Manual. Try
"info libc standards" and "info libc introduction using feature".

HTH,
Ray
--
Obsig: developing a new sig

 
 
 

1. FS: Dec Alphastation 500/500 Must sell

I agree,  not knowing in advance whether Linux will run on some
brand or type of PC has withheld me from buying one and using Linux,
I'd love to have a UNIX clone at home, and would gladly spend some
extra money to get a machine that's got X windows, a modem, POP/PPP,
a sound card etc. installed and working,  spending rare free hours
installing hardware and fixing installation problems just doesn't
attract me, and I think this is true for many other people.  

As for OpenBSD, NetBSD, FreeBSD, the same argument holds expect for the
fact that the user base of these systems seems (?) to be much smaller
than Linux's,  although I've heard some UNIX specialists in a company
I've worked for praise NetBSD over the commercial UNIX this company was
selling.  Also,  I don't understand why there have to be three competing
*BSD projects,  the Linux gang seems better at keeping proselytes and
dissidents involved in the main stream ..

While posting ..
Does anyone know Linux vendors (Intel or Alpha) that deliver in the
Netherlands or neighbouring areas (Belgium, Germany) ?  The closest one
I found so far is based in Austria,  bit expensive to drive by just to
pick
one up ..

2. SLS 1.02 STILL HANGS ON A1

3. rom14, rom14.500, rom22.500

4. Where can I find ksh93?

5. Compaq AlphaServer 500 500/333 Mhz and FreeBSD ?

6. Compile error in vmlinux-2.4.19-rc1

7. Upgrade memory on Alphastation 500/500

8. Staroffice 4.0.3 runs painfully slow.

9. AMD k6 500 or Celeron 500

10. Install problems w/SuSE 6.3 on AS 500/500

11. Help-PC likes linux so much won't run DOS

12. Mouse Likes DOS but hates Linux

13. /usr/ucb/ps - what do the options mean?