2 # Process this file with autoconf to produce a configure script.
4 # This file is part of avahi.
6 # avahi is free software; you can redistribute it and/or modify it
7 # under the terms of the GNU Lesser General Public License as
8 # published by the Free Software Foundation; either version 2 of the
9 # License, or (at your option) any later version.
11 # avahi is distributed in the hope that it will be useful, but WITHOUT
12 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
13 # or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
14 # License for more details.
16 # You should have received a copy of the GNU Lesser General Public
17 # License along with avahi; if not, write to the Free Software
18 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
22 AC_INIT([avahi],[0.6.31],[avahi (at) lists (dot) freedesktop (dot) org])
23 AC_CONFIG_SRCDIR([avahi-core/server.c])
24 AC_CONFIG_MACRO_DIR([common])
25 AC_CONFIG_HEADERS([config.h])
26 AM_INIT_AUTOMAKE([foreign 1.11 -Wall -Wno-portability silent-rules tar-pax])
28 AC_SUBST(PACKAGE_URL, [http://avahi.org/])
30 AC_SUBST(LIBAVAHI_COMMON_VERSION_INFO, [8:3:5])
31 AC_SUBST(LIBAVAHI_CORE_VERSION_INFO, [7:2:0])
35 AM_SILENT_RULES([yes])
37 AC_CHECK_PROG([STOW], [stow], [yes], [no])
39 AS_IF([test "x$STOW" = "xyes" && test -d /usr/local/stow], [
40 AC_MSG_NOTICE([*** Found /usr/local/stow: default install prefix set to /usr/local/stow/${PACKAGE_NAME}-${PACKAGE_VERSION} ***])
41 ac_default_prefix="/usr/local/stow/${PACKAGE_NAME}-${PACKAGE_VERSION}"
44 # Checks for programs.
48 AC_USE_SYSTEM_EXTENSIONS
53 AC_PROG_GCC_TRADITIONAL
56 AC_ARG_ENABLE([stack-protector],
57 [AS_HELP_STRING([--disable-stack-protector],
58 [Disable GCC's/libc's stack-smashing protection])],
59 [case "${enableval}" in
60 yes) enable_ssp=yes ;;
62 *) AC_MSG_ERROR([invalid value ${enableval} for --disable-stack-protector]) ;;
66 if test x"$enable_ssp" = x"yes" && test x"$GCC" != x"yes"; then
67 AC_MSG_NOTICE([Disabling stack-smashing protection because compiler is not GCC])
71 if test x"$enable_ssp" = x"yes"; then
72 # Check for broken ssp in libc: http://www.avahi.org/ticket/105
73 # libc's brokenness will get in the way regardless of whether -lssp is
74 # provided, but provide it anyway (otherwise non-libc ssp would wrongly
77 # Get -lssp if it exists
80 AC_MSG_CHECKING([whether stack-smashing protection is available])
81 ssp_old_cflags="$CFLAGS"
82 ssp_old_ldflags="$LDFLAGS"
83 CFLAGS="$CFLAGS -Werror -fstack-protector-all -fPIC"
84 LDFLAGS="$LDFLAGS -Wl,-z,defs"
85 cat confdefs.h > conftest.c
86 cat >>conftest.c <<_ACEOF
87 void test_broken_ssp(c)
90 char arr[[123]], *p; /* beware of possible double-braces if copying this */
91 for (p = arr; *c; ++p) {
99 if $CC -c $CFLAGS $CPPFLAGS -o conftest.o conftest.c >/dev/null 2>&1; then
101 AC_MSG_CHECKING([whether stack-smashing protection is buggy])
102 if $CC -o conftest.so $LDFLAGS -shared conftest.o $LIBS >/dev/null 2>&1; then
112 rm -f conftest.c conftest.o conftest.so
114 CFLAGS="$ssp_old_cflags"
115 LDFLAGS="$ssp_old_ldflags"
118 if test x"$enable_ssp" = x"yes"; then
119 # Do this the long way so we don't call GCC_STACK_PROTECT_LIB twice
123 GCC_STACK_PROTECT_CXX
125 # XXX: Update the enable_ssp value now for output later?
131 ACX_PTHREAD(,AC_MSG_ERROR([Missing POSIX Threads support]))
134 # Check for netlink.h
136 AC_CHECK_HEADER(linux/netlink.h,
138 AC_DEFINE([HAVE_NETLINK],[],[Support for Linux netlink])
140 #include <sys/socket.h>
141 #include <asm/types.h>
144 AM_CONDITIONAL(HAVE_NETLINK, [ test x"$HAVE_NETLINK" = xyes ])
147 # Check for net/route.h
149 AC_CHECK_HEADER(net/route.h,
151 AC_DEFINE([HAVE_PF_ROUTE],[],[Support for PF_ROUTE])
153 #include <sys/types.h>
154 #include <sys/socket.h>
155 #include <net/if_dl.h>
158 AM_CONDITIONAL(HAVE_PF_ROUTE, [ test x"$HAVE_PF_ROUTE" = xyes ])
161 # Check for sys/filio.h; needed for FIONREAD on Solaris
163 AC_CHECK_HEADER(sys/filio.h,
165 AC_DEFINE([HAVE_SYS_FILIO_H],[],[Support for sys/filio.h])
169 AM_CONDITIONAL(HAVE_SYS_FILIO_H, [ test x"$HAVE_SYS_FILIO_H" = xyes ])
172 # Check for sys/sysctl.h; not present on Solaris
174 AC_CHECK_HEADER(sys/sysctl.h,
176 AC_DEFINE([HAVE_SYS_SYSCTL_H],[],[Support for sys/sysctl.h])
178 #include <sys/types.h>
179 #include <sys/socket.h>
180 #include <sys/param.h>
183 AM_CONDITIONAL(HAVE_SYS_SYSCTL_H, [ test x"$HAVE_SYS_SYSCTL_H" = xyes ])
186 # Check for lifconf struct; only present on Solaris
188 AC_MSG_CHECKING(for struct lifconf)
189 AC_CACHE_VAL(avahi_cv_has_struct_lifconf,
191 [#include <sys/socket.h>
193 ],[sizeof (struct lifconf);],
194 avahi_cv_has_struct_lifconf=yes,avahi_cv_has_struct_lifconf=no)])
195 AC_MSG_RESULT($avahi_cv_has_struct_lifconf)
196 if test $avahi_cv_has_struct_lifconf = yes; then
197 AC_DEFINE(HAVE_STRUCT_LIFCONF,1,[Define if there is a struct lifconf.])
201 # Check for struct ip_mreqn
203 AC_MSG_CHECKING(for struct ip_mreqn)
204 AC_TRY_COMPILE([#include <netinet/in.h>], [
205 struct ip_mreqn mreq;
206 mreq.imr_address.s_addr = 0;
210 AC_DEFINE([HAVE_STRUCT_IP_MREQN],[],[Support for struct ip_mreqn])
212 # We'll just have to try and use struct ip_mreq
214 AC_MSG_CHECKING(for struct ip_mreq)
215 AC_TRY_COMPILE([#include <netinet/in.h>], [
217 mreq.imr_interface.s_addr = 0;
221 AC_DEFINE([HAVE_STRUCT_IP_MREQ],[],[Support for struct ip_mreq])
223 # No multicast support
229 AC_LANG_CONFTEST([AC_LANG_SOURCE([[int main() {}]])])
230 $CC -c conftest.c $CFLAGS $@ > /dev/null 2> /dev/null
236 # If using GCC specify some additional parameters
237 if test "x$GCC" = "xyes" ; then
239 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 -fdiagnostics-show-option -Wno-cast-qual -fno-strict-aliasing"
241 if test "x$HAVE_NETLINK" = "xyes" ; then
242 # Test whether rtnetlink.h can be included when compiled with -std=c99
243 # some distributions (e.g. archlinux) have broken headers that dont
244 # define __u64 with -std=c99
245 AC_MSG_CHECKING([checking whether rtnetlink.h can be included with -std=c99])
248 AC_TRY_COMPILE([#include <linux/rtnetlink.h>], [],
249 use_stdc99=yes, use_stdc99=no)
251 if test x"$use_stdc99" = xyes; then
252 DESIRED_FLAGS="-std=c99 $DESIRED_FLAGS"
260 DESIRED_FLAGS="-std=c99 $DESIRED_FLAGS"
263 for flag in $DESIRED_FLAGS ; do
264 AC_MSG_CHECKING([whether $CC accepts $flag])
265 if test_gcc_flag $flag ; then
266 CFLAGS="$CFLAGS $flag"
274 # Checks for header files.
276 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])
279 # Checks for typedefs, structures, and compiler characteristics.
286 AC_SEARCH_LIBS([inet_ntop],[nsl])
287 AC_SEARCH_LIBS([recv],[socket])
288 AC_CHECK_DECL([CMSG_SPACE],,CFLAGS="$CFLAGS -D_XOPEN_SOURCE=500 -D__EXTENSIONS__", [[#include <sys/socket.h>]])
290 # Checks for library functions.
292 AC_FUNC_SELECT_ARGTYPES
293 # avahi_malloc actually returns NULL for avahi_malloc(0), so it does not matter
294 # whether libc's malloc does too. (Same for realloc.)
297 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])
304 AC_CHECK_DECLS(environ)
306 # check if gcc's -fvisibility is supported
307 CHECK_VISIBILITY_HIDDEN
309 # Check for pkg-config manually first, as if its not installed the
310 # PKG_PROG_PKG_CONFIG macro won't be defined.
311 AC_CHECK_PROG(have_pkg_config, pkg-config, yes, no)
313 if test x"$have_pkg_config" = "xno"; then
314 AC_MSG_ERROR(pkg-config is required to install this program)
330 DX_INIT_DOXYGEN(avahi, doxygen.cfg, doxygen)
333 # Conditionally compile test and example programs
336 AS_HELP_STRING([--enable-tests],[Enable building of tests and examples]),
337 [case "${enableval}" in
338 yes) ENABLE_TESTS=yes ;;
339 no) ENABLE_TESTS=no ;;
340 *) AC_MSG_ERROR(bad value ${enableval} for --enable-tests) ;;
344 AM_CONDITIONAL([ENABLE_TESTS], [test "x$ENABLE_TESTS" = "xyes"])
346 # ==========================================================================
349 avahi-common/Makefile
356 # ==========================================================================
358 ---{ $PACKAGE_NAME $VERSION }---
361 sysconfdir: ${sysconfdir}
362 localstatedir: ${localstatedir}
365 Enable stack-smashing protection: ${enable_ssp}
369 Building libavahi-core yes
370 Building tests: ${ENABLE_TESTS}