tech-toolchain archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: Host requirements to build the Tools binaries



>   | On Linux (actually glibc2), _XOPEN_SOURCE expand declarations to add
>   | XPG4 functions etc.
> 
>   | On NetBSD (and FreeBSD and OpenBSD), _XOPEN_SOURCE restricts declarations
>   | to disallow NetBSD or GNU extensions.
> 
> I think that both are correct in their own ways.  The Linux behaviour
> is permitted, though not required, and the BSD behaviour allows applications
> to be strictly XSI conforming if they desire.
> 
>   | Then several packages require extra -D_NETBSD_SOURCE definitions to
> 
> That's an additional feature request which allows applications which
> would otherwise be strictly conforming to gain access to additional
> functionality provided by the implementation.
> 
> 
> Defining _XOPEN_SOURCE is required of an application to be a strictly
> conforming XSI application, which imposes a whole set of rules upon it
> about what it is, or isn't, allowed to do.   It also makes the application
> portable to more environments.

I'm not sure if there is any definitions or standards for
the _XOPEN_SOURCE macro, but I had to resolve an issue
"how can we use both strptime(3) (XPG4) and timegm(3) (GNU extension)
 among all Linux, NetBSD, FreeBSD, and OpenBSD?"

Newer GCC14 no longer allows implicit function declarations.

Linux requires _XOPEN_SOURCE to pull strptime(3) in <time.h>.

NetBSD (and maybe FreeBSD and OpenBSD) hides timegm(3)
if _XOPEN_SOURCE is defined.

On NetBSD, all declarations are visible by default
(unless _XOPEN_SOURCE, _POSIX_C_SOURCE, or _ANSI_SOURCE is defined).

On Linux, _GNU_SOURCE makes all declarations visible.

Then I wrote "_GNU_SOURCE for glibc might work."
That's all.

Thanks,
---
Izumi Tsutsui


Home | Main Index | Thread Index | Old Index