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