Set _ALL_SOURCE for AIX, but avoid its struct list.
PATCH 1/1 Set _ALL_SOURCE for AIX, but avoid its struct list.
AIX 5.3 seems to need _ALL_SOURCE for struct addrinfo, but that introduces a struct list in grp.h.
---
Also, the AIX iconv is insufficent. All tests pass if I build GNU libiconv, but using AIX's fails in many conversion tests. If you build with NO_ICONV, all the conversion tests fail as well. I'm not sure if that should be changed, or if NO_ICONV should be removed...
git-compat-util.h | 3 +++ 1 files changed, 3 insertions(+), 0 deletions(-)
git-compat-util.h +3 -0
@@ -15,6 +15,7 @@#define _XOPEN_SOURCE 600/* glibc2 and AIX 5.3L need 500, OpenBSD needs 600 for S_ISLNK() */ #define _XOPEN_SOURCE_EXTENDED 1/* AIX 5.3L needs this */ #endif +#define _ALL_SOURCE#define _GNU_SOURCE#define _BSD_SOURCE
@@ -45,7 +46,9 @@#include <arpa/inet.h> #include <netdb.h> #include <pwd.h> +#undef _ALL_SOURCE/* AIX 5.3L defines a struct list with _ALL_SOURCE. */ #include <grp.h> +#define _ALL_SOURCE#ifndef NO_ICONV #include <iconv.h>
Signature · 1 line
1.5.0.rc1.gf4b6c
Quoted 2 lines · Jason Riedy
AIX 5.3 seems to need
_ALL_SOURCEfor struct addrinfo, but that introduces a struct list ingrp.h.
Yuck.
What the h**k is _ALL_SOURCE? What are the valid other possibilities, _ALL_BINARY???
I am wondering if we want to do "#ifdef _AIX" around truly yucky parts.
I notice that I did not heed Linus's suggestion to define these to 1 to make them behave identically as "cc -D_GNU_SOURCE", by the way...
Also I wonder if we do _ALL_SOURCE before any of the system header files on AIX, if we still need "_XOPEN_SOURCE_EXTENDED 1" which we specifically added for AIX.
git-compat-util.h +7 -3
@@ -13,10 +13,10 @@#if !defined(__APPLE__) && !defined(__FreeBSD__)#define _XOPEN_SOURCE 600/* glibc2 and AIX 5.3L need 500, OpenBSD needs 600 for S_ISLNK() */ -#define _XOPEN_SOURCE_EXTENDED 1/* AIX 5.3L needs this */ #endif -#define _GNU_SOURCE -#define _BSD_SOURCE +#define _GNU_SOURCE 1 +#define _BSD_SOURCE 1 +#define _ALL_SOURCE 1/* AIX */ #include <unistd.h> #include <stdio.h>
@@ -45,7 +45,11 @@#include <arpa/inet.h> #include <netdb.h> #include <pwd.h> + +/* AIX 5.3L defines a struct list with _ALL_SOURCE. */ +#undef _ALL_SOURCE#include <grp.h> +#define _ALL_SOURCE 1#ifndef NO_ICONV #include <iconv.h>
Quoted 1 line · And Junio C Hamano
Yuck.
Yuck, thy name is AIX.
Quoted 2 lines
What the h**k is
_ALL_SOURCE? What are the valid other possibilities,_ALL_BINARY???
There's no equivalent to features.h... And while this includes
a few repeats:
bash-3.2$ find /usr/include/ -name \*.h|xargs fgrep -h \#ifdef|sort|uniq|wc -l
402
Quoted 2 lines
I am wondering if we want to do "#ifdef
_AIX" around truly yucky parts.
Sure.
Quoted 3 lines
I notice that I did not heed Linus's suggestion to define these to 1 to make them behave identically as "cc -D_GNU_SOURCE", by the way...
I missed the suggestion altogether. Sounds like the right thing to do.
Quoted 3 lines
Also I wonder if we do
_ALL_SOURCEbefore any of the system header files on AIX, if we still need "_XOPEN_SOURCE_EXTENDED1" which we specifically added for AIX.
The #ifdef _ALL_SOURCE in netdb.h comes right after the #endif of #ifdef _XOPEN_SOURCE_EXTENDED. So all doesn't really mean all, just kinda sorta maybe some.
Yeah, AIX is a joy. And thanks to DARPA and the DOE, it ain't going away. The following seems to work for me on Solaris 5.8 and AIX 5.3.
Jason, wishing they would all just see the light...
git-compat-util.h +16 -3
@@ -13,10 +13,15 @@#if !defined(__APPLE__) && !defined(__FreeBSD__)#define _XOPEN_SOURCE 600/* glibc2 and AIX 5.3L need 500, OpenBSD needs 600 for S_ISLNK() */ -#define _XOPEN_SOURCE_EXTENDED 1/* AIX 5.3L needs this */ #endif -#define _GNU_SOURCE -#define _BSD_SOURCE +#define _GNU_SOURCE 1 +#define _BSD_SOURCE 1 + +#if defined(_AIX) +/* For AIX 5.3L, at the very least. */ +#define _ALL_SOURCE 1 +#define _XOPEN_SOURCE_EXTENDED 1 +#endif #include <unistd.h> #include <stdio.h>
@@ -45,7 +50,15 @@#include <arpa/inet.h> #include <netdb.h> #include <pwd.h> + +#if defined(_AIX) +/* AIX 5.3L defines a struct list with _ALL_SOURCE. */ +#undef _ALL_SOURCE +#endif #include <grp.h> +#if defined(_AIX) +#define _ALL_SOURCE 1 +#endif #ifndef NO_ICONV #include <iconv.h>