On Sun, Aug 02, 2009 at 03:31:24PM +0200, Bruno Haible wrote: > > 2009-08-02 Simon Josefsson <si...@josefsson.org> > > Bruno Haible <br...@clisp.org> > > > > Ensure HOST_NAME_MAX as part of the gethostname module. > > * m4/gethostname.m4 (gl_FUNC_GETHOSTNAME): On native Windows platforms, > > define also HOST_NAME_MAX. > > * tests/test-gethostname.c (main): Check also HOST_NAME_MAX. > > * doc/posix-headers/limits.texi: Document the mingw problem. > > Well, that led to a compilation error on Linux: > > test-gethostname.c: In function ‘main’: > test-gethostname.c:31: error: ‘HOST_NAME_MAX’ undeclared (first use in this > function) > test-gethostname.c:31: error: (Each undeclared identifier is reported only > once > test-gethostname.c:31: error: for each function it appears in.) > > Fixed as follows: > It assumes that only win32 lacks HOST_NAME_MAX which is not true.
The daily gnulib snapshot from Simon fails thusly on sparc-sun-solaris2.6: test-gethostname.c: In function 'main': test-gethostname.c:34: error: 'HOST_NAME_MAX' undeclared (first use in this function) test-gethostname.c:34: error: (Each undeclared identifier is reported only once test-gethostname.c:34: error: for each function it appears in.) After googling a bit and checking some of the hosts I have access to it seems atleast IRIX, Solaris, OS X 10.5 and FreeBSD does not define HOST_NAME_MAX directly. On Solaris 10 the value is available from getconf: $ getconf HOST_NAME_MAX 255 On Solaris < 10 there is MAXHOSTNAMELEN in <netdb.h> that could perhaps be used to define HOST_NAME_MAX. IRIX also defines MAXHOSTNAMELEN but in <sys/param.h>. -tgc