Hi/2.

Bruno Haible wrote:
> KO Myung-Hun wrote:
>> kLIBC does not have sched.h.
>> kLIBC declares 'struct sched_param' directly in its own spawn.h.
> 
> But then the sched.h that gnulib module 'sched' creates is broken for kLIBC:
> It will set HAVE_STRUCT_SCHED_PARAM=0 and thus provide a different
> definition of 'struct sched_param', that conflicts if both <sched.h> and
> <spawn.h> are included.
> 
> You must first fix the problem in <sched.h>:
>   - Adjust m4/sched_h.m4 so that it considers <spawn.h> too,
>     also when <sched.h> does not exist. It should set 
> HAVE_STRUCT_SCHED_PARAM=1.
>   - Adjust lib/sched.in.h so that it includes <spawn.h> in the kLIBC case.
> 
> Then, AFAICS, no change should be necessary to lib/spawn.in.h (because
> module 'spawn' depends on module 'sched').
> 

Fixed.

-- 
KO Myung-Hun

Using Mozilla SeaMonkey 2.7.2
Under OS/2 Warp 4 for Korean with FixPak #15
In VirtualBox v4.1.32 on Intel Core i7-3615QM 2.30GHz with 8GB RAM

Korean OS/2 User Community : http://www.ecomstation.co.kr

>From e2e77811f811e923e697a49a6d4c26b42eaeed1d Mon Sep 17 00:00:00 2001
From: KO Myung-Hun <k...@chollian.net>
Date: Sat, 27 Apr 2013 15:33:09 +0900
Subject: [PATCH] sched: check struct sched_param in spawn.h as well

On OS/2 kLIBC, struct sched_param is in spawn.h. So without this a
redefinition error occurs when sched.h is inclued by spawn.h.

* lib/sched.in.h: Include spawn.h on kLIBC.
* lib/sched_h.m4: Check struct sched_param in spawn.h as well.
---
 lib/sched.in.h |  5 +++++
 m4/sched_h.m4  | 13 ++++++++++---
 2 files changed, 15 insertions(+), 3 deletions(-)

diff --git a/lib/sched.in.h b/lib/sched.in.h
index edebf81..4525f41 100644
--- a/lib/sched.in.h
+++ b/lib/sched.in.h
@@ -45,6 +45,11 @@ struct sched_param
 #  define GNULIB_defined_struct_sched_param 1
 # endif
 
+#elif defined __KLIBC__
+
+/* On OS/2 kLIBC, struct sched_param is in spawn.h */
+# include <spawn.h>
+
 #endif
 
 #if !(defined SCHED_FIFO && defined SCHED_RR && defined SCHED_OTHER)
diff --git a/m4/sched_h.m4 b/m4/sched_h.m4
index 329af35..a0cdc61 100644
--- a/m4/sched_h.m4
+++ b/m4/sched_h.m4
@@ -27,9 +27,16 @@ AC_DEFUN([gl_SCHED_H],
      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>])
+     if test "$HAVE_SCHED_H" = 1; then
+       AC_CHECK_TYPE([struct sched_param],
+         [HAVE_STRUCT_SCHED_PARAM=1], [HAVE_STRUCT_SCHED_PARAM=0],
+         [#include <sched.h>])
+     else
+       dnl On OS/2 kLIBC, struct sched_param is in spawn.h.
+       AC_CHECK_TYPE([struct sched_param],
+         [HAVE_STRUCT_SCHED_PARAM=1], [HAVE_STRUCT_SCHED_PARAM=0],
+         [#include <spawn.h>])
+     fi
      AC_SUBST([HAVE_STRUCT_SCHED_PARAM])
 
      dnl Ensure the type pid_t gets defined.
-- 
1.8.5.2

Reply via email to