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