]> git.meshlink.io Git - catta/blob - configure.ac
bump sonames
[catta] / configure.ac
1 # -*- Autoconf -*-
2 # Process this file with autoconf to produce a configure script.
3
4 # $Id$
5
6 # This file is part of avahi.
7 #
8 # avahi is free software; you can redistribute it and/or modify it
9 # under the terms of the GNU Lesser General Public License as
10 # published by the Free Software Foundation; either version 2 of the
11 # License, or (at your option) any later version.
12 #
13 # avahi is distributed in the hope that it will be useful, but WITHOUT
14 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
15 # or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
16 # License for more details.
17 #
18 # You should have received a copy of the GNU Lesser General Public
19 # License along with avahi; if not, write to the Free Software
20 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
21 # USA.
22
23 AC_PREREQ(2.57)
24 AC_INIT([avahi],[0.6.10],[avahi (at) lists (dot) freedesktop (dot) org])
25 AC_CONFIG_SRCDIR([avahi-core/server.c])
26 AC_CONFIG_HEADERS([config.h])
27 AM_INIT_AUTOMAKE([foreign 1.9 -Wall])
28
29 AC_SUBST(PACKAGE_URL, [http://avahi.org/])
30
31 AC_SUBST(LIBAVAHI_COMMON_VERSION_INFO, [7:0:4])
32 AC_SUBST(LIBAVAHI_CORE_VERSION_INFO, [4:2:0])
33 AC_SUBST(LIBAVAHI_CLIENT_VERSION_INFO, [4:2:1])
34 AC_SUBST(LIBAVAHI_GLIB_VERSION_INFO, [1:0:0])
35 AC_SUBST(LIBAVAHI_QT3_VERSION_INFO, [1:1:0])
36 AC_SUBST(LIBAVAHI_QT4_VERSION_INFO, [1:1:0])
37 AC_SUBST(LIBAVAHI_COMPAT_LIBDNS_SD_VERSION_INFO, [1:0:0])
38 AC_SUBST(LIBAVAHI_COMPAT_HOWL_VERSION_INFO, [0:0:0])
39 AC_SUBST(HOWL_COMPAT_VERSION, [0.9.8])
40
41 if type -p stow > /dev/null && test -d /usr/local/stow ; then
42     AC_MSG_NOTICE([*** Found /usr/local/stow: default install prefix set to /usr/local/stow/${PACKAGE_NAME}-${PACKAGE_VERSION} ***])
43     ac_default_prefix="/usr/local/stow/${PACKAGE_NAME}-${PACKAGE_VERSION}"
44 fi
45
46 # Checks for programs.
47 AC_PROG_CC
48 AC_PROG_CXX
49 AC_GNU_SOURCE
50 AC_PROG_CPP
51 AC_PROG_INSTALL
52 AC_PROG_LN_S
53 AC_PROG_MAKE_SET
54 AC_PROG_GCC_TRADITIONAL
55
56 # libtool stuff
57 AC_PROG_LIBTOOL
58
59 ACX_PTHREAD(,AC_MSG_ERROR([Missing POSIX Threads support]))
60
61 #
62 # Check for netlink.h
63 #
64 AC_CHECK_HEADER(linux/netlink.h, 
65 HAVE_NETLINK=yes
66 AC_DEFINE([HAVE_NETLINK],[],[Support for Linux netlink])
67 , [], [
68 #include <sys/socket.h>
69 #include <asm/types.h>
70 ])
71
72 AM_CONDITIONAL(HAVE_NETLINK, [ test x"$HAVE_NETLINK" = xyes ])
73
74 #
75 # Check for net/route.h
76 #
77 AC_CHECK_HEADER(net/route.h, 
78 HAVE_PF_ROUTE=yes
79 AC_DEFINE([HAVE_PF_ROUTE],[],[Support for PF_ROUTE])
80 , [], [
81 #include <sys/types.h>
82 #include <sys/socket.h>
83 ])
84
85 AM_CONDITIONAL(HAVE_PF_ROUTE, [ test x"$HAVE_PF_ROUTE" = xyes ])
86
87 #
88 # Check for sys/filio.h; needed for FIONREAD on Solaris
89 #
90 AC_CHECK_HEADER(sys/filio.h, 
91 HAVE_SYS_FILIO_H=yes
92 AC_DEFINE([HAVE_SYS_FILIO_H],[],[Support for sys/filio.h])
93 , [], [
94 ])
95
96 AM_CONDITIONAL(HAVE_SYS_FILIO_H, [ test x"$HAVE_SYS_FILIO_H" = xyes ])
97
98 #
99 # Check for sys/sysctl.h; not present on Solaris
100 #
101 AC_CHECK_HEADER(sys/sysctl.h, 
102 HAVE_SYS_SYSCTL=yes
103 AC_DEFINE([HAVE_SYS_SYSCTL_H],[],[Support for sys/sysctl.h])
104 , [], [
105 ])
106
107 AM_CONDITIONAL(HAVE_SYS_SYSCTL_H, [ test x"$HAVE_SYS_SYSCTL_H" = xyes ])
108
109 #
110 # Check for struct ip_mreqn
111 #
112 AC_MSG_CHECKING(for struct ip_mreqn)
113 AC_TRY_COMPILE([#include <netinet/in.h>], [
114         struct ip_mreqn mreq;
115         mreq.imr_address.s_addr = 0;
116 ], [
117         # Yes, we have it...
118         AC_MSG_RESULT(yes)
119         AC_DEFINE([HAVE_STRUCT_IP_MREQN],[],[Support for struct ip_mreqn])
120 ], [
121         # We'll just have to try and use struct ip_mreq
122         AC_MSG_RESULT(no)
123         AC_MSG_CHECKING(for struct ip_mreq)
124         AC_TRY_COMPILE([#include <netinet/in.h>], [
125                 struct ip_mreq mreq;
126                 mreq.imr_interface.s_addr = 0;
127         ], [
128                 # Yes, we have it...
129                 AC_MSG_RESULT(yes)
130                 AC_DEFINE([HAVE_STRUCT_IP_MREQ],[],[Support for struct ip_mreq])
131         ], [
132                 # No multicast support
133                         AC_MSG_RESULT(no)
134         ])
135 ])
136
137 #
138 # Detecting the linux distribution for specific things like init scripts.
139 #
140 AC_ARG_WITH(distro, AS_HELP_STRING([--with-distro=DISTRO],[Specify the distribution to target: One of debian, gentoo, archlinux, fedora, mandriva, darwin, netbsd, freebsd, slackware or none]))
141 if test "z$with_distro" = "z"; then
142     AC_CHECK_FILE(/etc/SuSE-release,with_distro="suse")
143     AC_CHECK_FILE(/etc/gentoo-release,with_distro="gentoo")
144     AC_CHECK_FILE(/etc/arch-release,with_distro="archlinux")
145     AC_CHECK_FILE(/etc/debian_version,with_distro="debian")
146     AC_CHECK_FILE(/etc/redhat-release,with_distro="fedora")
147     AC_CHECK_FILE(/etc/mandriva-release,with_distro="mandriva")
148     AC_CHECK_FILE(/etc/slackware-version,with_distro="slackware")
149     if test "z$with_distro" = "z"; then
150         with_distro=`uname -s`
151     fi
152 fi
153 with_distro=`echo ${with_distro} | tr '[[:upper:]]' '[[:lower:]]' `
154
155 case $with_distro in
156     debian|gentoo|archlinux|suse|fedora|mandriva|darwin|freebsd|slackware|none)
157      ;;
158     netbsd)
159      AC_MSG_WARN([Your distribution (${with_distro}) is supported but no init script exist yet! (patches welcome)])
160      ;;
161     linux)
162      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.])
163      ;;
164     *)
165      AC_MSG_ERROR([Your distribution (${with_distro}) is not yet supported, init scripts and dbus configuration will not be installed! (patches welcome), you can specify --with-distro=none to skip this check])
166      ;;
167 esac
168
169 AM_CONDITIONAL(TARGET_SUSE, test x"$with_distro" = xsuse)
170 AM_CONDITIONAL(TARGET_GENTOO, test x"$with_distro" = xgentoo)
171 AM_CONDITIONAL(TARGET_DEBIAN, test x"$with_distro" = xdebian)
172 AM_CONDITIONAL(TARGET_ARCHLINUX, test x"$with_distro" = xarchlinux)
173 AM_CONDITIONAL(TARGET_FEDORA, test x"$with_distro" = xfedora)
174 AM_CONDITIONAL(TARGET_MANDRIVA, test x"$with_distro" = xmandriva)
175 AM_CONDITIONAL(TARGET_DARWIN, test x"$with_distro" = xdarwin)
176 AM_CONDITIONAL(TARGET_NETBSD, test x"$with_distro" = xnetbsd)
177 AM_CONDITIONAL(TARGET_FREEBSD, test x"$with_distro" = xfreebsd)
178 AM_CONDITIONAL(TARGET_SLACKWARE, test x"$with_distro" = xslackware)
179
180 test_gcc_flag() {
181     AC_LANG_CONFTEST([int main() {}])
182     $CC -c conftest.c $CFLAGS $@ > /dev/null 2> /dev/null
183     ret=$?
184     rm -f conftest.o
185     return $ret
186 }
187
188 # If using GCC specify some additional parameters
189 if test "x$GCC" = "xyes" ; then
190
191     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 -Winline"
192
193     if test "x$HAVE_NETLINK" = "xyes" ; then
194         # Test whether rtnetlink.h can be included when compiled with -std=c99
195         # some distributions (e.g. archlinux) have broken headers that dont
196         # define __u64 with -std=c99
197         AC_MSG_CHECKING([checking whether rtnetlink.h can be included with -std=c99])
198         OLDCFLAGS="$CFLAGS"
199         CFLAGS="-std=c99"
200         AC_TRY_COMPILE([#include <linux/rtnetlink.h>], [],
201             use_stdc99=yes, use_stdc99=no)
202
203         if test x"$use_stdc99" = xyes; then
204             DESIRED_FLAGS="-std=c99 $DESIRED_FLAGS"
205             AC_MSG_RESULT([yes])
206         else
207             AC_MSG_RESULT([no])
208         fi
209
210         CFLAGS="$OLDCFLAGS"
211     else
212         DESIRED_FLAGS="-std=c99 $DESIRED_FLAGS"
213     fi
214
215     for flag in $DESIRED_FLAGS ; do
216         AC_MSG_CHECKING([whether $CC accepts $flag])
217         if test_gcc_flag $flag ; then 
218            CFLAGS="$CFLAGS $flag"
219            AC_MSG_RESULT([yes])
220         else
221            AC_MSG_RESULT([no])
222         fi
223     done 
224 fi
225
226 # Checks for header files.
227 AC_HEADER_STDC
228 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])
229 AC_HEADER_STDBOOL
230
231 # Checks for typedefs, structures, and compiler characteristics.
232 AC_C_CONST
233 AC_TYPE_SIZE_T
234 AC_HEADER_TIME
235 AC_HEADER_SYS_WAIT
236
237 # Checks for library functions.
238 AC_FUNC_MEMCMP
239 AC_FUNC_SELECT_ARGTYPES
240 AC_FUNC_MALLOC
241 AC_FUNC_REALLOC
242 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])
243
244 AC_FUNC_CHOWN
245 AC_FUNC_STAT
246 AC_TYPE_MODE_T
247 AC_TYPE_PID_T
248
249 AC_CHECK_DECLS(environ)
250
251 enable_chroot=yes
252 AC_CHECK_HEADERS([sys/capability.h],,enable_chroot=no)
253 AC_CHECK_HEADERS([sys/prctl.h],,enable_chroot=no)
254 AC_CHECK_FUNCS([chroot],,enable_chroot=no)
255
256 AM_CONDITIONAL(ENABLE_CHROOT, test "x$enable_chroot" = "xyes")
257
258 if test "x$enable_chroot" = "xyes" ; then
259    AC_DEFINE([ENABLE_CHROOT], 1, [Enable chroot() usage])
260 fi
261
262 AC_CHECK_LIB(dl, dlopen, [ AC_CHECK_HEADERS(dlfcn.h, HAVE_DLOPEN=yes, HAVE_DLOPEN=no) ], HAVE_DLOPEN=no)
263 if test "x$HAVE_DLOPEN" = "xyes" ; then
264     AC_DEFINE([HAVE_DLOPEN],1,[Have dlopen()])
265 fi
266 AM_CONDITIONAL(HAVE_DLOPEN, test "x$HAVE_DLOPEN" = "xyes")
267
268 # Check for pkg-config manually first, as if its not installed the
269 # PKG_PROG_PKG_CONFIG macro won't be defined.
270 AC_CHECK_PROG(have_pkg_config, pkg-config, yes, no)
271
272 if test x"$have_pkg_config" = "xno"; then
273     AC_MSG_ERROR(pkg-config is required to install this program)
274 fi
275
276 PKG_PROG_PKG_CONFIG
277
278 #
279 # Check for GLIB 2.0
280 #
281 AC_ARG_ENABLE(glib,
282         AS_HELP_STRING([--disable-glib],[Disable use of GLib]),
283         [case "${enableval}" in
284                 yes) HAVE_GLIB=yes ;;
285                 no)  HAVE_GLIB=no ;;
286                 *) AC_MSG_ERROR(bad value ${enableval} for --enable-glib) ;;
287         esac],
288         [HAVE_GLIB=yes])
289
290 if test "x$HAVE_GLIB" = "xyes" ; then
291         PKG_CHECK_MODULES(GLIB20, [ glib-2.0 >= 2.4.0 ])
292         AC_SUBST(GLIB20_CFLAGS)
293         AC_SUBST(GLIB20_LIBS)
294 fi
295 AM_CONDITIONAL(HAVE_GLIB, test "x$HAVE_GLIB" = "xyes")
296
297 #
298 # Check for Qt 3
299 #
300 AC_ARG_ENABLE(qt3,
301         AS_HELP_STRING([--disable-qt3],[Disable building of Qt3 mainloop integration]),
302         [case "${enableval}" in
303                 yes) HAVE_QT3=yes ;;
304                 no)  HAVE_QT3=no ;;
305                 *) AC_MSG_ERROR(bad value ${enableval} for --enable-qt3) ;;
306         esac],
307         [HAVE_QT3=yes])
308
309 if test "x$HAVE_QT3" = "xyes" ; then
310         PKG_CHECK_MODULES( QT3, [ qt-mt >= 3.0.0 ])
311         AC_SUBST(QT3_CFLAGS)
312         AC_SUBST(QT3_LIBS)
313             QT3_PREFIX="`$PKG_CONFIG --variable=prefix qt-mt`/bin"
314         MOC_QT3="no"
315             AC_CHECK_FILE( "$QT3_PREFIX/moc-qt3", [ MOC_QT3=$QT3_PREFIX/moc-qt3 ], [
316                     AC_CHECK_FILE("$QT3_PREFIX/moc", [ MOC_QT3=$QT3_PREFIX/moc ], [ 
317                 AC_MSG_ERROR([Couldn't find QT3 moc])])])
318         AC_SUBST(MOC_QT3)
319 fi
320 AM_CONDITIONAL(HAVE_QT3, test "x$HAVE_QT3" = "xyes")
321
322 #
323 # Check for Qt 4
324 #
325 AC_ARG_ENABLE(qt4,
326         AS_HELP_STRING([--disable-qt4],[Disable building of Qt4Core mainloop integration]),
327         [case "${enableval}" in
328                 yes) HAVE_QT4=yes ;;
329                 no)  HAVE_QT4=no ;;
330                 *) AC_MSG_ERROR(bad value ${enableval} for --enable-qt4) ;;
331         esac],
332         [HAVE_QT4=yes])
333
334 if test "x$HAVE_QT4" = "xyes" ; then
335         PKG_CHECK_MODULES( QT4, [ QtCore >= 4.0.0 ])
336         AC_SUBST(QT4_CFLAGS)
337         AC_SUBST(QT4_LIBS)
338             QT4_PREFIX="`$PKG_CONFIG --variable=prefix QtCore`/bin"
339         MOC_QT4="no"
340             AC_CHECK_FILE( "$QT4_PREFIX/moc-qt4", [ MOC_QT4=$QT4_PREFIX/moc-qt4 ], [
341                AC_CHECK_FILE("$QT4_PREFIX/moc", [ MOC_QT4=$QT4_PREFIX/moc ], [ 
342                AC_MSG_ERROR([Couldn't find QT4 moc])])])
343         AC_SUBST(MOC_QT4)
344 fi
345 AM_CONDITIONAL(HAVE_QT4, test "x$HAVE_QT4" = "xyes")
346
347 #
348 # Check for GTK+
349 #
350 AC_ARG_ENABLE(gtk,
351         AS_HELP_STRING([--disable-gtk],[Disable use of GTK+]),
352         [case "${enableval}" in
353                 yes) HAVE_GTK=yes ;;
354                 no)  HAVE_GTK=no ;;
355                 *) AC_MSG_ERROR(bad value ${enableval} for --enable-gtk) ;;
356         esac],
357         [HAVE_GTK=yes])
358
359 if test "x$HAVE_GTK" = "xyes" ; then
360         # Check for GTK 2.0
361         PKG_CHECK_MODULES(GTK20, [ gtk+-2.0 >= 2.4.0 ])
362         AC_SUBST(GTK20_CFLAGS)
363         AC_SUBST(GTK20_LIBS)
364         
365         # Check for GLADE 2.0
366         PKG_CHECK_MODULES(GLADE20, [ libglade-2.0 >= 2.4.0 ])
367         AC_SUBST(GLADE20_CFLAGS)
368         AC_SUBST(GLADE20_LIBS)
369 fi
370 AM_CONDITIONAL(HAVE_GTK, test "x$HAVE_GTK" = "xyes")
371
372 #
373 # D-BUS
374 #
375 AC_ARG_ENABLE(dbus,
376         AS_HELP_STRING([--disable-dbus],[Disable use of D-BUS]),
377         [case "${enableval}" in
378                 yes) HAVE_DBUS=yes ;;
379                 no)  HAVE_DBUS=no ;;
380                 *) AC_MSG_ERROR(bad value ${enableval} for --enable-dbus) ;;
381         esac],
382         [HAVE_DBUS=yes]) 
383
384 AC_ARG_WITH(dbus-sys, AS_HELP_STRING([--with-dbus-sys=<dir>], [where D-BUS system.d directory is]))
385 AC_ARG_WITH(dbus-system-socket, AS_HELP_STRING([--with-dbus-system-address=<address>], [where the dbus system socket is, you probably want to put unix:path= at the start]))
386
387 DBUS_VERSION="Disabled"
388 DBUS_SYS_DIR="Disabled"
389 DBUS_SYSTEM_BUS_DEFAULT_ADDRESS="Disabled"
390 if test "x$HAVE_DBUS" = "xyes" ; then
391     PKG_CHECK_MODULES(DBUS, [ dbus-1 >= 0.34 ])
392
393     AC_DEFINE(HAVE_DBUS, 1, [Whether we have D-BUS or not])
394
395     DBUS_VERSION=`$PKG_CONFIG dbus-1 --modversion`
396     DBUS_VERSION_MAJOR=`echo $DBUS_VERSION | awk -F. '{print $1}'`
397     DBUS_VERSION_MINOR=`echo $DBUS_VERSION | awk -F. '{print $2}'`
398     DBUS_VERSION_MICRO=`echo $DBUS_VERSION | awk -F. '{print $3}'`
399     if test "z$DBUS_VERSION_MAJOR" = "z"; then
400         DBUS_VERSION_MAJOR="0"
401     fi
402     if test "z$DBUS_VERSION_MINOR" = "z"; then
403         DBUS_VERSION_MINOR="0"
404     fi
405     if test "z$DBUS_VERSION_MICRO" = "z"; then
406         DBUS_VERSION_MICRO="0"
407     fi
408
409     if test "z$DBUS_VERSION_MAJOR" = "z0" -a "z$DBUS_VERSION_MINOR" = "z0" -a "z$DBUS_VERSION_MICRO" = "z0"; then
410         echo "Error: Couldn't determine the version of your DBUS package."
411         echo "  This is probably an error in this script, please report it"
412         echo "  along with the following information:"
413         echo "      Base DBUS version ='$DBUS_VERSION'"
414         echo "      DBUS_VERSION_MAJOR='$DBUS_VERSION_MAJOR'"
415         echo "      DBUS_VERSION_MINOR='$DBUS_VERSION_MINOR'"
416         echo "      DBUS_VERSION_MICRO='$DBUS_VERSION_MICRO'"
417         exit 1
418     else
419         echo "Your dbus version is $DBUS_VERSION_MAJOR,$DBUS_VERSION_MINOR,$DBUS_VERSION_MICRO."
420         DBUS_CFLAGS="$DBUS_CFLAGS -DDBUS_VERSION_MAJOR=$DBUS_VERSION_MAJOR"
421         DBUS_CFLAGS="$DBUS_CFLAGS -DDBUS_VERSION_MINOR=$DBUS_VERSION_MINOR"
422         DBUS_CFLAGS="$DBUS_CFLAGS -DDBUS_VERSION_MICRO=$DBUS_VERSION_MICRO"
423     fi
424
425     DBUS_CFLAGS="$DBUS_CFLAGS -DDBUS_API_SUBJECT_TO_CHANGE"
426     AC_SUBST(DBUS_CFLAGS)
427     AC_SUBST(DBUS_LIBS)
428
429     if ! test -z "$with_dbus_sys" ; then
430         DBUS_SYS_DIR="$with_dbus_sys"
431     else
432         DBUS_SYS_DIR="${sysconfdir}/dbus-1/system.d"
433     fi
434     AC_SUBST(DBUS_SYS_DIR)
435
436     if ! test -z "$with_dbus_system_address" ; then
437         DBUS_SYSTEM_BUS_DEFAULT_ADDRESS="$with_dbus_system_address"
438     else
439         # This is ugly, but D-BUS doesn't export this address for us
440         # so we have to guess, pretty much all setups i've seen have 
441         # it in /var/lib/dbus or /var/run/dbus, and its defaulted to
442         # /var/run upstream so we will try guess first then default
443         # to /var/run/dbus
444
445         DBUS_SYSTEM_BUS_DEFAULT_ADDRESS="unix:path=/var/run/dbus/system_bus_socket"
446         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"
447         for sock in $TRY_SOCKETS; do
448             if test -S $sock; then
449                 DBUS_SYSTEM_BUS_DEFAULT_ADDRESS="unix:path=$sock"
450             fi
451         done
452     fi
453     AC_SUBST(DBUS_SYSTEM_BUS_DEFAULT_ADDRESS)
454     
455 fi
456 AM_CONDITIONAL(HAVE_DBUS, test "x$HAVE_DBUS" = "xyes")
457
458 #
459 # Expat
460 #
461 AC_ARG_ENABLE(expat,
462         AS_HELP_STRING([--disable-expat],[Disable use of Expat]),
463         [case "${enableval}" in
464                 yes) HAVE_EXPAT=yes ;;
465                 no)  HAVE_EXPAT=no ;;
466                 *) AC_MSG_ERROR(bad value ${enableval} for --enable-expat) ;;
467         esac],
468         [HAVE_EXPAT=yes]) 
469
470 if test "x$HAVE_EXPAT" = "xyes" ; then
471     AC_CHECK_LIB(expat, XML_ParserCreate, [ AC_CHECK_HEADERS(expat.h, have_expat=true, have_expat=false) ], have_expat=false)
472
473     if ! $have_expat ; then
474         AC_MSG_ERROR([*** libexpat not found ***])
475     fi
476 fi
477 AM_CONDITIONAL(HAVE_EXPAT, test "x$HAVE_EXPAT" = "xyes")
478
479 #
480 # GDBM
481 #
482 AC_ARG_ENABLE(gdbm,
483         AS_HELP_STRING([--disable-gdbm],[Disable use of GDBM]),
484         [case "${enableval}" in
485                 yes) HAVE_GDBM=yes ;;
486                 no)  HAVE_GDBM=no ;;
487                 *) AC_MSG_ERROR(bad value ${enableval} for --enable-gdbm) ;;
488         esac],
489         [HAVE_GDBM=yes]) 
490
491 if test "x$HAVE_GDBM" = "xyes" ; then
492     AC_CHECK_LIB(gdbm, gdbm_open, [ AC_CHECK_HEADERS(gdbm.h, have_gdbm=true, have_gdbm=false) ], have_gdbm=false)
493
494     if ! $have_gdbm ; then
495         AC_MSG_ERROR([*** libgdbm not found ***])
496     fi
497     AC_DEFINE([HAVE_GDBM],[],[Support for GDBM])
498 fi
499 AM_CONDITIONAL(HAVE_GDBM, test "x$HAVE_GDBM" = "xyes")
500
501 #
502 # libdaemon
503 #
504 AC_ARG_ENABLE(libdaemon,
505         AS_HELP_STRING([--disable-libdaemon],[Disable use of libdaemon]),
506         [case "${enableval}" in
507                 yes) HAVE_LIBDAEMON=yes ;;
508                 no)  HAVE_LIBDAEMON=no ;;
509                 *) AC_MSG_ERROR(bad value ${enableval} for --enable-libdaemon) ;;
510         esac],
511         [HAVE_LIBDAEMON=yes]) 
512
513 if test "x$HAVE_LIBDAEMON" = "xyes" ; then
514     PKG_CHECK_MODULES(LIBDAEMON, [ libdaemon >= 0.5 ])
515     AC_SUBST(LIBDAEMON_CFLAGS)
516     AC_SUBST(LIBDAEMON_LIBS)
517 fi
518 AM_CONDITIONAL(HAVE_LIBDAEMON, test "x$HAVE_LIBDAEMON" = "xyes")
519
520 #
521 # Python stuff
522 #
523 AC_ARG_ENABLE(python,
524     AS_HELP_STRING([--disable-python], [Disable scripts that depends on python]),
525     [case "${enableval}" in
526           yes) HAVE_PYTHON=yes ;;
527           no)  HAVE_PYTHON=no ;;
528           *) AC_MSG_ERROR([bad value ${enableval} for --enable-python]) ;;
529     esac],[HAVE_PYTHON=yes])
530
531 HAVE_PYTHON_DBUS=no
532 HAVE_PYGTK=no
533
534 if test "x$HAVE_PYTHON" = "xyes" ; then
535     AM_PATH_PYTHON([2.4])
536
537     AC_ARG_ENABLE(pygtk,
538         AS_HELP_STRING([--disable-pygtk],[Disable use of GTK in Python]),
539         [case "${enableval}" in
540                 yes) HAVE_PYGTK=yes ;;
541                 no)  HAVE_PYGTK=no ;;
542                 *) AC_MSG_ERROR(bad value ${enableval} for --enable-pygtk) ;;
543         esac],
544         [HAVE_PYGTK=yes])
545     
546     if test "x$HAVE_PYGTK" = "xyes" ; then
547         AM_CHECK_PYMOD(gtk,,,[AC_MSG_ERROR(Could not find Python module gtk)])
548     fi
549
550
551     if test "x$HAVE_DBUS" = "xyes" ; then
552         AC_ARG_ENABLE(python-dbus,
553             AS_HELP_STRING([--disable-python-dbus],[Disable use of D-BUS in Python]),
554             [case "${enableval}" in
555                    yes) HAVE_PYTHON_DBUS=yes ;;
556                    no)  HAVE_PYTHON_DBUS=no ;;
557                    *) AC_MSG_ERROR(bad value ${enableval} for --enable-python-dbus) ;;
558             esac],
559             [HAVE_PYTHON_DBUS=yes])
560     
561         if test "x$HAVE_PYTHON_DBUS" = "xyes"; then
562             AM_CHECK_PYMOD(dbus,,,[AC_MSG_ERROR(Could not find Python module dbus)])
563         fi
564
565         AM_CHECK_PYMOD(socket,,,[AC_MSG_ERROR(Could not find Python module socket)])
566         if test "x$HAVE_GDBM" = "xyes"; then
567             AM_CHECK_PYMOD(gdbm,,,[AC_MSG_ERROR(Could not find Python module gdbm)])
568         fi
569     fi
570 fi
571 AM_CONDITIONAL(HAVE_PYTHON, [test "x$HAVE_PYTHON" = "xyes" ])
572 AM_CONDITIONAL(HAVE_PYGTK, test "x$HAVE_PYGTK" = "xyes")
573 AM_CONDITIONAL(HAVE_PYTHON_DBUS, test "x$HAVE_PYTHON_DBUS" = "xyes")
574
575 #
576 # Check for mono stuff
577 #
578 HAVE_MONO=no
579 if test "x$HAVE_DBUS" = "xyes" ; then
580     AC_ARG_ENABLE(mono,
581             AS_HELP_STRING([--disable-mono],[Disable mono bindings]),
582             [case "${enableval}" in
583                     yes) HAVE_MONO=yes ;;
584                     no)  HAVE_MONO=no ;;
585                     *) AC_MSG_ERROR(bad value ${enableval} for --enable-mono) ;;
586             esac],
587             [HAVE_MONO=yes])
588
589     if test "x$HAVE_MONO" = "xyes" ; then
590         AC_PATH_PROG(MCS, mcs)
591         if test "x$MCS" = "x" ; then
592             AC_MSG_ERROR([Can not find "mcs" - The Mono C-Sharp Compiler) in your PATH])
593         fi
594
595         AC_PATH_PROG(GACUTIL, gacutil)
596         if test "x$GACUTIL" = "x" ; then
597             AC_MSG_ERROR([Can not find "gacutil" in your PATH])
598         fi
599
600         AC_SUBST(MCS)
601         AC_SUBST(GACUTIL)
602     fi
603 fi
604 AM_CONDITIONAL(HAVE_MONO, test "x$HAVE_MONO" = "xyes")
605
606 #
607 # Check for monodoc stuff
608 #
609 HAVE_MONODOC=no
610 AC_ARG_ENABLE(monodoc,
611         AS_HELP_STRING([--disable-monodoc],[Disable documentation for mono bindings]),
612         [case "${enableval}" in
613                 yes) HAVE_MONODOC=yes ;;
614                 no)  HAVE_MONODOC=no ;;
615                 *) AC_MSG_ERROR(bad value ${enableval} for --enable-monodoc) ;;
616         esac],
617         [HAVE_MONODOC=yes])
618
619 if test "x$HAVE_MONO" = "xyes" && test "x$HAVE_MONODOC" = "xyes" ; then
620         PKG_CHECK_MODULES(MONODOC, [monodoc >= 1.1.8])
621         MONODOC_DIR=`$PKG_CONFIG --variable=sourcesdir monodoc`        
622
623         AC_PATH_PROG(MONODOCER, monodocer)
624         AC_PATH_PROG(MDASSEMBLER, mdassembler)
625
626         AC_SUBST(MONODOC_DIR)
627         AC_SUBST(MONODOCER)
628         AC_SUBST(MDASSEMBLER)
629 fi
630 AM_CONDITIONAL(HAVE_MONODOC, test "x$HAVE_MONODOC" = "xyes")
631
632 #
633 # Defining Avahi User and Group.
634 #
635 AC_ARG_WITH(avahi_user, AS_HELP_STRING([--with-avahi-user=<user>],[User for running the Avahi daemon (avahi)]))
636 if test -z "$with_avahi_user" ; then
637     AVAHI_USER=avahi
638 else
639     AVAHI_USER=$with_avahi_user
640 fi
641 AC_SUBST(AVAHI_USER)
642 AC_DEFINE_UNQUOTED(AVAHI_USER,"$AVAHI_USER", [User for running the Avahi daemon])
643
644 AC_ARG_WITH(avahi_group,AS_HELP_STRING([--with-avahi-group=<group>],[Group for Avahi (avahi)]))
645 if test -z "$with_avahi_group" ; then
646     AVAHI_GROUP=avahi
647 else
648     AVAHI_GROUP=$with_avahi_group
649 fi
650 AC_SUBST(AVAHI_GROUP)
651 AC_DEFINE_UNQUOTED(AVAHI_GROUP,"$AVAHI_GROUP", [Group for Avahi])
652
653 #
654 # Avahi runtime dir
655 #
656 avahi_runtime_dir="${localstatedir}/run"
657 avahi_socket="${avahi_runtime_dir}/avahi-daemon/socket"
658 AC_SUBST(avahi_runtime_dir)
659 AC_SUBST(avahi_socket)
660
661 #
662 # Avahi interfaces dir
663 #
664 if test "x$HAVE_PYTHON_DBUS" = "xyes" -o "x$HAVE_GTK" = "xyes"; then
665         interfacesdir="${datadir}/${PACKAGE}/interfaces/"
666         AC_SUBST(interfacesdir)
667 fi
668
669 #
670 # Doxygen
671 #
672 DX_HTML_FEATURE(ON)
673 DX_CHM_FEATURE(OFF)
674 DX_CHI_FEATURE(OFF)
675 DX_MAN_FEATURE(OFF)
676 DX_RTF_FEATURE(OFF)
677 DX_XML_FEATURE(OFF)
678 DX_PDF_FEATURE(OFF)
679 DX_PS_FEATURE(OFF)
680 DX_INIT_DOXYGEN(avahi, doxygen.cfg, doxygen)
681
682 #
683 # Build and Install man pages
684 #
685 AC_ARG_ENABLE(manpages,
686         AS_HELP_STRING([--disable-manpages],[Disable building and installation of man pages]),
687 [case "${enableval}" in
688   yes) manpages=yes ;;
689   no)  manpages=no ;;
690   *) AC_MSG_ERROR([bad value ${enableval} for --disable-manpages]) ;;
691 esac],[manpages=yes])
692
693 if test x$manpages = xyes ; then
694     #
695     # XMLTOMAN manpage generation
696     #
697     AC_ARG_ENABLE(xmltoman,
698     AS_HELP_STRING([--disable-xmltoman],[Disable rebuilding of man pages with xmltoman]),
699     [case "${enableval}" in
700       yes) xmltoman=yes ;;
701       no)  xmltoman=no ;;
702       *) AC_MSG_ERROR([bad value ${enableval} for --disable-xmltoman]) ;;
703     esac],[xmltoman=yes])
704     
705     if test x$xmltoman = xyes ; then
706         AC_CHECK_PROG(have_xmltoman, xmltoman, yes, no)
707     fi
708
709     if test x$have_xmltoman = xno -o x$xmltoman = xno; then
710         if ! test -e man/avahi-daemon.8 ; then
711             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])
712             exit 1
713         fi
714         AC_MSG_WARN([*** Not rebuilding man pages as xmltoman is not found ***])
715         xmltoman=no
716     fi
717 fi
718 AM_CONDITIONAL([USE_XMLTOMAN], [test "x$xmltoman" = xyes])
719 AM_CONDITIONAL([BUILD_MANPAGES], [test "x$manpages" = xyes])
720
721 #
722 # Conditionally compile test and example programs
723 #
724 AC_ARG_ENABLE(tests,
725         AS_HELP_STRING([--enable-tests],[Enable building of tests and examples]),
726         [case "${enableval}" in
727                 yes) ENABLE_TESTS=yes ;;
728                 no)  ENABLE_TESTS=no ;;
729                 *) AC_MSG_ERROR(bad value ${enableval} for --enable-tests) ;;
730         esac],
731         [ENABLE_TESTS=no])
732
733 AM_CONDITIONAL([ENABLE_TESTS], [test "x$ENABLE_TESTS" = "xyes"])
734
735 #
736 # Optionally enable libdns_sd compatibility support
737 #
738 AC_ARG_ENABLE(compat-libdns_sd,
739         AS_HELP_STRING([--enable-compat-libdns_sd],[Enable compatibility layer for libdns_sd]),
740         [case "${enableval}" in
741                 yes) ENABLE_COMPAT_LIBDNS_SD=yes ;;
742                 no)  ENABLE_COMPAT_LIBDNS_SD=no ;;
743                 *) AC_MSG_ERROR(bad value ${enableval} for --enable-compat-libdns_sd) ;;
744         esac],
745         [ENABLE_COMPAT_LIBDNS_SD=no])
746
747 AM_CONDITIONAL([ENABLE_COMPAT_LIBDNS_SD], [test "x$ENABLE_COMPAT_LIBDNS_SD" = "xyes"])
748
749 #
750 # Optionally enable HOWL compatibility support
751 #
752 AC_ARG_ENABLE(compat-howl,
753         AS_HELP_STRING([--enable-compat-howl],[Enable compatibility layer for HOWL]),
754         [case "${enableval}" in
755                 yes) ENABLE_COMPAT_HOWL=yes ;;
756                 no)  ENABLE_COMPAT_HOWL=no ;;
757                 *) AC_MSG_ERROR(bad value ${enableval} for --enable-compat-howl) ;;
758         esac],
759         [ENABLE_COMPAT_HOWL=no])
760
761 AM_CONDITIONAL([ENABLE_COMPAT_HOWL], [test "x$ENABLE_COMPAT_HOWL" = "xyes"])
762
763
764 # ==========================================================================
765 AC_CONFIG_FILES([
766 Makefile 
767 avahi-common/Makefile 
768 avahi-core/Makefile 
769 avahi-glib/Makefile 
770 avahi-qt/Makefile
771 avahi-daemon/Makefile 
772 avahi-daemon/avahi-dbus.conf
773 avahi-discover-standalone/Makefile 
774 avahi-client/Makefile 
775 initscript/Makefile 
776 initscript/debian/Makefile
777 initscript/gentoo/Makefile
778 initscript/archlinux/Makefile
779 initscript/suse/Makefile
780 initscript/fedora/Makefile
781 initscript/mandriva/Makefile
782 initscript/darwin/Makefile
783 initscript/freebsd/Makefile
784 initscript/slackware/Makefile
785 avahi-dnsconfd/Makefile
786 avahi-utils/Makefile
787 avahi-python/Makefile
788 avahi-python/avahi/Makefile
789 examples/Makefile
790 common/Makefile
791 man/Makefile
792 tests/Makefile
793 service-type-database/Makefile
794 avahi-sharp/Makefile
795 avahi-compat-libdns_sd/Makefile
796 avahi-compat-howl/Makefile
797 avahi-compat-howl/samples/Makefile
798 ])
799 AC_OUTPUT
800
801 # ==========================================================================
802 echo "
803  ---{ $PACKAGE_NAME $VERSION }---
804
805     prefix:                 ${prefix}
806     sysconfdir:             ${sysconfdir}
807     localstatedir:          ${localstatedir}
808     avahi socket:           ${avahi_socket}
809     dbus-1 system.d dir:    ${DBUS_SYS_DIR}
810     dbus-1 version:         ${DBUS_VERSION}
811     dbus-1 system socket    ${DBUS_SYSTEM_BUS_DEFAULT_ADDRESS}
812     compiler:               ${CC}
813     cflags:                 ${CFLAGS}
814     Enable GLIB:            ${HAVE_GLIB}
815     Enable GTK:             ${HAVE_GTK}
816     Enable D-BUS:           ${HAVE_DBUS}
817     Enable Expat:           ${HAVE_EXPAT}
818     Enable GDBM:            ${HAVE_GDBM}
819     Enable libdaemon:       ${HAVE_LIBDAEMON}
820     Enable Python:          ${HAVE_PYTHON}
821     Enable pygtk:           ${HAVE_PYGTK}
822     Enable python-dbus:     ${HAVE_PYTHON_DBUS}
823     Enable QT3:             ${HAVE_QT3}
824     Enable QT4:             ${HAVE_QT4}
825     Enable Mono:            ${HAVE_MONO}
826     Enable Monodoc:         ${HAVE_MONODOC}
827     Distribution/OS:        ${with_distro}
828     User for Avahi:         ${AVAHI_USER}
829     Group for Avahi:        ${AVAHI_GROUP}
830     Enable chroot():        ${enable_chroot}
831 "
832
833 BUILD_DAEMON="no   (You need libdaemon and expat!)"
834
835 if test "x$HAVE_EXPAT" = "xyes" -a "x$HAVE_LIBDAEMON" = "xyes" ; then
836     BUILD_DAEMON=yes
837 fi
838
839 BUILD_PYTHON="no   (You need python, pygtk and python-dbus!)"
840
841 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
842     BUILD_PYTHON=yes
843 fi
844
845 BUILD_CLIENT="no   (You need avahi-daemon and dbus!)"
846
847 if test "x$BUILD_DAEMON" = "xyes" -a "x$HAVE_DBUS" = "xyes" ; then
848     BUILD_CLIENT=yes
849 fi
850
851 if test "x$ENABLE_COMPAT_LIBDNS_SD" = "xyes" -a "x$BUILD_CLIENT" != "xyes" ; then
852    ENABLE_COMPAT_LIBDNS_SD="no   (You need libavahi-client!)"
853 fi
854 if test "x$ENABLE_COMPAT_HOWL" = "xyes" -a "x$BUILD_CLIENT" != "xyes" ; then
855    ENABLE_COMPAT_HOWL="no   (You need libavahi-client!)"
856 fi
857
858
859 echo "\
860     Building libavahi-core              yes
861     Building avahi-daemon:              ${BUILD_DAEMON}
862     Building avahi-dnsconfd:            ${BUILD_DAEMON}
863     Building libavahi-client:           ${BUILD_CLIENT}
864     Building avahi-utils:               ${BUILD_CLIENT}
865     Building avahi-python:              ${BUILD_PYTHON}
866     Building libavahi-glib:             ${HAVE_GLIB}
867     Building avahi-discover-standalone: ${HAVE_GTK}
868     Building libavahi-qt3:              ${HAVE_QT3}
869     Building libavahi-qt4:              ${HAVE_QT4}
870     Building avahi-sharp:               ${HAVE_MONO}
871     Building avahi-compat-libdns_sd:    ${ENABLE_COMPAT_LIBDNS_SD}
872     Building avahi-compat-howl:         ${ENABLE_COMPAT_HOWL}
873     Building tests:                     ${ENABLE_TESTS}
874 "