1# -*- Autoconf -*-
2# Process this file with autoconf to produce a configure script.
3
4# This file is part of avahi.
5#
6# avahi is free software; you can redistribute it and/or modify it
7# under the terms of the GNU Lesser General Public License as
8# published by the Free Software Foundation; either version 2 of the
9# License, or (at your option) any later version.
10#
11# avahi is distributed in the hope that it will be useful, but WITHOUT
12# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
13# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
14# License for more details.
15#
16# You should have received a copy of the GNU Lesser General Public
17# License along with avahi; if not, write to the Free Software
18# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
19# USA.
20
21AC_PREREQ(2.63)
22AC_INIT([avahi],[0.8],[avahi (at) lists (dot) freedesktop (dot) org])
23AC_CONFIG_SRCDIR([avahi-core/server.c])
24AC_CONFIG_MACRO_DIR([common])
25AC_CONFIG_HEADERS([config.h])
26AM_INIT_AUTOMAKE([foreign 1.11 -Wall -Wno-portability silent-rules tar-pax])
27
28AC_SUBST(PACKAGE_URL, [http://avahi.org/])
29
30AC_SUBST(LIBAVAHI_COMMON_VERSION_INFO, [8:4:5])
31AC_SUBST(LIBAVAHI_CORE_VERSION_INFO, [8:0:1])
32AC_SUBST(LIBAVAHI_CLIENT_VERSION_INFO, [5:9:2])
33AC_SUBST(LIBAVAHI_GLIB_VERSION_INFO, [1:2:0])
34AC_SUBST(LIBAVAHI_LIBEVENT_VERSION_INFO, [1:0:0])
35AC_SUBST(LIBAVAHI_GOBJECT_VERSION_INFO, [0:5:0])
36AC_SUBST(LIBAVAHI_QT3_VERSION_INFO, [1:2:0])
37AC_SUBST(LIBAVAHI_QT4_VERSION_INFO, [1:2:0])
38AC_SUBST(LIBAVAHI_QT5_VERSION_INFO, [1:2:0])
39AC_SUBST(LIBAVAHI_UI_VERSION_INFO, [1:4:1])
40
41# Do not touch these, since they we took this version-info from upstream HOWL/Bonjour
42AC_SUBST(LIBAVAHI_COMPAT_LIBDNS_SD_VERSION_INFO, [1:0:0])
43AC_SUBST(LIBAVAHI_COMPAT_HOWL_VERSION_INFO, [0:0:0])
44AC_SUBST(HOWL_COMPAT_VERSION, [0.9.8])
45
46AC_CANONICAL_HOST
47
48AM_SILENT_RULES([yes])
49
50AC_CHECK_PROG([STOW], [stow], [yes], [no])
51
52AS_IF([test "x$STOW" = "xyes" && test -d /usr/local/stow], [
53        AC_MSG_NOTICE([*** Found /usr/local/stow: default install prefix set to /usr/local/stow/${PACKAGE_NAME}-${PACKAGE_VERSION} ***])
54        ac_default_prefix="/usr/local/stow/${PACKAGE_NAME}-${PACKAGE_VERSION}"
55])
56
57# Checks for programs.
58AC_PROG_CC
59AC_PROG_CC_C99
60AC_PROG_CXX
61AM_PROG_CC_C_O
62AC_USE_SYSTEM_EXTENSIONS
63AC_PROG_CPP
64AC_PROG_MKDIR_P
65AC_PROG_INSTALL
66AC_PROG_LN_S
67AC_PROG_MAKE_SET
68AC_PROG_GCC_TRADITIONAL
69
70# -fstack-protector
71AC_ARG_ENABLE([stack-protector],
72    [AS_HELP_STRING([--disable-stack-protector],
73        [Disable GCC's/libc's stack-smashing protection])],
74    [case "${enableval}" in
75         yes) enable_ssp=yes ;;
76          no) enable_ssp=no ;;
77           *) AC_MSG_ERROR([invalid value ${enableval} for --disable-stack-protector]) ;;
78     esac],
79    [enable_ssp=yes])
80
81if test x"$enable_ssp" = x"yes" && test x"$GCC" != x"yes"; then
82    AC_MSG_NOTICE([Disabling stack-smashing protection because compiler is not GCC])
83    enable_ssp=no
84fi
85
86if test x"$enable_ssp" = x"yes"; then
87    # Check for broken ssp in libc: http://www.avahi.org/ticket/105
88    # libc's brokenness will get in the way regardless of whether -lssp is
89    # provided, but provide it anyway (otherwise non-libc ssp would wrongly
90    # break here)
91
92    # Get -lssp if it exists
93    GCC_STACK_PROTECT_LIB
94
95    AC_MSG_CHECKING([whether stack-smashing protection is available])
96    ssp_old_cflags="$CFLAGS"
97    ssp_old_ldflags="$LDFLAGS"
98    CFLAGS="$CFLAGS -Werror -fstack-protector-all -fPIC"
99    LDFLAGS="$LDFLAGS -Wl,-z,defs"
100    cat confdefs.h > conftest.c
101    cat >>conftest.c <<_ACEOF
102void test_broken_ssp(c)
103    const char *c;
104{
105    char arr[[123]], *p; /* beware of possible double-braces if copying this */
106    for (p = arr; *c; ++p) {
107        *p = *c;
108        ++c;
109    }
110}
111_ACEOF
112    rm -f conftest.o
113
114    if $CC -c $CFLAGS $CPPFLAGS -o conftest.o conftest.c >/dev/null 2>&1; then
115        AC_MSG_RESULT([yes])
116        AC_MSG_CHECKING([whether stack-smashing protection is buggy])
117        if $CC -o conftest.so $LDFLAGS -shared conftest.o $LIBS >/dev/null 2>&1; then
118            AC_MSG_RESULT([no])
119        else
120            AC_MSG_RESULT([yes])
121            enable_ssp=no
122        fi
123    else
124        AC_MSG_RESULT([no])
125    fi
126
127    rm -f conftest.c conftest.o conftest.so
128
129    CFLAGS="$ssp_old_cflags"
130    LDFLAGS="$ssp_old_ldflags"
131fi
132
133if test x"$enable_ssp" = x"yes"; then
134    # Do this the long way so we don't call GCC_STACK_PROTECT_LIB twice
135    GCC_STACK_PROTECT_CC
136
137    AC_LANG_PUSH([C++])
138    GCC_STACK_PROTECT_CXX
139    AC_LANG_POP([C++])
140    # XXX: Update the enable_ssp value now for output later?
141fi
142
143# libtool stuff
144AC_PROG_LIBTOOL
145
146AC_CACHE_CHECK([whether the C++ compiler works], [avahi_cv_sys_cxx_works], [
147    AC_LANG_PUSH([C++])
148    AC_COMPILE_IFELSE([int main() { return 0; }], [avahi_cv_sys_cxx_works=yes],
149        [avahi_cv_sys_cxx_works=no])
150    AC_LANG_POP([C++])
151    ])
152[ if [ "x$avahi_cv_sys_cxx_works" = "xno" ]; then ]
153    AC_MSG_FAILURE([The C++ compiler does not work])
154[ fi ]
155
156ACX_PTHREAD(,AC_MSG_ERROR([Missing POSIX Threads support]))
157
158#
159# Check for netlink.h
160#
161AC_CHECK_HEADER(linux/netlink.h,
162HAVE_NETLINK=yes
163AC_DEFINE([HAVE_NETLINK],[],[Support for Linux netlink])
164, [], [
165#include <sys/socket.h>
166#include <asm/types.h>
167])
168
169AM_CONDITIONAL(HAVE_NETLINK, [ test x"$HAVE_NETLINK" = xyes ])
170
171#
172# Check for net/route.h
173#
174AC_CHECK_HEADER(net/route.h,
175HAVE_PF_ROUTE=yes
176AC_DEFINE([HAVE_PF_ROUTE],[],[Support for PF_ROUTE])
177, [], [
178#include <sys/types.h>
179#include <sys/socket.h>
180#include <net/if_dl.h>
181])
182
183AM_CONDITIONAL(HAVE_PF_ROUTE, [ test x"$HAVE_PF_ROUTE" = xyes ])
184
185#
186# Check for sys/filio.h; needed for FIONREAD on Solaris
187#
188AC_CHECK_HEADER(sys/filio.h,
189HAVE_SYS_FILIO_H=yes
190AC_DEFINE([HAVE_SYS_FILIO_H],[],[Support for sys/filio.h])
191, [], [
192])
193
194AM_CONDITIONAL(HAVE_SYS_FILIO_H, [ test x"$HAVE_SYS_FILIO_H" = xyes ])
195
196#
197# Check for sys/sysctl.h; not present on Solaris
198#
199AC_CHECK_HEADER(sys/sysctl.h,
200HAVE_SYS_SYSCTL=yes
201AC_DEFINE([HAVE_SYS_SYSCTL_H],[],[Support for sys/sysctl.h])
202, [], [
203#include <sys/types.h>
204#include <sys/socket.h>
205#include <sys/param.h>
206])
207
208AM_CONDITIONAL(HAVE_SYS_SYSCTL_H, [ test x"$HAVE_SYS_SYSCTL_H" = xyes ])
209
210#
211# Check for lifconf struct; only present on Solaris
212#
213AC_MSG_CHECKING(for struct lifconf)
214AC_CACHE_VAL(avahi_cv_has_struct_lifconf,
215[AC_TRY_COMPILE(
216[#include <sys/socket.h>
217#include <net/if.h>
218],[sizeof (struct lifconf);],
219avahi_cv_has_struct_lifconf=yes,avahi_cv_has_struct_lifconf=no)])
220AC_MSG_RESULT($avahi_cv_has_struct_lifconf)
221if test $avahi_cv_has_struct_lifconf = yes; then
222    AC_DEFINE(HAVE_STRUCT_LIFCONF,1,[Define if there is a struct lifconf.])
223fi
224
225#
226# Check for struct ip_mreqn
227#
228AC_MSG_CHECKING(for struct ip_mreqn)
229AC_TRY_COMPILE([#include <netinet/in.h>], [
230	struct ip_mreqn mreq;
231	mreq.imr_address.s_addr = 0;
232], [
233	# Yes, we have it...
234	AC_MSG_RESULT(yes)
235	AC_DEFINE([HAVE_STRUCT_IP_MREQN],[],[Support for struct ip_mreqn])
236], [
237	# We'll just have to try and use struct ip_mreq
238	AC_MSG_RESULT(no)
239	AC_MSG_CHECKING(for struct ip_mreq)
240	AC_TRY_COMPILE([#include <netinet/in.h>], [
241		struct ip_mreq mreq;
242		mreq.imr_interface.s_addr = 0;
243	], [
244		# Yes, we have it...
245		AC_MSG_RESULT(yes)
246		AC_DEFINE([HAVE_STRUCT_IP_MREQ],[],[Support for struct ip_mreq])
247	], [
248		# No multicast support
249			AC_MSG_RESULT(no)
250	])
251])
252
253#
254# Detecting the linux distribution for specific things like init scripts.
255#
256AC_ARG_WITH(distro, AS_HELP_STRING([--with-distro=DISTRO],[Specify the distribution to target: One of lfs, debian, gentoo, archlinux, fedora, mandriva, darwin, netbsd, freebsd, slackware or none]))
257if test "z$with_distro" = "z"; then
258    if test "$cross_compiling" = yes; then
259        AC_MSG_WARN([Target distribution cannot be reliably detected when cross-compiling. You should specify it with --with-distro (see $0 --help for recognized distros)])
260    else
261        AC_CHECK_FILE(/etc/lfs-release,with_distro="lfs")
262        AC_CHECK_FILE(/etc/SuSE-release,with_distro="suse")
263        AC_CHECK_FILE(/etc/gentoo-release,with_distro="gentoo")
264        AC_CHECK_FILE(/etc/arch-release,with_distro="archlinux")
265        AC_CHECK_FILE(/etc/debian_version,with_distro="debian")
266        AC_CHECK_FILE(/etc/redhat-release,with_distro="fedora")
267        AC_CHECK_FILE(/etc/mandriva-release,with_distro="mandriva")
268        AC_CHECK_FILE(/etc/slackware-version,with_distro="slackware")
269    fi
270    if test "z$with_distro" = "z"; then
271        with_distro=`uname -s`
272    fi
273fi
274with_distro=`echo ${with_distro} | tr '[[:upper:]]' '[[:lower:]]' `
275
276case $with_distro in
277    lfs|debian|gentoo|archlinux|suse|fedora|mandriva|darwin|freebsd|slackware|none)
278     ;;
279    netbsd)
280     AC_MSG_WARN([Your distribution (${with_distro}) is supported but no init script exist yet! (patches welcome)])
281     ;;
282    linux)
283     AC_MSG_ERROR([Linux distribution autodetection failed, you must specify the distribution to target using --with-distro=DISTRO, set DISTRO to none if your distribution is not supported.])
284     ;;
285    *)
286     AC_MSG_ERROR([Your distribution (${with_distro}) is not yet supported, init scripts and D-Bus configuration will not be installed! (patches welcome), you can specify --with-distro=none to skip this check])
287     ;;
288esac
289
290AM_CONDITIONAL(TARGET_LFS, test x"$with_distro" = xlfs)
291AM_CONDITIONAL(TARGET_SUSE, test x"$with_distro" = xsuse)
292AM_CONDITIONAL(TARGET_GENTOO, test x"$with_distro" = xgentoo)
293AM_CONDITIONAL(TARGET_DEBIAN, test x"$with_distro" = xdebian)
294AM_CONDITIONAL(TARGET_ARCHLINUX, test x"$with_distro" = xarchlinux)
295AM_CONDITIONAL(TARGET_FEDORA, test x"$with_distro" = xfedora)
296AM_CONDITIONAL(TARGET_MANDRIVA, test x"$with_distro" = xmandriva)
297AM_CONDITIONAL(TARGET_DARWIN, test x"$with_distro" = xdarwin)
298AM_CONDITIONAL(TARGET_NETBSD, test x"$with_distro" = xnetbsd)
299AM_CONDITIONAL(TARGET_FREEBSD, test x"$with_distro" = xfreebsd)
300AM_CONDITIONAL(TARGET_SLACKWARE, test x"$with_distro" = xslackware)
301
302test_gcc_flag() {
303    AC_LANG_CONFTEST([int main() {}])
304    $CC -c conftest.c $CFLAGS $@ > /dev/null 2> /dev/null
305    ret=$?
306    rm -f conftest.o
307    return $ret
308}
309
310# If using GCC specify some additional parameters
311if test "x$GCC" = "xyes" ; then
312
313    DESIRED_FLAGS="-Wall -W -Wextra -pedantic -pipe -Wformat -Wold-style-definition -Wdeclaration-after-statement -Wfloat-equal -Wmissing-declarations -Wmissing-prototypes -Wstrict-prototypes -Wredundant-decls -Wmissing-noreturn -Wshadow -Wendif-labels -Wpointer-arith -Wbad-function-cast -Wcast-qual -Wcast-align -Wwrite-strings -fdiagnostics-show-option -Wno-cast-qual -fno-strict-aliasing"
314
315    if test "x$HAVE_NETLINK" = "xyes" ; then
316        # Test whether rtnetlink.h can be included when compiled with -std=c99
317        # some distributions (e.g. archlinux) have broken headers that dont
318        # define __u64 with -std=c99
319        AC_MSG_CHECKING([checking whether rtnetlink.h can be included with -std=c99])
320        OLDCFLAGS="$CFLAGS"
321        CFLAGS="-std=c99"
322        AC_TRY_COMPILE([#include <linux/rtnetlink.h>], [],
323            use_stdc99=yes, use_stdc99=no)
324
325        if test x"$use_stdc99" = xyes; then
326            DESIRED_FLAGS="-std=c99 $DESIRED_FLAGS"
327            AC_MSG_RESULT([yes])
328        else
329            AC_MSG_RESULT([no])
330        fi
331
332        CFLAGS="$OLDCFLAGS"
333    else
334        DESIRED_FLAGS="-std=c99 $DESIRED_FLAGS"
335    fi
336
337    for flag in $DESIRED_FLAGS ; do
338        AC_MSG_CHECKING([whether $CC accepts $flag])
339        if test_gcc_flag $flag ; then
340           CFLAGS="$CFLAGS $flag"
341           AC_MSG_RESULT([yes])
342        else
343           AC_MSG_RESULT([no])
344        fi
345    done
346fi
347
348# Checks for header files.
349AC_HEADER_STDC
350AC_CHECK_HEADERS([arpa/inet.h fcntl.h inttypes.h limits.h netinet/in.h stdlib.h string.h sys/ioctl.h sys/socket.h sys/time.h unistd.h netdb.h syslog.h])
351AC_HEADER_STDBOOL
352
353# Checks for typedefs, structures, and compiler characteristics.
354AC_C_CONST
355AC_TYPE_SIZE_T
356AC_HEADER_TIME
357AC_HEADER_SYS_WAIT
358
359 # Solaris stuff
360 AC_SEARCH_LIBS([inet_ntop],[nsl])
361 AC_SEARCH_LIBS([recv],[socket])
362 AC_CHECK_DECL([CMSG_SPACE],,CFLAGS="$CFLAGS -D_XOPEN_SOURCE=500 -D__EXTENSIONS__", [[#include <sys/socket.h>]])
363
364# Checks for library functions.
365AC_FUNC_MEMCMP
366AC_FUNC_SELECT_ARGTYPES
367# avahi_malloc actually returns NULL for avahi_malloc(0), so it does not matter
368# whether libc's malloc does too. (Same for realloc.)
369#AC_FUNC_MALLOC
370#AC_FUNC_REALLOC
371AC_CHECK_FUNCS([gethostname memchr memmove memset mkdir select socket strchr strcspn strdup strerror strrchr strspn strstr uname setresuid setreuid setresgid setregid strcasecmp gettimeofday putenv strncasecmp strlcpy gethostbyname seteuid setegid setproctitle getprogname])
372
373AC_FUNC_CHOWN
374AC_FUNC_STAT
375AC_TYPE_MODE_T
376AC_TYPE_PID_T
377
378AC_CHECK_DECLS(environ)
379
380# check if gcc's -fvisibility is supported
381CHECK_VISIBILITY_HIDDEN
382
383enable_chroot=yes
384AC_CHECK_HEADERS([sys/capability.h],,enable_chroot=no)
385AC_CHECK_HEADERS([sys/prctl.h],,enable_chroot=no)
386AC_CHECK_FUNCS([chroot],,enable_chroot=no)
387
388AM_CONDITIONAL(ENABLE_CHROOT, test "x$enable_chroot" = "xyes")
389
390if test "x$enable_chroot" = "xyes" ; then
391   AC_DEFINE([ENABLE_CHROOT], 1, [Enable chroot() usage])
392fi
393
394AC_CHECK_LIB(dl, dlopen, [ AC_CHECK_HEADERS(dlfcn.h, HAVE_DLOPEN=yes, HAVE_DLOPEN=no) ], HAVE_DLOPEN=no)
395if test "x$HAVE_DLOPEN" = "xyes" ; then
396    AC_DEFINE([HAVE_DLOPEN],1,[Have dlopen()])
397fi
398AM_CONDITIONAL(HAVE_DLOPEN, test "x$HAVE_DLOPEN" = "xyes")
399
400have_inotify=no
401AC_CHECK_HEADERS([sys/inotify.h], [have_inotify=yes])
402
403AM_CONDITIONAL(HAVE_INOTIFY, test "x$have_inotify" = "xyes")
404
405if test "x$have_inotify" = "xyes" ; then
406   AC_DEFINE([HAVE_INOTIFY], 1, [Enable Linux inotify() usage])
407fi
408
409have_kqueue=yes
410AC_CHECK_FUNCS([kqueue],,have_kqueue=no)
411
412AM_CONDITIONAL(HAVE_KQUEUE, test "x$have_kqueue" = "xyes")
413
414if test "x$have_kqueue" = "xyes" ; then
415    AC_DEFINE([HAVE_KQUEUE], 1, [Enable BSD kqueue() usage])
416fi
417
418GETTEXT_PACKAGE=avahi
419AC_SUBST([GETTEXT_PACKAGE])
420AC_DEFINE_UNQUOTED([GETTEXT_PACKAGE],["$GETTEXT_PACKAGE"],[Gettext package])
421AM_GNU_GETTEXT_VERSION([0.19.8])
422AM_GNU_GETTEXT([external])
423
424avahilocaledir='${prefix}/${DATADIRNAME}/locale'
425AC_SUBST(avahilocaledir)
426
427# Check for pkg-config manually first, as if its not installed the
428# PKG_PROG_PKG_CONFIG macro won't be defined.
429AC_CHECK_PROG(have_pkg_config, pkg-config, yes, no)
430
431if test x"$have_pkg_config" = "xno"; then
432    AC_MSG_ERROR(pkg-config is required to install this program)
433fi
434
435PKG_PROG_PKG_CONFIG
436
437#
438# Check for GLIB 2.0
439#
440AC_ARG_ENABLE(glib,
441        AS_HELP_STRING([--disable-glib],[Disable use of GLib]),
442        [case "${enableval}" in
443                yes) HAVE_GLIB=yes ;;
444                no)  HAVE_GLIB=no ;;
445                *) AC_MSG_ERROR(bad value ${enableval} for --enable-glib) ;;
446        esac],
447        [HAVE_GLIB=yes])
448
449if test "x$HAVE_GLIB" = "xyes" ; then
450        PKG_CHECK_MODULES(GLIB20, [ glib-2.0 >= 2.4.0 ])
451        AC_SUBST(GLIB20_CFLAGS)
452        AC_SUBST(GLIB20_LIBS)
453fi
454AM_CONDITIONAL(HAVE_GLIB, test "x$HAVE_GLIB" = "xyes")
455
456#
457# Check for GLIB's gobject 2.0
458#
459AC_ARG_ENABLE(gobject,
460        AS_HELP_STRING([--disable-gobject],[Disable use of GLib GObject]),
461        [case "${enableval}" in
462                yes) HAVE_GOBJECT=yes ;;
463                no)  HAVE_GOBJECT=no ;;
464                *) AC_MSG_ERROR(bad value ${enableval} for --enable-gobject) ;;
465        esac],
466        [HAVE_GOBJECT=yes])
467
468if test "x$HAVE_GOBJECT" = "xyes" ; then
469        PKG_CHECK_MODULES(GOBJECT, [ glib-2.0 >= 2.4.0 gobject-2.0 ])
470        AC_SUBST(GOBJECT_CFLAGS)
471        AC_SUBST(GOBJECT_LIBS)
472fi
473AM_CONDITIONAL(HAVE_GOBJECT, test "x$HAVE_GOBJECT" = "xyes")
474
475#
476# Introspection support.
477#
478GOBJECT_INTROSPECTION_CHECK([0.9.5])
479
480#
481# Check for libevent 2.0.21
482#
483AC_ARG_ENABLE(libevent,
484	AS_HELP_STRING([--disable-libevent],[Disable use of libevent]),
485	[case "${enableval}" in
486		yes) HAVE_LIBEVENT=yes ;;
487		no)  HAVE_LIBEVENT=no ;;
488		*) AC_MSG_ERROR(bad value ${enableval} for --enable-libevent) ;;
489	esac],
490	[HAVE_LIBEVENT=yes])
491
492if test "x$HAVE_LIBEVENT" = "xyes" ; then
493	PKG_CHECK_MODULES(LIBEVENT, [ libevent >= 2.0.21 ])
494	AC_SUBST(LIBEVENT_CFLAGS)
495	AC_SUBST(LIBEVENT_LIBS)
496fi
497AM_CONDITIONAL(HAVE_LIBEVENT, test "x$HAVE_LIBEVENT" = "xyes")
498
499#
500# Check for Qt 3
501#
502AC_ARG_ENABLE(qt3,
503        AS_HELP_STRING([--enable-qt3],[Enable building of Qt3 mainloop integration]),
504        [case "${enableval}" in
505                yes) HAVE_QT3=yes ;;
506                no)  HAVE_QT3=no ;;
507                *) AC_MSG_ERROR(bad value ${enableval} for --enable-qt3) ;;
508        esac],
509        [HAVE_QT3=no])
510
511if test "x$HAVE_QT3" = "xyes" ; then
512        PKG_CHECK_MODULES( QT3, [ qt-mt >= 3.0.0 ])
513        AC_SUBST(QT3_CFLAGS)
514        AC_SUBST(QT3_LIBS)
515	    QT3_PREFIX="`$PKG_CONFIG --variable=prefix qt-mt`/bin"
516        AC_PATH_PROGS(MOC_QT3, [moc-qt3 moc], no, [$QT3_PREFIX])
517        if test "$MOC_QT3" = no; then
518            AC_MSG_ERROR([Could not find QT3 moc])
519        fi
520        AC_SUBST(MOC_QT3)
521fi
522AM_CONDITIONAL(HAVE_QT3, test "x$HAVE_QT3" = "xyes")
523
524#
525# Check for Qt 4
526#
527AC_ARG_ENABLE(qt4,
528        AS_HELP_STRING([--disable-qt4],[Disable building of Qt4Core mainloop integration]),
529        [case "${enableval}" in
530                yes) HAVE_QT4=yes ;;
531                no)  HAVE_QT4=no ;;
532                *) AC_MSG_ERROR(bad value ${enableval} for --enable-qt4) ;;
533        esac],
534        [HAVE_QT4=no])
535
536if test "x$HAVE_QT4" = "xyes" ; then
537        PKG_CHECK_MODULES( QT4, [ QtCore >= 4.0.0 ])
538        AC_SUBST(QT4_CFLAGS)
539        AC_SUBST(QT4_LIBS)
540	    QT4_PREFIX="`$PKG_CONFIG --variable=prefix QtCore`/bin"
541        AC_PATH_PROGS(MOC_QT4, [moc-qt4 moc], no, [$QT4_PREFIX])
542        if test "$MOC_QT4" = no; then
543            AC_MSG_ERROR([Could not find QT4 moc])
544        fi
545        AC_SUBST(MOC_QT4)
546fi
547AM_CONDITIONAL(HAVE_QT4, test "x$HAVE_QT4" = "xyes")
548
549#
550# Check for Qt 5
551#
552AC_ARG_ENABLE(qt5,
553        AS_HELP_STRING([--disable-qt5],[Disable building of Qt5Core mainloop integration]),
554        [case "${enableval}" in
555                yes) HAVE_QT5=yes ;;
556                no)  HAVE_QT5=no ;;
557                *) AC_MSG_ERROR(bad value ${enableval} for --enable-qt5) ;;
558        esac],
559        [HAVE_QT5=yes])
560
561if test "x$HAVE_QT5" = "xyes" ; then
562        PKG_CHECK_MODULES( QT5, [ Qt5Core >= 5.0.0 ])
563        AC_AVAHI_QT_ADD_PIC_IF_NEEDED
564        AC_SUBST(QT5_CFLAGS)
565        AC_SUBST(QT5_LIBS)
566        QT5_PREFIX="`$PKG_CONFIG --variable=host_bins Qt5Core`"
567        AC_PATH_PROGS(MOC_QT5, [moc-qt5 moc], no, [$QT5_PREFIX])
568        if test "$MOC_QT5" = no; then
569            AC_MSG_ERROR([Could not find QT5 moc])
570        fi
571        AC_SUBST(MOC_QT5)
572fi
573AM_CONDITIONAL(HAVE_QT5, test "x$HAVE_QT5" = "xyes")
574
575#
576# Check for GTK+ 2.0
577#
578AC_ARG_ENABLE(gtk,
579        AS_HELP_STRING([--disable-gtk],[Disable use of GTK+ 2]),
580        [case "${enableval}" in
581                yes) HAVE_GTK=yes ;;
582                no)  HAVE_GTK=no ;;
583                *) AC_MSG_ERROR(bad value ${enableval} for --enable-gtk) ;;
584        esac],
585        [HAVE_GTK=no])
586
587if test "x$HAVE_GTK" = "xyes" ; then
588        # Check for GTK 2.0
589        PKG_CHECK_MODULES(GTK20, [ gtk+-2.0 >= 2.14.0 ])
590        AC_SUBST(GTK20_CFLAGS)
591        AC_SUBST(GTK20_LIBS)
592fi
593AM_CONDITIONAL(HAVE_GTK, test "x$HAVE_GTK" = "xyes")
594
595#
596# Check for GTK+ 3.0
597#
598AC_ARG_ENABLE(gtk3,
599        AS_HELP_STRING([--disable-gtk3],[Disable use of GTK+ 3]),
600        [case "${enableval}" in
601                yes) HAVE_GTK3=yes ;;
602                no)  HAVE_GTK3=no ;;
603                *) AC_MSG_ERROR(bad value ${enableval} for --enable-gtk3) ;;
604        esac],
605        [HAVE_GTK3=yes])
606
607if test "x$HAVE_GTK3" = "xyes" ; then
608        # Check for GTK 3.0
609        PKG_CHECK_MODULES(GTK30, [ gtk+-3.0 ])
610        AC_SUBST(GTK30_CFLAGS)
611        AC_SUBST(GTK30_LIBS)
612fi
613AM_CONDITIONAL(HAVE_GTK3, test "x$HAVE_GTK3" = "xyes")
614
615AM_CONDITIONAL(HAVE_GTK2OR3, test "x$HAVE_GTK3" = "xyes" -o "x$HAVE_GTK" = "xyes" )
616
617#
618# D-Bus
619#
620AC_ARG_ENABLE(dbus,
621        AS_HELP_STRING([--disable-dbus],[Disable use of D-Bus]),
622        [case "${enableval}" in
623                yes) HAVE_DBUS=yes ;;
624                no)  HAVE_DBUS=no ;;
625                *) AC_MSG_ERROR(bad value ${enableval} for --enable-dbus) ;;
626        esac],
627        [HAVE_DBUS=yes])
628
629AC_ARG_WITH(dbus-sys, AS_HELP_STRING([--with-dbus-sys=<dir>], [Path to D-Bus system.d directory]))
630AC_ARG_WITH(dbus-system-socket, AS_HELP_STRING([--with-dbus-system-address=<address>], [Path to the D-Bus system socket, you probably want to put unix:path= at the start. Only needed for very old D-Bus releases]))
631
632DBUS_VERSION="Disabled"
633DBUS_SYS_DIR="Disabled"
634DBUS_SYSTEM_BUS_DEFAULT_ADDRESS="Disabled"
635if test "x$HAVE_DBUS" = "xyes" ; then
636    PKG_CHECK_MODULES(DBUS, [ dbus-1 >= 0.34 ])
637
638    AC_DEFINE(HAVE_DBUS, 1, [Whether we have D-Bus or not])
639
640    DBUS_VERSION=`$PKG_CONFIG dbus-1 --modversion`
641    DBUS_VERSION_MAJOR=`echo $DBUS_VERSION | awk -F. '{print $1}'`
642    DBUS_VERSION_MINOR=`echo $DBUS_VERSION | awk -F. '{print $2}'`
643    DBUS_VERSION_MICRO=`echo $DBUS_VERSION | awk -F. '{print $3}'`
644    if test "z$DBUS_VERSION_MAJOR" = "z"; then
645        DBUS_VERSION_MAJOR="0"
646    fi
647    if test "z$DBUS_VERSION_MINOR" = "z"; then
648        DBUS_VERSION_MINOR="0"
649    fi
650    if test "z$DBUS_VERSION_MICRO" = "z"; then
651        DBUS_VERSION_MICRO="0"
652    fi
653
654    if test "z$DBUS_VERSION_MAJOR" = "z0" -a "z$DBUS_VERSION_MINOR" = "z0" -a "z$DBUS_VERSION_MICRO" = "z0"; then
655        echo "Error: Couldn't determine the version of your D-Bus package."
656        echo "  This is probably an error in this script, please report it"
657        echo "  along with the following information:"
658        echo "      Base D-Buss version ='$DBUS_VERSION'"
659        echo "      DBUS_VERSION_MAJOR='$DBUS_VERSION_MAJOR'"
660        echo "      DBUS_VERSION_MINOR='$DBUS_VERSION_MINOR'"
661        echo "      DBUS_VERSION_MICRO='$DBUS_VERSION_MICRO'"
662        exit 1
663    else
664        echo "Your D-Bus version is $DBUS_VERSION_MAJOR,$DBUS_VERSION_MINOR,$DBUS_VERSION_MICRO."
665        DBUS_CFLAGS="$DBUS_CFLAGS -DDBUS_VERSION_MAJOR=$DBUS_VERSION_MAJOR"
666        DBUS_CFLAGS="$DBUS_CFLAGS -DDBUS_VERSION_MINOR=$DBUS_VERSION_MINOR"
667        DBUS_CFLAGS="$DBUS_CFLAGS -DDBUS_VERSION_MICRO=$DBUS_VERSION_MICRO"
668    fi
669
670    DBUS_CFLAGS="$DBUS_CFLAGS -DDBUS_API_SUBJECT_TO_CHANGE"
671    AC_SUBST(DBUS_CFLAGS)
672    AC_SUBST(DBUS_LIBS)
673
674    if ! test -z "$with_dbus_sys" ; then
675        DBUS_SYS_DIR="$with_dbus_sys"
676    else
677        DBUS_SYS_DIR="${sysconfdir}/dbus-1/system.d"
678    fi
679    AC_SUBST(DBUS_SYS_DIR)
680
681    if ! test -z "$with_dbus_system_address" ; then
682        DBUS_SYSTEM_BUS_DEFAULT_ADDRESS="$with_dbus_system_address"
683    else
684        # This is ugly, but D-Bus doesn't export this address for us
685        # so we have to guess, pretty much all setups i've seen have
686        # it in /var/lib/dbus or /var/run/dbus, and its defaulted to
687        # /var/run upstream so we will try guess first then default
688        # to /var/run/dbus.
689
690        DBUS_SYSTEM_BUS_DEFAULT_ADDRESS="unix:path=/var/run/dbus/system_bus_socket"
691        TRY_SOCKETS="/var/lib/dbus/system_bus_socket /var/run/dbus/system_bus_socket ${localstatedir}/run/dbus/system_bus_socket ${prefix}/var/run/dbus/system_bus_socket"
692        for sock in $TRY_SOCKETS; do
693            if test -S $sock; then
694                DBUS_SYSTEM_BUS_DEFAULT_ADDRESS="unix:path=$sock"
695            fi
696        done
697    fi
698    AC_SUBST(DBUS_SYSTEM_BUS_DEFAULT_ADDRESS)
699
700    SAVED_LIBS="$LIBS"
701    LIBS="$LIBS $DBUS_LIBS"
702    AC_CHECK_FUNCS([dbus_connection_close dbus_bus_get_private])
703    LIBS="$SAVED_LIBS"
704fi
705AM_CONDITIONAL(HAVE_DBUS, test "x$HAVE_DBUS" = "xyes")
706
707#
708# Expat
709#
710AC_ARG_WITH(xml, AS_HELP_STRING([--with-xml=[expat/bsdxml/none]],[XML library to use]))
711use_expat=false
712use_bsdxml=false
713
714# See what we have
715AC_CHECK_LIB(expat, XML_ParserCreate, [ AC_CHECK_HEADERS(expat.h, have_expat=true, have_expat=false) ], have_expat=false)
716AC_CHECK_LIB(bsdxml, XML_ParserCreate, [ AC_CHECK_HEADERS(bsdxml.h, have_bsdxml=true, have_bsdxml=false) ], have_bsdxml=false)
717
718if test "x$with_xml" = "xnone"; then
719        :
720elif test "x$with_xml" = "xexpat"; then
721	use_expat=true
722	if ! $have_expat ; then
723		AC_MSG_ERROR([*** libexpat requested, but not found ***])
724	fi
725elif test "x$with_xml" = "xbsdxml"; then
726	use_bsdxml=true
727	if ! $have_bsdxml ; then
728		AC_MSG_ERROR([*** libbsdxml requested, but not found ***])
729	fi
730elif test "x$with_xml" != "x"; then
731	AC_MSG_ERROR([*** unknown with-xml option ***])
732else
733	if $have_expat ; then
734		use_expat=true
735	elif $have_bsdxml ; then
736		use_bsdxml=true
737	else
738		AC_MSG_ERROR([*** neither libexpat not libbsdxml could be found ***])
739	fi
740fi
741
742if $use_expat; then
743	with_xml=expat
744	XML_CFLAGS=-DUSE_EXPAT_H
745	XML_LIBS=-lexpat
746fi
747if $use_bsdxml; then
748	with_xml=bsdxml
749	XML_CFLAGS=-DUSE_BSDXML_H
750	XML_LIBS=-lbsdxml
751fi
752AC_SUBST(XML_LIBS)
753AC_SUBST(XML_CFLAGS)
754
755if $use_expat || $use_bsdxml; then
756	HAVE_XML=yes
757fi
758
759AM_CONDITIONAL(HAVE_XML, test "x$HAVE_XML" = "xyes")
760
761#
762# GDBM
763#
764#
765# Check for dbm
766#
767AC_ARG_ENABLE(dbm,
768        AS_HELP_STRING([--enable-dbm],[Enable use of DBM]),
769        [case "${enableval}" in
770                yes) HAVE_DBM=yes ;;
771                no)  HAVE_DBM=no ;;
772                *) AC_MSG_ERROR(bad value ${enableval} for --enable-dbm) ;;
773        esac],
774        [HAVE_DBM=no])
775
776AC_ARG_ENABLE(gdbm,
777        AS_HELP_STRING([--disable-gdbm],[Disable use of GDBM]),
778        [case "${enableval}" in
779                yes) HAVE_GDBM=yes ;;
780                no)  HAVE_GDBM=no ;;
781                *) AC_MSG_ERROR(bad value ${enableval} for --disable-gdbm) ;;
782        esac],
783        [HAVE_GDBM=yes])
784
785if test "x$HAVE_GDBM" = "xyes" ; then
786    if test "x$HAVE_DBM" = "xyes" ; then
787        AC_MSG_ERROR([*** --enable-gdbm and --enable-dbm both specified ***])
788    fi
789    AC_CHECK_LIB(gdbm, gdbm_open, [ AC_CHECK_HEADERS(gdbm.h, have_gdbm=true, have_gdbm=false) ], have_gdbm=false)
790
791    if ! $have_gdbm ; then
792        AC_MSG_ERROR([*** libgdbm not found ***])
793    fi
794    AC_DEFINE([HAVE_GDBM],[],[Support for GDBM])
795else
796    if test "x$HAVE_DBM" = "xyes" ; then
797        AC_CHECK_HEADERS(ndbm.h, have_dbm=true, have_dbm=false)
798
799        if ! $have_dbm ; then
800            AC_MSG_ERROR([*** dbm not found ***])
801        fi
802        AC_DEFINE([HAVE_DBM],[],[Support for DBM])
803    fi
804fi
805AM_CONDITIONAL(HAVE_GDBM, test "x$HAVE_GDBM" = "xyes")
806AM_CONDITIONAL(HAVE_DBM, test "x$HAVE_DBM" = "xyes")
807
808#
809# libdaemon
810#
811AC_ARG_ENABLE(libdaemon,
812        AS_HELP_STRING([--disable-libdaemon],[Disable use of libdaemon]),
813        [case "${enableval}" in
814                yes) HAVE_LIBDAEMON=yes ;;
815                no)  HAVE_LIBDAEMON=no ;;
816                *) AC_MSG_ERROR(bad value ${enableval} for --enable-libdaemon) ;;
817        esac],
818        [HAVE_LIBDAEMON=yes])
819
820if test "x$HAVE_LIBDAEMON" = "xyes" ; then
821    PKG_CHECK_MODULES(LIBDAEMON, [ libdaemon >= 0.14 ])
822    AC_SUBST(LIBDAEMON_CFLAGS)
823    AC_SUBST(LIBDAEMON_LIBS)
824fi
825AM_CONDITIONAL(HAVE_LIBDAEMON, test "x$HAVE_LIBDAEMON" = "xyes")
826
827#
828# Python stuff
829#
830AC_ARG_ENABLE(python,
831    AS_HELP_STRING([--disable-python], [Disable scripts that depends on python]),
832    [case "${enableval}" in
833          yes) HAVE_PYTHON=yes ;;
834          no)  HAVE_PYTHON=no ;;
835          *) AC_MSG_ERROR([bad value ${enableval} for --enable-python]) ;;
836    esac],[HAVE_PYTHON=yes])
837
838HAVE_PYTHON_DBUS=no
839HAVE_PYGOBJECT=no
840
841if test "x$HAVE_PYTHON" = "xyes" ; then
842    AM_PATH_PYTHON([2.6])
843
844    AC_ARG_ENABLE(pygobject,
845        AS_HELP_STRING([--disable-pygobject],[Disable use of Python GObject]),
846        [case "${enableval}" in
847                yes) HAVE_PYGOBJECT=yes ;;
848                no)  HAVE_PYGOBJECT=no ;;
849                *) AC_MSG_ERROR(bad value ${enableval} for --enable-pygobject) ;;
850        esac],
851        [HAVE_PYGOBJECT=yes])
852
853    if test "x$HAVE_PYGOBJECT" = "xyes" ; then
854        PKG_CHECK_MODULES([PYGOBJECT],[pygobject-3.0],,
855            [AC_MSG_ERROR(Could not find Python GObject)])
856    fi
857
858
859    if test "x$HAVE_DBUS" = "xyes" ; then
860        AC_ARG_ENABLE(python-dbus,
861	    AS_HELP_STRING([--disable-python-dbus],[Disable use of D-Bus in Python]),
862            [case "${enableval}" in
863                   yes) HAVE_PYTHON_DBUS=yes ;;
864                   no)  HAVE_PYTHON_DBUS=no ;;
865                   *) AC_MSG_ERROR(bad value ${enableval} for --enable-python-dbus) ;;
866            esac],
867            [HAVE_PYTHON_DBUS=yes])
868
869        if test "x$HAVE_PYTHON_DBUS" = "xyes"; then
870            AM_CHECK_PYMOD(dbus,,,[AC_MSG_ERROR(Could not find Python module dbus)])
871        fi
872
873        AM_CHECK_PYMOD(socket,,,[AC_MSG_ERROR(Could not find Python module socket)])
874        if test "x$HAVE_GDBM" = "xyes" || test "x$HAVE_DBM" = "xyes"; then
875            AM_CHECK_PYMOD(anydbm,,,[
876                AM_CHECK_PYMOD(dbm,,,[AC_MSG_ERROR(Could not find Python module dbm)])
877            ])
878        fi
879    fi
880fi
881AM_CONDITIONAL(HAVE_PYTHON, [test "x$HAVE_PYTHON" = "xyes" ])
882AM_CONDITIONAL(HAVE_PYGOBJECT, test "x$HAVE_PYGOBJECT" = "xyes")
883AM_CONDITIONAL(HAVE_PYTHON_DBUS, test "x$HAVE_PYTHON_DBUS" = "xyes")
884
885#
886# Check for mono stuff
887#
888HAVE_MONO=no
889if test "x$HAVE_DBUS" = "xyes" ; then
890    AC_ARG_ENABLE(mono,
891            AS_HELP_STRING([--disable-mono],[Disable mono bindings]),
892            [case "${enableval}" in
893                    yes) HAVE_MONO=yes ;;
894                    no)  HAVE_MONO=no ;;
895                    *) AC_MSG_ERROR(bad value ${enableval} for --enable-mono) ;;
896            esac],
897            [HAVE_MONO=yes])
898
899    if test "x$HAVE_MONO" = "xyes" ; then
900        AC_PATH_PROG(MCS, mcs)
901        if test "x$MCS" = "x" ; then
902            AC_MSG_ERROR([Can not find "mcs" - The Mono C-Sharp Compiler) in your PATH])
903        fi
904
905        AC_PATH_PROG(GACUTIL, gacutil)
906        if test "x$GACUTIL" = "x" ; then
907            AC_MSG_ERROR([Can not find "gacutil" in your PATH])
908        fi
909
910        AC_SUBST(MCS)
911        AC_SUBST(GACUTIL)
912    fi
913fi
914AM_CONDITIONAL(HAVE_MONO, test "x$HAVE_MONO" = "xyes")
915
916#
917# Check for monodoc stuff
918#
919HAVE_MONODOC=no
920AC_ARG_ENABLE(monodoc,
921        AS_HELP_STRING([--disable-monodoc],[Disable documentation for mono bindings]),
922        [case "${enableval}" in
923                yes) HAVE_MONODOC=yes ;;
924                no)  HAVE_MONODOC=no ;;
925                *) AC_MSG_ERROR(bad value ${enableval} for --enable-monodoc) ;;
926        esac],
927        [HAVE_MONODOC=yes])
928
929if test "x$HAVE_MONO" = "xyes" && test "x$HAVE_MONODOC" = "xyes" ; then
930        PKG_CHECK_MODULES(MONODOC, [monodoc >= 1.1.8])
931        MONODOC_DIR=`$PKG_CONFIG --variable=sourcesdir monodoc`
932
933        AC_PATH_PROG(MONODOCER, monodocer)
934        AC_PATH_PROG(MDASSEMBLER, mdassembler)
935
936        AC_SUBST(MONODOC_DIR)
937        AC_SUBST(MONODOCER)
938        AC_SUBST(MDASSEMBLER)
939fi
940AM_CONDITIONAL(HAVE_MONODOC, test "x$HAVE_MONODOC" = "xyes")
941
942#
943# Build autoipd?
944#
945AC_ARG_ENABLE(autoipd,
946        AS_HELP_STRING([--disable-autoipd],[Disable building of avahi-autoipd]),
947        [case "${enableval}" in
948                yes) ENABLE_AUTOIPD=yes ;;
949                no)  ENABLE_AUTOIPD=no ;;
950                *) AC_MSG_ERROR(bad value ${enableval} for --disable-autoipd) ;;
951        esac],
952        [ENABLE_AUTOIPD=yes])
953
954AM_CONDITIONAL(ENABLE_AUTOIPD, test "x$ENABLE_AUTOIPD" = "xyes")
955
956#
957# Defining users and groups
958#
959AC_ARG_WITH(avahi_user, AS_HELP_STRING([--with-avahi-user=<user>],[User for running avahi-daemon (avahi)]))
960if test -z "$with_avahi_user" ; then
961    AVAHI_USER=avahi
962else
963    AVAHI_USER=$with_avahi_user
964fi
965AC_SUBST(AVAHI_USER)
966AC_DEFINE_UNQUOTED(AVAHI_USER,"$AVAHI_USER", [User for running the Avahi daemon])
967
968AC_ARG_WITH(avahi_group,AS_HELP_STRING([--with-avahi-group=<group>],[Group for running avahi-daemon (avahi)]))
969if test -z "$with_avahi_group" ; then
970    AVAHI_GROUP=avahi
971else
972    AVAHI_GROUP=$with_avahi_group
973fi
974AC_SUBST(AVAHI_GROUP)
975AC_DEFINE_UNQUOTED(AVAHI_GROUP,"$AVAHI_GROUP", [Group for Avahi])
976
977AC_ARG_WITH(avahi_priv_access_group,AS_HELP_STRING([--with-avahi-priv-access-group=<group>],[Priviliged access group for Avahi clients (netdev)]))
978if test -z "$with_avahi_priv_access_group" ; then
979    AVAHI_PRIV_ACCESS_GROUP=netdev
980else
981    AVAHI_PRIV_ACCESS_GROUP=$with_avahi_priv_access_group
982fi
983AC_SUBST(AVAHI_PRIV_ACCESS_GROUP)
984AC_DEFINE_UNQUOTED(AVAHI_PRIV_ACCESS_GROUP,"$AVAHI_PRIV_ACCESS_GROUP", [Privileged access group for Avahi clients])
985
986AC_ARG_WITH(autoipd_user, AS_HELP_STRING([--with-autoipd-user=<user>],[User for running the avahi-autoipd daemon (avahi-autoipd)]))
987if test -z "$with_autoipd_user" ; then
988    AVAHI_AUTOIPD_USER=avahi-autoipd
989else
990    AVAHI_AUTOIPD_USER=$with_autoipd_user
991fi
992AC_SUBST(AVAHI_AUTOIPD_USER)
993AC_DEFINE_UNQUOTED(AVAHI_AUTOIPD_USER,"$AVAHI_AUTOIPD_USER", [User for running the avahi-autoipd daemon])
994
995AC_ARG_WITH(autoipd_group,AS_HELP_STRING([--with-autoipd-group=<group>],[Group for running the avahi-autoipd daemon (avahi-autoipd)]))
996if test -z "$with_autoipd_group" ; then
997    AVAHI_AUTOIPD_GROUP=avahi-autoipd
998else
999    AVAHI_AUTOIPD_GROUP=$with_autoipd_group
1000fi
1001AC_SUBST(AVAHI_AUTOIPD_GROUP)
1002AC_DEFINE_UNQUOTED(AVAHI_AUTOIPD_GROUP,"$AVAHI_AUTOIPD_GROUP", [Group for running the avahi-autoipd daemon])
1003
1004#
1005# Avahi runtime dir
1006#
1007avahi_runtime_dir="/run"
1008avahi_socket="${avahi_runtime_dir}/avahi-daemon/socket"
1009AC_SUBST(avahi_runtime_dir)
1010AC_SUBST(avahi_socket)
1011
1012#
1013# Avahi interfaces dir
1014#
1015if test "x$HAVE_PYTHON_DBUS" = "xyes" -o "x$HAVE_GTK" = "xyes" -o "x$HAVE_GTK3" = "xyes"; then
1016	interfacesdir="${datadir}/${PACKAGE}/interfaces/"
1017	AC_SUBST(interfacesdir)
1018fi
1019
1020#
1021# Doxygen
1022#
1023DX_HTML_FEATURE(ON)
1024DX_CHM_FEATURE(OFF)
1025DX_CHI_FEATURE(OFF)
1026DX_MAN_FEATURE(OFF)
1027DX_RTF_FEATURE(OFF)
1028DX_XML_FEATURE(ON)
1029DX_PDF_FEATURE(OFF)
1030DX_PS_FEATURE(OFF)
1031DX_INIT_DOXYGEN(avahi, doxygen.cfg, doxygen)
1032
1033AC_ARG_ENABLE(core-docs,
1034        AS_HELP_STRING([--enable-core-docs],[Enable building of documentation for avahi-core]),
1035[case "${enableval}" in
1036  yes) ENABLE_CORE_DOCS=yes ;;
1037  no)  ENABLE_CORE_DOCS=no ;;
1038  *) AC_MSG_ERROR([bad value ${enableval} for --enable-core-docs]) ;;
1039esac],[ENABLE_CORE_DOCS=no])
1040
1041AM_CONDITIONAL([ENABLE_CORE_DOCS], [test "x$ENABLE_CORE_DOCS" = xyes])
1042
1043#
1044# Build and Install man pages
1045#
1046AC_ARG_ENABLE(manpages,
1047        AS_HELP_STRING([--disable-manpages],[Disable building and installation of man pages]),
1048[case "${enableval}" in
1049  yes) manpages=yes ;;
1050  no)  manpages=no ;;
1051  *) AC_MSG_ERROR([bad value ${enableval} for --disable-manpages]) ;;
1052esac],[manpages=yes])
1053
1054if test x$manpages = xyes ; then
1055    #
1056    # XMLTOMAN manpage generation
1057    #
1058    AC_ARG_ENABLE(xmltoman,
1059    AS_HELP_STRING([--disable-xmltoman],[Disable rebuilding of man pages with xmltoman]),
1060    [case "${enableval}" in
1061      yes) xmltoman=yes ;;
1062      no)  xmltoman=no ;;
1063      *) AC_MSG_ERROR([bad value ${enableval} for --disable-xmltoman]) ;;
1064    esac],[xmltoman=yes])
1065
1066    if test x$xmltoman = xyes ; then
1067        AC_CHECK_PROG(have_xmltoman, xmltoman, yes, no)
1068    fi
1069
1070    if test x$have_xmltoman = xno -o x$xmltoman = xno; then
1071        if ! test -e $srcdir/man/avahi-daemon.8 ; then
1072            AC_MSG_ERROR([*** xmltoman was not found or was disabled, it is required to build the manpages as they have not been pre-built, install xmltoman, pass --disable-manpages or dont pass --disable-xmltoman])
1073            exit 1
1074        fi
1075        AC_MSG_WARN([*** Not rebuilding man pages as xmltoman is not found ***])
1076        xmltoman=no
1077    fi
1078fi
1079AM_CONDITIONAL([USE_XMLTOMAN], [test "x$xmltoman" = xyes])
1080AM_CONDITIONAL([BUILD_MANPAGES], [test "x$manpages" = xyes])
1081
1082#
1083# Conditionally compile test and example programs
1084#
1085AC_ARG_ENABLE(tests,
1086        AS_HELP_STRING([--enable-tests],[Enable building of tests and examples]),
1087        [case "${enableval}" in
1088                yes) ENABLE_TESTS=yes ;;
1089                no)  ENABLE_TESTS=no ;;
1090                *) AC_MSG_ERROR(bad value ${enableval} for --enable-tests) ;;
1091        esac],
1092        [ENABLE_TESTS=no])
1093
1094AM_CONDITIONAL([ENABLE_TESTS], [test "x$ENABLE_TESTS" = "xyes"])
1095
1096#
1097# Optionally enable libdns_sd compatibility support
1098#
1099AC_ARG_ENABLE(compat-libdns_sd,
1100        AS_HELP_STRING([--enable-compat-libdns_sd],[Enable compatibility layer for libdns_sd]),
1101        [case "${enableval}" in
1102                yes) ENABLE_COMPAT_LIBDNS_SD=yes ;;
1103                no)  ENABLE_COMPAT_LIBDNS_SD=no ;;
1104                *) AC_MSG_ERROR(bad value ${enableval} for --enable-compat-libdns_sd) ;;
1105        esac],
1106        [ENABLE_COMPAT_LIBDNS_SD=no])
1107
1108AM_CONDITIONAL([ENABLE_COMPAT_LIBDNS_SD], [test "x$ENABLE_COMPAT_LIBDNS_SD" = "xyes"])
1109
1110#
1111# Optionally enable HOWL compatibility support
1112#
1113AC_ARG_ENABLE(compat-howl,
1114        AS_HELP_STRING([--enable-compat-howl],[Enable compatibility layer for HOWL]),
1115        [case "${enableval}" in
1116                yes) ENABLE_COMPAT_HOWL=yes ;;
1117                no)  ENABLE_COMPAT_HOWL=no ;;
1118                *) AC_MSG_ERROR(bad value ${enableval} for --enable-compat-howl) ;;
1119        esac],
1120        [ENABLE_COMPAT_HOWL=no])
1121
1122AM_CONDITIONAL([ENABLE_COMPAT_HOWL], [test "x$ENABLE_COMPAT_HOWL" = "xyes"])
1123
1124#
1125# systemd
1126#
1127AC_ARG_WITH([systemdsystemunitdir],
1128        AS_HELP_STRING([--with-systemdsystemunitdir=DIR], [Directory for systemd service files]),
1129        [],
1130        [with_systemdsystemunitdir=$($PKG_CONFIG --variable=systemdsystemunitdir systemd)])
1131if test "x$with_systemdsystemunitdir" != xno; then
1132        AC_SUBST([systemdsystemunitdir], [$with_systemdsystemunitdir])
1133fi
1134AM_CONDITIONAL(HAVE_SYSTEMD, [test -n "$with_systemdsystemunitdir" -a "x$with_systemdsystemunitdir" != xno ])
1135
1136# ==========================================================================
1137AC_CONFIG_FILES([
1138Makefile
1139avahi-common/Makefile
1140avahi-core/Makefile
1141avahi-glib/Makefile
1142avahi-gobject/Makefile
1143avahi-qt/Makefile
1144avahi-daemon/Makefile
1145avahi-daemon/avahi-dbus.conf
1146avahi-discover-standalone/Makefile
1147avahi-client/Makefile
1148initscript/Makefile
1149initscript/debian/Makefile
1150initscript/gentoo/Makefile
1151initscript/suse/Makefile
1152initscript/fedora/Makefile
1153initscript/lfs/Makefile
1154initscript/mandriva/Makefile
1155initscript/darwin/Makefile
1156initscript/freebsd/Makefile
1157initscript/slackware/Makefile
1158avahi-dnsconfd/Makefile
1159avahi-utils/Makefile
1160avahi-python/Makefile
1161avahi-python/avahi/Makefile
1162avahi-python/avahi-discover/Makefile
1163examples/Makefile
1164common/Makefile
1165man/Makefile
1166tests/Makefile
1167service-type-database/Makefile
1168avahi-sharp/Makefile
1169avahi-ui-sharp/Makefile
1170avahi-compat-libdns_sd/Makefile
1171avahi-compat-howl/Makefile
1172avahi-compat-howl/samples/Makefile
1173avahi-autoipd/Makefile
1174avahi-ui/Makefile
1175avahi-libevent/Makefile
1176po/Makefile.in
1177])
1178AC_OUTPUT
1179
1180# ==========================================================================
1181echo "
1182 ---{ $PACKAGE_NAME $VERSION }---
1183
1184    prefix:                                    ${prefix}
1185    sysconfdir:                                ${sysconfdir}
1186    localstatedir:                             ${localstatedir}
1187    avahi socket:                              ${avahi_socket}
1188    dbus-1 system.d dir:                       ${DBUS_SYS_DIR}
1189    dbus-1 version:                            ${DBUS_VERSION}
1190    dbus-1 system socket:                      ${DBUS_SYSTEM_BUS_DEFAULT_ADDRESS}
1191    C Compiler:                                ${CC}
1192    CFLAGS:                                    ${CFLAGS}
1193    Enable GLIB:                               ${HAVE_GLIB}
1194    Enable GLIB GObject:                       ${HAVE_GOBJECT}
1195    Enable GObject Introspection:              ${found_introspection}
1196    Enable GTK 2.0:                            ${HAVE_GTK}
1197    Enable GTK 3.0:                            ${HAVE_GTK3}
1198    Enable D-Bus:                              ${HAVE_DBUS}
1199    With XML:                                  ${with_xml}
1200    Enable GDBM:                               ${HAVE_GDBM}
1201    Enable DBM:                                ${HAVE_DBM}
1202    Enable libdaemon:                          ${HAVE_LIBDAEMON}
1203    Enable Python:                             ${HAVE_PYTHON}
1204    Enable pygobject:                          ${HAVE_PYGOBJECT}
1205    Enable python-dbus:                        ${HAVE_PYTHON_DBUS}
1206    Enable QT3:                                ${HAVE_QT3}
1207    Enable QT4:                                ${HAVE_QT4}
1208    Enable QT5:                                ${HAVE_QT5}
1209    Enable Mono:                               ${HAVE_MONO}
1210    Enable Monodoc:                            ${HAVE_MONODOC}
1211    Distribution/OS:                           ${with_distro}
1212    User for avahi-daemon:                     ${AVAHI_USER}
1213    Group for avahi-daemon:                    ${AVAHI_GROUP}
1214    Priviliged access group for Avahi clients: ${AVAHI_PRIV_ACCESS_GROUP}
1215    User for avahi-autoipd:                    ${AVAHI_AUTOIPD_USER}
1216    Group for avahi-autoipd:                   ${AVAHI_AUTOIPD_GROUP}
1217    Enable chroot():                           ${enable_chroot}
1218    Enable Linux inotify:                      ${have_inotify}
1219    Enable stack-smashing protection:          ${enable_ssp}
1220    systemd unit directory:                    ${with_systemdsystemunitdir}
1221"
1222
1223BUILD_DAEMON="no   (You need libdaemon and expat/bsdxml!)"
1224
1225if test "x$HAVE_XML" = "xyes" -a "x$HAVE_LIBDAEMON" = "xyes" ; then
1226    BUILD_DAEMON=yes
1227fi
1228
1229BUILD_PYTHON="no   (You need python, pygobject and python-dbus!)"
1230
1231if test "x$BUILD_DAEMON" = "xyes" -a "x$HAVE_DBUS" = "xyes" -a "x$HAVE_PYTHON" = "xyes" -a "x$HAVE_PYTHON_DBUS" = "xyes" -a "x$HAVE_PYGOBJECT" = "xyes" ; then
1232    BUILD_PYTHON=yes
1233fi
1234
1235BUILD_CLIENT="no   (You need avahi-daemon and D-Bus!)"
1236
1237if test "x$HAVE_DBUS" = "xyes" ; then
1238    BUILD_CLIENT=yes
1239fi
1240
1241if test "x$ENABLE_COMPAT_LIBDNS_SD" = "xyes" -a "x$BUILD_CLIENT" != "xyes" ; then
1242   ENABLE_COMPAT_LIBDNS_SD="no   (You need libavahi-client!)"
1243fi
1244if test "x$ENABLE_COMPAT_HOWL" = "xyes" -a "x$BUILD_CLIENT" != "xyes" ; then
1245   ENABLE_COMPAT_HOWL="no   (You need libavahi-client!)"
1246fi
1247if test "x$ENABLE_AUTOIPD" = "xyes" -a "x$HAVE_LIBDAEMON" != "xyes" ; then
1248   ENABLE_AUTOIPD="no   (You need libdaemon!)"
1249fi
1250
1251HAVE_GTK2OR3=no
1252if test "x$HAVE_GTK" = "xyes" -o "x$HAVE_GTK3" = "xyes" ; then
1253   HAVE_GTK2OR3=yes
1254fi
1255
1256BUILD_UI="no"
1257if test "x$HAVE_GTK2OR3" = "xyes" -a "x$BUILD_CLIENT" = "xyes" ; then
1258   BUILD_UI="yes"
1259fi
1260
1261BUILD_GOBJECT="no"
1262if test "x$BUILD_CLIENT" = "xyes" -a "x$HAVE_GOBJECT" = "xyes" ; then
1263   BUILD_GOBJECT="yes"
1264fi
1265
1266echo "\
1267    Building libavahi-core              yes
1268    Building avahi-daemon:              ${BUILD_DAEMON}
1269    Building avahi-dnsconfd:            ${BUILD_DAEMON}
1270    Building libavahi-client:           ${BUILD_CLIENT}
1271    Building avahi-utils:               ${BUILD_CLIENT}
1272    Building avahi-python:              ${BUILD_PYTHON}
1273    Building libavahi-glib:             ${HAVE_GLIB}
1274    Building libavahi-gobject:          ${BUILD_GOBJECT}
1275    Building avahi-discover-standalone: ${HAVE_GTK2OR3}
1276    Building libavahi-qt3:              ${HAVE_QT3}
1277    Building libavahi-qt4:              ${HAVE_QT4}
1278    Building libavahi-qt5:              ${HAVE_QT5}
1279    Building avahi-sharp:               ${HAVE_MONO}
1280    Building avahi-compat-libdns_sd:    ${ENABLE_COMPAT_LIBDNS_SD}
1281    Building avahi-compat-howl:         ${ENABLE_COMPAT_HOWL}
1282    Building tests:                     ${ENABLE_TESTS}
1283    Building avahi-core documentation:  ${ENABLE_CORE_DOCS}
1284    Building avahi-autoipd:             ${ENABLE_AUTOIPD}
1285    Building libavahi-ui:               ${BUILD_UI}
1286    Building libavahi-libevent:		${HAVE_LIBEVENT}
1287"
1288