source: web/old/remctl-2.14/m4/inet-ntoa.m4 @ f6f3e91

web
Last change on this file since f6f3e91 was f6f3e91, checked in by Jessica B. Hamrick <jhamrick@…>, 15 years ago

Preserve directory hierarchy (not sure what happened to it)

  • Property mode set to 100644
File size: 1.5 KB
Line 
1dnl Check for a working inet_ntoa.
2dnl
3dnl Check whether inet_ntoa is present and working.  Since calling inet_ntoa
4dnl involves passing small structs on the stack, present and working versions
5dnl may still not function with gcc on some platforms (such as IRIX).
6dnl Provides RRA_FUNC_INET_NTOA and defines HAVE_INET_NTOA if inet_ntoa is
7dnl present and working.
8dnl
9dnl Copyright 2008, 2009 Board of Trustees, Leland Stanford Jr. University
10dnl Copyright (c) 2004, 2005, 2006, 2007
11dnl     by Internet Systems Consortium, Inc. ("ISC")
12dnl Copyright (c) 1991, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001,
13dnl     2002, 2003 by The Internet Software Consortium and Rich Salz
14dnl
15dnl See LICENSE for licensing terms.
16
17dnl Source used by RRA_FUNC_INET_NTOA.
18AC_DEFUN([_RRA_FUNC_INET_NTOA_SOURCE], [[
19#include <sys/types.h>
20#include <sys/socket.h>
21#include <netinet/in.h>
22#include <arpa/inet.h>
23#include <string.h>
24
25int
26main(void)
27{
28    struct in_addr in;
29    in.s_addr = htonl(0x7f000000L);
30    return (strcmp(inet_ntoa(in), "127.0.0.0") == 0) ? 0 : 1;
31}
32]])
33
34dnl The public macro.
35AC_DEFUN([RRA_FUNC_INET_NTOA],
36[AC_CACHE_CHECK(for working inet_ntoa, rra_cv_func_inet_ntoa_works,
37    [AC_RUN_IFELSE([AC_LANG_SOURCE([_RRA_FUNC_INET_NTOA_SOURCE])],
38        [rra_cv_func_inet_ntoa_works=yes],
39        [rra_cv_func_inet_ntoa_works=no],
40        [rra_cv_func_inet_ntoa_works=no])])
41 AS_IF([test "$rra_cv_func_inet_ntoa_works" = yes],
42    [AC_DEFINE([HAVE_INET_NTOA], 1,
43        [Define if your system has a working inet_ntoa function.])],
44    [AC_LIBOBJ([inet_ntoa])])])
Note: See TracBrowser for help on using the repository browser.