immutable: Add tests.
[gnulib.git] / m4 / arpa_inet_h.m4
blobc4e386d1f8f281cf864996ce92cf83127ff3b9f4
1 # arpa_inet_h.m4 serial 14
2 dnl Copyright (C) 2006, 2008-2021 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.
7 dnl Written by Simon Josefsson and Bruno Haible
9 AC_DEFUN([gl_HEADER_ARPA_INET],
11   dnl Use AC_REQUIRE here, so that the default behavior below is expanded
12   dnl once only, before all statements that occur in other macros.
13   AC_REQUIRE([gl_ARPA_INET_H_DEFAULTS])
15   AC_CHECK_HEADERS_ONCE([arpa/inet.h])
16   if test $ac_cv_header_arpa_inet_h = yes; then
17     HAVE_ARPA_INET_H=1
18   else
19     HAVE_ARPA_INET_H=0
20   fi
21   AC_SUBST([HAVE_ARPA_INET_H])
22   dnl <arpa/inet.h> is always overridden, because of GNULIB_POSIXCHECK.
23   gl_CHECK_NEXT_HEADERS([arpa/inet.h])
25   AC_REQUIRE([gl_FEATURES_H])
27   gl_PREREQ_SYS_H_WS2TCPIP
29   dnl Check for declarations of anything we want to poison if the
30   dnl corresponding gnulib module is not in use.
31   gl_WARN_ON_USE_PREPARE([[
32 /* On some systems, this header is not self-consistent.  */
33 #if !(defined __GLIBC__ || defined __UCLIBC__)
34 # include <sys/socket.h>
35 #endif
36 #ifdef __TANDEM
37 # include <netdb.h>
38 #endif
39 #include <arpa/inet.h>
40     ]], [inet_ntop inet_pton])
43 AC_DEFUN([gl_ARPA_INET_MODULE_INDICATOR],
45   dnl Use AC_REQUIRE here, so that the default settings are expanded once only.
46   AC_REQUIRE([gl_ARPA_INET_H_DEFAULTS])
47   gl_MODULE_INDICATOR_SET_VARIABLE([$1])
50 AC_DEFUN([gl_ARPA_INET_H_DEFAULTS],
52   GNULIB_INET_NTOP=0;     AC_SUBST([GNULIB_INET_NTOP])
53   GNULIB_INET_PTON=0;     AC_SUBST([GNULIB_INET_PTON])
54   dnl Assume proper GNU behavior unless another module says otherwise.
55   HAVE_DECL_INET_NTOP=1;  AC_SUBST([HAVE_DECL_INET_NTOP])
56   HAVE_DECL_INET_PTON=1;  AC_SUBST([HAVE_DECL_INET_PTON])
57   REPLACE_INET_NTOP=0;    AC_SUBST([REPLACE_INET_NTOP])
58   REPLACE_INET_PTON=0;    AC_SUBST([REPLACE_INET_PTON])