]> git.ipfire.org Git - thirdparty/cups.git/blob - config-scripts/cups-dnssd.m4
Merge changes from CUPS 1.6svn-r10310.
[thirdparty/cups.git] / config-scripts / cups-dnssd.m4
1 dnl
2 dnl "$Id: cups-dnssd.m4 7890 2008-08-29 22:19:39Z mike $"
3 dnl
4 dnl DNS Service Discovery (aka Bonjour) stuff for CUPS.
5 dnl
6 dnl Copyright 2007-2012 by Apple Inc.
7 dnl
8 dnl These coded instructions, statements, and computer programs are the
9 dnl property of Apple Inc. and are protected by Federal copyright
10 dnl law. Distribution and use rights are outlined in the file "LICENSE.txt"
11 dnl which should have been included with this file. If this file is
12 dnl file is missing or damaged, see the license at "http://www.cups.org/".
13 dnl
14
15 AC_ARG_ENABLE(avahi, [ --disable-avahi disable DNS Service Discovery support using Avahi])
16 AC_ARG_ENABLE(dnssd, [ --disable-dnssd disable DNS Service Discovery support using mDNSResponder])
17 AC_ARG_WITH(dnssd-libs, [ --with-dnssd-libs set directory for DNS Service Discovery library],
18 LDFLAGS="-L$withval $LDFLAGS"
19 DSOFLAGS="-L$withval $DSOFLAGS",)
20 AC_ARG_WITH(dnssd-includes, [ --with-dnssd-includes set directory for DNS Service Discovery includes],
21 CFLAGS="-I$withval $CFLAGS"
22 CPPFLAGS="-I$withval $CPPFLAGS",)
23
24 DNSSDLIBS=""
25 DNSSD_BACKEND=""
26
27 if test "x$PKGCONFIG" != x -a x$enable_avahi != xno; then
28 AC_MSG_CHECKING(for Avahi)
29 if $PKGCONFIG --exists avahi-client; then
30 AC_MSG_RESULT(yes)
31 CFLAGS="$CFLAGS `$PKGCONFIG --cflags avahi-client`"
32 DNSSDLIBS="`$PKGCONFIG --libs avahi-client`"
33 DNSSD_BACKEND="dnssd"
34 AC_DEFINE(HAVE_AVAHI)
35 else
36 AC_MSG_RESULT(no)
37 fi
38 fi
39
40 if test "x$DNSSD_BACKEND" = x -a x$enable_dnssd != xno; then
41 AC_CHECK_HEADER(dns_sd.h, [
42 case "$uname" in
43 Darwin*)
44 # Darwin and MacOS X...
45 AC_DEFINE(HAVE_DNSSD)
46 AC_DEFINE(HAVE_COREFOUNDATION)
47 AC_DEFINE(HAVE_SYSTEMCONFIGURATION)
48 DNSSDLIBS="-framework CoreFoundation -framework SystemConfiguration"
49 DNSSD_BACKEND="dnssd"
50 ;;
51 *)
52 # All others...
53 AC_MSG_CHECKING(for current version of dns_sd library)
54 SAVELIBS="$LIBS"
55 LIBS="$LIBS -ldns_sd"
56 AC_TRY_COMPILE([#include <dns_sd.h>],
57 [int constant = kDNSServiceFlagsShareConnection;
58 unsigned char txtRecord[100];
59 uint8_t valueLen;
60 TXTRecordGetValuePtr(sizeof(txtRecord),
61 txtRecord, "value", &valueLen);],
62 AC_MSG_RESULT(yes)
63 AC_DEFINE(HAVE_DNSSD)
64 DNSSDLIBS="-ldns_sd"
65 DNSSD_BACKEND="dnssd",
66 AC_MSG_RESULT(no))
67 LIBS="$SAVELIBS"
68 ;;
69 esac
70 ])
71 fi
72
73 AC_SUBST(DNSSDLIBS)
74 AC_SUBST(DNSSD_BACKEND)
75
76 dnl
77 dnl End of "$Id: cups-dnssd.m4 7890 2008-08-29 22:19:39Z mike $".
78 dnl