Also <sys/utsname.h> is not self-contained: $ cat foo.c #define _MINIX 1 #include <sys/utsname.h> $ gcc -c foo.c In file included from foo.c:2: /usr/pkg/gcc44/lib/gcc/i686-pc-minix/4.4.3/include-fixed/sys/utsname.h:32: error: expected declaration specifiers or '...' before 'size_t'
Here's the workaround. 2011-07-31 Bruno Haible <br...@clisp.org> sys_utsname: Add support for Minix. * lib/sys_utsname.in.h [Minix]: Include <stddef.h> before <sys/utsname.h>. * m4/sys_utsname_h.m4 (gl_SYS_UTSNAME_H): Likewise. * doc/posix-headers/sys_utsname.texi: Document the Minix problem. --- doc/posix-headers/sys_utsname.texi.orig Sun Jul 31 23:27:20 2011 +++ doc/posix-headers/sys_utsname.texi Sun Jul 31 23:22:04 2011 @@ -10,6 +10,9 @@ @item This header file is missing on some platforms: mingw. +@item +This header file is not self-contained on some platforms: +Minix 3.1.8. @end itemize Portability problems not fixed by Gnulib: --- lib/sys_utsname.in.h.orig Sun Jul 31 23:27:20 2011 +++ lib/sys_utsname.in.h Sun Jul 31 23:23:24 2011 @@ -23,7 +23,15 @@ @PRAGMA_COLUMNS@ #if @HAVE_SYS_UTSNAME_H@ + +/* Minix 3.1.8 has a bug: <stddef.h> must be included before <sys/utsname.h>. + But avoid namespace pollution on glibc systems. */ +# if defined __minix && !defined __GLIBC__ +# include <stddef.h> +# endif + # @INCLUDE_NEXT@ @NEXT_SYS_UTSNAME_H@ + #endif #define _@GUARD_PREFIX@_SYS_UTSNAME_H --- m4/sys_utsname_h.m4.orig Sun Jul 31 23:27:20 2011 +++ m4/sys_utsname_h.m4 Sun Jul 31 23:25:10 2011 @@ -1,4 +1,4 @@ -# sys_utsname_h.m4 serial 7 +# sys_utsname_h.m4 serial 8 dnl Copyright (C) 2009-2011 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -20,6 +20,9 @@ else HAVE_SYS_UTSNAME_H=1 AC_CHECK_TYPES([struct utsname], [], [HAVE_STRUCT_UTSNAME=0], [[ +/* Minix 3.1.8 has a bug: <stddef.h> must be included before + <sys/utsname.h>. */ +#include <stddef.h> #include <sys/utsname.h> ]]) fi @@ -27,7 +30,11 @@ dnl Check for declarations of anything we want to poison if the dnl corresponding gnulib module is not in use. - gl_WARN_ON_USE_PREPARE([[#include <sys/utsname.h> + gl_WARN_ON_USE_PREPARE([[ + /* Minix 3.1.8 has a bug: <stddef.h> must be included before + <sys/utsname.h>. */ + #include <stddef.h> + #include <sys/utsname.h> ]], [uname]) ]) -- In memoriam Jean Jaurès <http://en.wikipedia.org/wiki/Jean_Jaurès>