diff options
author | Alexander Nozdrin <alik@sun.com> | 2010-05-21 17:17:01 +0400 |
---|---|---|
committer | Alexander Nozdrin <alik@sun.com> | 2010-05-21 17:17:01 +0400 |
commit | 9003fb7cad18d091ee9f94c72f7304c2f6c4f6e5 (patch) | |
tree | cee7c59ceb75b7c60315f06eaa747756fbebeb97 /configure.in | |
parent | 44486663e2dffe756918b8efc226af1716872f8c (diff) | |
download | mariadb-git-9003fb7cad18d091ee9f94c72f7304c2f6c4f6e5.tar.gz |
Fix for Bug#52923 (Inadequate documentation of "Can't get hostname for your address" error).
The thing is that on some platforms (e.g. Mac OS X) sockaddr_in / sockaddr_in6
contain a non-standard field (sin_len / sin6_len), that must be set.
The problem was that only standard fields were set, thus getnameinfo() returned
EAI_SYSTEM instead of EAI_NONAME.
The fix is to introduce configure-time checks (for GNU auto-tools and CMake) for
those additional fields and to set them if they are available.
Diffstat (limited to 'configure.in')
-rw-r--r-- | configure.in | 61 |
1 files changed, 61 insertions, 0 deletions
diff --git a/configure.in b/configure.in index ec74b15efb0..7b84dbe9631 100644 --- a/configure.in +++ b/configure.in @@ -1012,6 +1012,66 @@ else AC_MSG_RESULT([yes]) fi +#-------------------------------------------------------------------------- +# Check if struct sockaddr_in::sin_len is available +#-------------------------------------------------------------------------- + +AC_CACHE_CHECK( + [if sockaddr_in::sin_len is available], + mysql_cv_have_sockaddr_in_sin_len, + AC_TRY_COMPILE( + [ + #ifdef WIN32 + #include <winsock2.h> + #else + #include <sys/types.h> + #include <netinet/in.h> + #include <sys/socket.h> + #endif + ], + [unsigned int i = sizeof(((struct sockaddr_in *) 0)->sin_len)], + mysql_cv_have_sockaddr_in_sin_len=yes, + mysql_cv_have_sockaddr_in_sin_len=no)) + +if test "$mysql_cv_have_sockaddr_in_sin_len" = "yes"; then + AC_DEFINE( + [HAVE_SOCKADDR_IN_SIN_LEN], + [1], + [If sockaddr_in::sin_len is available]) +fi + +#-------------------------------------------------------------------------- +# Check if struct sockaddr_in6::sin6_len is available +#-------------------------------------------------------------------------- + +AC_CACHE_CHECK( + [if sockaddr_in6::sin6_len is available], + mysql_cv_have_sockaddr_in6_sin6_len, + AC_TRY_COMPILE( + [ + #ifdef WIN32 + #include <winsock2.h> + #else + #include <sys/types.h> + #include <netinet/in.h> + #include <sys/socket.h> + #endif + + #ifdef HAVE_NETINET_IN6_H + #include <netinet/in6.h> + #endif + ], + [unsigned int i = sizeof(((struct sockaddr_in6 *) 0)->sin6_len)], + mysql_cv_have_sockaddr_in6_sin6_len=yes, + mysql_cv_have_sockaddr_in6_sin6_len=no)) + +if test "$mysql_cv_have_sockaddr_in_sin6_len" = "yes"; then + AC_DEFINE( + [HAVE_SOCKADDR_IN6_SIN6_LEN], + [1], + [If sockaddr_in6::sin6_len is available]) +fi + #-------------------------------------------------------------------- # Check for TCP wrapper support #-------------------------------------------------------------------- @@ -3121,6 +3181,7 @@ esac AC_SUBST([RDTSC_SPARC_ASSEMBLY]) + #-------------------------------------------------------------------- # Output results #-------------------------------------------------------------------- |