This error shows that <strings.h> is not self-contained: gcc -std=gnu99 -DHAVE_CONFIG_H -I. -I.. -DGNULIB_STRICT_CHECKING=1 -DIN_GNULIB_TESTS=1 -I. -I. -I.. -I./.. -I../gllib -I./../gllib -Wall -I/home/bruno/prefix-minix-gcc/include -g -O2 -MT test-ffs.o -MD -MP -MF $depbase.Tpo -c -o test-ffs.o test-ffs.c && mv -f $depbase.Tpo $depbase.Po In file included from ../gllib/strings.h:28, from test-ffs.c:20: /usr/include/strings.h:6: error: expected declaration specifiers or '...' before '(' token /usr/include/strings.h:7: error: expected declaration specifiers or '...' before '(' token /usr/include/strings.h:7: error: conflicting types for '_PROTOTYPE' /usr/include/strings.h:6: note: previous declaration of '_PROTOTYPE' was here /usr/include/strings.h:8: error: expected declaration specifiers or '...' before '(' token /usr/include/strings.h:8: error: conflicting types for '_PROTOTYPE' /usr/include/strings.h:6: note: previous declaration of '_PROTOTYPE' was here /usr/include/strings.h:10: error: expected declaration specifiers or '...' before '(' token /usr/include/strings.h:10: error: conflicting types for '_PROTOTYPE' /usr/include/strings.h:6: note: previous declaration of '_PROTOTYPE' was here test-ffs.c:23: error: 'ffs' undeclared here (not in a function) test-ffs.c: In function 'main': test-ffs.c:48: warning: implicit declaration of function 'ffs' *** Error code 1 (continuing)
This patch is the workaround. 2011-07-31 Bruno Haible <br...@clisp.org> strings: Add support for Minix. * lib/strings.in.h [Minix]: Include <sys/types.h> before <strings.h>. * m4/strings_h.m4 (gl_HEADER_STRINGS_H_BODY): Likewise. * doc/posix-headers/strings.texi: Document the Minix problem. --- doc/posix-headers/strings.texi.orig Sun Jul 31 23:01:16 2011 +++ doc/posix-headers/strings.texi Sun Jul 31 22:58:12 2011 @@ -7,6 +7,9 @@ Portability problems fixed by Gnulib: @itemize +@item +This header file is not self-contained on some platforms: +Minix 3.1.8. @end itemize Portability problems not fixed by Gnulib: --- lib/strings.in.h.orig Sun Jul 31 23:01:16 2011 +++ lib/strings.in.h Sun Jul 31 22:57:18 2011 @@ -23,6 +23,12 @@ #endif @PRAGMA_COLUMNS@ +/* Minix 3.1.8 has a bug: <sys/types.h> must be included before <strings.h>. + But avoid namespace pollution on glibc systems. */ +#if defined __minix && !defined __GLIBC__ +# include <sys/types.h> +#endif + /* The include_next requires a split double-inclusion guard. */ #@INCLUDE_NEXT@ @NEXT_STRINGS_H@ --- m4/strings_h.m4.orig Sun Jul 31 23:01:17 2011 +++ m4/strings_h.m4 Sun Jul 31 23:00:00 2011 @@ -1,5 +1,5 @@ # Configure a replacement for <strings.h>. -# serial 4 +# serial 5 # Copyright (C) 2007, 2009-2011 Free Software Foundation, Inc. # This file is free software; the Free Software Foundation @@ -20,7 +20,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 <strings.h> + gl_WARN_ON_USE_PREPARE([[ + /* Minix 3.1.8 has a bug: <sys/types.h> must be included before + <strings.h>. */ + #include <sys/types.h> + #include <strings.h> ]], [ffs strcasecmp strncasecmp]) ]) -- In memoriam Jean Jaurès <http://en.wikipedia.org/wiki/Jean_Jaurès>