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