]> git.meshlink.io Git - catta/blob - configure.ac
remove i18n from the build alltogether
[catta] / configure.ac
1 # -*- Autoconf -*-
2 # Process this file with autoconf to produce a configure script.
3
4 # This file is part of avahi.
5 #
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.
10 #
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.
15 #
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
19 # USA.
20
21 AC_PREREQ(2.63)
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])
27
28 AC_SUBST(PACKAGE_URL, [http://avahi.org/])
29
30 AC_SUBST(LIBAVAHI_COMMON_VERSION_INFO, [8:3:5])
31 AC_SUBST(LIBAVAHI_CORE_VERSION_INFO, [7:2:0])
32
33 AC_CANONICAL_HOST
34
35 AM_SILENT_RULES([yes])
36
37 AC_CHECK_PROG([STOW], [stow], [yes], [no])
38
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}"
42 ])
43
44 # Checks for programs.
45 AC_PROG_CC
46 AC_PROG_CC_C99
47 AC_PROG_CXX
48 AM_PROG_CC_C_O
49 AC_USE_SYSTEM_EXTENSIONS
50 AC_PROG_CPP
51 AC_PROG_MKDIR_P
52 AC_PROG_INSTALL
53 AC_PROG_LN_S
54 AC_PROG_MAKE_SET
55 AC_PROG_GCC_TRADITIONAL
56
57 # -fstack-protector
58 AC_ARG_ENABLE([stack-protector],
59     [AS_HELP_STRING([--disable-stack-protector],
60         [Disable GCC's/libc's stack-smashing protection])],
61     [case "${enableval}" in
62          yes) enable_ssp=yes ;;
63           no) enable_ssp=no ;;
64            *) AC_MSG_ERROR([invalid value ${enableval} for --disable-stack-protector]) ;;
65      esac],
66     [enable_ssp=yes])
67
68 if test x"$enable_ssp" = x"yes" && test x"$GCC" != x"yes"; then
69     AC_MSG_NOTICE([Disabling stack-smashing protection because compiler is not GCC])
70     enable_ssp=no
71 fi
72
73 if test x"$enable_ssp" = x"yes"; then
74     # Check for broken ssp in libc: http://www.avahi.org/ticket/105
75     # libc's brokenness will get in the way regardless of whether -lssp is
76     # provided, but provide it anyway (otherwise non-libc ssp would wrongly
77     # break here)
78
79     # Get -lssp if it exists
80     GCC_STACK_PROTECT_LIB
81
82     AC_MSG_CHECKING([whether stack-smashing protection is available])
83     ssp_old_cflags="$CFLAGS"
84     ssp_old_ldflags="$LDFLAGS"
85     CFLAGS="$CFLAGS -Werror -fstack-protector-all -fPIC"
86     LDFLAGS="$LDFLAGS -Wl,-z,defs"
87     cat confdefs.h > conftest.c
88     cat >>conftest.c <<_ACEOF
89 void test_broken_ssp(c)
90     const char *c;
91 {
92     char arr[[123]], *p; /* beware of possible double-braces if copying this */
93     for (p = arr; *c; ++p) {
94         *p = *c;
95         ++c;
96     }
97 }
98 _ACEOF
99     rm -f conftest.o
100
101     if $CC -c $CFLAGS $CPPFLAGS -o conftest.o conftest.c >/dev/null 2>&1; then
102         AC_MSG_RESULT([yes])
103         AC_MSG_CHECKING([whether stack-smashing protection is buggy])
104         if $CC -o conftest.so $LDFLAGS -shared conftest.o $LIBS >/dev/null 2>&1; then
105             AC_MSG_RESULT([no])
106         else
107             AC_MSG_RESULT([yes])
108             enable_ssp=no
109         fi
110     else
111         AC_MSG_RESULT([no])
112     fi
113
114     rm -f conftest.c conftest.o conftest.so
115
116     CFLAGS="$ssp_old_cflags"
117     LDFLAGS="$ssp_old_ldflags"
118 fi
119
120 if test x"$enable_ssp" = x"yes"; then
121     # Do this the long way so we don't call GCC_STACK_PROTECT_LIB twice
122     GCC_STACK_PROTECT_CC
123
124     AC_LANG_PUSH([C++])
125     GCC_STACK_PROTECT_CXX
126     AC_LANG_POP([C++])
127     # XXX: Update the enable_ssp value now for output later?
128 fi
129
130 # libtool stuff
131 AC_PROG_LIBTOOL
132
133 ACX_PTHREAD(,AC_MSG_ERROR([Missing POSIX Threads support]))
134
135 #
136 # Check for netlink.h
137 #
138 AC_CHECK_HEADER(linux/netlink.h,
139 HAVE_NETLINK=yes
140 AC_DEFINE([HAVE_NETLINK],[],[Support for Linux netlink])
141 , [], [
142 #include <sys/socket.h>
143 #include <asm/types.h>
144 ])
145
146 AM_CONDITIONAL(HAVE_NETLINK, [ test x"$HAVE_NETLINK" = xyes ])
147
148 #
149 # Check for net/route.h
150 #
151 AC_CHECK_HEADER(net/route.h,
152 HAVE_PF_ROUTE=yes
153 AC_DEFINE([HAVE_PF_ROUTE],[],[Support for PF_ROUTE])
154 , [], [
155 #include <sys/types.h>
156 #include <sys/socket.h>
157 #include <net/if_dl.h>
158 ])
159
160 AM_CONDITIONAL(HAVE_PF_ROUTE, [ test x"$HAVE_PF_ROUTE" = xyes ])
161
162 #
163 # Check for sys/filio.h; needed for FIONREAD on Solaris
164 #
165 AC_CHECK_HEADER(sys/filio.h,
166 HAVE_SYS_FILIO_H=yes
167 AC_DEFINE([HAVE_SYS_FILIO_H],[],[Support for sys/filio.h])
168 , [], [
169 ])
170
171 AM_CONDITIONAL(HAVE_SYS_FILIO_H, [ test x"$HAVE_SYS_FILIO_H" = xyes ])
172
173 #
174 # Check for sys/sysctl.h; not present on Solaris
175 #
176 AC_CHECK_HEADER(sys/sysctl.h,
177 HAVE_SYS_SYSCTL=yes
178 AC_DEFINE([HAVE_SYS_SYSCTL_H],[],[Support for sys/sysctl.h])
179 , [], [
180 #include <sys/types.h>
181 #include <sys/socket.h>
182 #include <sys/param.h>
183 ])
184
185 AM_CONDITIONAL(HAVE_SYS_SYSCTL_H, [ test x"$HAVE_SYS_SYSCTL_H" = xyes ])
186
187 #
188 # Check for lifconf struct; only present on Solaris
189 #
190 AC_MSG_CHECKING(for struct lifconf)
191 AC_CACHE_VAL(avahi_cv_has_struct_lifconf,
192 [AC_TRY_COMPILE(
193 [#include <sys/socket.h>
194 #include <net/if.h>
195 ],[sizeof (struct lifconf);],
196 avahi_cv_has_struct_lifconf=yes,avahi_cv_has_struct_lifconf=no)])
197 AC_MSG_RESULT($avahi_cv_has_struct_lifconf)
198 if test $avahi_cv_has_struct_lifconf = yes; then
199     AC_DEFINE(HAVE_STRUCT_LIFCONF,1,[Define if there is a struct lifconf.])
200 fi
201
202 #
203 # Check for struct ip_mreqn
204 #
205 AC_MSG_CHECKING(for struct ip_mreqn)
206 AC_TRY_COMPILE([#include <netinet/in.h>], [
207         struct ip_mreqn mreq;
208         mreq.imr_address.s_addr = 0;
209 ], [
210         # Yes, we have it...
211         AC_MSG_RESULT(yes)
212         AC_DEFINE([HAVE_STRUCT_IP_MREQN],[],[Support for struct ip_mreqn])
213 ], [
214         # We'll just have to try and use struct ip_mreq
215         AC_MSG_RESULT(no)
216         AC_MSG_CHECKING(for struct ip_mreq)
217         AC_TRY_COMPILE([#include <netinet/in.h>], [
218                 struct ip_mreq mreq;
219                 mreq.imr_interface.s_addr = 0;
220         ], [
221                 # Yes, we have it...
222                 AC_MSG_RESULT(yes)
223                 AC_DEFINE([HAVE_STRUCT_IP_MREQ],[],[Support for struct ip_mreq])
224         ], [
225                 # No multicast support
226                         AC_MSG_RESULT(no)
227         ])
228 ])
229
230 test_gcc_flag() {
231     AC_LANG_CONFTEST([int main() {}])
232     $CC -c conftest.c $CFLAGS $@ > /dev/null 2> /dev/null
233     ret=$?
234     rm -f conftest.o
235     return $ret
236 }
237
238 # If using GCC specify some additional parameters
239 if test "x$GCC" = "xyes" ; then
240
241     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"
242
243     if test "x$HAVE_NETLINK" = "xyes" ; then
244         # Test whether rtnetlink.h can be included when compiled with -std=c99
245         # some distributions (e.g. archlinux) have broken headers that dont
246         # define __u64 with -std=c99
247         AC_MSG_CHECKING([checking whether rtnetlink.h can be included with -std=c99])
248         OLDCFLAGS="$CFLAGS"
249         CFLAGS="-std=c99"
250         AC_TRY_COMPILE([#include <linux/rtnetlink.h>], [],
251             use_stdc99=yes, use_stdc99=no)
252
253         if test x"$use_stdc99" = xyes; then
254             DESIRED_FLAGS="-std=c99 $DESIRED_FLAGS"
255             AC_MSG_RESULT([yes])
256         else
257             AC_MSG_RESULT([no])
258         fi
259
260         CFLAGS="$OLDCFLAGS"
261     else
262         DESIRED_FLAGS="-std=c99 $DESIRED_FLAGS"
263     fi
264
265     for flag in $DESIRED_FLAGS ; do
266         AC_MSG_CHECKING([whether $CC accepts $flag])
267         if test_gcc_flag $flag ; then
268            CFLAGS="$CFLAGS $flag"
269            AC_MSG_RESULT([yes])
270         else
271            AC_MSG_RESULT([no])
272         fi
273     done
274 fi
275
276 # Checks for header files.
277 AC_HEADER_STDC
278 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 AC_HEADER_STDBOOL
280
281 # Checks for typedefs, structures, and compiler characteristics.
282 AC_C_CONST
283 AC_TYPE_SIZE_T
284 AC_HEADER_TIME
285 AC_HEADER_SYS_WAIT
286
287  # Solaris stuff
288  AC_SEARCH_LIBS([inet_ntop],[nsl])
289  AC_SEARCH_LIBS([recv],[socket])
290  AC_CHECK_DECL([CMSG_SPACE],,CFLAGS="$CFLAGS -D_XOPEN_SOURCE=500 -D__EXTENSIONS__", [[#include <sys/socket.h>]])
291
292 # Checks for library functions.
293 AC_FUNC_MEMCMP
294 AC_FUNC_SELECT_ARGTYPES
295 # avahi_malloc actually returns NULL for avahi_malloc(0), so it does not matter
296 # whether libc's malloc does too. (Same for realloc.)
297 #AC_FUNC_MALLOC
298 #AC_FUNC_REALLOC
299 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])
300
301 AC_FUNC_CHOWN
302 AC_FUNC_STAT
303 AC_TYPE_MODE_T
304 AC_TYPE_PID_T
305
306 AC_CHECK_DECLS(environ)
307
308 # check if gcc's -fvisibility is supported
309 CHECK_VISIBILITY_HIDDEN
310
311 # Check for pkg-config manually first, as if its not installed the
312 # PKG_PROG_PKG_CONFIG macro won't be defined.
313 AC_CHECK_PROG(have_pkg_config, pkg-config, yes, no)
314
315 if test x"$have_pkg_config" = "xno"; then
316     AC_MSG_ERROR(pkg-config is required to install this program)
317 fi
318
319 PKG_PROG_PKG_CONFIG
320
321 #
322 # Doxygen
323 #
324 DX_HTML_FEATURE(ON)
325 DX_CHM_FEATURE(OFF)
326 DX_CHI_FEATURE(OFF)
327 DX_MAN_FEATURE(OFF)
328 DX_RTF_FEATURE(OFF)
329 DX_XML_FEATURE(ON)
330 DX_PDF_FEATURE(OFF)
331 DX_PS_FEATURE(OFF)
332 DX_INIT_DOXYGEN(avahi, doxygen.cfg, doxygen)
333
334 AC_ARG_ENABLE(core-docs,
335         AS_HELP_STRING([--enable-core-docs],[Enable building of documentation for avahi-core]),
336 [case "${enableval}" in
337   yes) ENABLE_CORE_DOCS=yes ;;
338   no)  ENABLE_CORE_DOCS=no ;;
339   *) AC_MSG_ERROR([bad value ${enableval} for --enable-core-docs]) ;;
340 esac],[ENABLE_CORE_DOCS=no])
341
342 AM_CONDITIONAL([ENABLE_CORE_DOCS], [test "x$ENABLE_CORE_DOCS" = xyes])
343
344 #
345 # Conditionally compile test and example programs
346 #
347 AC_ARG_ENABLE(tests,
348         AS_HELP_STRING([--enable-tests],[Enable building of tests and examples]),
349         [case "${enableval}" in
350                 yes) ENABLE_TESTS=yes ;;
351                 no)  ENABLE_TESTS=no ;;
352                 *) AC_MSG_ERROR(bad value ${enableval} for --enable-tests) ;;
353         esac],
354         [ENABLE_TESTS=no])
355
356 AM_CONDITIONAL([ENABLE_TESTS], [test "x$ENABLE_TESTS" = "xyes"])
357
358 # ==========================================================================
359 AC_CONFIG_FILES([
360 Makefile
361 avahi-common/Makefile
362 avahi-core/Makefile
363 examples/Makefile
364 common/Makefile
365 ])
366 AC_OUTPUT
367
368 # ==========================================================================
369 echo "
370  ---{ $PACKAGE_NAME $VERSION }---
371
372     prefix:                                    ${prefix}
373     sysconfdir:                                ${sysconfdir}
374     localstatedir:                             ${localstatedir}
375     C Compiler:                                ${CC}
376     CFLAGS:                                    ${CFLAGS}
377     Enable stack-smashing protection:          ${enable_ssp}
378 "
379
380 echo "\
381     Building libavahi-core              yes
382     Building tests:                     ${ENABLE_TESTS}
383     Building avahi-core documentation:  ${ENABLE_CORE_DOCS}
384 "