]> git.meshlink.io Git - catta/blob - configure.ac
fix typo
[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])
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 #
81 # Check for GLIB 2.0
82 #
83 AC_ARG_ENABLE(glib,
84         AS_HELP_STRING([--disable-glib],[Disable use of GLib]),
85         [case "${enableval}" in
86                 yes) HAVE_GLIB=yes ;;
87                 no)  HAVE_GLIB=no ;;
88                 *) AC_MSG_ERROR(bad value ${enableval} for --enable-glib) ;;
89         esac],
90         [HAVE_GLIB=yes])
91
92 if test "x$HAVE_GLIB" = "xyes"; then
93         PKG_CHECK_MODULES(GLIB20, [ glib-2.0 >= 2.4.0 ])
94         AC_SUBST(GLIB20_CFLAGS)
95         AC_SUBST(GLIB20_LIBS)
96 fi
97 AM_CONDITIONAL(HAVE_GLIB, test "x$HAVE_GLIB" = "xyes")
98
99
100 #
101 # Check for GTK+
102 #
103 AC_ARG_ENABLE(gtk,
104         AS_HELP_STRING([--disable-gtk],[Disable use of GTK+]),
105         [case "${enableval}" in
106                 yes) HAVE_GTK=yes ;;
107                 no)  HAVE_GTK=no ;;
108                 *) AC_MSG_ERROR(bad value ${enableval} for --enable-gtk) ;;
109         esac],
110         [HAVE_GTK=yes])
111
112 if test "x$HAVE_GTK" = "xyes"; then
113         # Check for GTK 2.0
114         PKG_CHECK_MODULES(GTK20, [ gtk+-2.0 >= 2.4.0 ])
115         AC_SUBST(GTK20_CFLAGS)
116         AC_SUBST(GTK20_LIBS)
117         
118         # Check for GLADE 2.0
119         PKG_CHECK_MODULES(GLADE20, [ libglade-2.0 >= 2.4.0 ])
120         AC_SUBST(GLADE20_CFLAGS)
121         AC_SUBST(GLADE20_LIBS)
122
123             interfacesdir="${datadir}/${PACKAGE}/interfaces/"
124             AC_SUBST(interfacesdir)
125 fi
126 AM_CONDITIONAL(HAVE_GTK, test "x$HAVE_GTK" = "xyes")
127
128 #
129 # D-BUS
130 #
131 AC_ARG_ENABLE(dbus,
132         AS_HELP_STRING([--disable-dbus],[Disable use of D-BUS]),
133         [case "${enableval}" in
134                 yes) HAVE_DBUS=yes ;;
135                 no)  HAVE_DBUS=no ;;
136                 *) AC_MSG_ERROR(bad value ${enableval} for --enable-dbus) ;;
137         esac],
138         [HAVE_DBUS=yes]) 
139
140 AC_ARG_WITH(dbus-sys, AS_HELP_STRING([--with-dbus-sys=<dir>], [where D-BUS system.d directory is]))
141
142 if test "x$HAVE_DBUS" = "xyes"; then
143         AC_DEFINE(HAVE_DBUS, 1, [Whether we have D-BUS or not])
144
145     PKG_CHECK_MODULES(DBUS, [ dbus-1 >= 0.30 ])
146     DBUS_CFLAGS="$DBUS_CFLAGS -DDBUS_API_SUBJECT_TO_CHANGE"
147     AC_SUBST(DBUS_CFLAGS)
148         AC_SUBST(DBUS_LIBS)
149
150         if ! test -z "$with_dbus_sys" ; then
151            DBUS_SYS_DIR="$with_dbus_sys"
152         else
153                DBUS_SYS_DIR="${sysconfdir}/dbus-1/system.d"
154         fi
155         AC_SUBST(DBUS_SYS_DIR)
156     
157 fi
158 AM_CONDITIONAL(HAVE_DBUS, test "x$HAVE_DBUS" = "xyes")
159
160 #
161 # Expat
162 #
163 AC_ARG_ENABLE(expat,
164         AS_HELP_STRING([--disable-expat],[Disable use of Expat]),
165         [case "${enableval}" in
166                 yes) HAVE_EXPAT=yes ;;
167                 no)  HAVE_EXPAT=no ;;
168                 *) AC_MSG_ERROR(bad value ${enableval} for --enable-expat) ;;
169         esac],
170         [HAVE_EXPAT=yes]) 
171
172 if test "x$HAVE_EXPAT" = "xyes"; then
173    AC_CHECK_LIB(expat, XML_ParserCreate, [ AC_CHECK_HEADERS(expat.h, have_expat=true, have_expat=false) ], have_expat=false)
174
175    if ! $have_expat ; then
176       AC_MSG_ERROR([*** libexpat not found ***])
177    fi
178 fi
179 AM_CONDITIONAL(HAVE_EXPAT, test "x$HAVE_EXPAT" = "xyes")
180
181 #
182 # libdaemon
183 #
184 AC_ARG_ENABLE(libdaemon,
185         AS_HELP_STRING([--disable-libdaemon],[Disable use of libdaemon]),
186         [case "${enableval}" in
187                 yes) HAVE_LIBDAEMON=yes ;;
188                 no)  HAVE_LIBDAEMON=no ;;
189                 *) AC_MSG_ERROR(bad value ${enableval} for --enable-libdaemon) ;;
190         esac],
191         [HAVE_LIBDAEMON=yes]) 
192
193 if test "x$HAVE_LIBDAEMON" = "xyes"; then
194    PKG_CHECK_MODULES(LIBDAEMON, [ libdaemon >= 0.5 ])
195    AC_SUBST(LIBDAEMON_CFLAGS)
196    AC_SUBST(LIBDAEMON_LIBS)
197 fi
198 AM_CONDITIONAL(HAVE_LIBDAEMON, test "x$HAVE_LIBDAEMON" = "xyes")
199
200 #
201 # Python stuff
202 #
203 AC_ARG_ENABLE(python,
204         AS_HELP_STRING([--disable-python], [Disable scripts that depends on python]),
205         [case "${enableval}" in
206               yes) HAVE_PYTHON=yes ;;
207               no)  HAVE_PYTHON=no ;;
208               *) AC_MSG_ERROR([bad value ${enableval} for --enable-python]) ;;
209         esac],[HAVE_PYTHON=yes])
210
211 if test "y$HAVE_PYTHON" = xyes ; then
212    AM_PATH_PYTHON(2.4)
213
214    if  test "x$HAVE_PYTHON" = xyes ; then
215        AM_CHECK_PYMOD(gtk,,,[AC_MSG_ERROR(Could not find Python module pygtk)])
216        AM_CHECK_PYMOD(dbus,,,[AC_MSG_ERROR(Could not find Python module dbus)])
217    fi
218 fi
219 AM_CONDITIONAL(HAVE_PYTHON, [test "x$HAVE_PYTHON" = "xyes" ])
220
221 #
222 # Detecting the linux distro for specific things like initscripts.
223 #
224 AC_ARG_WITH(distro, AS_HELP_STRING([--with-distro=DISTRO],[Specify the Linux distribution to target: One of redhat, suse, gentoo, debian, or slackware]))
225 if test "z$with_distro" = "z"; then
226    AC_CHECK_FILE(/etc/redhat-release,with_distro="redhat")
227    AC_CHECK_FILE(/etc/SuSE-release,with_distro="suse")
228    AC_CHECK_FILE(/etc/fedora-release,with_distro="redhat")
229    AC_CHECK_FILE(/etc/gentoo-release,with_distro="gentoo")
230    AC_CHECK_FILE(/etc/debian_version,with_distro="debian")
231    AC_CHECK_FILE(/etc/slackware-version,with_distro="slackware")
232 fi
233 with_distro=`echo ${with_distro} | tr '[[:upper:]]' '[[:lower:]]' `
234
235 if test "z$with_distro" = "z"; then
236    echo "Linux distribution autodetection failed, you must specify the distribution to target using --with-distro=DISTRO"
237    exit 1
238 else
239 case $with_distro in
240    debian|gentoo|suse)
241      ;;
242    *)
243      echo "Your distribution (${with_distro}) is not yet supported, init scripts and dbus configuration will not be installed! (patches welcome)"
244      ;;
245 esac
246
247 fi
248 AM_CONDITIONAL(TARGET_REDHAT, test x"$with_distro" = xredhat)
249 AM_CONDITIONAL(TARGET_SUSE, test x"$with_distro" = xsuse)
250 AM_CONDITIONAL(TARGET_GENTOO, test x"$with_distro" = xgentoo)
251 AM_CONDITIONAL(TARGET_DEBIAN, test x"$with_distro" = xdebian)
252 AM_CONDITIONAL(TARGET_SLACKWARE, test x"$with_distro" = xslackware)
253
254 #
255 # Defining Avahi User and Group.
256 #
257 AC_ARG_WITH(avahi_user, AS_HELP_STRING([--with-avahi-user=<user>],[User for running the Avahi daemon (avahi)]))
258 if test -z "$with_avahi_user" ; then
259     AVAHI_USER=avahi
260 else
261     AVAHI_USER=$with_avahi_user
262 fi
263 AC_SUBST(AVAHI_USER)
264 AC_DEFINE_UNQUOTED(AVAHI_USER,"$AVAHI_USER", [User for running the Avahi daemon])
265
266 AC_ARG_WITH(avahi_group,AS_HELP_STRING([--with-avahi-group=<group>],[Group for Avahi (avahi)]))
267 if test -z "$with_avahi_group" ; then
268     AVAHI_GROUP=avahi
269 else
270     AVAHI_GROUP=$with_avahi_group
271 fi
272 AC_SUBST(AVAHI_GROUP)
273 AC_DEFINE_UNQUOTED(AVAHI_GROUP,"$AVAHI_GROUP", [Group for Avahi])
274
275 #
276 # Avahi runtime dir
277 #
278 avahi_runtime_dir="${localstatedir}/run"
279 avahi_socket="${avahi_runtime_dir}/avahi-daemon/socket"
280 AC_SUBST(avahi_runtime_dir)
281 AC_SUBST(avahi_socket)
282
283
284 #
285 # Doxygen
286 #
287 DX_HTML_FEATURE(ON)
288 DX_CHM_FEATURE(OFF)
289 DX_CHI_FEATURE(OFF)
290 DX_MAN_FEATURE(OFF)
291 DX_RTF_FEATURE(OFF)
292 DX_XML_FEATURE(OFF)
293 DX_PDF_FEATURE(OFF)
294 DX_PS_FEATURE(OFF)
295 DX_INIT_DOXYGEN(avahi, doxygen.cfg, doxygen)
296
297 #
298 # XMLTOMAN manpage generation
299 #
300 AC_ARG_ENABLE(xmltoman,
301         AS_HELP_STRING([--disable-xmltoman],[Disable rebuilding of man pages with xmltoman]),
302 [case "${enableval}" in
303   yes) xmltoman=yes ;;
304   no)  xmltoman=no ;;
305   *) AC_MSG_ERROR([bad value ${enableval} for --disable-xmltoman]) ;;
306 esac],[xmltoman=yes])
307
308 if test x$xmltoman = xyes ; then
309    AC_CHECK_PROG(have_xmltoman, xmltoman, yes, no)
310
311    if test x$have_xmltoman = xno ; then
312      AC_MSG_WARN([*** Not rebuilding man pages as xmltoman is not found ***])
313      xmltoman=no
314    fi
315 fi
316
317 AM_CONDITIONAL([USE_XMLTOMAN], [test "x$xmltoman" = xyes])
318
319 # ==========================================================================
320 AC_CONFIG_FILES([
321 Makefile 
322 avahi-common/Makefile 
323 avahi-core/Makefile 
324 avahi-glib/Makefile 
325 avahi-daemon/Makefile 
326 avahi-daemon/avahi-dbus.conf
327 avahi-discover-standalone/Makefile 
328 avahi-client/Makefile 
329 initscript/Makefile 
330 initscript/Debian/Makefile
331 initscript/Gentoo/Makefile
332 initscript/SUSE/Makefile
333 avahi-dnsconfd/Makefile
334 avahi-utils/Makefile
335 avahi-utils/avahi/Makefile
336 examples/Makefile
337 common/Makefile
338 man/Makefile
339 tests/Makefile
340 ])
341 AC_OUTPUT
342
343 # ==========================================================================
344 echo "
345  ---{ $PACKAGE_NAME $VERSION }---
346
347     prefix:                 ${prefix}
348     sysconfdir:             ${sysconfdir}
349     dbus-1 system.d dir:    ${DBUS_SYS_DIR}
350     dbus-1 version:         `pkg-config dbus-1 --modversion`
351     compiler:               ${CC}
352     cflags:                 ${CFLAGS}
353     Enable GLIB:            ${HAVE_GLIB}
354     Enable GTK:             ${HAVE_GTK}
355     Enable D-BUS:           ${HAVE_DBUS}
356     Enable Expat:           ${HAVE_EXPAT}
357     Enable libdaemon:       ${HAVE_LIBDAEMON}
358     Have Python:            ${HAVE_PYTHON}
359     Linux Distro:           ${with_distro}
360     User for Avahi:         ${AVAHI_USER}
361     Group for Avahi:        ${AVAHI_GROUP}
362 "
363
364 BUILD_DAEMON=no
365
366 if test "x$HAVE_EXPAT" = "xyes" -a "x$HAVE_LIBDAEMON" = "xyes" ; then
367    BUILD_DAEMON=yes
368 fi
369
370 BUILD_UTILS=no
371
372 if test "x$BUILD_DAEMON" = "xyes" -a "x$HAVE_DBUS" = "xyes" -a "x$HAVE_PYTHON" = "xyes" ; then
373    BUILD_UTILS=yes
374 fi
375     
376 echo "
377     Building avahi-core                 yes
378     Building avahi-daemon:              ${BUILD_DAEMON}
379     Building avahi-dnsconfd:            ${BUILD_DAEMON}
380     Building avahi-utils:               ${BUILD_UTILS}
381     Building avahi-glib:                ${HAVE_GLIB}
382     Building avahi-discover-standalone  ${HAVE_GTK}
383 "