1 From f8ffde6c0c0a9008cd65601f6c9712899106e42c Mon Sep 17 00:00:00 2001
2 From: "Yann E. MORIN" <yann.morin.1998@free.fr>
3 Date: Mon, 11 Apr 2016 23:03:48 +0200
4 Subject: [PATCH] host2ip.c: disable NIS support for toolchains lacking SUN RPC
6 Some toolchains are missing SUN RPC; this is the case for toolchains
7 based on uClibc, and some glibc-based toolchains (when SUN RPC headers
8 were taken out of glibc).
10 Add a configure check for the required SUN RPC header, and make the code
11 using SUN RPC conditional on the result.
13 Also drop the legacy AM_C_PROTOTYPES: it is no longer supported by
14 autoconf and breaks autoreconf.
16 Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
17 [yann.morin.1998@free.fr: add the ./configure check; do not include
18 features.h; do not check specifically for uClibc]
19 Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
23 2 files changed, 7 insertions(+), 1 deletion(-)
25 diff --git a/configure.in b/configure.in
26 index de394cf..889e6ed 100644
29 @@ -39,9 +39,10 @@ CU_CHECK_LIB(socket, socket)
30 dnl Checks for header files.
32 AC_CHECK_HEADERS(search.h sys/time.h unistd.h)
33 +AC_CHECK_HEADER([rpcsvc/ypclnt.h],
34 + [AC_DEFINE([HAVE_YP],[1],[Define to 1 if you have rpcsvc/ypclnt.h])])
36 dnl Checks for typedefs, structures, and compiler characteristics.
41 diff --git a/host2ip.c b/host2ip.c
42 index b094343..95014cd 100644
46 #include <netdb.h> /* gethostbyname() */
47 #include <netinet/in.h> /* sockaddr_in */
48 #include <arpa/inet.h> /* inet_addr() */
50 #include <rpcsvc/ypclnt.h> /* YP */
53 #include <string.h> /* strlen() added by Akira 12/27/01 */
56 @@ -28,6 +31,7 @@ struct in_addr host2ip(char *host)
57 else if ((hep = gethostbyname(host))) {
58 in = *(struct in_addr *)(hep->h_addr_list[0]);
61 /* As a last resort, try YP. */
63 static char *domain = 0; /* YP domain */
64 @@ -39,5 +43,6 @@ struct in_addr host2ip(char *host)
65 in.s_addr = inet_addr(value);