]> git.meshlink.io Git - catta/blob - configure.ac
1f55b99a0b203766ea7de9d05e1b1cbabc9fa795
[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 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 "y$HAVE_PYTHON" = xyes ; then
213    AM_PATH_PYTHON(2.4)
214
215    if  test "x$HAVE_PYTHON" = xyes ; then
216        AM_CHECK_PYMOD(gtk,,,[AC_MSG_ERROR(Could not find Python module pygtk)])
217        AM_CHECK_PYMOD(dbus,,,[AC_MSG_ERROR(Could not find Python module dbus)])
218    fi
219 fi
220 AM_CONDITIONAL(HAVE_PYTHON, [test "x$HAVE_PYTHON" = "xyes" ])
221
222 #
223 # Detecting the linux distro for specific things like initscripts.
224 #
225 AC_ARG_WITH(distro, AS_HELP_STRING([--with-distro=DISTRO],[Specify the Linux distribution to target: One of redhat, suse, gentoo, debian, or slackware]))
226 if test "z$with_distro" = "z"; then
227    AC_CHECK_FILE(/etc/redhat-release,with_distro="redhat")
228    AC_CHECK_FILE(/etc/SuSE-release,with_distro="suse")
229    AC_CHECK_FILE(/etc/fedora-release,with_distro="redhat")
230    AC_CHECK_FILE(/etc/gentoo-release,with_distro="gentoo")
231    AC_CHECK_FILE(/etc/debian_version,with_distro="debian")
232    AC_CHECK_FILE(/etc/slackware-version,with_distro="slackware")
233 fi
234 with_distro=`echo ${with_distro} | tr '[[:upper:]]' '[[:lower:]]' `
235
236 if test "z$with_distro" = "z"; then
237    echo "Linux distribution autodetection failed, you must specify the distribution to target using --with-distro=DISTRO"
238    exit 1
239 else
240 case $with_distro in
241    debian|gentoo|suse)
242      ;;
243    *)
244      echo "Your distribution (${with_distro}) is not yet supported, init scripts and dbus configuration will not be installed! (patches welcome)"
245      ;;
246 esac
247
248 fi
249 AM_CONDITIONAL(TARGET_REDHAT, test x"$with_distro" = xredhat)
250 AM_CONDITIONAL(TARGET_SUSE, test x"$with_distro" = xsuse)
251 AM_CONDITIONAL(TARGET_GENTOO, test x"$with_distro" = xgentoo)
252 AM_CONDITIONAL(TARGET_DEBIAN, test x"$with_distro" = xdebian)
253 AM_CONDITIONAL(TARGET_SLACKWARE, test x"$with_distro" = xslackware)
254
255 #
256 # Defining Avahi User and Group.
257 #
258 AC_ARG_WITH(avahi_user, AS_HELP_STRING([--with-avahi-user=<user>],[User for running the Avahi daemon (avahi)]))
259 if test -z "$with_avahi_user" ; then
260     AVAHI_USER=avahi
261 else
262     AVAHI_USER=$with_avahi_user
263 fi
264 AC_SUBST(AVAHI_USER)
265 AC_DEFINE_UNQUOTED(AVAHI_USER,"$AVAHI_USER", [User for running the Avahi daemon])
266
267 AC_ARG_WITH(avahi_group,AS_HELP_STRING([--with-avahi-group=<group>],[Group for Avahi (avahi)]))
268 if test -z "$with_avahi_group" ; then
269     AVAHI_GROUP=avahi
270 else
271     AVAHI_GROUP=$with_avahi_group
272 fi
273 AC_SUBST(AVAHI_GROUP)
274 AC_DEFINE_UNQUOTED(AVAHI_GROUP,"$AVAHI_GROUP", [Group for Avahi])
275
276 #
277 # Avahi runtime dir
278 #
279 avahi_runtime_dir="${localstatedir}/run"
280 avahi_socket="${avahi_runtime_dir}/avahi-daemon/socket"
281 AC_SUBST(avahi_runtime_dir)
282 AC_SUBST(avahi_socket)
283
284
285 #
286 # Doxygen
287 #
288 DX_HTML_FEATURE(ON)
289 DX_CHM_FEATURE(OFF)
290 DX_CHI_FEATURE(OFF)
291 DX_MAN_FEATURE(OFF)
292 DX_RTF_FEATURE(OFF)
293 DX_XML_FEATURE(OFF)
294 DX_PDF_FEATURE(OFF)
295 DX_PS_FEATURE(OFF)
296 DX_INIT_DOXYGEN(avahi, doxygen.cfg, doxygen)
297
298 #
299 # XMLTOMAN manpage generation
300 #
301 AC_ARG_ENABLE(xmltoman,
302         AS_HELP_STRING([--disable-xmltoman],[Disable rebuilding of man pages with xmltoman]),
303 [case "${enableval}" in
304   yes) xmltoman=yes ;;
305   no)  xmltoman=no ;;
306   *) AC_MSG_ERROR([bad value ${enableval} for --disable-xmltoman]) ;;
307 esac],[xmltoman=yes])
308
309 if test x$xmltoman = xyes ; then
310    AC_CHECK_PROG(have_xmltoman, xmltoman, yes, no)
311
312    if test x$have_xmltoman = xno ; then
313      AC_MSG_WARN([*** Not rebuilding man pages as xmltoman is not found ***])
314      xmltoman=no
315    fi
316 fi
317
318 AM_CONDITIONAL([USE_XMLTOMAN], [test "x$xmltoman" = xyes])
319
320 # ==========================================================================
321 AC_CONFIG_FILES([
322 Makefile 
323 avahi-common/Makefile 
324 avahi-core/Makefile 
325 avahi-glib/Makefile 
326 avahi-daemon/Makefile 
327 avahi-daemon/avahi-dbus.conf
328 avahi-discover-standalone/Makefile 
329 avahi-client/Makefile 
330 initscript/Makefile 
331 initscript/Debian/Makefile
332 initscript/Gentoo/Makefile
333 initscript/SUSE/Makefile
334 avahi-dnsconfd/Makefile
335 avahi-utils/Makefile
336 avahi-utils/avahi/Makefile
337 examples/Makefile
338 common/Makefile
339 man/Makefile
340 tests/Makefile
341 ])
342 AC_OUTPUT
343
344 # ==========================================================================
345 echo "
346  ---{ $PACKAGE_NAME $VERSION }---
347
348     prefix:                 ${prefix}
349     sysconfdir:             ${sysconfdir}
350     dbus-1 system.d dir:    ${DBUS_SYS_DIR}
351     dbus-1 version:         `pkg-config dbus-1 --modversion`
352     compiler:               ${CC}
353     cflags:                 ${CFLAGS}
354     Enable GLIB:            ${HAVE_GLIB}
355     Enable GTK:             ${HAVE_GTK}
356     Enable D-BUS:           ${HAVE_DBUS}
357     Enable Expat:           ${HAVE_EXPAT}
358     Enable libdaemon:       ${HAVE_LIBDAEMON}
359     Have Python:            ${HAVE_PYTHON}
360     Linux Distro:           ${with_distro}
361     User for Avahi:         ${AVAHI_USER}
362     Group for Avahi:        ${AVAHI_GROUP}
363 "
364
365 BUILD_DAEMON="no (!)"
366
367 if test "x$HAVE_EXPAT" = "xyes" -a "x$HAVE_LIBDAEMON" = "xyes" ; then
368    BUILD_DAEMON=yes
369 fi
370
371 BUILD_UTILS="no (!)"
372
373 if test "x$BUILD_DAEMON" = "xyes" -a "x$HAVE_DBUS" = "xyes" -a "x$HAVE_PYTHON" = "xyes" ; then
374    BUILD_UTILS=yes
375 fi
376     
377 echo "
378     Building avahi-core                 yes
379     Building avahi-daemon:              ${BUILD_DAEMON}
380     Building avahi-dnsconfd:            ${BUILD_DAEMON}
381     Building avahi-utils:               ${BUILD_UTILS}
382     Building avahi-glib:                ${HAVE_GLIB}
383     Building avahi-discover-standalone: ${HAVE_GTK}
384 "