Mike Fulton wrote: > > I am building m4 (latest) on the z/OS operating system and for the most > > part, things are going very well. > > I am not sure of the best place to request this - whether as a 'bug' report > > (which this is not) or as a discussion topic, so I decided on 'discussion'. > > > > The problem I have hit for z/OS is that canonicalize-lgpl.c is defining > > __stat to stat, i.e. > > #define __stat stat > > > > Unfortunately, on z/OS, the system header <sys/stat.h> uses __stat as a > > wrapper for the header file to test if the header has been included or not, > > e.g. > > > > #ifndef __stat > > #define __stat 1 > > <header file contents> > > #endif
Thanks for the explanation. Sending an explanation without a patch is better than sending a patch without an explanation :) Eric Blake wrote: > we will get it fixed to quit > using the identifier __stat for our own uses now that we know system > headers are using it. Done as follows: 2021-08-08 Bruno Haible <br...@clisp.org> canonicalize-lgpl: Fix conflict with z/OS <sys/stat.h>. Reported by Mike Fulton <mikefultonperso...@gmail.com> in <https://lists.gnu.org/archive/html/m4-discuss/2021-08/msg00000.html> via Eric Blake. * lib/canonicalize-lgpl.c (__stat): Remove macro. (file_accessible): Use 'stat' instead. diff --git a/lib/canonicalize-lgpl.c b/lib/canonicalize-lgpl.c index c6fef17..92e9639 100644 --- a/lib/canonicalize-lgpl.c +++ b/lib/canonicalize-lgpl.c @@ -74,7 +74,6 @@ # define __pathconf pathconf # define __rawmemchr rawmemchr # define __readlink readlink -# define __stat stat # if IN_RELOCWRAPPER /* When building the relocatable program wrapper, use the system's memmove function, not the gnulib override, otherwise we would get a link error. @@ -105,7 +104,7 @@ file_accessible (char const *file) return __faccessat (AT_FDCWD, file, F_OK, AT_EACCESS) == 0; # else struct stat st; - return __stat (file, &st) == 0 || errno == EOVERFLOW; + return stat (file, &st) == 0 || errno == EOVERFLOW; # endif }