On Haiku I'm seeing these errors: /data/testdir1/gllib/spawn.h:110: field `_sp' has incomplete type /data/testdir1/gllib/spawnattr_setschedpolicy.c: In function `posix_spawnattr_setschedpolicy': /data/testdir1/gllib/spawnattr_setschedpolicy.c:28: `SCHED_OTHER' undeclared (first use in this function) /data/testdir1/gllib/spawnattr_setschedpolicy.c:28: (Each undeclared identifier is reported only once /data/testdir1/gllib/spawnattr_setschedpolicy.c:28: for each function it appears in.) /data/testdir1/gllib/spawnattr_setschedpolicy.c:29: `SCHED_FIFO' undeclared (first use in this function) /data/testdir1/gllib/spawnattr_setschedpolicy.c:29: `SCHED_RR' undeclared (first use in this function)
The reason is that <sched.h> exists but does not have the 'struct sched_param' type nor the SCHED_* macros. This fixes it. 2008-11-15 Bruno Haible <[EMAIL PROTECTED]> Make the 'sched' module work on platforms where <sched.h> exists but is incomplete (such as Haiku). * lib/sched.in.h; Include the system's <sched.h> if it exists. (SCHED_FIFO, SCHED_RR, SCHED_OTHER): New macros. * m4/sched_h.m4 (gl_SCHED_H): Test whether <sched.h> exists and also defines SCHED_FIFO, SCHED_RR, SCHED_OTHER. Set HAVE_SCHED_H, HAVE_STRUCT_SCHED_PARAM. * modules/sched (Depends-on): Add include_next. (Makefile.am): Substitute HAVE_SCHED_H, INCLUDE_NEXT, PRAGMA_SYSTEM_HEADER, NEXT_SCHED_H, HAVE_STRUCT_SCHED_PARAM. * doc/posix-headers/sched.texi: Document the issue. --- doc/posix-headers/sched.texi.orig 2008-11-15 13:05:35.000000000 +0100 +++ doc/posix-headers/sched.texi 2008-11-15 13:05:20.000000000 +0100 @@ -10,6 +10,13 @@ @item This header file is missing on some platforms: mingw, BeOS. [EMAIL PROTECTED] [EMAIL PROTECTED] sched_param} is not defined on some platforms: +Haiku. [EMAIL PROTECTED] [EMAIL PROTECTED], @code{SCHED_RR}, @code{SCHED_OTHER} are not defined on +some platforms: +Haiku. @end itemize Portability problems not fixed by Gnulib: --- lib/sched.in.h.orig 2008-11-15 13:05:35.000000000 +0100 +++ lib/sched.in.h 2008-11-15 12:26:54.000000000 +0100 @@ -15,11 +15,33 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. */ #ifndef _GL_SCHED_H + +#if __GNUC__ >= 3 [EMAIL PROTECTED]@ +#endif + +/* The include_next requires a split double-inclusion guard. */ +#if @HAVE_SCHED_H@ +# @INCLUDE_NEXT@ @NEXT_SCHED_H@ +#endif + +#ifndef _GL_SCHED_H #define _GL_SCHED_H +#if [EMAIL PROTECTED]@ + struct sched_param { int sched_priority; }; +#endif + +#if !(defined SCHED_FIFO && defined SCHED_RR && defined SCHED_OTHER) +# define SCHED_FIFO 1 +# define SCHED_RR 2 +# define SCHED_OTHER 0 +#endif + +#endif /* _GL_SCHED_H */ #endif /* _GL_SCHED_H */ --- m4/sched_h.m4.orig 2008-11-15 13:05:35.000000000 +0100 +++ m4/sched_h.m4 2008-11-11 02:39:20.000000000 +0100 @@ -1,4 +1,4 @@ -# sched_h.m4 serial 1 +# sched_h.m4 serial 2 dnl Copyright (C) 2008 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -8,11 +8,29 @@ AC_DEFUN([gl_SCHED_H], [ - AC_CHECK_HEADERS_ONCE([sched.h]) - if test $ac_cv_header_sched_h = yes; then - SCHED_H='' - else - SCHED_H='sched.h' - fi + AC_COMPILE_IFELSE( + [AC_LANG_PROGRAM([[ + #include <sched.h> + struct sched_param a; + int b[] = { SCHED_FIFO, SCHED_RR, SCHED_OTHER }; + ]])], + [SCHED_H=''], + [SCHED_H='sched.h' + + gl_CHECK_NEXT_HEADERS([sched.h]) + + AC_CHECK_HEADERS_ONCE([sched.h]) + if test $ac_cv_header_sched_h = yes; then + HAVE_SCHED_H=1 + else + HAVE_SCHED_H=0 + fi + AC_SUBST([HAVE_SCHED_H]) + + AC_CHECK_TYPE([struct sched_param], + [HAVE_STRUCT_SCHED_PARAM=1], [HAVE_STRUCT_SCHED_PARAM=0], + [#include <sched.h>]) + AC_SUBST([HAVE_STRUCT_SCHED_PARAM]) + ]) AC_SUBST([SCHED_H]) ]) --- modules/sched.orig 2008-11-15 13:05:35.000000000 +0100 +++ modules/sched 2008-11-11 02:40:02.000000000 +0100 @@ -6,6 +6,7 @@ m4/sched_h.m4 Depends-on: +include_next configure.ac: gl_SCHED_H @@ -18,7 +19,12 @@ sched.h: sched.in.h rm -f [EMAIL PROTECTED] $@ { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \ - cat < $(srcdir)/sched.in.h; \ + sed -e 's|@''HAVE_SCHED_H''@|$(HAVE_SCHED_H)|g' \ + -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \ + -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \ + -e 's|@''NEXT_SCHED_H''@|$(NEXT_SCHED_H)|g' \ + -e 's|@''HAVE_STRUCT_SCHED_PARAM''@|$(HAVE_STRUCT_SCHED_PARAM)|g' \ + < $(srcdir)/sched.in.h; \ } > [EMAIL PROTECTED] mv [EMAIL PROTECTED] $@ MOSTLYCLEANFILES += sched.h sched.h-t