On 16/04/2026 17:10, Bruno Haible wrote:
On AIX 7.3 (machine: cfarm119.cfarm.net, compiler: gcc,
configure options: --with-openssl=no), the build fails due to a
compilation error:

   CC       src/yes.o
../src/yes.c: In function 'splice_write':
../src/yes.c:150:62: error: 'SPLICE_F_GIFT' undeclared (first use in this 
function)
   150 |           unsigned int flags = iov.iov_len % page_size ? 0 : 
SPLICE_F_GIFT;
       |                                                              
^~~~~~~~~~~~~
../src/yes.c:150:62: note: each undeclared identifier is reported only once for 
each function it appears in
../src/yes.c:151:23: warning: implicit declaration of function 'vmsplice' 
[-Wimplicit-function-declaration]
   151 |           ssize_t n = vmsplice (vmsplice_fd, &iov, 1, flags);
       |                       ^~~~~~~~
../src/yes.c:166:27: warning: implicit declaration of function 'splice' 
[-Wimplicit-function-declaration]
   166 |               ssize_t s = splice (pipefd[0], NULL, STDOUT_FILENO, NULL,
       |                           ^~~~~~
../src/yes.c:167:46: error: 'SPLICE_F_MOVE' undeclared (first use in this 
function)
   167 |                                   remaining, SPLICE_F_MOVE);
       |                                              ^~~~~~~~~~~~~
gmake[2]: *** [Makefile:13598: src/yes.o] Error 1

I guess the configuration needs to be tweaked. It found:

   checking for splice... yes

and thus defined

   $ grep -i splice config.status
   D["HAVE_SPLICE"]=" 1"


Indeed, splice() is a separate TCP thing on AIX:

  #include <sys/types.h>  #include <sys/socket.h>
  int splice(socket1, socket2, flags)

The attached allows the build to complete on cfarm119.

cheers,
Padraig
From 5597a275c2b60610090b40dd64ff5904dd393f41 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?P=C3=A1draig=20Brady?= <[email protected]>
Date: Thu, 16 Apr 2026 22:02:03 +0100
Subject: [PATCH] build: fix build failure on AIX

* m4/jm-macros.m4: AIX has a splice() function for TCP,
so check for vmsplice() instead.
* src/splice.h: Define HAVE_SPLICE if vmsplice available.
Reported by Bruno Haible.
---
 m4/jm-macros.m4 | 2 +-
 src/splice.h    | 7 ++++++-
 2 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/m4/jm-macros.m4 b/m4/jm-macros.m4
index fbf082703..fb00f9faf 100644
--- a/m4/jm-macros.m4
+++ b/m4/jm-macros.m4
@@ -70,7 +70,7 @@ AC_DEFUN([coreutils_MACROS],
     setgroups
     sethostname
     siginterrupt
-    splice
+    vmsplice
     sync
     sysinfo
     tcgetpgrp
diff --git a/src/splice.h b/src/splice.h
index 1fb55054d..c146563f7 100644
--- a/src/splice.h
+++ b/src/splice.h
@@ -17,7 +17,12 @@
 #ifndef SPLICE_H
 # define SPLICE_H 1
 
-# if HAVE_SPLICE
+# if HAVE_VMSPLICE
+
+/* splice() and vmsplice() were introduced at the same time,
+   so assume splice() is available.  Note AIX also has a different
+   splice() which is why we don't explicitly check for that function. */
+#  define HAVE_SPLICE 1
 
 /* Empirically determined pipe size for best throughput.
    Needs to be <= /proc/sys/fs/pipe-max-size  */
-- 
2.53.0

Reply via email to