From: Ruediger Meier <ruediger.me...@ga-group.nl> We want to use it later to do checks for getaddrinfo and getnameinfo more portable. --- acinclude.m4 | 57 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 57 insertions(+), 0 deletions(-)
diff --git a/acinclude.m4 b/acinclude.m4 index d91c733..38d1819 100644 --- a/acinclude.m4 +++ b/acinclude.m4 @@ -486,6 +486,63 @@ AC_DEFUN([SANE_CHECK_GPHOTO2], ]) # +# Checks for functions which comming usually from netdb.h or ws2tcpip.h (e.g. +# getaddrinfo). Header checks have to be done before as well as adding the right +# libs +AC_DEFUN([SANE_CHECK_NETDB_FUNC], +[ + sane_netdb_includes="$ac_includes_default + #ifdef HAVE_SYS_SOCKET_H + # include <sys/socket.h> + #endif + #ifdef HAVE_NETDB_H + # include <netdb.h> + #endif + #ifdef HAVE_WINSOCK2_H + # include <winsock2.h> + #endif + #ifdef HAVE_WS2TCPIP_H + # include <ws2tcpip.h> + #endif" + + ac_cv_func_$1="no" + need_winver_xp="no" + + AC_MSG_CHECKING([for win32 ]$1) + AC_TRY_COMPILE( + [$sane_netdb_includes], + [int testme(){ ]$1[; }], + [AC_MSG_RESULT(yes) + ac_cv_func_$1="yes"], + [AC_MSG_RESULT(no)]) + + dnl Under mingw, we may need to set WINVER to 0x0501 to expose the function. + if test "$ac_cv_func_$1" != "yes"; then + AC_MSG_CHECKING([for win32 ]$1[ if WINVER is 0x0501]) + AC_TRY_COMPILE( + [#define WINVER 0x0501 + $sane_netdb_includes], + [int testme(){ ]$1[; }], + [AC_MSG_RESULT(yes) + ac_cv_func_$1="yes" + need_winver_xp="yes"], + [AC_MSG_RESULT(no)]) + fi + + if test "$ac_cv_func_$1" = "yes"; then + AC_DEFINE([HAVE_]translit($1, [a-z], [A-Z]), [1], + [Define to 1 if you have the `]$1[' function.]) + + if test "$need_winver_xp" = "yes"; then + AC_DEFINE([NEED_WINVER_XP], [1], + [Define to 1 if some win32 functions needs WINVER set.]) + fi + fi + + unset sane_netdb_includes +]) + +# # Check for AF_INET6, determines whether or not to enable IPv6 support # Check for ss_family member in struct sockaddr_storage AC_DEFUN([SANE_CHECK_IPV6], -- 1.7.6.1