John E. Malmberg wrote:
> The configure script is now detecting that struct sched_param is present.
> ...
> Attached is a patch to lib/sched.in.patch

Thanks. Applied with tiny changes: I write "OpenVMS", not "VMS", as
discussed in the other thread. Also, no need to use conditionals based
on __CRTL_VER or HAVE_PTHREAD_H, since you said that only OpenVMS >= 7.3
is interesting and this <pthread.h> exists on VMS since 7.2:
http://h41379.www4.hpe.com/doc/72final/6493/6101pro_029.html
http://h30266.www3.hpe.com/odl/axpos/opsys/vmsos84/6493/6101pro_031.html


2017-06-19  Bruno Haible  <[email protected]>
            John E. Malmberg  <[email protected]>  (tiny change)

        sched: Fix compilation failure on OpenVMS.
        * m4/sched_h.m4 (gl_SCHED_H): Require AC_CANONICAL_HOST. On OpenVMS,
        test whether <pthread.h> exists and defines struct sched_param.
        * lib/sched.in.h: On OpenVMS, include <pthread.h>.

diff --git a/lib/sched.in.h b/lib/sched.in.h
index aa96aed..6b4bde8 100644
--- a/lib/sched.in.h
+++ b/lib/sched.in.h
@@ -39,10 +39,13 @@
 #include <sys/types.h>
 
 #ifdef __KLIBC__
-
-/* On OS/2 kLIBC, struct sched_param is in spawn.h */
+/* On OS/2 kLIBC, struct sched_param is in spawn.h.  */
 # include <spawn.h>
+#endif
 
+#ifdef __VMS
+/* On OpenVMS, struct sched_param is in <pthread.h>.  */
+# include <pthread.h>
 #endif
 
 #if !@HAVE_STRUCT_SCHED_PARAM@
diff --git a/m4/sched_h.m4 b/m4/sched_h.m4
index fd60a40..213cf68 100644
--- a/m4/sched_h.m4
+++ b/m4/sched_h.m4
@@ -1,4 +1,4 @@
-# sched_h.m4 serial 9
+# sched_h.m4 serial 10
 dnl Copyright (C) 2008-2017 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,6 +8,7 @@ dnl Written by Bruno Haible.
 
 AC_DEFUN([gl_SCHED_H],
 [
+  AC_REQUIRE([AC_CANONICAL_HOST])
   AC_CHECK_HEADERS_ONCE([sys/cdefs.h])
   AC_COMPILE_IFELSE(
     [AC_LANG_PROGRAM([[
@@ -41,10 +42,20 @@ AC_DEFUN([gl_SCHED_H],
            #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>])
+       case "$host_os" in
+         os2*)
+           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>])
+           ;;
+         vms)
+           dnl On OpenVMS 7.2 or newer, struct sched_param is in pthread.h.
+           AC_CHECK_TYPE([struct sched_param],
+             [HAVE_STRUCT_SCHED_PARAM=1], [HAVE_STRUCT_SCHED_PARAM=0],
+             [#include <pthread.h>])
+           ;;
+       esac
      fi
      AC_SUBST([HAVE_STRUCT_SCHED_PARAM])
 


Reply via email to