]> git.ipfire.org Git - thirdparty/cups.git/blame - config-scripts/cups-dnssd.m4
License change: Apache License, Version 2.0.
[thirdparty/cups.git] / config-scripts / cups-dnssd.m4
CommitLineData
f7deaa1a 1dnl
503b54c9 2dnl DNS Service Discovery (aka Bonjour) stuff for CUPS.
f7deaa1a 3dnl
105922ec 4dnl Copyright 2007-2017 by Apple Inc.
f7deaa1a 5dnl
e3101897 6dnl Licensed under Apache License v2.0. See the file "LICENSE" for more information.
f7deaa1a 7dnl
8
3e7fe0ca
MS
9AC_ARG_ENABLE(avahi, [ --disable-avahi disable DNS Service Discovery support using Avahi])
10AC_ARG_ENABLE(dnssd, [ --disable-dnssd disable DNS Service Discovery support using mDNSResponder])
09a101d6 11AC_ARG_WITH(dnssd-libs, [ --with-dnssd-libs set directory for DNS Service Discovery library],
f7deaa1a 12 LDFLAGS="-L$withval $LDFLAGS"
13 DSOFLAGS="-L$withval $DSOFLAGS",)
09a101d6 14AC_ARG_WITH(dnssd-includes, [ --with-dnssd-includes set directory for DNS Service Discovery includes],
f7deaa1a 15 CFLAGS="-I$withval $CFLAGS"
f7deaa1a 16 CPPFLAGS="-I$withval $CPPFLAGS",)
17
18DNSSDLIBS=""
c5571a1d 19DNSSD_BACKEND=""
766a8229
MS
20IPPFIND_BIN=""
21IPPFIND_MAN=""
f7deaa1a 22
105922ec 23if test "x$PKGCONFIG" != x -a x$enable_avahi != xno -a x$host_os_name != xdarwin; then
3e7fe0ca
MS
24 AC_MSG_CHECKING(for Avahi)
25 if $PKGCONFIG --exists avahi-client; then
26 AC_MSG_RESULT(yes)
27 CFLAGS="$CFLAGS `$PKGCONFIG --cflags avahi-client`"
28 DNSSDLIBS="`$PKGCONFIG --libs avahi-client`"
29 DNSSD_BACKEND="dnssd"
766a8229
MS
30 IPPFIND_BIN="ippfind"
31 IPPFIND_MAN="ippfind.\$(MAN1EXT)"
3e7fe0ca
MS
32 AC_DEFINE(HAVE_AVAHI)
33 else
34 AC_MSG_RESULT(no)
35 fi
36fi
37
38if test "x$DNSSD_BACKEND" = x -a x$enable_dnssd != xno; then
f7deaa1a 39 AC_CHECK_HEADER(dns_sd.h, [
105922ec
MS
40 case "$host_os_name" in
41 darwin*)
d4874933 42 # Darwin and macOS...
cc0d019f 43 AC_DEFINE(HAVE_DNSSD)
d1c13e16 44 DNSSDLIBS="-framework CoreFoundation -framework SystemConfiguration"
c5571a1d 45 DNSSD_BACKEND="dnssd"
766a8229
MS
46 IPPFIND_BIN="ippfind"
47 IPPFIND_MAN="ippfind.\$(MAN1EXT)"
f7deaa1a 48 ;;
49 *)
50 # All others...
d1c13e16
MS
51 AC_MSG_CHECKING(for current version of dns_sd library)
52 SAVELIBS="$LIBS"
53 LIBS="$LIBS -ldns_sd"
7a0cbd5e 54 AC_TRY_COMPILE([#include <dns_sd.h>],
d1c13e16
MS
55 [int constant = kDNSServiceFlagsShareConnection;
56 unsigned char txtRecord[100];
57 uint8_t valueLen;
58 TXTRecordGetValuePtr(sizeof(txtRecord),
59 txtRecord, "value", &valueLen);],
60 AC_MSG_RESULT(yes)
cc0d019f 61 AC_DEFINE(HAVE_DNSSD)
d1c13e16
MS
62 DNSSDLIBS="-ldns_sd"
63 DNSSD_BACKEND="dnssd",
766a8229
MS
64 IPPFIND_BIN="ippfind"
65 IPPFIND_MAN="ippfind.\$(MAN1EXT)"
d1c13e16
MS
66 AC_MSG_RESULT(no))
67 LIBS="$SAVELIBS"
f7deaa1a 68 ;;
69 esac
70 ])
71fi
72
73AC_SUBST(DNSSDLIBS)
c5571a1d 74AC_SUBST(DNSSD_BACKEND)
766a8229
MS
75AC_SUBST(IPPFIND_BIN)
76AC_SUBST(IPPFIND_MAN)