]> Savannah Git Hosting - gnulib.git/commitdiff
sched: port to GCC 6.2.1 on macOS Sierra
authorPaul Eggert <eggert@cs.ucla.edu>
Sun, 25 Sep 2016 04:10:12 +0000 (21:10 -0700)
committerPaul Eggert <eggert@cs.ucla.edu>
Sun, 25 Sep 2016 04:10:45 +0000 (21:10 -0700)
Problem reported by Denis Davydov in:
http://lists.gnu.org/archive/html/bug-gnulib/2016-09/msg00056.html
* lib/sched.in.h [HAVE_SYS_CDEFS_H]:
Include <sys/cdefs.h> before <sched.h>.
* m4/nproc.m4 (gl_PREREQ_NPROC): Include errno.h before sched.h,
so that we needn’t worry about the sched.h include bug here.
* m4/sched_h.m4 (gl_SCHED_H): Check for sys/cdefs.h,
and include it before <sched.h> if it exists, when
checking for <sched.h>.

ChangeLog
lib/sched.in.h
m4/nproc.m4
m4/sched_h.m4

index b006ef07efc174c3e231a4c8150d928507dcbfe1..d929818f4147d6b0b688ed65338875ca5f1608ec 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,16 @@
 2016-09-24  Paul Eggert  <eggert@cs.ucla.edu>
 
+       sched: port to GCC 6.2.1 on macOS Sierra
+       Problem reported by Denis Davydov in:
+       http://lists.gnu.org/archive/html/bug-gnulib/2016-09/msg00056.html
+       * lib/sched.in.h [HAVE_SYS_CDEFS_H]:
+       Include <sys/cdefs.h> before <sched.h>.
+       * m4/nproc.m4 (gl_PREREQ_NPROC): Include errno.h before sched.h,
+       so that we needn’t worry about the sched.h include bug here.
+       * m4/sched_h.m4 (gl_SCHED_H): Check for sys/cdefs.h,
+       and include it before <sched.h> if it exists, when
+       checking for <sched.h>.
+
        tests/init.sh: port Alpine fix to AIX 7.1
        * tests/init.sh (compare_): When attempting to use diff -U3,
        prefer diff -u to -U3 to -c to plain diff.  Do not insist on
index 1c0fe592dde1b35e10c340ad10afb3fc1518a372..63ac5bd2dcdad71ee81186cd0ed0cc3de573126c 100644 (file)
@@ -1,4 +1,4 @@
-/* Replacement <sched.h> for platforms that lack it.
+/* A GNU-like <sched.h>.
    Copyright (C) 2008-2016 Free Software Foundation, Inc.
 
    This program is free software: you can redistribute it and/or modify
@@ -23,6 +23,9 @@
 
 /* The include_next requires a split double-inclusion guard.  */
 #if @HAVE_SCHED_H@
+# if @HAVE_SYS_CDEFS_H@
+#  include <sys/cdefs.h>
+# endif
 # @INCLUDE_NEXT@ @NEXT_SCHED_H@
 #endif
 
index fead2346b2019af3087a9a8fbd1b61275c2455e1..f38591bbf3605134b49b4a67434d2c0ad957500c 100644 (file)
@@ -1,4 +1,4 @@
-# nproc.m4 serial 4
+# nproc.m4 serial 5
 dnl Copyright (C) 2009-2016 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -40,7 +40,8 @@ AC_DEFUN([gl_PREREQ_NPROC],
       [gl_cv_func_sched_getaffinity3],
       [AC_COMPILE_IFELSE(
          [AC_LANG_PROGRAM(
-            [[#include <sched.h>]],
+            [[#include <errno.h>
+              #include <sched.h>]],
             [[sched_getaffinity (0, 0, (cpu_set_t *) 0);]])],
          [gl_cv_func_sched_getaffinity3=yes],
          [gl_cv_func_sched_getaffinity3=no])
index f56454191ce0f5fa1848ee6c48cfe75cb97b1703..7192b6302bafce841e39f88d8b355d51800e81e8 100644 (file)
@@ -1,4 +1,4 @@
-# sched_h.m4 serial 7
+# sched_h.m4 serial 8
 dnl Copyright (C) 2008-2016 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_CHECK_HEADERS_ONCE([sys/cdefs.h])
   AC_COMPILE_IFELSE(
     [AC_LANG_PROGRAM([[
        #include <sched.h>
@@ -17,10 +18,14 @@ AC_DEFUN([gl_SCHED_H],
      ]])],
     [SCHED_H=''],
     [SCHED_H='sched.h'
+     AC_CHECK_HEADERS([sched.h], [], [],
+       [[#if HAVE_SYS_CDEFS_H
+          #include <sys/cdefs.h>
+         #endif
+       ]])
+     gl_NEXT_HEADERS([sched.h])
 
-     gl_CHECK_NEXT_HEADERS([sched.h])
-
-     if test $ac_cv_header_sched_h = yes; then
+     if test "$ac_cv_header_sched_h" = yes; then
        HAVE_SCHED_H=1
      else
        HAVE_SCHED_H=0
@@ -30,7 +35,11 @@ AC_DEFUN([gl_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>])
+         [[#if HAVE_SYS_CDEFS_H
+            #include <sys/cdefs.h>
+           #endif
+           #include <sched.h>
+         ]])
      else
        dnl On OS/2 kLIBC, struct sched_param is in spawn.h.
        AC_CHECK_TYPE([struct sched_param],