bug-gnulib
[Top][All Lists]
Advanced

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

Re: inet_ntop fix for mingw32


From: Bruno Haible
Subject: Re: inet_ntop fix for mingw32
Date: Wed, 18 Jan 2006 14:02:12 +0100
User-agent: KMail/1.5

Simon Josefsson wrote:
> This fixes the socklen M4 test.  It more or less duplicate the
> sys_socket module but I don't see any other way around it.

Duplication of code always leads to maintenance problems. Not sometimes.
Always. (I tried it often enough ;-))

Already in this patch it is not clear why the replacement socket_.h
includes <winsock2.h> but socklen.m4 doesn't. It is probably because
on current mingw systems, <winsock2.h> doesn't define socklen_t.
They only need to reshuffle their include files a bit, to break
our macro.

How about this? (Untested.)

Bruno


*** socklen.m4  2 Dec 2005 18:23:00 -0000       1.3
--- socklen.m4  18 Jan 2006 13:08:44 -0000
***************
*** 1,5 ****
! # socklen.m4 serial 2
! dnl Copyright (C) 2005 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 ----
! # socklen.m4 serial 3
! dnl Copyright (C) 2005-2006 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.
***************
*** 11,17 ****
  dnl types for the argument to getsockopt, getpeername, etc.  So we
  dnl have to test to find something that will work.
  AC_DEFUN([gl_TYPE_SOCKLEN_T],
!   [AC_CHECK_TYPE([socklen_t], ,
       [AC_MSG_CHECKING([for socklen_t equivalent])
        AC_CACHE_VAL([gl_cv_gl_cv_socklen_t_equiv],
          [# Systems have either "struct sockaddr *" or
--- 11,18 ----
  dnl types for the argument to getsockopt, getpeername, etc.  So we
  dnl have to test to find something that will work.
  AC_DEFUN([gl_TYPE_SOCKLEN_T],
!   [AC_REQUIRE([gl_HEADER_SYS_SOCKET])
!    AC_CHECK_TYPE([socklen_t], ,
       [AC_MSG_CHECKING([for socklen_t equivalent])
        AC_CACHE_VAL([gl_cv_gl_cv_socklen_t_equiv],
          [# Systems have either "struct sockaddr *" or
***************
*** 21,28 ****
           for t in int size_t "unsigned int" "long int" "unsigned long int"; do
             AC_TRY_COMPILE(
               [#include <sys/types.h>
!               #include <sys/socket.h>
! 
                int getpeername (int, $arg2 *, $t *);],
                 [$t len;
                getpeername (0, 0, &len);],
--- 22,32 ----
           for t in int size_t "unsigned int" "long int" "unsigned long int"; do
             AC_TRY_COMPILE(
               [#include <sys/types.h>
!               #if HAVE_SYS_SOCKET_H
!               # include <sys/socket.h>
!               #else
!               # include "socket_.h"
!               #endif
                int getpeername (int, $arg2 *, $t *);],
                 [$t len;
                getpeername (0, 0, &len);],






reply via email to

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