1dnl
2dnl Networking stuff for CUPS.
3dnl
4dnl Copyright 2007-2016 by Apple Inc.
5dnl Copyright 1997-2005 by Easy Software Products, all rights reserved.
6dnl
7dnl Licensed under Apache License v2.0.  See the file "LICENSE" for more information.
8dnl
9
10AC_CHECK_HEADER(resolv.h,AC_DEFINE(HAVE_RESOLV_H),,[
11#include <sys/socket.h>
12#include <netinet/in.h>
13#include <arpa/inet.h>
14#include <netinet/in_systm.h>
15#include <netinet/ip.h>])
16AC_SEARCH_LIBS(socket, socket)
17AC_SEARCH_LIBS(gethostbyaddr, nsl)
18AC_SEARCH_LIBS(getifaddrs, nsl, AC_DEFINE(HAVE_GETIFADDRS))
19AC_SEARCH_LIBS(hstrerror, nsl socket resolv, AC_DEFINE(HAVE_HSTRERROR))
20AC_SEARCH_LIBS(rresvport_af, nsl, AC_DEFINE(HAVE_RRESVPORT_AF))
21AC_SEARCH_LIBS(__res_init, resolv bind, AC_DEFINE(HAVE_RES_INIT),
22	AC_SEARCH_LIBS(res_9_init, resolv bind, AC_DEFINE(HAVE_RES_INIT),
23	AC_SEARCH_LIBS(res_init, resolv bind, AC_DEFINE(HAVE_RES_INIT))))
24
25# Tru64 5.1b leaks file descriptors with these functions; disable until
26# we can come up with a test for this...
27if test "$host_os_name" != "osf1"; then
28	AC_SEARCH_LIBS(getaddrinfo, nsl, AC_DEFINE(HAVE_GETADDRINFO))
29	AC_SEARCH_LIBS(getnameinfo, nsl, AC_DEFINE(HAVE_GETNAMEINFO))
30fi
31
32AC_CHECK_MEMBER(struct sockaddr.sa_len,,, [#include <sys/socket.h>])
33AC_CHECK_HEADER(sys/sockio.h, AC_DEFINE(HAVE_SYS_SOCKIO_H))
34
35CUPS_DEFAULT_DOMAINSOCKET=""
36
37dnl Domain socket support...
38AC_ARG_WITH(domainsocket, [  --with-domainsocket     set unix domain socket name],
39	default_domainsocket="$withval",
40	default_domainsocket="")
41
42if test x$enable_domainsocket != xno -a x$default_domainsocket != xno; then
43	if test "x$default_domainsocket" = x; then
44		case "$host_os_name" in
45			darwin*)
46				# Darwin and macOS do their own thing...
47				CUPS_DEFAULT_DOMAINSOCKET="$localstatedir/run/cupsd"
48				;;
49			*)
50				# All others use FHS standard...
51				CUPS_DEFAULT_DOMAINSOCKET="$CUPS_STATEDIR/cups.sock"
52				;;
53		esac
54	else
55		CUPS_DEFAULT_DOMAINSOCKET="$default_domainsocket"
56	fi
57
58	CUPS_LISTEN_DOMAINSOCKET="Listen $CUPS_DEFAULT_DOMAINSOCKET"
59
60	AC_DEFINE_UNQUOTED(CUPS_DEFAULT_DOMAINSOCKET, "$CUPS_DEFAULT_DOMAINSOCKET")
61else
62	CUPS_LISTEN_DOMAINSOCKET=""
63fi
64
65AC_SUBST(CUPS_DEFAULT_DOMAINSOCKET)
66AC_SUBST(CUPS_LISTEN_DOMAINSOCKET)
67