0001-host2ip.c-disable-NIS-support-for-toolchains-lacking.patch 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  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
  5. Some toolchains are missing SUN RPC; this is the case for toolchains
  6. based on uClibc, and some glibc-based toolchains (when SUN RPC headers
  7. were taken out of glibc).
  8. Add a configure check for the required SUN RPC header, and make the code
  9. using SUN RPC conditional on the result.
  10. Also drop the legacy AM_C_PROTOTYPES: it is no longer supported by
  11. autoconf and breaks autoreconf.
  12. Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
  13. [yann.morin.1998@free.fr: add the ./configure check; do not include
  14. features.h; do not check specifically for uClibc]
  15. Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
  16. ---
  17. configure.in | 3 ++-
  18. host2ip.c | 5 +++++
  19. 2 files changed, 7 insertions(+), 1 deletion(-)
  20. diff --git a/configure.in b/configure.in
  21. index de394cf..889e6ed 100644
  22. --- a/configure.in
  23. +++ b/configure.in
  24. @@ -39,9 +39,10 @@ CU_CHECK_LIB(socket, socket)
  25. dnl Checks for header files.
  26. AC_HEADER_STDC
  27. AC_CHECK_HEADERS(search.h sys/time.h unistd.h)
  28. +AC_CHECK_HEADER([rpcsvc/ypclnt.h],
  29. + [AC_DEFINE([HAVE_YP],[1],[Define to 1 if you have rpcsvc/ypclnt.h])])
  30. dnl Checks for typedefs, structures, and compiler characteristics.
  31. -AM_C_PROTOTYPES
  32. AC_C_CONST
  33. AC_C_BIGENDIAN
  34. AC_TYPE_UID_T
  35. diff --git a/host2ip.c b/host2ip.c
  36. index b094343..95014cd 100644
  37. --- a/host2ip.c
  38. +++ b/host2ip.c
  39. @@ -3,7 +3,10 @@
  40. #include <netdb.h> /* gethostbyname() */
  41. #include <netinet/in.h> /* sockaddr_in */
  42. #include <arpa/inet.h> /* inet_addr() */
  43. +#ifdef HAVE_YP
  44. #include <rpcsvc/ypclnt.h> /* YP */
  45. +#endif
  46. +
  47. #include <string.h> /* strlen() added by Akira 12/27/01 */
  48. #include "sysdep.h"
  49. @@ -28,6 +31,7 @@ struct in_addr host2ip(char *host)
  50. else if ((hep = gethostbyname(host))) {
  51. in = *(struct in_addr *)(hep->h_addr_list[0]);
  52. }
  53. +#ifdef HAVE_YP
  54. /* As a last resort, try YP. */
  55. else {
  56. static char *domain = 0; /* YP domain */
  57. @@ -39,5 +43,6 @@ struct in_addr host2ip(char *host)
  58. in.s_addr = inet_addr(value);
  59. }
  60. }
  61. +#endif
  62. return in;
  63. } /* host2ip */
  64. --
  65. 1.9.1