2 # Process this file with autoconf to produce a configure script.
4 # This file is part of PulseAudio.
6 # Copyright 2004-2008 Lennart Poettering
7 # Copyright 2006-2007 Pierre Ossman <ossman@cendio.se> for Cendio AB
9 # PulseAudio is free software; you can redistribute it and/or modify it
10 # under the terms of the GNU Lesser General Public License as published by
11 # the Free Software Foundation; either version 2 of the License, or
12 # (at your option) any later version.
14 # PulseAudio is distributed in the hope that it will be useful, but
15 # WITHOUT ANY WARRANTY; without even the implied warranty of
16 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 # General Public License for more details.
19 # You should have received a copy of the GNU Lesser General Public License
20 # along with PulseAudio; if not, write to the Free Software Foundation,
21 # Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
25 AC_INIT([pulseaudio-module-tizen],[0.1])
26 AC_CONFIG_SRCDIR([src/module-tizenaudio-policy.c])
27 AC_CONFIG_MACRO_DIR([m4])
28 AC_CONFIG_HEADERS([config.h])
29 AM_INIT_AUTOMAKE([foreign 1.11 -Wall -Wno-portability subdir-objects silent-rules color-tests dist-xz tar-ustar])
31 #### Checks for programs. ####
42 # Only required if you want the WebRTC canceller -- no runtime dep on
45 AC_PROG_GCC_TRADITIONAL
46 AC_USE_SYSTEM_EXTENSIONS
50 AC_CHECK_PROGS([M4], gm4 m4, no)
51 AS_IF([test "x$M4" = "xno"], AC_MSG_ERROR([m4 missing]))
57 #### Compiler flags ####
59 AX_APPEND_COMPILE_FLAGS(
60 [-Wall -W -Wextra -pipe -Wno-long-long -Wno-overlength-strings -Wunsafe-loop-optimizations -Wundef -Wformat=2 -Wlogical-op -Wsign-compare -Wformat-security -Wmissing-include-dirs -Wformat-nonliteral -Wold-style-definition -Wpointer-arith -Winit-self -Wdeclaration-after-statement -Wfloat-equal -Wmissing-prototypes -Wstrict-prototypes -Wredundant-decls -Wmissing-declarations -Wmissing-noreturn -Wshadow -Wendif-labels -Wcast-align -Wstrict-aliasing -Wwrite-strings -Wno-unused-parameter -ffast-math -fno-common -fdiagnostics-show-option],
61 [], [-pedantic -Werror])
63 # Only enable fastpath asserts when doing a debug build, e.g. from bootstrap.sh.
64 AS_CASE([" $CFLAGS "], [*" -O0 "*], [], [AX_APPEND_FLAG(["-DFASTPATH"], [CPPFLAGS])])
66 # Only set _FORTIFY_SOURCE when optimizations are enabled. If optimizations
67 # are disabled, _FORTIFY_SOURCE doesn't do anything, and causes tons of
68 # warnings during compiling on some distributions (at least Fedora).
69 AS_CASE([" $CFLAGS "], [*" -O0 "*], [], [AX_APPEND_FLAG(["-D_FORTIFY_SOURCE=2"], [CPPFLAGS])])
72 #### Linker flags ####
74 # Use immediate (now) bindings; avoids the funky re-call in itself.
75 # The -z now syntax is lifted from Sun's linker and works with GNU's too, other linkers might be added later.
76 AX_APPEND_LINK_FLAGS([-Wl,-z,now], [IMMEDIATE_LDFLAGS])
77 AC_SUBST([IMMEDIATE_LDFLAGS])
79 # On ELF systems we don't want the libraries to be unloaded since we don't clean them up properly,
80 # so we request the nodelete flag to be enabled.
81 # On other systems, we don't really know how to do that, but it's welcome if somebody can tell.
82 AX_APPEND_LINK_FLAGS([-Wl,-z,nodelete], [NODELETE_LDFLAGS])
83 AC_SUBST([NODELETE_LDFLAGS])
85 # Check for the proper way to build libraries that have no undefined symbols
87 # FreeBSD (et al.) does not complete linking for shared objects when pthreads
88 # are requested, as different implementations are present.
89 *-freebsd* | *-openbsd*) ;;
91 for possible_flag in "-Wl,--no-undefined" "-Wl,-z,defs"; do
92 AX_CHECK_LINK_FLAG([$possible_flag], [NOUNDEFINED_LDFLAGS="$possible_flag"; break])
96 AC_SUBST([NOUNDEFINED_LDFLAGS])
99 #### Atomic operations ####
101 # Native atomic operation support
102 AC_ARG_ENABLE([atomic-arm-linux-helpers],
103 AS_HELP_STRING([--disable-atomic-arm-linux-helpers],[use inline asm or libatomic_ops instead]))
105 AC_ARG_ENABLE([atomic-arm-memory-barrier],
106 AS_HELP_STRING([--enable-atomic-arm-memory-barrier],[only really needed in SMP arm systems]))
108 if test "x$enable_atomic_arm_memory_barrier" = "xyes"; then
109 AC_DEFINE_UNQUOTED(ATOMIC_ARM_MEMORY_BARRIER_ENABLED, 1, [Enable memory barriers])
112 # If everything else fails use libatomic_ops
113 need_libatomic_ops=yes
115 AC_CACHE_CHECK([whether $CC knows __sync_bool_compare_and_swap()],
116 pulseaudio_cv_sync_bool_compare_and_swap, [
118 [AC_LANG_PROGRAM([], [[int a = 4; __sync_bool_compare_and_swap(&a, 4, 5);]])],
119 [pulseaudio_cv_sync_bool_compare_and_swap=yes],
120 [pulseaudio_cv_sync_bool_compare_and_swap=no])
123 if test "$pulseaudio_cv_sync_bool_compare_and_swap" = "yes" ; then
124 AC_DEFINE([HAVE_ATOMIC_BUILTINS], 1, [Have __sync_bool_compare_and_swap() and friends.])
125 need_libatomic_ops=no
127 # HW specific atomic ops stuff
128 AC_MSG_CHECKING([architecture for native atomic operations])
132 AC_MSG_CHECKING([whether we can use Linux kernel helpers])
133 # The Linux kernel helper functions have been there since 2.6.16. However
134 # compile time checking for kernel version in cross compile environment
135 # (which is usually the case for arm cpu) is tricky (or impossible).
136 if test "x$os_is_linux" = "x1" && test "x$enable_atomic_arm_linux_helpers" != "xno"; then
138 AC_DEFINE_UNQUOTED(ATOMIC_ARM_LINUX_HELPERS, 1, [special arm linux implementation])
139 need_libatomic_ops=no
142 AC_CACHE_CHECK([compiler support for arm inline asm atomic operations],
143 pulseaudio_cv_support_arm_atomic_ops, [
145 [AC_LANG_PROGRAM([], [[
148 asm volatile ("ldrex %0, [%1]\n"
150 "strexeq %0, %3, [%1]\n"
152 : "r" (&a), "Ir" (o), "r" (n)
154 return (a==1 ? 0 : -1);
156 [pulseaudio_cv_support_arm_atomic_ops=yes],
157 [pulseaudio_cv_support_arm_atomic_ops=no])
159 AS_IF([test "$pulseaudio_cv_support_arm_atomic_ops" = "yes"], [
160 AC_DEFINE([ATOMIC_ARM_INLINE_ASM], 1, [Have ARM atomic instructions.])
161 need_libatomic_ops=no
167 need_libatomic_ops=no
171 need_libatomic_ops=no
174 AC_MSG_RESULT([unknown])
179 # If we're on ARM, check for the ARMV6 instructions we need */
182 AC_CACHE_CHECK([support for required armv6 instructions],
183 pulseaudio_cv_support_armv6,
186 [[volatile int a = -60000, b = 0xaaaabbbb, c = 0xccccdddd;
187 asm volatile ("ldr r0, %2 \n"
192 "pkhbt r1, r3, r2, LSL #8 \n"
195 : "m" (a), "m" (b), "m" (c)
196 : "r0", "r1", "r2", "r3", "cc");
197 return (a == -128 && b == 0xaabbdddd) ? 0 : -1;
199 [pulseaudio_cv_support_armv6=yes],
200 [pulseaudio_cv_support_armv6=no])
202 AS_IF([test "$pulseaudio_cv_support_armv6" = "yes"], [
203 AC_DEFINE([HAVE_ARMV6], 1, [Have ARMv6 instructions.])
210 #### libtool stuff ####
213 LT_INIT([dlopen win32-dll disable-static])
215 dnl As an extra safety device, check for lt_dladvise_init() which is
216 dnl only implemented in libtool 2.x, and refine as we go if we have
217 dnl refined requirements.
219 dnl Check the header files first since the system may have a
220 dnl libltdl.so for runtime, but no headers, and we want to bail out as
221 dnl soon as possible.
223 dnl We don't need any special variable for this though, since the user
224 dnl can give the proper place to find libltdl through the standard
225 dnl variables like LDFLAGS and CPPFLAGS.
227 AC_CHECK_HEADER([ltdl.h],
228 [AC_CHECK_LIB([ltdl], [lt_dladvise_init], [LIBLTDL=-lltdl], [LIBLTDL=])],
231 AS_IF([test "x$LIBLTDL" = "x"],
232 [AC_MSG_ERROR([Unable to find libltdl version 2. Makes sure you have libtool 2.4 or later installed.])])
236 ###################################
237 # Basic environment checks #
238 ###################################
240 #### Checks for header files. ####
246 AC_CHECK_HEADERS_ONCE([arpa/inet.h glob.h grp.h netdb.h netinet/in.h \
247 netinet/in_systm.h netinet/tcp.h poll.h pwd.h sched.h \
248 sys/mman.h sys/select.h sys/socket.h sys/wait.h \
249 sys/uio.h syslog.h sys/dl.h dlfcn.h linux/sockios.h])
250 AC_CHECK_HEADERS([netinet/ip.h], [], [],
251 [#include <sys/types.h>
252 #if HAVE_NETINET_IN_H
253 # include <netinet/in.h>
255 #if HAVE_NETINET_IN_SYSTM_H
256 # include <netinet/in_systm.h>
259 AC_CHECK_HEADERS([sys/resource.h], [HAVE_SYS_RESOURCE_H=1], [HAVE_SYS_RESOURCE_H=0])
260 AC_SUBST(HAVE_SYS_RESOURCE_H)
261 AC_CHECK_HEADERS([sys/un.h], [HAVE_AF_UNIX=1], [HAVE_AF_UNIX=0])
262 AM_CONDITIONAL(HAVE_AF_UNIX, test "x$HAVE_AF_UNIX" = "x1")
263 AC_SUBST(HAVE_AF_UNIX)
266 AC_CHECK_HEADERS([linux/input.h], [HAVE_EVDEV=1], [HAVE_EVDEV=0])
267 AM_CONDITIONAL([HAVE_EVDEV], [test "x$HAVE_EVDEV" = "x1"])
269 AC_CHECK_HEADERS_ONCE([sys/prctl.h])
271 #### Check for libs ####
274 AC_SEARCH_LIBS([pow], [m])
277 AC_SEARCH_LIBS([sched_setscheduler], [rt])
278 AC_SEARCH_LIBS([dlopen], [dl])
279 AC_SEARCH_LIBS([shm_open], [rt])
280 AC_SEARCH_LIBS([inet_ntop], [nsl])
281 AC_SEARCH_LIBS([timer_create], [rt])
282 AC_SEARCH_LIBS([pthread_setaffinity_np], [pthread])
283 AC_SEARCH_LIBS([pthread_getname_np], [pthread])
284 AC_SEARCH_LIBS([pthread_setname_np], [pthread])
287 AC_SEARCH_LIBS([connect], [socket])
288 AC_SEARCH_LIBS([backtrace], [execinfo ubacktrace])
291 #### Check for functions ####
294 AC_CHECK_FUNCS_ONCE([lrintf strtof])
299 AC_CHECK_FUNCS_ONCE([chmod chown fstat fchown fchmod clock_gettime getaddrinfo getgrgid_r getgrnam_r \
300 getpwnam_r getpwuid_r gettimeofday getuid mlock nanosleep \
301 pipe posix_fadvise posix_madvise posix_memalign setpgid setsid shm_open \
302 sigaction sleep symlink sysconf uname pthread_setaffinity_np pthread_getname_np pthread_setname_np])
303 AC_CHECK_FUNCS([mkfifo], [HAVE_MKFIFO=1], [HAVE_MKFIFO=0])
304 AC_SUBST(HAVE_MKFIFO)
305 AM_CONDITIONAL(HAVE_MKFIFO, test "x$HAVE_MKFIFO" = "x1")
308 AC_CHECK_FUNCS_ONCE([readlink])
311 AC_CHECK_FUNCS_ONCE([ctime_r usleep])
314 AC_CHECK_FUNCS_ONCE([strerror_r])
317 AC_CHECK_FUNCS_ONCE([lstat])
320 AC_CHECK_FUNCS_ONCE([setresuid setresgid setreuid setregid seteuid setegid ppoll strsignal sig2str strtof_l pipe2 accept4])
324 AC_CHECK_FUNCS([regexec], [HAVE_REGEX=1], [HAVE_REGEX=0])
325 AM_CONDITIONAL(HAVE_REGEX, [test "x$HAVE_REGEX" = "x1"])
327 # Large File-Support (LFS)
329 # Check for open64 to know if the current system does have open64() and similar functions
330 AC_CHECK_FUNCS_ONCE([open64])
333 ###################################
334 # External libraries #
335 ###################################
337 PKG_CHECK_MODULES(PA, libpulse)
342 PKG_CHECK_MODULES(PACORE, pulsecore)
343 AC_SUBST(PACORE_CFLAGS)
344 AC_SUBST(PACORE_LIBS)
345 AC_SUBST(PACORE_LDFLAGS)
351 #### json parsing ####
353 PKG_CHECK_MODULES(LIBJSON, [ json-c >= 0.11 ])
356 PKG_CHECK_MODULES(INIPARSER, iniparser)
357 AC_SUBST(INIPARSER_CFLAGS)
358 AC_SUBST(INIPARSER_LIBS)
360 PKG_CHECK_MODULES(VCONF, vconf)
361 AC_SUBST(VCONF_CFLAGS)
364 PKG_CHECK_MODULES(DNSSD, dns_sd)
365 AC_SUBST(DNSSD_CFLAGS)
368 PKG_CHECK_MODULES(HALAPIAUDIO, hal-api-audio)
369 AC_SUBST(HALAPIAUDIO_CFLAGS)
370 AC_SUBST(HALAPIAUDIO_LIBS)
372 dnl use hal tc ------------------------------------------------------------
373 AC_ARG_ENABLE(haltc, AC_HELP_STRING([--enable-haltc], [using haltc]),
375 case "${enableval}" in
376 yes) ENABLE_HALTC=yes ;;
377 no) ENABLE_HALTC=no ;;
378 *) AC_MSG_ERROR(bad value ${enableval} for --enable-haltc) ;;
381 AM_CONDITIONAL(ENABLE_HALTC, test "x$ENABLE_HALTC" = "xyes")
382 dnl end --------------------------------------------------------------------
384 dnl use acm ----------------------------------------------------------------
385 AC_ARG_ENABLE(acm, AC_HELP_STRING([--enable-acm], [using acm]),
387 case "${enableval}" in
388 yes) ENABLE_ACM=yes ;;
390 *) AC_MSG_ERROR(bad value ${enableval} for --enable-acm) ;;
393 AM_CONDITIONAL(ENABLE_ACM, test "x$ENABLE_ACM" = "xyes")
394 dnl end --------------------------------------------------------------------
396 dnl use aec ----------------------------------------------------------------
397 AC_ARG_ENABLE(aec, AC_HELP_STRING([--enable-aec], [using aec]),
399 case "${enableval}" in
400 yes) ENABLE_AEC=yes ;;
402 *) AC_MSG_ERROR(bad value ${enableval} for --enable-aec) ;;
405 AM_CONDITIONAL(ENABLE_AEC, test "x$ENABLE_AEC" = "xyes")
406 dnl end --------------------------------------------------------------------
408 #### D-Bus support (optional) ####
410 AC_ARG_ENABLE([dbus],
411 AS_HELP_STRING([--disable-dbus],[Disable optional D-Bus support]))
413 AS_IF([test "x$enable_dbus" != "xno"],
414 [PKG_CHECK_MODULES(DBUS, [ dbus-1 >= 1.4.12 ], HAVE_DBUS=1, HAVE_DBUS=0)],
417 AS_IF([test "x$enable_dbus" = "xyes" && test "x$HAVE_DBUS" = "x0"],
418 [AC_MSG_ERROR([*** D-Bus not available or too old version])])
420 AS_IF([test "x$HAVE_DBUS" = "x1"],
422 save_CFLAGS="$CFLAGS"; CFLAGS="$CFLAGS $DBUS_CFLAGS"
423 save_LIBS="$LIBS"; LIBS="$LIBS $DBUS_LIBS"
424 AC_CHECK_FUNCS(dbus_watch_get_unix_fd)
425 CFLAGS="$save_CFLAGS"
430 AM_CONDITIONAL([HAVE_DBUS], [test "x$HAVE_DBUS" = x1])
431 AS_IF([test "x$HAVE_DBUS" = "x1"], AC_DEFINE([HAVE_DBUS], 1, [Have D-Bus.]))
433 PA_MACHINE_ID="${sysconfdir}/machine-id"
434 AX_DEFINE_DIR(PA_MACHINE_ID, PA_MACHINE_ID, [D-Bus machine-id file])
435 PA_MACHINE_ID_FALLBACK="${localstatedir}/lib/dbus/machine-id"
436 AX_DEFINE_DIR(PA_MACHINE_ID_FALLBACK, PA_MACHINE_ID_FALLBACK,
437 [Fallback machine-id file])
439 #### vconf helper support (optional) ####
440 PKG_CHECK_MODULES(GLIB2, glib-2.0)
441 AC_SUBST(GLIB2_CFLAGS)
444 AC_ARG_ENABLE(vconf-helper, AC_HELP_STRING([--enable-vconf-helper], [using vconf-helper]),
446 case "${enableval}" in
447 yes) ENABLE_VCONF_HELPER=yes ;;
448 no) ENABLE_VCONF_HELPER=no ;;
449 *) AC_MSG_ERROR(bad value ${enableval} for --enable-vconf-helper) ;;
451 ],[ENABLE_VCONF_HELPER=no])
452 AM_CONDITIONAL(ENABLE_VCONF_HELPER, test "x$ENABLE_VCONF_HELPER" = "xyes")
454 ###################################
456 ###################################
458 AC_DEFINE_UNQUOTED(PA_CFLAGS, "$CFLAGS", [The CFLAGS used during compilation])