bug-gnulib
[Top][All Lists]
Advanced

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

Re: Incorrect detection of member sa_len.


From: Bruno Haible
Subject: Re: Incorrect detection of member sa_len.
Date: Sun, 10 Apr 2011 13:21:50 +0200
User-agent: KMail/1.9.9

Hello Ralf,

> > Any BSD system must include `<sys/types.h>` in order for the test
> > code to deliver a trustworthy answer. As always this header must
> > precede `<sys/socket.h>` on any BSD system.
>
> The test should be using AC_INCLUDES_DEFAULT, no?  That takes care of
> sys/types.h:
> 
> AC_CHECK_MEMBERS([struct sockaddr.sa_len], , ,
>   [AC_INCLUDES_DEFAULT
>    [#include <sys/socket.h>
>   ]])

No, the use of AC_INCLUDES_DEFAULT is not very appropriate in gnulib.

AC_INCLUDES_DEFAULT was a useful catch-all before gnulib, for common
functions and types that different systems defined in different header files.

In gnulib:

  1. We have an extensive documentation which functions are defined in which
     header files [1] and which header files have which problems [2], so
     we don't need a catch-all any more.

  2. We need the precise information. Assume that above test with succeed
     because of <stdint.h> or <unistd.h>, not because of <sys/types.h>, on
     some other platform. We need to know this, because then gnulib's
     sys_socket.in.h needs to include <stdint.h> or <unistd.h>, which it
     doesn't do now. It is good if a wrong configure test result alerts us
     that something is missing, rather than if programs like inetutils
     would not compile on specific platforms - which is harder to debug
     (use of "gcc -E" and similar).

Also, AC_INCLUDES_DEFAULT does not include <stdbool.h>, <signal.h>,
<sys/socket.h>, and others. So it's fallacious to think that
AC_INCLUDES_DEFAULT can be reliably used for any purpose. It's better
if people learn to look up POSIX and the gnulib documentation.

Currently gnulib has 23 uses of AC_INCLUDES_DEFAULT, compared to 293 uses
of AC_LANG_PROGRAM and 125 uses of AC_CHECK_HEADERS. It would be possible
to eliminate all uses of AC_INCLUDES_DEFAULT, but it is not high priority.

Bruno

[1] 
http://www.gnu.org/software/gnulib/manual/html_node/Function-Substitutes.html
[2] 
http://www.gnu.org/software/gnulib/manual/html_node/Header-File-Substitutes.html
-- 
In memoriam Hendrik Nicolaas Werkman 
<http://en.wikipedia.org/wiki/Hendrik_Nicolaas_Werkman>



reply via email to

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