Revert manifest to default one
[external/cups.git] / config-scripts / cups-dnssd.m4
1 dnl
2 dnl "$Id: cups-dnssd.m4 9771 2011-05-12 05:21:56Z mike $"
3 dnl
4 dnl   DNS Service Discovery (aka Bonjour) stuff for CUPS.
5 dnl
6 dnl   Copyright 2007-2011 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(dnssd, [  --disable-dnssd         disable DNS Service Discovery support])
16 AC_ARG_WITH(dnssd-libs, [  --with-dnssd-libs       set directory for DNS Service Discovery library],
17         LDFLAGS="-L$withval $LDFLAGS"
18         DSOFLAGS="-L$withval $DSOFLAGS",)
19 AC_ARG_WITH(dnssd-includes, [  --with-dnssd-includes   set directory for DNS Service Discovery includes],
20         CFLAGS="-I$withval $CFLAGS"
21         CPPFLAGS="-I$withval $CPPFLAGS",)
22
23 DNSSDLIBS=""
24 DNSSD_BACKEND=""
25
26 AC_ARG_ENABLE(avahi, [  --enable-avahi          turn on DNS Service Discovery support, default=no],
27               [if test x$enable_avahi = xyes; 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                                enable_dnssd=no
36                        else
37                                AC_MSG_RESULT(no)
38                        fi
39                fi])
40
41 if test x$enable_dnssd != xno; then
42         AC_CHECK_HEADER(dns_sd.h, [
43                 case "$uname" in
44                         Darwin*)
45                                 # Darwin and MacOS X...
46                                 AC_DEFINE(HAVE_DNSSD)
47                                 AC_DEFINE(HAVE_COREFOUNDATION)
48                                 AC_DEFINE(HAVE_SYSTEMCONFIGURATION)
49                                 DNSSDLIBS="-framework CoreFoundation -framework SystemConfiguration"
50                                 DNSSD_BACKEND="dnssd"
51                                 ;;
52                         *)
53                                 # All others...
54                                 AC_MSG_CHECKING(for current version of dns_sd library)
55                                 SAVELIBS="$LIBS"
56                                 LIBS="$LIBS -ldns_sd"
57                                 AC_TRY_COMPILE([#include <dns_sd.h>],
58                                         [int constant = kDNSServiceFlagsShareConnection;
59                                         unsigned char txtRecord[100];
60                                         uint8_t valueLen;
61                                         TXTRecordGetValuePtr(sizeof(txtRecord),
62                                             txtRecord, "value", &valueLen);],
63                                         AC_MSG_RESULT(yes)
64                                         AC_DEFINE(HAVE_DNSSD)
65                                         DNSSDLIBS="-ldns_sd"
66                                         DNSSD_BACKEND="dnssd",
67                                         AC_MSG_RESULT(no))
68                                 LIBS="$SAVELIBS"
69                                 ;;
70                 esac
71         ])
72 fi
73
74 AC_SUBST(DNSSDLIBS)
75 AC_SUBST(DNSSD_BACKEND)
76
77 dnl
78 dnl End of "$Id: cups-dnssd.m4 9771 2011-05-12 05:21:56Z mike $".
79 dnl