diff options
Diffstat (limited to 'gl/m4/gethostname.m4')
-rw-r--r-- | gl/m4/gethostname.m4 | 20 |
1 files changed, 13 insertions, 7 deletions
diff --git a/gl/m4/gethostname.m4 b/gl/m4/gethostname.m4 index ef0b43ef..7413f9e3 100644 --- a/gl/m4/gethostname.m4 +++ b/gl/m4/gethostname.m4 | |||
@@ -1,5 +1,5 @@ | |||
1 | # gethostname.m4 serial 9 | 1 | # gethostname.m4 serial 13 |
2 | dnl Copyright (C) 2002, 2008, 2009, 2010 Free Software Foundation, Inc. | 2 | dnl Copyright (C) 2002, 2008-2013 Free Software Foundation, Inc. |
3 | dnl This file is free software; the Free Software Foundation | 3 | dnl This file is free software; the Free Software Foundation |
4 | dnl gives unlimited permission to copy and/or distribute it, | 4 | dnl gives unlimited permission to copy and/or distribute it, |
5 | dnl with or without modifications, as long as this notice is preserved. | 5 | dnl with or without modifications, as long as this notice is preserved. |
@@ -14,7 +14,7 @@ AC_DEFUN([gl_FUNC_GETHOSTNAME], | |||
14 | 14 | ||
15 | dnl Where is gethostname() defined? | 15 | dnl Where is gethostname() defined? |
16 | dnl - On native Windows, it is in ws2_32.dll. | 16 | dnl - On native Windows, it is in ws2_32.dll. |
17 | dnl - Otherwise is is in libc. | 17 | dnl - Otherwise it is in libc. |
18 | GETHOSTNAME_LIB= | 18 | GETHOSTNAME_LIB= |
19 | AC_CHECK_FUNCS([gethostname], , [ | 19 | AC_CHECK_FUNCS([gethostname], , [ |
20 | AC_CACHE_CHECK([for gethostname in winsock2.h and -lws2_32], | 20 | AC_CACHE_CHECK([for gethostname in winsock2.h and -lws2_32], |
@@ -37,12 +37,14 @@ AC_DEFUN([gl_FUNC_GETHOSTNAME], | |||
37 | AC_SUBST([GETHOSTNAME_LIB]) | 37 | AC_SUBST([GETHOSTNAME_LIB]) |
38 | 38 | ||
39 | if test "$ac_cv_func_gethostname" = no; then | 39 | if test "$ac_cv_func_gethostname" = no; then |
40 | AC_LIBOBJ([gethostname]) | ||
41 | HAVE_GETHOSTNAME=0 | 40 | HAVE_GETHOSTNAME=0 |
42 | gl_PREREQ_GETHOSTNAME | ||
43 | fi | 41 | fi |
44 | 42 | ||
45 | dnl Also provide HOST_NAME_MAX when <limits.h> lacks it. | 43 | gl_PREREQ_HOST_NAME_MAX |
44 | ]) | ||
45 | |||
46 | # Provide HOST_NAME_MAX when <limits.h> lacks it. | ||
47 | AC_DEFUN([gl_PREREQ_HOST_NAME_MAX], [ | ||
46 | dnl - On most Unix systems, use MAXHOSTNAMELEN from <sys/param.h> instead. | 48 | dnl - On most Unix systems, use MAXHOSTNAMELEN from <sys/param.h> instead. |
47 | dnl - On Solaris, Cygwin, BeOS, use MAXHOSTNAMELEN from <netdb.h> instead. | 49 | dnl - On Solaris, Cygwin, BeOS, use MAXHOSTNAMELEN from <netdb.h> instead. |
48 | dnl - On mingw, use 256, because | 50 | dnl - On mingw, use 256, because |
@@ -83,7 +85,11 @@ lucky | |||
83 | #if HAVE_NETDB_H | 85 | #if HAVE_NETDB_H |
84 | # include <netdb.h> | 86 | # include <netdb.h> |
85 | #endif | 87 | #endif |
86 | ]) | 88 | ], |
89 | [dnl The system does not define MAXHOSTNAMELEN in any of the common | ||
90 | dnl headers. Use a safe fallback. | ||
91 | gl_cv_decl_HOST_NAME_MAX=256 | ||
92 | ]) | ||
87 | fi | 93 | fi |
88 | fi | 94 | fi |
89 | ]) | 95 | ]) |