diff options
author | yuangongji <yuangongji@foxmail.com> | 2020-03-14 11:13:38 +0800 |
---|---|---|
committer | Azat Khuzhin <azat@libevent.org> | 2020-03-17 21:43:05 +0300 |
commit | 6d54be2cc078351b4ce1e469bedc4a976f4e3636 (patch) | |
tree | 1e1c6cfe5943349349eb3636e8030375ee4715e0 /m4 | |
parent | 9a9b92ed06249be8326d82e2483b87e1a1b4caac (diff) | |
download | libevent-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 'm4')
-rw-r--r-- | m4/ax_check_funcs_ex.m4 | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/m4/ax_check_funcs_ex.m4 b/m4/ax_check_funcs_ex.m4 new file mode 100644 index 00000000..7aaa58b0 --- /dev/null +++ b/m4/ax_check_funcs_ex.m4 @@ -0,0 +1,22 @@ +# Check if the function is available. +# HAVE_XXX will be defined if yes. + +# $1: the name of function +# $2: the headers in where the function declared +AC_DEFUN([AX_CHECK_DECL_EX], [dnl + AS_IF([test "x$2" = "x"], [AC_MSG_ERROR([header not privided])]) + AS_VAR_PUSHDEF([have_func_var], [HAVE_[]m4_toupper($1)]) + AC_CHECK_DECL([$1],dnl + [AC_DEFINE([have_func_var], [1], [Define to 1 if you have the `$1' function.])],,dnl + [$2]dnl + ) + AS_VAR_POPDEF([have_func_var])dnl +]) + +AC_DEFUN([AX_CHECK_DECLS_EX], [dnl + AS_IF([test "x$2" = "x"], [AC_MSG_ERROR([header not privided])]) + m4_foreach([decl],dnl + m4_split(m4_normalize($1)),dnl + [AX_CHECK_DECL_EX([decl], [$2])]dnl + ) +]) |