Joachim Schmitz wrote: > Good question. In config.h I can only see: > > #define HOST_NAME_MAX > > So it gets #define'd but with no value > ... > Possibly because it does not #include <arpa/nameser.h>
<arpa/nameser.h> is such a rarely included header file that we can ignore it here, and simply use a fallback of 256 (which is the maximum value of MAXHOSTNAMELEN on any platform). I'm applying this: 2010-12-24 Bruno Haible <br...@clisp.org> gethostname: Provide a fallback for HOST_NAME_MAX. * m4/gethostname.m4 (gl_FUNC_GETHOSTNAME): When neither HOST_NAME_MAX nor MAXHOSTNAMELEN is found in the usual system headers, use 256 instead. Reported by Joachim Schmitz <j...@schmitz-digital.de>. --- m4/gethostname.m4.orig Fri Dec 24 13:51:48 2010 +++ m4/gethostname.m4 Fri Dec 24 13:50:52 2010 @@ -1,5 +1,5 @@ -# gethostname.m4 serial 9 -dnl Copyright (C) 2002, 2008, 2009, 2010 Free Software Foundation, Inc. +# gethostname.m4 serial 10 +dnl Copyright (C) 2002, 2008-2010 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. @@ -83,7 +83,11 @@ #if HAVE_NETDB_H # include <netdb.h> #endif -]) +], + [dnl The system does not define MAXHOSTNAMELEN in any of the common + dnl headers. Use a safe fallback. + gl_cv_decl_HOST_NAME_MAX=256 + ]) fi fi ])