Subject: Re: bug#8555: [Bug Report] O_NOCACHE is a system define on AIX 5.1 and AIX 5.2
From: Jim Meyering <[email-masked]>
To: "Gary V. Vaughan" <[email-masked]>
Cc: [email-masked]
Date: Tue, 26 Apr 2011 09:13:48 +0200
List-Id: <debbugs-submit.debbugs.gnu.org>

Gary V. Vaughan wrote:
> On AIX 5.1 and AIX 5.2, building coreutils-8.11 is not possible out of the
> box, because dd.c has an enum that tries to set a new constant O_NOCACHE. On
> these machines, O_NOCACHE is a preprocessor define in /usr/include/fcntl.c,
> so the symbol in the dd.c enum definition is replaced by a constant before
> the compiler sees it, so can't be compiled as is.
>
> I worked around it as follows:
>
>   gsed -i -e 's|O_NOCACHE|DD_NOCACHE|g' src/dd.c

Hi Gary,

Thank you for the report.  Shame on AIX.
I've fixed it slightly differently.
This way I don't have to change all of dd.c's uses of O_NOCACHE.

From 07c78f7eecf0b9ab75a6ae6aeff6e71bb34e421b Mon Sep 17 00:00:00 2001
From: Jim Meyering <[email-masked]>
Date: Tue, 26 Apr 2011 09:09:43 +0200
Subject: [PATCH] dd: work around compilation failure on AIX 5.1 and 5.2

* src/dd.c (O_NOCACHE): Undefine.  This symbol is defined
via AIX's <fcntl.h>, yet used as an enum name in dd.c.
Reported by Gary V. Vaughan in http://debbugs.gnu.org/8555
---
 src/dd.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/src/dd.c b/src/dd.c
index cb626fc..072410e 100644
--- a/src/dd.c
+++ b/src/dd.c
@@ -66,6 +66,10 @@
 # define O_CIO 0
 #endif

+/* On AIX 5.1 and AIX 5.2, O_NOCACHE is defined via <fcntl.h>
+   and would interfere with our use of that name, below.  */
+#undef O_NOCACHE
+
 #if ! HAVE_FDATASYNC
 # define fdatasync(fd) (errno = ENOSYS, -1)
 #endif
--
1.7.5.rc3.316.gd1ff9