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

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Don't claim GCC predefines __POSIX__

   >    >> How do you test that you are on a POSIX compliant system?
   >    >
   >    > Practically, run autoconf tests for the features you care about,
   >    > which are unlikely to be 100% conformance. Â?For 100% conformance,
   >    > run a conformance testsuite - or if anyone does POSIX
   >    > certification, look at a list of certified systems.
   >    I fully understand the complexity of saying a system is or is not
   >    fully POSIX is not trivially detectable by the compiler.
   > One can get quite far by checking for __POSIX_VERSION__ as well
   > if using autoconf tests is to heavy.

   I presume you meant _POSIX_VERSION.  The previous paragraph of the
   manual (before the one I propose to remove) says:

Right, thanks.

     @strong{Usage Note:} Don't try to test whether the system
     supports POSIX by including @file{unistd.h} and then checking
     whether @code{_POSIX_VERSION} is defined.  On a non-POSIX system,
     this will probably fail because there is no @file{unistd.h}.  We
     do not know of @emph{any} way you can reliably test at
     compilation time whether your target system supports POSIX or
     whether @file{unistd.h} exists.

   Maybe, given that you have POSIX, testing the version that way is
   more useful.

It is a quick way to check though, so if a system is not POSIX
(i.e. doesn't have <unistd.h>, and doesn't define _POSIX_VERSION) then
it will fail.  If it works, then you should (in theory) have a POSIX
comformant system.  Testing for __POSIX__ was really never safe
anyway, since a POSIX never defined that macro.

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