add simple test for command()
[nsca-ng.git] / m4 / networking.m4
blob5db53c16b6a1020ce83acca99dd70b9d3f0dd238
1 # Copyright (c) 2013 Holger Weiss <holger@weiss.in-berlin.de>
2 # All rights reserved.
4 # Redistribution and use in source and binary forms, with or without
5 # modification, are permitted provided that the following conditions are met:
7 # 1. Redistributions of source code must retain the above copyright notice, this
8 #    list of conditions and the following disclaimer.
10 # 2. Redistributions in binary form must reproduce the above copyright notice,
11 #    this list of conditions and the following disclaimer in the documentation
12 #    and/or other materials provided with the distribution.
14 # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
15 # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16 # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
17 # DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
18 # FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19 # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
20 # SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
21 # CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
22 # OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
23 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25 # NSCA_LIB_NETWORKING
26 # -------------------
27 # Check the availability of some networking header files and types.  Also, find
28 # out which libraries define the networking functions we're interested in and
29 # add the according flags to LIBS.  We bail out if any of these functions aren't
30 # found.
31 AC_DEFUN([NSCA_LIB_NETWORKING],
33   AC_CHECK_HEADERS([arpa/inet.h netinet/in.h sys/socket.h])
34   AC_CHECK_TYPES([struct sockaddr_storage, struct sockaddr_in6], [], [],
35     [[#include <sys/types.h>
36       #ifdef HAVE_SYS_SOCKET_H
37       #include <sys/socket.h>
38       #endif
39       #ifdef HAVE_NETINET_IN_H
40       #include <netinet/in.h>
41       #endif]])
42   # Solaris 8 and newer provide the inet_ntop(3) function in libnsl, older
43   # Solaris versions provide inet_ntop(3) in libresolv instead.
44   AC_SEARCH_LIBS([inet_ntop], [nsl resolv], [],
45     [AC_MSG_FAILURE([cannot find the `inet_ntop' function])])
46   # The libsocket library might or might not depend on libnsl.
47   AC_SEARCH_LIBS([getpeername], [socket], [],
48     [AC_CHECK_LIB([nsl], [getpeername],
49       [LIBS="-lsocket -lnsl $LIBS"],
50       [AC_MSG_FAILURE([cannot find the `getpeername' function])],
51       [-lsocket -lnsl])])
52 ])# NSCA_LIB_NETWORKING
54 dnl vim:set joinspaces textwidth=80: