bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Os2


From: Bruno Haible
Subject: Re: Os2
Date: Sun, 13 Apr 2008 14:57:18 +0200
User-agent: KMail/1.5.4

Elbert Pol wrote:

> test-sys_socket.c:27: error: `SHUT_RD' undeclared here (not in a function)
> test-sys_socket.c:27: error: initializer element is not constant
> test-sys_socket.c:27: error: (near initialization for `a[0]')
> test-sys_socket.c:27: error: `SHUT_WR' undeclared here (not in a function)
> test-sys_socket.c:27: error: initializer element is not constant
> test-sys_socket.c:27: error: (near initialization for `a[1]')
> test-sys_socket.c:27: error: `SHUT_RDWR' undeclared here (not in a function)
> test-sys_socket.c:27: error: initializer element is not constant
> test-sys_socket.c:27: error: (near initialization for `a[2]')

Fixing it like this. Simon, do you agree?


2008-04-13  Bruno Haible  <address@hidden>

        * doc/posix-headers/sys_socket.texi: Document the problem on EMX.
        * lib/sys_socket.in.h (SHUT_RD, SHUT_WR, SHUT_RDWR): Define if missing.
        * m4/sys_socket_h.m4 (gl_HEADER_SYS_SOCKET): Replace <sys/socket.h>
        also if it exists but lacks definitions of the SHUT_* macros.
        * modules/sys_socket (Description): Update.
        Reported by Elbert Pol <address@hidden>.

*** doc/posix-headers/sys_socket.texi.orig      2008-04-13 14:50:25.000000000 
+0200
--- doc/posix-headers/sys_socket.texi   2008-04-13 14:49:18.000000000 +0200
***************
*** 13,18 ****
--- 13,23 ----
  @item
  This header file is not self-contained on some platforms: it requires
  @code{<sys/types.h>} to be included first.
+ @item
+ This header file is lacking the @code{SHUT_RD}, @code{SHUT_WR},
+ @code{SHUT_RDWR} macros on some platforms, despite having the @code{shutdown}
+ functions:
+ emx+gcc.
  @end itemize
  
  Portability problems not fixed by Gnulib:
*** lib/sys_socket.in.h.orig    2008-04-13 14:50:25.000000000 +0200
--- lib/sys_socket.in.h 2008-04-13 14:46:10.000000000 +0200
***************
*** 1,5 ****
! /* Provide a sys/socket header file for systems lacking it (read: MinGW).
!    Copyright (C) 2005, 2006, 2007 Free Software Foundation, Inc.
     Written by Simon Josefsson.
  
     This program is free software; you can redistribute it and/or modify
--- 1,6 ----
! /* Provide a sys/socket header file for systems lacking it (read: MinGW)
!    and for systems where it is incomplete.
!    Copyright (C) 2005-2008 Free Software Foundation, Inc.
     Written by Simon Josefsson.
  
     This program is free software; you can redistribute it and/or modify
***************
*** 16,23 ****
     along with this program; if not, write to the Free Software Foundation,
     Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  */
  
! /* This file is supposed to be used on platforms that lack <sys/socket.h>
!    and on platforms where <sys/socket.h> cannot be included standalone.
     It is intended to provide definitions and prototypes needed by an
     application.  */
  
--- 17,25 ----
     along with this program; if not, write to the Free Software Foundation,
     Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  */
  
! /* This file is supposed to be used on platforms that lack <sys/socket.h>,
!    on platforms where <sys/socket.h> cannot be included standalone, and on
!    platforms where <sys/socket.h> does not provide all necessary definitions.
     It is intended to provide definitions and prototypes needed by an
     application.  */
  
***************
*** 37,43 ****
  #ifndef _GL_SYS_SOCKET_H
  #define _GL_SYS_SOCKET_H
  
! #if address@hidden@
  
  /* A platform that lacks <sys/socket.h>.
  
--- 39,60 ----
  #ifndef _GL_SYS_SOCKET_H
  #define _GL_SYS_SOCKET_H
  
! #if @HAVE_SYS_SOCKET_H@
! 
! /* A platform that has <sys/socket.h>.  */
! 
! /* For shutdown().  */
! # if !defined SHUT_RD
! #  define SHUT_RD 0
! # endif
! # if !defined SHUT_WR
! #  define SHUT_WR 1
! # endif
! # if !defined SHUT_RDWR
! #  define SHUT_RDWR 2
! # endif
! 
! #else
  
  /* A platform that lacks <sys/socket.h>.
  
*** m4/sys_socket_h.m4.orig     2008-04-13 14:50:25.000000000 +0200
--- m4/sys_socket_h.m4  2008-04-13 14:40:06.000000000 +0200
***************
*** 1,5 ****
! # sys_socket_h.m4 serial 4
! dnl Copyright (C) 2005, 2006, 2007 Free Software Foundation, Inc.
  dnl This file is free software; the Free Software Foundation
  dnl gives unlimited permission to copy and/or distribute it,
  dnl with or without modifications, as long as this notice is preserved.
--- 1,5 ----
! # sys_socket_h.m4 serial 5
! dnl Copyright (C) 2005-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,
  dnl with or without modifications, as long as this notice is preserved.
***************
*** 17,25 ****
      ])
    if test $gl_cv_header_sys_socket_h_selfcontained = yes; then
      SYS_SOCKET_H=''
    else
      SYS_SOCKET_H='sys/socket.h'
! 
      gl_CHECK_NEXT_HEADERS([sys/socket.h])
      if test $ac_cv_header_sys_socket_h = yes; then
        HAVE_SYS_SOCKET_H=1
--- 17,44 ----
      ])
    if test $gl_cv_header_sys_socket_h_selfcontained = yes; then
      SYS_SOCKET_H=''
+     dnl If the shutdown function exists, <sys/socket.h> should define
+     dnl SHUT_RD, SHUT_WR, SHUT_RDWR.
+     AC_CHECK_FUNCS([shutdown])
+     if test $ac_cv_func_shutdown = yes; then
+       AC_CACHE_CHECK([whether <sys/socket.h> defines the SHUT_* macros],
+         [gl_cv_header_sys_socket_h_shut],
+         [
+           AC_COMPILE_IFELSE(
+             [AC_LANG_PROGRAM([[#include <sys/socket.h>]],
+                [[int a[] = { SHUT_RD, SHUT_WR, SHUT_RDWR };]])],
+             [gl_cv_header_sys_socket_h_shut=yes],
+             [gl_cv_header_sys_socket_h_shut=no])
+         ])
+       if test $gl_cv_header_sys_socket_h_shut = no; then
+         SYS_SOCKET_H='sys/socket.h'
+       fi
+     fi
    else
      SYS_SOCKET_H='sys/socket.h'
!   fi
!   if test -n "$SYS_SOCKET_H"; then
!     dnl Check prerequisites of the <sys/socket.h> replacement.
      gl_CHECK_NEXT_HEADERS([sys/socket.h])
      if test $ac_cv_header_sys_socket_h = yes; then
        HAVE_SYS_SOCKET_H=1
*** modules/sys_socket.orig     2008-04-13 14:50:25.000000000 +0200
--- modules/sys_socket  2008-04-13 14:50:02.000000000 +0200
***************
*** 1,5 ****
  Description:
! A <sys/socket.h> for systems lacking it.
  
  Files:
  lib/sys_socket.in.h
--- 1,5 ----
  Description:
! A POSIX-like <sys/socket.h>.
  
  Files:
  lib/sys_socket.in.h





reply via email to

[Prev in Thread] Current Thread [Next in Thread]