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