File: getaddrinfo.m4

package info (click to toggle)
ctdb 1.0.112-12-3
  • links: PTS, VCS
  • area: main
  • in suites: squeeze
  • size: 4,292 kB
  • ctags: 4,779
  • sloc: ansic: 43,144; sh: 10,967; xml: 3,034; makefile: 451; perl: 107; python: 101; awk: 59
file content (32 lines) | stat: -rw-r--r-- 945 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
dnl test for getaddrinfo/getnameinfo
AC_CACHE_CHECK([for getaddrinfo],libreplace_cv_HAVE_GETADDRINFO,[
AC_TRY_LINK([
#include <sys/types.h>
#if STDC_HEADERS
#include <stdlib.h>
#include <stddef.h>
#endif
#include <sys/socket.h>
#include <netdb.h>],
[
struct sockaddr sa;
struct addrinfo *ai = NULL;
int ret = getaddrinfo(NULL, NULL, NULL, &ai);
if (ret != 0) {
	const char *es = gai_strerror(ret);
}
freeaddrinfo(ai);
ret = getnameinfo(&sa, sizeof(sa),
		NULL, 0,
		NULL, 0, 0);

],
libreplace_cv_HAVE_GETADDRINFO=yes,libreplace_cv_HAVE_GETADDRINFO=no)])
if test x"$libreplace_cv_HAVE_GETADDRINFO" = x"yes"; then
	AC_DEFINE(HAVE_GETADDRINFO,1,[Whether the system has getaddrinfo])
	AC_DEFINE(HAVE_GETNAMEINFO,1,[Whether the system has getnameinfo])
	AC_DEFINE(HAVE_FREEADDRINFO,1,[Whether the system has freeaddrinfo])
	AC_DEFINE(HAVE_GAI_STRERROR,1,[Whether the system has gai_strerror])
else
	LIBREPLACEOBJ="${LIBREPLACEOBJ} getaddrinfo.o"
fi