arpa_inet_h.m4 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. # arpa_inet_h.m4 serial 17
  2. dnl Copyright (C) 2006, 2008-2023 Free Software Foundation, Inc.
  3. dnl This file is free software; the Free Software Foundation
  4. dnl gives unlimited permission to copy and/or distribute it,
  5. dnl with or without modifications, as long as this notice is preserved.
  6. dnl Written by Simon Josefsson and Bruno Haible
  7. AC_DEFUN_ONCE([gl_ARPA_INET_H],
  8. [
  9. dnl Ensure to expand the default settings once only, before all statements
  10. dnl that occur in other macros.
  11. AC_REQUIRE([gl_ARPA_INET_H_DEFAULTS])
  12. AC_CHECK_HEADERS_ONCE([arpa/inet.h])
  13. if test $ac_cv_header_arpa_inet_h = yes; then
  14. HAVE_ARPA_INET_H=1
  15. else
  16. HAVE_ARPA_INET_H=0
  17. fi
  18. AC_SUBST([HAVE_ARPA_INET_H])
  19. dnl <arpa/inet.h> is always overridden, because of GNULIB_POSIXCHECK.
  20. gl_CHECK_NEXT_HEADERS([arpa/inet.h])
  21. AC_REQUIRE([gl_FEATURES_H])
  22. gl_PREREQ_SYS_H_WS2TCPIP
  23. dnl Check for declarations of anything we want to poison if the
  24. dnl corresponding gnulib module is not in use.
  25. gl_WARN_ON_USE_PREPARE([[
  26. /* On some systems, this header is not self-consistent. */
  27. #if !(defined __GLIBC__ || defined __UCLIBC__)
  28. # include <sys/socket.h>
  29. #endif
  30. #ifdef __TANDEM
  31. # include <netdb.h>
  32. #endif
  33. #include <arpa/inet.h>
  34. ]], [inet_ntop inet_pton])
  35. ])
  36. # gl_ARPA_INET_MODULE_INDICATOR([modulename])
  37. # sets the shell variable that indicates the presence of the given module
  38. # to a C preprocessor expression that will evaluate to 1.
  39. # This macro invocation must not occur in macros that are AC_REQUIREd.
  40. AC_DEFUN([gl_ARPA_INET_MODULE_INDICATOR],
  41. [
  42. dnl Ensure to expand the default settings once only.
  43. gl_ARPA_INET_H_REQUIRE_DEFAULTS
  44. gl_MODULE_INDICATOR_SET_VARIABLE([$1])
  45. ])
  46. # Initializes the default values for AC_SUBSTed shell variables.
  47. # This macro must not be AC_REQUIREd. It must only be invoked, and only
  48. # outside of macros or in macros that are not AC_REQUIREd.
  49. AC_DEFUN([gl_ARPA_INET_H_REQUIRE_DEFAULTS],
  50. [
  51. m4_defun(GL_MODULE_INDICATOR_PREFIX[_ARPA_INET_H_MODULE_INDICATOR_DEFAULTS], [
  52. gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_INET_NTOP])
  53. gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_INET_PTON])
  54. ])
  55. m4_require(GL_MODULE_INDICATOR_PREFIX[_ARPA_INET_H_MODULE_INDICATOR_DEFAULTS])
  56. AC_REQUIRE([gl_ARPA_INET_H_DEFAULTS])
  57. ])
  58. AC_DEFUN([gl_ARPA_INET_H_DEFAULTS],
  59. [
  60. dnl Assume proper GNU behavior unless another module says otherwise.
  61. HAVE_DECL_INET_NTOP=1; AC_SUBST([HAVE_DECL_INET_NTOP])
  62. HAVE_DECL_INET_PTON=1; AC_SUBST([HAVE_DECL_INET_PTON])
  63. REPLACE_INET_NTOP=0; AC_SUBST([REPLACE_INET_NTOP])
  64. REPLACE_INET_PTON=0; AC_SUBST([REPLACE_INET_PTON])
  65. ])