summaryrefslogtreecommitdiff
path: root/configure.ac
diff options
context:
space:
mode:
authoryuangongji <yuangongji@foxmail.com>2020-03-14 11:13:38 +0800
committerAzat Khuzhin <azat@libevent.org>2020-03-17 21:43:05 +0300
commit6d54be2cc078351b4ce1e469bedc4a976f4e3636 (patch)
tree1e1c6cfe5943349349eb3636e8030375ee4715e0 /configure.ac
parent9a9b92ed06249be8326d82e2483b87e1a1b4caac (diff)
downloadlibevent-6d54be2cc078351b4ce1e469bedc4a976f4e3636.tar.gz
autoconf: fix getaddrinfo checking errors on mingw
`AC_CHECK_FUNCS` can not properly check `getaddrinfo` because this function requires some special headers on mingw. Using `AC_CHECK_DECL` can effectively solve this issue. Same for - getnameinfo - getprotobynumber - getservbyname - inet_ntop - inet_pton
Diffstat (limited to 'configure.ac')
-rw-r--r--configure.ac40
1 files changed, 30 insertions, 10 deletions
diff --git a/configure.ac b/configure.ac
index 31a6614d..3504d182 100644
--- a/configure.ac
+++ b/configure.ac
@@ -251,6 +251,7 @@ AC_CHECK_HEADERS([ \
sys/wait.h \
sys/random.h \
errno.h \
+ afunix.h \
])
case "${host_os}" in
@@ -347,7 +348,7 @@ AM_CONDITIONAL(BUILD_MIDIPIX, test x$midipix = xtrue)
AM_CONDITIONAL(BUILD_WITH_NO_UNDEFINED, test x$bwin32 = xtrue || test x$cygwin = xtrue || test x$midipix = xtrue)
if test x$bwin32 = xtrue; then
- AC_SEARCH_LIBS([getservbyname],[ws2_32])
+ AC_HAVE_LIBRARY([ws2_32])
fi
dnl Checks for typedefs, structures, and compiler characteristics.
@@ -367,11 +368,7 @@ AC_CHECK_FUNCS([ \
getegid \
geteuid \
getifaddrs \
- getnameinfo \
- getprotobynumber \
gettimeofday \
- inet_ntop \
- inet_pton \
issetugid \
mach_absolute_time \
mmap \
@@ -396,17 +393,36 @@ AC_CHECK_FUNCS([ \
unsetenv \
usleep \
vasprintf \
- getservbyname \
getrandom \
])
-AC_CHECK_FUNCS(_gmtime64_s, [have__gmtime64_s=yes], )
-if test "x$have__gmtime64_s" != "xyes"; then
- AC_CHECK_FUNCS(_gmtime64)
-fi
+AS_IF([test x$bwin32 = xtrue],
+ AC_CHECK_FUNCS(_gmtime64_s, , [AC_CHECK_FUNCS(_gmtime64)])
+)
AM_CONDITIONAL(STRLCPY_IMPL, [test x"$ac_cv_func_strlcpy" = xno])
+m4_define([funcstochk],
+ [getnameinfo
+ getprotobynumber
+ getservbyname
+ inet_ntop
+ inet_pton]
+)
+
+AS_IF([test x$bwin32 = xtrue],
+ [AX_CHECK_DECLS_EX([funcstochk getaddrinfo],
+ [#ifdef _WIN32
+ #include <winsock2.h>
+ #include <ws2tcpip.h>
+ #endif])],
+ [AC_CHECK_FUNCS(m4_normalize(funcstochk))]
+)
+
+m4_undefine([funcstochk])
+
+dnl check getaddrinfo and gethostbyname_r for non-windows
+AS_IF([test x$bwin32 = xfalse], [
AC_CACHE_CHECK(
[for getaddrinfo],
[libevent_cv_getaddrinfo],
@@ -486,6 +502,7 @@ AC_CHECK_FUNC(gethostbyname_r, [
])
fi
+]) dnl end of checking getaddrinfo and gethostbyname_r
AC_MSG_CHECKING(for F_SETFD in fcntl.h)
AC_EGREP_CPP(yes,
@@ -739,6 +756,9 @@ AC_CHECK_TYPES([struct linger],,,
#ifdef HAVE_SYS_SOCKET_H
#include <sys/socket.h>
#endif
+#ifdef _WIN32
+#include <winsock2.h>
+#endif
])
AC_MSG_CHECKING([for socklen_t])