]> git.meshlink.io Git - catta/blob - configure.ac
* Add avahi-client examples to doxygen
[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.1],[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://www.freedesktop.org/Software/Avahi])
30
31 if type -p stow > /dev/null && test -d /usr/local/stow ; then
32    AC_MSG_NOTICE([*** Found /usr/local/stow: default install prefix set to /usr/local/stow/${PACKAGE_NAME}-${PACKAGE_VERSION} ***])
33    ac_default_prefix="/usr/local/stow/${PACKAGE_NAME}-${PACKAGE_VERSION}"
34 fi
35
36 # Checks for programs.
37 AC_PROG_CC
38 AC_PROG_CXX
39 AC_GNU_SOURCE
40 AC_PROG_CPP
41 AC_PROG_INSTALL
42 AC_PROG_LN_S
43 AC_PROG_MAKE_SET
44 AC_PROG_GCC_TRADITIONAL
45
46 # libtool stuff
47 AC_PROG_LIBTOOL
48
49 # Checks for header files.
50 AC_HEADER_STDC
51 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])
52
53 # Checks for typedefs, structures, and compiler characteristics.
54 AC_C_CONST
55 AC_TYPE_SIZE_T
56 AC_HEADER_TIME
57 AC_HEADER_SYS_WAIT
58
59 # Checks for library functions.
60 AC_FUNC_MEMCMP
61 AC_FUNC_SELECT_ARGTYPES
62 AC_FUNC_MALLOC
63 AC_FUNC_REALLOC
64 AC_CHECK_FUNCS([gethostname memchr memmove memset mkdir select socket strchr strcspn strdup strerror strrchr strspn strstr uname setresuid setreuid strcasecmp gettimeofday putenv])
65
66 AC_FUNC_CHOWN
67 AC_FUNC_STAT
68 AC_TYPE_MODE_T
69 AC_TYPE_PID_T
70
71 # If using GCC specify some additional parameters
72 if test "x$GCC" = "xyes" ; then
73    CFLAGS="$CFLAGS -pipe -W -Wall -pedantic"
74
75    AC_LANG_CONFTEST([int main() {}])
76    $CC -c conftest.c -std=c99 -Wno-unused-parameter $CFLAGS > /dev/null 2> /dev/null && CFLAGS="$CFLAGS -std=c99 -Wno-unused-parameter"
77    rm -f conftest.o
78 fi
79
80 PKG_PROG_PKG_CONFIG
81
82 #
83 # Check for GLIB 2.0
84 #
85 AC_ARG_ENABLE(glib,
86         AS_HELP_STRING([--disable-glib],[Disable use of GLib]),
87         [case "${enableval}" in
88                 yes) HAVE_GLIB=yes ;;
89                 no)  HAVE_GLIB=no ;;
90                 *) AC_MSG_ERROR(bad value ${enableval} for --enable-glib) ;;
91         esac],
92         [HAVE_GLIB=yes])
93
94 if test "x$HAVE_GLIB" = "xyes" ; then
95         PKG_CHECK_MODULES(GLIB20, [ glib-2.0 >= 2.4.0 ])
96         AC_SUBST(GLIB20_CFLAGS)
97         AC_SUBST(GLIB20_LIBS)
98 fi
99 AM_CONDITIONAL(HAVE_GLIB, test "x$HAVE_GLIB" = "xyes")
100
101 #
102 # Check for GTK+
103 #
104 AC_ARG_ENABLE(gtk,
105         AS_HELP_STRING([--disable-gtk],[Disable use of GTK+]),
106         [case "${enableval}" in
107                 yes) HAVE_GTK=yes ;;
108                 no)  HAVE_GTK=no ;;
109                 *) AC_MSG_ERROR(bad value ${enableval} for --enable-gtk) ;;
110         esac],
111         [HAVE_GTK=yes])
112
113 if test "x$HAVE_GTK" = "xyes" ; then
114         # Check for GTK 2.0
115         PKG_CHECK_MODULES(GTK20, [ gtk+-2.0 >= 2.4.0 ])
116         AC_SUBST(GTK20_CFLAGS)
117         AC_SUBST(GTK20_LIBS)
118         
119         # Check for GLADE 2.0
120         PKG_CHECK_MODULES(GLADE20, [ libglade-2.0 >= 2.4.0 ])
121         AC_SUBST(GLADE20_CFLAGS)
122         AC_SUBST(GLADE20_LIBS)
123
124             interfacesdir="${datadir}/${PACKAGE}/interfaces/"
125             AC_SUBST(interfacesdir)
126 fi
127 AM_CONDITIONAL(HAVE_GTK, test "x$HAVE_GTK" = "xyes")
128
129 #
130 # D-BUS
131 #
132 AC_ARG_ENABLE(dbus,
133         AS_HELP_STRING([--disable-dbus],[Disable use of D-BUS]),
134         [case "${enableval}" in
135                 yes) HAVE_DBUS=yes ;;
136                 no)  HAVE_DBUS=no ;;
137                 *) AC_MSG_ERROR(bad value ${enableval} for --enable-dbus) ;;
138         esac],
139         [HAVE_DBUS=yes]) 
140
141 AC_ARG_WITH(dbus-sys, AS_HELP_STRING([--with-dbus-sys=<dir>], [where D-BUS system.d directory is]))
142
143 if test "x$HAVE_DBUS" = "xyes" ; then
144         AC_DEFINE(HAVE_DBUS, 1, [Whether we have D-BUS or not])
145
146     PKG_CHECK_MODULES(DBUS, [ dbus-1 >= 0.30 ])
147     DBUS_CFLAGS="$DBUS_CFLAGS -DDBUS_API_SUBJECT_TO_CHANGE"
148     AC_SUBST(DBUS_CFLAGS)
149         AC_SUBST(DBUS_LIBS)
150
151         if ! test -z "$with_dbus_sys" ; then
152            DBUS_SYS_DIR="$with_dbus_sys"
153         else
154                DBUS_SYS_DIR="${sysconfdir}/dbus-1/system.d"
155         fi
156         AC_SUBST(DBUS_SYS_DIR)
157     
158 fi
159 AM_CONDITIONAL(HAVE_DBUS, test "x$HAVE_DBUS" = "xyes")
160
161 #
162 # Expat
163 #
164 AC_ARG_ENABLE(expat,
165         AS_HELP_STRING([--disable-expat],[Disable use of Expat]),
166         [case "${enableval}" in
167                 yes) HAVE_EXPAT=yes ;;
168                 no)  HAVE_EXPAT=no ;;
169                 *) AC_MSG_ERROR(bad value ${enableval} for --enable-expat) ;;
170         esac],
171         [HAVE_EXPAT=yes]) 
172
173 if test "x$HAVE_EXPAT" = "xyes" ; then
174    AC_CHECK_LIB(expat, XML_ParserCreate, [ AC_CHECK_HEADERS(expat.h, have_expat=true, have_expat=false) ], have_expat=false)
175
176    if ! $have_expat ; then
177       AC_MSG_ERROR([*** libexpat not found ***])
178    fi
179 fi
180 AM_CONDITIONAL(HAVE_EXPAT, test "x$HAVE_EXPAT" = "xyes")
181
182 #
183 # libdaemon
184 #
185 AC_ARG_ENABLE(libdaemon,
186         AS_HELP_STRING([--disable-libdaemon],[Disable use of libdaemon]),
187         [case "${enableval}" in
188                 yes) HAVE_LIBDAEMON=yes ;;
189                 no)  HAVE_LIBDAEMON=no ;;
190                 *) AC_MSG_ERROR(bad value ${enableval} for --enable-libdaemon) ;;
191         esac],
192         [HAVE_LIBDAEMON=yes]) 
193
194 if test "x$HAVE_LIBDAEMON" = "xyes" ; then
195    PKG_CHECK_MODULES(LIBDAEMON, [ libdaemon >= 0.5 ])
196    AC_SUBST(LIBDAEMON_CFLAGS)
197    AC_SUBST(LIBDAEMON_LIBS)
198 fi
199 AM_CONDITIONAL(HAVE_LIBDAEMON, test "x$HAVE_LIBDAEMON" = "xyes")
200
201 #
202 # Python stuff
203 #
204 AC_ARG_ENABLE(python,
205         AS_HELP_STRING([--disable-python], [Disable scripts that depends on python]),
206         [case "${enableval}" in
207               yes) HAVE_PYTHON=yes ;;
208               no)  HAVE_PYTHON=no ;;
209               *) AC_MSG_ERROR([bad value ${enableval} for --enable-python]) ;;
210         esac],[HAVE_PYTHON=yes])
211
212 if test "x$HAVE_PYTHON" = "xyes" ; then
213    AM_PATH_PYTHON([2.4])
214    AM_CHECK_PYMOD(gtk,,,[AC_MSG_ERROR(Could not find Python module pygtk)])
215    AM_CHECK_PYMOD(dbus,,,[AC_MSG_ERROR(Could not find Python module dbus)])
216 fi
217 AM_CONDITIONAL(HAVE_PYTHON, [test "x$HAVE_PYTHON" = "xyes" ])
218
219 #
220 # Detecting the linux distro for specific things like initscripts.
221 #
222 AC_ARG_WITH(distro, AS_HELP_STRING([--with-distro=DISTRO],[Specify the Linux distribution to target: One of redhat, suse, gentoo, debian, or slackware]))
223 if test "z$with_distro" = "z"; then
224    AC_CHECK_FILE(/etc/redhat-release,with_distro="redhat")
225    AC_CHECK_FILE(/etc/SuSE-release,with_distro="suse")
226    AC_CHECK_FILE(/etc/fedora-release,with_distro="redhat")
227    AC_CHECK_FILE(/etc/gentoo-release,with_distro="gentoo")
228    AC_CHECK_FILE(/etc/debian_version,with_distro="debian")
229    AC_CHECK_FILE(/etc/slackware-version,with_distro="slackware")
230 fi
231 with_distro=`echo ${with_distro} | tr '[[:upper:]]' '[[:lower:]]' `
232
233 if test "z$with_distro" = "z"; then
234    echo "Linux distribution autodetection failed, you must specify the distribution to target using --with-distro=DISTRO"
235    exit 1
236 else
237 case $with_distro in
238    debian|gentoo|suse)
239      ;;
240    *)
241      echo "Your distribution (${with_distro}) is not yet supported, init scripts and dbus configuration will not be installed! (patches welcome)"
242      ;;
243 esac
244
245 fi
246 AM_CONDITIONAL(TARGET_REDHAT, test x"$with_distro" = xredhat)
247 AM_CONDITIONAL(TARGET_SUSE, test x"$with_distro" = xsuse)
248 AM_CONDITIONAL(TARGET_GENTOO, test x"$with_distro" = xgentoo)
249 AM_CONDITIONAL(TARGET_DEBIAN, test x"$with_distro" = xdebian)
250 AM_CONDITIONAL(TARGET_SLACKWARE, test x"$with_distro" = xslackware)
251
252 #
253 # Defining Avahi User and Group.
254 #
255 AC_ARG_WITH(avahi_user, AS_HELP_STRING([--with-avahi-user=<user>],[User for running the Avahi daemon (avahi)]))
256 if test -z "$with_avahi_user" ; then
257     AVAHI_USER=avahi
258 else
259     AVAHI_USER=$with_avahi_user
260 fi
261 AC_SUBST(AVAHI_USER)
262 AC_DEFINE_UNQUOTED(AVAHI_USER,"$AVAHI_USER", [User for running the Avahi daemon])
263
264 AC_ARG_WITH(avahi_group,AS_HELP_STRING([--with-avahi-group=<group>],[Group for Avahi (avahi)]))
265 if test -z "$with_avahi_group" ; then
266     AVAHI_GROUP=avahi
267 else
268     AVAHI_GROUP=$with_avahi_group
269 fi
270 AC_SUBST(AVAHI_GROUP)
271 AC_DEFINE_UNQUOTED(AVAHI_GROUP,"$AVAHI_GROUP", [Group for Avahi])
272
273 #
274 # Avahi runtime dir
275 #
276 avahi_runtime_dir="${localstatedir}/run"
277 avahi_socket="${avahi_runtime_dir}/avahi-daemon/socket"
278 AC_SUBST(avahi_runtime_dir)
279 AC_SUBST(avahi_socket)
280
281
282 #
283 # Doxygen
284 #
285 DX_HTML_FEATURE(ON)
286 DX_CHM_FEATURE(OFF)
287 DX_CHI_FEATURE(OFF)
288 DX_MAN_FEATURE(OFF)
289 DX_RTF_FEATURE(OFF)
290 DX_XML_FEATURE(OFF)
291 DX_PDF_FEATURE(OFF)
292 DX_PS_FEATURE(OFF)
293 DX_INIT_DOXYGEN(avahi, doxygen.cfg, doxygen)
294
295 #
296 # XMLTOMAN manpage generation
297 #
298 AC_ARG_ENABLE(xmltoman,
299         AS_HELP_STRING([--disable-xmltoman],[Disable rebuilding of man pages with xmltoman]),
300 [case "${enableval}" in
301   yes) xmltoman=yes ;;
302   no)  xmltoman=no ;;
303   *) AC_MSG_ERROR([bad value ${enableval} for --disable-xmltoman]) ;;
304 esac],[xmltoman=yes])
305
306 if test x$xmltoman = xyes ; then
307    AC_CHECK_PROG(have_xmltoman, xmltoman, yes, no)
308
309    if test x$have_xmltoman = xno ; then
310      AC_MSG_WARN([*** Not rebuilding man pages as xmltoman is not found ***])
311      xmltoman=no
312    fi
313 fi
314
315 AM_CONDITIONAL([USE_XMLTOMAN], [test "x$xmltoman" = xyes])
316
317 # ==========================================================================
318 AC_CONFIG_FILES([
319 Makefile 
320 avahi-common/Makefile 
321 avahi-core/Makefile 
322 avahi-glib/Makefile 
323 avahi-daemon/Makefile 
324 avahi-daemon/avahi-dbus.conf
325 avahi-discover-standalone/Makefile 
326 avahi-client/Makefile 
327 initscript/Makefile 
328 initscript/Debian/Makefile
329 initscript/Gentoo/Makefile
330 initscript/SUSE/Makefile
331 avahi-dnsconfd/Makefile
332 avahi-utils/Makefile
333 avahi-utils/avahi/Makefile
334 examples/Makefile
335 common/Makefile
336 man/Makefile
337 tests/Makefile
338 ])
339 AC_OUTPUT
340
341 # ==========================================================================
342 echo "
343  ---{ $PACKAGE_NAME $VERSION }---
344
345     prefix:                 ${prefix}
346     sysconfdir:             ${sysconfdir}
347     dbus-1 system.d dir:    ${DBUS_SYS_DIR}
348     dbus-1 version:         `pkg-config dbus-1 --modversion`
349     compiler:               ${CC}
350     cflags:                 ${CFLAGS}
351     Enable GLIB:            ${HAVE_GLIB}
352     Enable GTK:             ${HAVE_GTK}
353     Enable D-BUS:           ${HAVE_DBUS}
354     Enable Expat:           ${HAVE_EXPAT}
355     Enable libdaemon:       ${HAVE_LIBDAEMON}
356     Have Python:            ${HAVE_PYTHON}
357     Linux Distro:           ${with_distro}
358     User for Avahi:         ${AVAHI_USER}
359     Group for Avahi:        ${AVAHI_GROUP}
360 "
361
362 BUILD_DAEMON="no (!)"
363
364 if test "x$HAVE_EXPAT" = "xyes" -a "x$HAVE_LIBDAEMON" = "xyes" ; then
365    BUILD_DAEMON=yes
366 fi
367
368 BUILD_UTILS="no (!)"
369
370 if test "x$BUILD_DAEMON" = "xyes" -a "x$HAVE_DBUS" = "xyes" -a "x$HAVE_PYTHON" = "xyes" ; then
371    BUILD_UTILS=yes
372 fi
373
374 BUILD_CLIENT="no (!)"
375
376 if test "x$BUILD_DAEMON" = "xyes" -a "x$HAVE_DBUS" = "xyes" ; then
377    BUILD_CLIENT=yes
378 fi
379
380     
381 echo "
382     Building libavahi-core              yes
383     Building avahi-daemon:              ${BUILD_DAEMON}
384     Building avahi-dnsconfd:            ${BUILD_DAEMON}
385     Building avahi-utils:               ${BUILD_UTILS}
386     Building libavahi-glib:             ${HAVE_GLIB}
387     Building libavahi-client:           ${BUILD_CLIENT}
388     Building avahi-discover-standalone: ${HAVE_GTK}
389 "