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