VirtualBox

source: kBuild/trunk/src/grep/m4/inet_pton.m4

Last change on this file was 3529, checked in by bird, 3 years ago

Imported grep 3.7 from grep-3.7.tar.gz (sha256: c22b0cf2d4f6bbe599c902387e8058990e1eee99aef333a203829e5fd3dbb342), applying minimal auto-props.

  • Property svn:eol-style set to LF
File size: 2.3 KB
Line 
1# inet_pton.m4 serial 19
2dnl Copyright (C) 2006, 2008-2021 Free Software Foundation, Inc.
3dnl This file is free software; the Free Software Foundation
4dnl gives unlimited permission to copy and/or distribute it,
5dnl with or without modifications, as long as this notice is preserved.
6
7AC_DEFUN([gl_FUNC_INET_PTON],
8[
9 AC_REQUIRE([gl_ARPA_INET_H_DEFAULTS])
10
11 dnl Persuade Solaris <arpa/inet.h> to declare inet_pton.
12 AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS])
13
14 AC_REQUIRE([AC_C_RESTRICT])
15
16 dnl Most platforms that provide inet_pton define it in libc.
17 dnl Solaris 8..10 provide inet_pton in libnsl instead.
18 dnl Solaris 2.6..7 provide inet_pton in libresolv instead.
19 dnl Haiku provides it in -lnetwork.
20 dnl Native Windows provides it in -lws2_32 instead, with a declaration in
21 dnl <ws2tcpip.h>, and it uses stdcall calling convention, not cdecl
22 dnl (hence we cannot use AC_CHECK_FUNCS, AC_SEARCH_LIBS to find it).
23 HAVE_INET_PTON=1
24 INET_PTON_LIB=
25 gl_PREREQ_SYS_H_WINSOCK2
26 if test $HAVE_WINSOCK2_H = 1; then
27 dnl It needs to be overridden, because the stdcall calling convention
28 dnl is not compliant with POSIX. Set REPLACE_INET_PTON in order to avoid
29 dnl a name conflict at the linker level, even though the header file
30 dnl <ws2tcpip.h> declares inet_pton only if _WIN32_WINNT >= 0x0600.
31 REPLACE_INET_PTON=1
32 AC_CHECK_DECLS([inet_pton],,, [[#include <ws2tcpip.h>]])
33 if test $ac_cv_have_decl_inet_pton = yes; then
34 INET_PTON_LIB="-lws2_32"
35 else
36 HAVE_DECL_INET_PTON=0
37 fi
38 else
39 gl_save_LIBS=$LIBS
40 AC_SEARCH_LIBS([inet_pton], [nsl resolv network], [],
41 [AC_CHECK_FUNCS([inet_pton])
42 if test $ac_cv_func_inet_pton = no; then
43 HAVE_INET_PTON=0
44 fi
45 ])
46 LIBS=$gl_save_LIBS
47
48 if test "$ac_cv_search_inet_pton" != "no" \
49 && test "$ac_cv_search_inet_pton" != "none required"; then
50 INET_PTON_LIB="$ac_cv_search_inet_pton"
51 fi
52
53 AC_CHECK_HEADERS_ONCE([netdb.h])
54 AC_CHECK_DECLS([inet_pton],,,
55 [[#include <arpa/inet.h>
56 #if HAVE_NETDB_H
57 # include <netdb.h>
58 #endif
59 ]])
60 if test $ac_cv_have_decl_inet_pton = no; then
61 HAVE_DECL_INET_PTON=0
62 fi
63 fi
64 AC_SUBST([INET_PTON_LIB])
65])
66
67# Prerequisites of lib/inet_pton.c.
68AC_DEFUN([gl_PREREQ_INET_PTON], [
69 AC_REQUIRE([gl_SOCKET_FAMILIES])
70])
Note: See TracBrowser for help on using the repository browser.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette