Code

2bbdca10889797ecc5fbef4a315a5406b2c92f21
[nagiosplug.git] / gl / m4 / inet_ntop.m4
1 # inet_ntop.m4 serial 9
2 dnl Copyright (C) 2005, 2006, 2008, 2009 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 AC_DEFUN([gl_INET_NTOP],
8 [
9   dnl Persuade Solaris <arpa/inet.h> to declare inet_ntop.
10   AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS])
12   gl_REPLACE_ARPA_INET_H
14   dnl The AC_SEARCH_LIBS call is a hack to persuade the Solaris 8 linker to
15   dnl find inet_ntop.
16   dnl
17   dnl It is the responsibility of gl_INET_NTOP's caller to arrange for
18   dnl -lnsl if it is needed.  Normally -lnsl is not needed on Solaris 8,
19   dnl since inet_ntop is needed only by getaddrinfo, and getaddrinfo
20   dnl isn't built on Solaris 8.
21   gl_save_LIBS=$LIBS
22   AC_SEARCH_LIBS([inet_ntop], [nsl], [],
23     [AC_REPLACE_FUNCS([inet_ntop])])
24   LIBS=$gl_save_LIBS
26   gl_PREREQ_INET_NTOP
27 ])
29 # Prerequisites of lib/inet_ntop.c.
30 AC_DEFUN([gl_PREREQ_INET_NTOP], [
31   AC_CHECK_DECLS([inet_ntop],,,[#include <arpa/inet.h>])
32   if test $ac_cv_have_decl_inet_ntop = no; then
33     HAVE_DECL_INET_NTOP=0
34   fi
35   AC_REQUIRE([gl_SOCKET_FAMILIES])
36   AC_REQUIRE([AC_C_RESTRICT])
37 ])