~ubuntu-branches/ubuntu/utopic/coreutils/utopic-proposed

« back to all changes in this revision

Viewing changes to m4/inet_pton.m4

  • Committer: Package Import Robot
  • Author(s): Colin Watson
  • Date: 2012-11-28 03:03:42 UTC
  • mfrom: (8.3.4 sid)
  • Revision ID: package-import@ubuntu.com-20121128030342-21zanj8354gas5gr
Tags: 8.20-3ubuntu1
* Resynchronise with Debian.  Remaining changes:
  - Make 'uname -i -p' return the real processor/hardware, instead of
    unknown.
  - Build-depend on gettext:any instead of on gettext, so that apt-get can
    properly resolve build-dependencies on the tool when cross-building.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# inet_pton.m4 serial 13
2
 
dnl Copyright (C) 2006, 2008-2011 Free Software Foundation, Inc.
 
1
# inet_pton.m4 serial 17
 
2
dnl Copyright (C) 2006, 2008-2012 Free Software Foundation, Inc.
3
3
dnl This file is free software; the Free Software Foundation
4
4
dnl gives unlimited permission to copy and/or distribute it,
5
5
dnl with or without modifications, as long as this notice is preserved.
6
6
 
7
7
AC_DEFUN([gl_FUNC_INET_PTON],
8
8
[
 
9
  AC_REQUIRE([gl_ARPA_INET_H_DEFAULTS])
 
10
 
9
11
  dnl Persuade Solaris <arpa/inet.h> to declare inet_pton.
10
12
  AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS])
11
13
 
 
14
  AC_REQUIRE([AC_C_RESTRICT])
 
15
 
12
16
  dnl Most platforms that provide inet_pton define it in libc.
13
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 Native Windows provides it in -lws2_32 instead, with a declaration in
 
20
  dnl <ws2tcpip.h>, and it uses stdcall calling convention, not cdecl
 
21
  dnl (hence we cannot use AC_CHECK_FUNCS, AC_SEARCH_LIBS to find it).
14
22
  HAVE_INET_PTON=1
15
 
  gl_save_LIBS=$LIBS
16
 
  AC_SEARCH_LIBS([inet_pton], [nsl], [],
17
 
    [AC_CHECK_FUNCS([inet_pton])
18
 
     if test $ac_cv_func_inet_pton = no; then
19
 
       HAVE_INET_PTON=0
20
 
     fi
21
 
    ])
22
 
  LIBS=$gl_save_LIBS
23
 
 
24
23
  INET_PTON_LIB=
25
 
  if test "$ac_cv_search_inet_pton" != "no" &&
26
 
     test "$ac_cv_search_inet_pton" != "none required"; then
27
 
    INET_PTON_LIB="$ac_cv_search_inet_pton"
 
24
  gl_PREREQ_SYS_H_WINSOCK2
 
25
  if test $HAVE_WINSOCK2_H = 1; then
 
26
    AC_CHECK_DECLS([inet_pton],,, [[#include <ws2tcpip.h>]])
 
27
    if test $ac_cv_have_decl_inet_pton = yes; then
 
28
      dnl It needs to be overridden, because the stdcall calling convention
 
29
      dnl is not compliant with POSIX.
 
30
      REPLACE_INET_PTON=1
 
31
      INET_PTON_LIB="-lws2_32"
 
32
    else
 
33
      HAVE_DECL_INET_PTON=0
 
34
      HAVE_INET_PTON=0
 
35
    fi
 
36
  else
 
37
    gl_save_LIBS=$LIBS
 
38
    AC_SEARCH_LIBS([inet_pton], [nsl resolv], [],
 
39
      [AC_CHECK_FUNCS([inet_pton])
 
40
       if test $ac_cv_func_inet_pton = no; then
 
41
         HAVE_INET_PTON=0
 
42
       fi
 
43
      ])
 
44
    LIBS=$gl_save_LIBS
 
45
 
 
46
    if test "$ac_cv_search_inet_pton" != "no" \
 
47
       && test "$ac_cv_search_inet_pton" != "none required"; then
 
48
      INET_PTON_LIB="$ac_cv_search_inet_pton"
 
49
    fi
 
50
 
 
51
    AC_CHECK_HEADERS_ONCE([netdb.h])
 
52
    AC_CHECK_DECLS([inet_pton],,,
 
53
      [[#include <arpa/inet.h>
 
54
        #if HAVE_NETDB_H
 
55
        # include <netdb.h>
 
56
        #endif
 
57
      ]])
 
58
    if test $ac_cv_have_decl_inet_pton = no; then
 
59
      HAVE_DECL_INET_PTON=0
 
60
    fi
28
61
  fi
29
62
  AC_SUBST([INET_PTON_LIB])
30
 
 
31
 
  AC_CHECK_HEADERS_ONCE([netdb.h])
32
 
  AC_CHECK_DECLS([inet_pton],,,
33
 
    [#include <arpa/inet.h>
34
 
     #if HAVE_NETDB_H
35
 
     # include <netdb.h>
36
 
     #endif
37
 
    ])
38
 
  if test $ac_cv_have_decl_inet_pton = no; then
39
 
    HAVE_DECL_INET_PTON=0
40
 
    AC_REQUIRE([AC_C_RESTRICT])
41
 
  fi
42
63
])
43
64
 
44
65
# Prerequisites of lib/inet_pton.c.