Make it more clear that PulseAudio needs libtool 2.2.
[profile/ivi/pulseaudio.git] / configure.ac
1 # -*- Autoconf -*-
2 # Process this file with autoconf to produce a configure script.
3
4 # This file is part of PulseAudio.
5 #
6 # Copyright 2004-2008 Lennart Poettering
7 # Copyright 2006-2007 Pierre Ossman <ossman@cendio.se> for Cendio AB
8 #
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.
13 #
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.
18 #
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.
22
23 AC_PREREQ(2.63)
24
25 AC_INIT([pulseaudio], m4_esyscmd([./git-version-gen .tarball-version]),
26         [mzchyfrnhqvb (at) 0pointer (dot) net])
27 AC_CONFIG_SRCDIR([src/daemon/main.c])
28 AC_CONFIG_MACRO_DIR([m4])
29 AC_CONFIG_HEADERS([config.h])
30 AM_INIT_AUTOMAKE([foreign 1.11 -Wall -Wno-portability silent-rules tar-pax])
31
32 m4_define(pa_major, `echo $VERSION | cut -d. -f1 | cut -d- -f1`)
33 m4_define(pa_minor, `echo $VERSION | cut -d. -f2 | cut -d- -f1`)
34 m4_define(pa_micro, `echo $VERSION | cut -d. -f3 | cut -d- -f1`)
35
36 AC_SUBST(PA_MAJOR, pa_major)
37 AC_SUBST(PA_MINOR, pa_minor)
38 AC_SUBST(PA_MICRO, pa_micro)
39 AC_SUBST(PA_MAJORMINOR, pa_major.pa_minor)
40 AC_SUBST(PA_MAJORMINORMICRO, pa_major.pa_minor.pa_micro)
41 AC_SUBST(PACKAGE_URL, [http://pulseaudio.org/])
42
43 AC_SUBST(PA_API_VERSION, 12)
44 AC_SUBST(PA_PROTOCOL_VERSION, 16)
45
46 # The stable ABI for client applications, for the version info x:y:z
47 # always will hold y=z
48 AC_SUBST(LIBPULSE_VERSION_INFO, [8:0:8])
49
50 # A simplified, synchronous, ABI-stable interface for client
51 # applications, for the version info x:y:z always will hold y=z
52 AC_SUBST(LIBPULSE_SIMPLE_VERSION_INFO, [0:2:0])
53
54 # The ABI-stable network browsing interface for client applications,
55 # for the version info x:y:z always will hold y=z
56 AC_SUBST(LIBPULSE_BROWSE_VERSION_INFO, [1:1:1])
57
58 # The ABI-stable GLib adapter for client applications, for the version
59 # info x:y:z always will hold y=z
60 AC_SUBST(LIBPULSE_MAINLOOP_GLIB_VERSION_INFO, [0:4:0])
61
62 AC_CANONICAL_HOST
63 AC_DEFINE_UNQUOTED([CANONICAL_HOST], "$host", [Canonical host string.])
64
65 if type -p stow > /dev/null && test -d /usr/local/stow ; then
66    AC_MSG_NOTICE([*** Found /usr/local/stow: default install prefix set to /usr/local/stow/${PACKAGE_NAME}-${PACKAGE_VERSION} ***])
67    ac_default_prefix="/usr/local/stow/${PACKAGE_NAME}-${PACKAGE_VERSION}"
68 fi
69
70 #### Platform hacks ####
71
72 case $host in
73    *-*-solaris* )
74       AC_DEFINE(_XOPEN_SOURCE,        600, Needed to get declarations for msg_control and msg_controllen on Solaris)
75       AC_DEFINE(__EXTENSIONS__,         1, Needed to get declarations for msg_control and msg_controllen on Solaris)
76       ;;
77 esac
78
79 AM_SILENT_RULES([yes])
80
81 #### Checks for programs. ####
82
83 # mkdir -p
84
85 AC_PROG_MKDIR_P
86
87 # CC
88
89 AC_PROG_CC
90 AC_PROG_CC_C99
91 AM_PROG_CC_C_O
92 AC_PROG_GCC_TRADITIONAL
93 AC_USE_SYSTEM_EXTENSIONS
94
95 # M4
96
97 AC_CHECK_PROGS([M4], gm4 m4, no)
98 if test "x$M4" = xno ; then
99    AC_MSG_ERROR([m4 missing])
100 fi
101
102 dnl Compiler flags
103 DESIRED_FLAGS="-Wall -W -Wextra -pipe -Wno-long-long -Winline -Wvla -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=2 -Wwrite-strings -Wno-unused-parameter -ffast-math -Wp,-D_FORTIFY_SOURCE=2 -fno-common -fdiagnostics-show-option"
104
105 for flag in $DESIRED_FLAGS ; do
106   CC_CHECK_CFLAGS([$flag], [CFLAGS="$CFLAGS $flag"])
107 done
108
109 dnl Linker flags.
110 dnl Check whether the linker supports the -version-script option.
111
112 dnl This variable is used to make sure ${srcdir} is expanded and not
113 dnl passed to the CC_CHECK_LDFLAGS macro as a name.
114 tmp_ldflag="-Wl,-version-script=${srcdir}/src/map-file"
115
116 CC_CHECK_LDFLAGS([${tmp_ldflag}],
117     [VERSIONING_LDFLAGS='-Wl,-version-script=$(srcdir)/map-file'])
118 AC_SUBST([VERSIONING_LDFLAGS])
119
120 dnl Check whether to build tests by default (as compile-test) or not
121 AC_ARG_ENABLE([default-build-tests],
122     AS_HELP_STRING([--disable-default-build-tests], [Build test programs only during make check]))
123
124 AM_CONDITIONAL([BUILD_TESTS_DEFAULT], [test "x$enable_default_build_tests" != "xno"])
125
126 # Native atomic operation support
127 AC_ARG_ENABLE([atomic-arm-linux-helpers],
128     AS_HELP_STRING([--disable-atomic-arm-linux-helpers],[use inline asm or libatomic_ops instead]),
129         [
130             case "${enableval}" in
131                 yes) atomic_arm_linux_helpers=yes ;;
132                 no) atomic_arm_linux_helpers=no ;;
133                 *) AC_MSG_ERROR(bad value ${enableval} for --disable-atomic-arm-linux-helpers) ;;
134             esac
135         ],
136         [atomic_arm_linux_helpers=auto])
137
138 AC_ARG_ENABLE([atomic-arm-memory-barrier],
139     AS_HELP_STRING([--enable-atomic-arm-memory-barrier],[only really needed in SMP arm systems]),
140         [
141             case "${enableval}" in
142                 yes) AC_DEFINE_UNQUOTED(ATOMIC_ARM_MEMORY_BARRIER_ENABLED, 1, [Enable memory barriers]) ;;
143                 no) ;;
144                 *) AC_MSG_ERROR(bad value ${enableval} for --disable-atomic-arm-linux-helpers) ;;
145             esac
146         ],)
147
148 AC_ARG_ENABLE([netbsd-atomic-ops],
149     AS_HELP_STRING([--enable-netbsd-atomic-ops],[Use the native NetBSD atomic_ops implementation]),
150         [
151             case "${enableval}" in
152                 yes) atomic_netbsd_helpers=yes ;;
153                 no) atomic_netbsd_helpers=no ;;
154                 *) AC_MSG_ERROR(bad value ${enableval} for --enable-netbsd-atomic-ops) ;;
155             esac
156         ],
157         [atomic_netbsd_helpers=auto])
158
159 AC_MSG_CHECKING([target operating system])
160 case $host in
161         *-*-linux*)
162             AC_MSG_RESULT([linux])
163             pulse_target_os=linux
164         ;;
165         *-*-netbsd*)
166             AC_MSG_RESULT([netbsd])
167             pulse_target_os=netbsd
168         ;;
169         *)
170             AC_MSG_RESULT([unknown])
171             pulse_target_os=unknown
172         ;;
173 esac
174
175 # If everything else fails use libatomic_ops
176 need_libatomic_ops=yes
177
178 AC_CACHE_CHECK([whether $CC knows __sync_bool_compare_and_swap()],
179   pulseaudio_cv_sync_bool_compare_and_swap,
180   [AC_LINK_IFELSE(
181      AC_LANG_PROGRAM([], [[int a = 4; __sync_bool_compare_and_swap(&a, 4, 5);]]),
182      [pulseaudio_cv_sync_bool_compare_and_swap=yes],
183      [pulseaudio_cv_sync_bool_compare_and_swap=no])
184   ])
185
186 if test "$pulseaudio_cv_sync_bool_compare_and_swap" = "yes" ; then
187     AC_DEFINE([HAVE_ATOMIC_BUILTINS], 1, [Have __sync_bool_compare_and_swap() and friends.])
188     need_libatomic_ops=no
189 else
190     # HW specific atomic ops stuff
191     AC_MSG_CHECKING([architecture for native atomic operations])
192     case $host_cpu in
193         arm*)
194             AC_MSG_RESULT([arm])
195             AC_MSG_CHECKING([whether we can use Linux kernel helpers])
196             # The Linux kernel helper functions have been there since 2.6.16. However
197             # compile time checking for kernel version in cross compile environment
198             # (which is usually the case for arm cpu) is tricky (or impossible).
199             if test "x$pulse_target_os" = "xlinux" && test "x$atomic_arm_linux_helpers" != "xno"; then
200                 AC_MSG_RESULT([yes])
201                 AC_DEFINE_UNQUOTED(ATOMIC_ARM_LINUX_HELPERS, 1, [special arm linux implementation])
202                 need_libatomic_ops=no
203             else
204                AC_MSG_RESULT([no])
205                AC_CACHE_CHECK([compiler support for arm inline asm atomic operations],
206                  pulseaudio_cv_support_arm_atomic_ops,
207                  [AC_COMPILE_IFELSE(
208                     AC_LANG_PROGRAM([],
209                       [[volatile int a=0;
210                         int o=0, n=1, r;
211                         asm volatile ("ldrex    %0, [%1]\n"
212                                          "subs  %0, %0, %2\n"
213                                          "strexeq %0, %3, [%1]\n"
214                                          : "=&r" (r)
215                                          : "r" (&a), "Ir" (o), "r" (n)
216                                          : "cc");
217                         return (a==1 ? 0 : -1);
218                       ]]),
219                     [pulseaudio_cv_support_arm_atomic_ops=yes],
220                     [pulseaudio_cv_support_arm_atomic_ops=no])
221                  ])
222                AS_IF([test "$pulseaudio_cv_support_arm_atomic_ops" = "yes"], [
223                    AC_DEFINE([ATOMIC_ARM_INLINE_ASM], 1, [Have ARMv6 instructions.])
224                    need_libatomic_ops=no
225                  ])
226            fi
227         ;;
228         *)
229             if test "x$pulse_target_os" = "xnetbsd" && test "x$atomic_netbsd_helpers" = "xyes"; then
230                 AC_MSG_RESULT([yes])
231                 AC_DEFINE_UNQUOTED(NETBSD_ATOMIC_OPS, 1, [netbsd implementation])
232                 need_libatomic_ops=no
233             else
234                 AC_MSG_RESULT([unknown])
235             fi
236         ;;
237     esac
238 fi
239
240 CC_CHECK_TLS
241
242 AC_CACHE_CHECK([whether $CC knows _Bool],
243   pulseaudio_cv__Bool,
244   [AC_COMPILE_IFELSE(
245      AC_LANG_PROGRAM([], [[_Bool b;]]),
246      [pulseaudio_cv__Bool=yes],
247      [pulseaudio_cv__Bool=no])
248   ])
249
250 AS_IF([test "$pulseaudio_cv__Bool" = "yes"], [
251     AC_DEFINE([HAVE_STD_BOOL], 1, [Have _Bool.])
252   ])
253
254 #### libtool stuff ####
255 LT_PREREQ(2.2)
256 LT_INIT([dlopen win32-dll disable-static])
257
258 dnl Unfortunately, even up to libtool 2.2.6a there is no way to know
259 dnl exactly which version of libltdl is present in the system, so we
260 dnl just assume that it's a working version as long as we have the
261 dnl library and the header files.
262 dnl
263 dnl As an extra safety device, check for lt_dladvise_init() which is
264 dnl only implemented in libtool 2.x, and refine as we go if we have
265 dnl refined requirements.
266 dnl
267 dnl Check the header files first since the system may have a
268 dnl libltdl.so for runtime, but no headers, and we want to bail out as
269 dnl soon as possible.
270 dnl
271 dnl We don't need any special variable for this though, since the user
272 dnl can give the proper place to find libltdl through the standard
273 dnl variables like LDFLAGS and CPPFLAGS.
274
275 AC_CHECK_HEADER([ltdl.h],
276     [AC_CHECK_LIB([ltdl], [lt_dladvise_init], [LIBLTDL=-lltdl], [LIBLTDL=])],
277     [LIBLTDL=])
278
279 AS_IF([test "x$LIBLTDL" = "x"],
280     [AC_MSG_ERROR([Unable to find libltdl version 2. Makes sure you have libtool 2.2 or later installed.])])
281 AC_SUBST([LIBLTDL])
282
283 #### Determine build environment ####
284
285 os_is_win32=0
286
287 case "$host_os" in
288         mingw*)
289         AC_DEFINE([OS_IS_WIN32], 1, [Build target is Windows.])
290         os_is_win32=1
291                 ;;
292         esac
293
294 AM_CONDITIONAL(OS_IS_WIN32, test "x$os_is_win32" = "x1")
295
296 ###################################
297 #   Basic environment checks      #
298 ###################################
299
300 #### Checks for header files. ####
301
302 # ISO
303 AC_HEADER_STDC
304
305 # POSIX
306 AC_CHECK_HEADERS_ONCE([arpa/inet.h glob.h grp.h netdb.h netinet/in.h \
307     netinet/in_systm.h netinet/tcp.h poll.h pwd.h sched.h \
308     sys/mman.h sys/resource.h sys/select.h sys/socket.h sys/wait.h \
309     sys/uio.h syslog.h sys/dl.h dlfcn.h linux/sockios.h])
310 AC_CHECK_HEADERS([netinet/ip.h], [], [],
311                  [#include <sys/types.h>
312                   #if HAVE_NETINET_IN_H
313                   # include <netinet/in.h>
314                   #endif
315                   #if HAVE_NETINET_IN_SYSTM_H
316                   # include <netinet/in_systm.h>
317                   #endif
318                  ])
319 AC_CHECK_HEADERS([regex.h], [HAVE_REGEX=1], [HAVE_REGEX=0])
320 AC_CHECK_HEADERS([sys/un.h], [HAVE_AF_UNIX=1], [HAVE_AF_UNIX=0])
321
322 AM_CONDITIONAL(HAVE_REGEX, test "x$HAVE_REGEX" = "x1")
323 AM_CONDITIONAL(HAVE_AF_UNIX, test "x$HAVE_AF_UNIX" = "x1")
324
325 # Linux
326 AC_CHECK_HEADERS([linux/input.h], [HAVE_EVDEV=1], [HAVE_EVDEV=0])
327
328 AM_CONDITIONAL([HAVE_EVDEV], [test "x$HAVE_EVDEV" = "x1"])
329
330 AC_CHECK_HEADERS_ONCE([sys/prctl.h])
331
332 # Solaris
333 AC_CHECK_HEADERS_ONCE([sys/filio.h])
334
335 # Windows
336 AC_CHECK_HEADERS_ONCE([windows.h winsock2.h ws2tcpip.h])
337
338 # NetBSD
339 AC_CHECK_HEADERS_ONCE([sys/atomic.h])
340
341 # Other
342 AC_CHECK_HEADERS_ONCE([sys/ioctl.h])
343 AC_CHECK_HEADERS_ONCE([byteswap.h])
344 AC_CHECK_HEADERS_ONCE([sys/syscall.h])
345 AC_CHECK_HEADERS_ONCE([sys/eventfd.h])
346 AC_CHECK_HEADERS_ONCE([execinfo.h])
347
348 #### Typdefs, structures, etc. ####
349
350 AC_C_CONST
351 AC_C_BIGENDIAN
352 AC_TYPE_PID_T
353 AC_TYPE_SIZE_T
354 AC_CHECK_TYPES(ssize_t, , [AC_DEFINE([ssize_t], [signed long],
355     [Define ssize_t if it is not done by the standard libs.])])
356 AC_TYPE_OFF_T
357
358 AC_TYPE_UID_T
359 AC_CHECK_DECLS(environ)
360
361 AC_CHECK_DEFINE([SIGXCPU], [signal.h], [
362 HAVE_SIGXCPU=1
363 AC_DEFINE([HAVE_SIGXCPU], 1, [Have SIGXCPU?])
364 ], [HAVE_SIGXCPU=0])
365 AM_CONDITIONAL(HAVE_SIGXCPU, test "x$HAVE_SIGXCPU" = "x1")
366
367 # Solaris lacks this
368 AC_CHECK_DEFINE([INADDR_NONE], [netinet/in.h], [],
369     [AC_CHECK_DEFINE([INADDR_NONE], [winsock2.h], [],
370         [AC_DEFINE([INADDR_NONE],  [0xffffffff], [Define INADDR_NONE if not found in <netinet/in.h>])])])
371
372 #### POSIX threads ####
373
374 ACX_PTHREAD
375
376 #### Check for libs ####
377
378 # ISO
379 AC_SEARCH_LIBS([pow], [m])
380
381 # POSIX
382 AC_SEARCH_LIBS([sched_setscheduler], [rt])
383 AC_SEARCH_LIBS([dlopen], [dl])
384 AC_SEARCH_LIBS([shm_open], [rt])
385 AC_SEARCH_LIBS([inet_ntop], [nsl])
386 AC_SEARCH_LIBS([timer_create], [rt])
387
388 # BSD
389 AC_SEARCH_LIBS([connect], [socket])
390
391 # Non-standard
392
393 # This magic is needed so we do not needlessly add static libs to the win32
394 # build, disabling its ability to make dlls.
395 AC_CHECK_FUNCS([getopt_long], [], [AC_CHECK_LIB([iberty], [getopt_long])])
396
397 #### Check for functions ####
398
399 # ISO
400 AC_CHECK_FUNCS_ONCE([lrintf strtof])
401
402 # POSIX
403 AC_FUNC_FORK
404 AC_FUNC_GETGROUPS
405 AC_FUNC_SELECT_ARGTYPES
406 AC_CHECK_FUNCS_ONCE([chmod chown clock_gettime getaddrinfo getgrgid_r getgrnam_r \
407     getpwnam_r getpwuid_r gettimeofday getuid inet_ntop inet_pton mlock nanosleep \
408     pipe posix_fadvise posix_madvise posix_memalign setpgid setsid shm_open \
409     sigaction sleep sysconf pthread_setaffinity_np])
410 AC_CHECK_FUNCS([mkfifo], [HAVE_MKFIFO=1], [HAVE_MKFIFO=0])
411
412 AM_CONDITIONAL(HAVE_MKFIFO, test "x$HAVE_MKFIFO" = "x1")
413
414 # X/OPEN
415 AC_CHECK_FUNCS_ONCE([readlink])
416
417 # SUSv2
418 AC_CHECK_FUNCS_ONCE([ctime_r usleep])
419
420 # SUSv3
421 AC_CHECK_FUNCS_ONCE([strerror_r])
422
423 # BSD
424 AC_CHECK_FUNCS_ONCE([lstat])
425
426 # Non-standard
427
428 AC_CHECK_FUNCS_ONCE([setresuid setresgid setreuid setregid seteuid setegid ppoll strsignal sig2str strtof_l])
429
430 AC_FUNC_ALLOCA
431
432 AC_CACHE_CHECK([for PTHREAD_PRIO_INHERIT],
433   pulseaudio_cv_PTHREAD_PRIO_INHERIT,
434   [save_CC=$CC; CC=$PTHREAD_CC
435    save_CFLAGS=$CFLAGS; CFLAGS=$PTHREAD_CFLAGS
436    save_LIBS=$LIBS; LIBS=$PTHREAD_LIBS
437    AC_LINK_IFELSE(
438      AC_LANG_PROGRAM(
439        [[
440          #include <pthread.h>
441        ]],
442        [[int i = PTHREAD_PRIO_INHERIT;]]),
443      [pulseaudio_cv_PTHREAD_PRIO_INHERIT=yes],
444      [pulseaudio_cv_PTHREAD_PRIO_INHERIT=no])
445    CC=$save_CC
446    CFLAGS=$save_CFLAGS
447    LIBS=$save_LIBS
448   ])
449
450 AS_IF([test "$pulseaudio_cv_PTHREAD_PRIO_INHERIT" = "yes"], [
451     AC_DEFINE([HAVE_PTHREAD_PRIO_INHERIT], 1, [Have PTHREAD_PRIO_INHERIT.])
452   ])
453
454 AC_DEFINE_UNQUOTED(PA_CFLAGS,"$CFLAGS", [The CFLAGS used during compilation])
455
456 #### Large File-Support (LFS) ####
457
458 AC_SYS_LARGEFILE
459
460 # Check for open64 to know if the current system does have open64() and similar functions
461 AC_CHECK_FUNCS_ONCE([open64])
462
463 #### [lib]iconv ####
464
465 AM_ICONV
466
467 IT_PROG_INTLTOOL([0.35.0])
468 GETTEXT_PACKAGE=pulseaudio
469 AC_SUBST([GETTEXT_PACKAGE])
470 AC_DEFINE_UNQUOTED([GETTEXT_PACKAGE],["$GETTEXT_PACKAGE"],[Gettext package])
471 AM_GLIB_GNU_GETTEXT
472
473 pulselocaledir='${prefix}/${DATADIRNAME}/locale'
474 AC_SUBST(pulselocaledir)
475
476 ###################################
477 #      External libraries         #
478 ###################################
479
480 #### pkg-config ####
481
482 PKG_PROG_PKG_CONFIG
483
484 #### X11 (optional) ####
485
486 AC_ARG_ENABLE([x11],
487     AS_HELP_STRING([--disable-x11],[Disable optional X11 support]),
488         [
489             case "${enableval}" in
490                 yes) x11=yes ;;
491                 no) x11=no ;;
492                 *) AC_MSG_ERROR(bad value ${enableval} for --disable-x11) ;;
493             esac
494         ],
495         [x11=auto])
496
497 if test "x${x11}" != xno ; then
498     PKG_CHECK_MODULES(X11, [ x11 ice sm xtst ],
499         HAVE_X11=1,
500         [
501             HAVE_X11=0
502             if test "x$x11" = xyes ; then
503                 AC_MSG_ERROR([*** X11 not found])
504             fi
505         ])
506 else
507     HAVE_X11=0
508 fi
509
510 if test "x${HAVE_X11}" = x1 ; then
511    AC_DEFINE([HAVE_X11], 1, [Have X11?])
512 fi
513
514 AC_SUBST(X11_CFLAGS)
515 AC_SUBST(X11_LIBS)
516 AC_SUBST(HAVE_X11)
517 AM_CONDITIONAL([HAVE_X11], [test "x$HAVE_X11" = x1])
518
519 #### Capabilities (optional) ####
520
521 CAP_LIBS=''
522
523 AC_ARG_WITH(
524         [caps],
525         AS_HELP_STRING([--without-caps],[Omit support for POSIX capabilities.]))
526
527 if test "x${with_caps}" != "xno"; then
528     AC_SEARCH_LIBS([cap_init], [cap], [], [
529                     if test "x${with_caps}" = "xyes" ; then
530                         AC_MSG_ERROR([*** POSIX caps libraries not found])
531                     fi])
532     AC_CHECK_HEADERS([sys/capability.h], [], [
533                     if test "x${with_caps}" = "xyes" ; then
534                         AC_MSG_ERROR([*** POSIX caps headers not found])
535                     fi])
536 fi
537
538 #### Valgrind (optional) ####
539
540 AC_CHECK_HEADERS_ONCE([valgrind/memcheck.h])
541
542 #### Sound file ####
543
544 PKG_CHECK_MODULES(LIBSNDFILE, [ sndfile >= 1.0.20 ])
545 AC_SUBST(LIBSNDFILE_CFLAGS)
546 AC_SUBST(LIBSNDFILE_LIBS)
547
548 PKG_CHECK_MODULES(LIBSPEEX, [ speexdsp >= 1.2 ])
549 AC_SUBST(LIBSPEEX_CFLAGS)
550 AC_SUBST(LIBSPEEX_LIBS)
551
552 #### atomic-ops ###
553
554 AC_MSG_CHECKING([whether we need libatomic_ops])
555 if test "x$need_libatomic_ops" = "xyes"; then
556    AC_MSG_RESULT([yes])
557    AC_CHECK_HEADERS([atomic_ops.h], [], [
558    AC_MSG_ERROR([*** libatomic-ops headers not found])
559    ])
560
561    # Win32 does not need the lib and breaks horribly if we try to include it
562    if test "x$os_is_win32" != "x1" ; then
563        LIBS="$LIBS -latomic_ops"
564    fi
565 else
566    AC_MSG_RESULT([no])
567 fi
568
569 #### Libsamplerate support (optional) ####
570
571 AC_ARG_ENABLE([samplerate],
572     AS_HELP_STRING([--disable-samplerate],[Disable optional libsamplerate support]),
573         [
574             case "${enableval}" in
575                 yes) samplerate=yes ;;
576                 no) samplerate=no ;;
577                 *) AC_MSG_ERROR(bad value ${enableval} for --disable-samplerate) ;;
578             esac
579         ],
580         [samplerate=auto])
581
582 if test "x${samplerate}" != xno ; then
583     PKG_CHECK_MODULES(LIBSAMPLERATE, [ samplerate >= 0.1.0 ],
584         HAVE_LIBSAMPLERATE=1,
585         [
586             HAVE_LIBSAMPLERATE=0
587             if test "x$samplerate" = xyes ; then
588                 AC_MSG_ERROR([*** Libsamplerate not found])
589             fi
590         ])
591 else
592     HAVE_LIBSAMPLERATE=0
593 fi
594
595 if test "x${HAVE_LIBSAMPLERATE}" = x1 ; then
596    AC_DEFINE([HAVE_LIBSAMPLERATE], 1, [Have libsamplerate?])
597 fi
598
599 AC_SUBST(LIBSAMPLERATE_CFLAGS)
600 AC_SUBST(LIBSAMPLERATE_LIBS)
601 AC_SUBST(HAVE_LIBSAMPLERATE)
602 AM_CONDITIONAL([HAVE_LIBSAMPLERATE], [test "x$HAVE_LIBSAMPLERATE" = x1])
603
604 #### Database support ####
605
606 HAVE_TDB=0
607 HAVE_GDBM=0
608
609 AC_ARG_WITH(
610         [database],
611         AS_HELP_STRING([--with-database=auto|tdb|gdbm],[Choose database backend.]),[],[with_database=auto])
612
613 if test "x${with_database}" = "xauto" -o "x${with_database}" = "xtdb" ; then
614     PKG_CHECK_MODULES(TDB, [ tdb ],
615         [
616             HAVE_TDB=1
617             with_database=tdb
618         ], [
619             if test "x${with_database}" = "xtdb" ; then
620                 AC_MSG_ERROR([*** tdb not found])
621             fi
622         ])
623 fi
624
625 if test "x${with_database}" = "xauto" -o "x${with_database}" = "xgdbm" ; then
626    have_gdbm=yes
627
628    AC_CHECK_LIB(gdbm, gdbm_open, [], [have_gdbm=no])
629    AC_CHECK_HEADERS(gdbm.h, [], [have_gdbm=no])
630
631    if test "x${have_gdbm}" = "xyes" ; then
632        HAVE_GDBM=1
633        GDBM_CFLAGS=
634        GDBM_LIBS=-lgdbm
635        with_database=gdbm
636    elif test "x${with_database}" = "xgdbm"; then
637        AC_MSG_ERROR([*** gdbm not found])
638    fi
639 fi
640
641 if test "x${HAVE_TDB}" != x1 -a "x${HAVE_GDBM}" != x1; then
642    AC_MSG_ERROR([*** missing database backend])
643 fi
644
645 if test "x${HAVE_TDB}" = x1 ; then
646    AC_DEFINE([HAVE_TDB], 1, [Have tdb?])
647 fi
648
649 if test "x${HAVE_GDBM}" = x1 ; then
650    AC_DEFINE([HAVE_GDBM], 1, [Have gdbm?])
651 fi
652
653 AC_SUBST(TDB_CFLAGS)
654 AC_SUBST(TDB_LIBS)
655 AC_SUBST(HAVE_TDB)
656 AM_CONDITIONAL([HAVE_TDB], [test "x$HAVE_TDB" = x1])
657
658 AC_SUBST(GDBM_CFLAGS)
659 AC_SUBST(GDBM_LIBS)
660 AC_SUBST(HAVE_GDBM)
661 AM_CONDITIONAL([HAVE_GDBM], [test "x$HAVE_GDBM" = x1])
662
663 #### OSS support (optional) ####
664
665 AC_ARG_ENABLE([oss],
666     AS_HELP_STRING([--disable-oss],[Disable optional OSS support]),
667         [
668             case "${enableval}" in
669                 yes) oss=yes ;;
670                 no) oss=no ;;
671                 *) AC_MSG_ERROR(bad value ${enableval} for --disable-oss) ;;
672             esac
673         ],
674         [oss=auto])
675
676 if test "x${oss}" != xno ; then
677     AC_CHECK_HEADERS([sys/soundcard.h],
678         [
679             HAVE_OSS=1
680             AC_DEFINE([HAVE_OSS], 1, [Have OSS?])
681         ],
682         [
683             HAVE_OSS=0
684             if test "x$oss" = xyes ; then
685                 AC_MSG_ERROR([*** OSS support not found])
686             fi
687         ])
688 else
689     HAVE_OSS=0
690 fi
691
692 AC_SUBST(HAVE_OSS)
693 AM_CONDITIONAL([HAVE_OSS], [test "x$HAVE_OSS" = x1])
694
695
696 #### ALSA support (optional) ####
697
698 AC_ARG_ENABLE([alsa],
699     AS_HELP_STRING([--disable-alsa],[Disable optional ALSA support]),
700         [
701             case "${enableval}" in
702                 yes) alsa=yes ;;
703                 no) alsa=no ;;
704                 *) AC_MSG_ERROR(bad value ${enableval} for --disable-alsa) ;;
705             esac
706         ],
707         [alsa=auto])
708
709 if test "x${alsa}" != xno ; then
710     PKG_CHECK_MODULES(ASOUNDLIB, [ alsa >= 1.0.19 ],
711         [
712             HAVE_ALSA=1
713             AC_DEFINE([HAVE_ALSA], 1, [Have ALSA?])
714         ],
715         [
716             HAVE_ALSA=0
717             if test "x$alsa" = xyes ; then
718                 AC_MSG_ERROR([*** Needed alsa >= 1.0.19 support not found])
719             fi
720         ])
721 else
722     HAVE_ALSA=0
723 fi
724
725 AC_SUBST(ASOUNDLIB_CFLAGS)
726 AC_SUBST(ASOUNDLIB_LIBS)
727 AC_SUBST(HAVE_ALSA)
728 AM_CONDITIONAL([HAVE_ALSA], [test "x$HAVE_ALSA" = x1])
729
730 #### Solaris audio support (optional) ####
731
732 AC_ARG_ENABLE([solaris],
733     AS_HELP_STRING([--disable-solaris],[Disable optional Solaris audio support]),
734         [
735             case "${enableval}" in
736                 yes) solaris=yes ;;
737                 no) solaris=no ;;
738                 *) AC_MSG_ERROR(bad value ${enableval} for --disable-solaris) ;;
739             esac
740         ],
741         [solaris=auto])
742
743 if test "x${solaris}" != xno ; then
744     AC_CHECK_HEADERS([sys/audio.h],
745         [
746             HAVE_SOLARIS=1
747             AC_DEFINE([HAVE_SOLARIS], 1, [Have Solaris audio?])
748         ],
749         [
750             HAVE_SOLARIS=0
751             if test "x$solaris" = xyes ; then
752                 AC_MSG_ERROR([*** Solaris audio support not found])
753             fi
754         ])
755 else
756     HAVE_SOLARIS=0
757 fi
758
759 AC_SUBST(HAVE_SOLARIS)
760 AM_CONDITIONAL([HAVE_SOLARIS], [test "x$HAVE_SOLARIS" = x1])
761
762 #### GLib 2 support (optional) ####
763
764 AC_ARG_ENABLE([glib2],
765     AS_HELP_STRING([--disable-glib2],[Disable optional GLib 2 support]),
766         [
767             case "${enableval}" in
768                 yes) glib2=yes ;;
769                 no) glib2=no ;;
770                 *) AC_MSG_ERROR(bad value ${enableval} for --disable-glib2) ;;
771             esac
772         ],
773         [glib2=auto])
774
775 if test "x${glib2}" != xno ; then
776     PKG_CHECK_MODULES(GLIB20, [ glib-2.0 >= 2.4.0 ],
777         HAVE_GLIB20=1,
778         [
779             HAVE_GLIB20=0
780             if test "x$glib2" = xyes ; then
781                 AC_MSG_ERROR([*** GLib 2 support not found])
782             fi
783         ])
784 else
785     HAVE_GLIB20=0
786 fi
787
788 AC_SUBST(GLIB20_CFLAGS)
789 AC_SUBST(GLIB20_LIBS)
790 AC_SUBST(HAVE_GLIB20)
791 AM_CONDITIONAL([HAVE_GLIB20], [test "x$HAVE_GLIB20" = x1])
792
793 if test "x$HAVE_GLIB20" = x1 ; then
794    AC_DEFINE([HAVE_GLIB], 1, [Have GLIB?])
795 fi
796
797 #### GTK2 support (optional) ####
798
799 AC_ARG_ENABLE([gtk2],
800     AS_HELP_STRING([--disable-gtk2],[Disable optional Gtk+ 2 support]),
801         [
802             case "${enableval}" in
803                 yes) gtk2=yes ;;
804                 no) gtk2=no ;;
805                 *) AC_MSG_ERROR(bad value ${enableval} for --disable-gtk2) ;;
806             esac
807         ],
808         [gtk2=auto])
809
810 if test "x${gtk2}" != xno ; then
811     PKG_CHECK_MODULES(GTK20, [ gtk+-2.0 >= 2.4.0 ],
812         HAVE_GTK20=1,
813         [
814             HAVE_GTK20=0
815             if test "x$gtk2" = xyes ; then
816                 AC_MSG_ERROR([*** Gtk+ 2 support not found])
817             fi
818         ])
819 else
820     HAVE_GTK20=0
821 fi
822
823 AC_SUBST(GTK20_CFLAGS)
824 AC_SUBST(GTK20_LIBS)
825 AC_SUBST(HAVE_GTK20)
826 AM_CONDITIONAL([HAVE_GTK20], [test "x$HAVE_GTK20" = x1])
827
828 if test "x$HAVE_GTK20" = x1 ; then
829    AC_DEFINE([HAVE_GTK], 1, [Have GTK?])
830 fi
831
832 #### GConf support (optional) ####
833
834 AC_ARG_ENABLE([gconf],
835     AS_HELP_STRING([--disable-gconf],[Disable optional GConf support]),
836         [
837             case "${enableval}" in
838                 yes) gconf=yes ;;
839                 no) gconf=no ;;
840                 *) AC_MSG_ERROR(bad value ${enableval} for --disable-gconf) ;;
841             esac
842         ],
843         [gconf=auto])
844
845 if test "x${gconf}" != xno ; then
846     PKG_CHECK_MODULES(GCONF, [ gconf-2.0 >= 2.4.0 ],
847         HAVE_GCONF=1,
848         [
849             HAVE_GCONF=0
850             if test "x$gconf" = xyes ; then
851                 AC_MSG_ERROR([*** GConf support not found])
852             fi
853         ])
854 else
855     HAVE_GCONF=0
856 fi
857
858 AC_SUBST(GCONF_CFLAGS)
859 AC_SUBST(GCONF_LIBS)
860 AC_SUBST(HAVE_GCONF)
861 AM_CONDITIONAL([HAVE_GCONF], [test "x$HAVE_GCONF" = x1])
862
863 #### Avahi support (optional) ####
864
865 AC_ARG_ENABLE([avahi],
866     AS_HELP_STRING([--disable-avahi],[Disable optional Avahi support]),
867         [
868             case "${enableval}" in
869                 yes) avahi=yes ;;
870                 no) avahi=no ;;
871                 *) AC_MSG_ERROR(bad value ${enableval} for --disable-avahi) ;;
872             esac
873         ],
874         [avahi=auto])
875
876 if test "x${avahi}" != xno ; then
877     PKG_CHECK_MODULES(AVAHI, [ avahi-client >= 0.6.0 ],
878         HAVE_AVAHI=1,
879         [
880                 HAVE_AVAHI=0
881                 if test "x$avahi" = xyes ; then
882                         AC_MSG_ERROR([*** Avahi support not found])
883                 fi
884         ])
885 else
886     HAVE_AVAHI=0
887 fi
888
889 AC_SUBST(AVAHI_CFLAGS)
890 AC_SUBST(AVAHI_LIBS)
891 AC_SUBST(HAVE_AVAHI)
892 AM_CONDITIONAL([HAVE_AVAHI], [test "x$HAVE_AVAHI" = x1])
893
894 ### LIBOIL ####
895
896 PKG_CHECK_MODULES(LIBOIL, [ liboil-0.3 >= 0.3.0 ])
897 AC_SUBST(LIBOIL_CFLAGS)
898 AC_SUBST(LIBOIL_LIBS)
899
900 ### JACK (optional) ####
901
902 AC_ARG_ENABLE([jack],
903     AS_HELP_STRING([--disable-jack],[Disable optional JACK support]),
904         [
905             case "${enableval}" in
906                 yes) jack=yes ;;
907                 no) jack=no ;;
908                 *) AC_MSG_ERROR(bad value ${enableval} for --disable-jack) ;;
909             esac
910         ],
911         [jack=auto])
912
913 if test "x${jack}" != xno ; then
914     PKG_CHECK_MODULES(JACK, [ jack >= 0.100 ],
915         HAVE_JACK=1,
916         [
917             HAVE_JACK=0
918             if test "x$jack" = xyes ; then
919                 AC_MSG_ERROR([*** JACK support not found])
920             fi
921         ])
922 else
923     HAVE_JACK=0
924 fi
925
926 AC_SUBST(JACK_CFLAGS)
927 AC_SUBST(JACK_LIBS)
928 AC_SUBST(HAVE_JACK)
929 AM_CONDITIONAL([HAVE_JACK], [test "x$HAVE_JACK" = x1])
930
931 #### Async DNS support (optional) ####
932
933 AC_ARG_ENABLE([asyncns],
934     AS_HELP_STRING([--disable-asyncns],[Disable optional Async DNS support]),
935         [
936             case "${enableval}" in
937                 yes) asyncns=yes ;;
938                 no) asyncns=no ;;
939                 *) AC_MSG_ERROR(bad value ${enableval} for --disable-asyncns) ;;
940             esac
941         ],
942         [asyncns=auto])
943
944 if test "x${asyncns}" != xno ; then
945     PKG_CHECK_MODULES(LIBASYNCNS, [ libasyncns >= 0.1 ],
946         HAVE_LIBASYNCNS=1,
947         [
948             HAVE_LIBASYNCNS=0
949             if test "x$asyncns" = xyes ; then
950                 AC_MSG_ERROR([*** Async DNS support not found])
951             fi
952         ])
953 else
954     HAVE_LIBASYNCNS=0
955 fi
956
957 AC_SUBST(LIBASYNCNS_CFLAGS)
958 AC_SUBST(LIBASYNCNS_LIBS)
959 AC_SUBST(HAVE_LIBASYNCNS)
960 AM_CONDITIONAL([HAVE_LIBASYNCNS], [test "x$HAVE_LIBASYNCNS" = x1])
961
962 if test "x$HAVE_LIBASYNCNS" != "x0" ; then
963    AC_DEFINE([HAVE_LIBASYNCNS], 1, [Have libasyncns?])
964 fi
965
966 #### TCP wrappers (optional) ####
967
968 AC_ARG_ENABLE([tcpwrap],
969     AS_HELP_STRING([--disable-tcpwrap],[Disable optional TCP wrappers support]),
970         [
971             case "${enableval}" in
972                 yes) tcpwrap=yes ;;
973                 no) tcpwrap=no ;;
974                 *) AC_MSG_ERROR(bad value ${enableval} for --disable-tcpwrap) ;;
975             esac
976         ],
977         [tcpwrap=auto])
978
979 if test "x${tcpwrap}" != xno ; then
980     ACX_LIBWRAP
981     if test "x${LIBWRAP_LIBS}" = x && test "x$tcpwrap" = xyes ; then
982         AC_MSG_ERROR([*** TCP wrappers support not found])
983     fi
984 else
985     LIBWRAP_LIBS=
986 fi
987
988 AC_SUBST(LIBWRAP_LIBS)
989
990 #### LIRC support (optional) ####
991
992 AC_ARG_ENABLE([lirc],
993     AS_HELP_STRING([--disable-lirc],[Disable optional LIRC support]),
994         [
995             case "${enableval}" in
996                 yes) lirc=yes ;;
997                 no) lirc=no ;;
998                 *) AC_MSG_ERROR(bad value ${enableval} for --disable-lirc) ;;
999             esac
1000         ],
1001         [lirc=auto])
1002
1003 if test "x${lirc}" != xno ; then
1004     ACX_LIRC
1005     if test "x${HAVE_LIRC}" = x0 && test "x$lirc" = xyes ; then
1006         AC_MSG_ERROR([*** LIRC support not found])
1007     fi
1008 else
1009     HAVE_LIRC=0
1010 fi
1011
1012 AC_SUBST(LIRC_CFLAGS)
1013 AC_SUBST(LIRC_LIBS)
1014 AM_CONDITIONAL([HAVE_LIRC], [test "x$HAVE_LIRC" = x1])
1015
1016 #### HAL support (optional) ####
1017
1018 AC_ARG_ENABLE([hal],
1019     AS_HELP_STRING([--disable-hal],[Disable optional HAL support]),
1020         [
1021             case "${enableval}" in
1022                 yes) hal=yes ;;
1023                 no) hal=no ;;
1024                 *) AC_MSG_ERROR(bad value ${enableval} for --disable-hal) ;;
1025             esac
1026         ],
1027         [hal=auto])
1028 if test "x${hal}" != xno -a \( "x$HAVE_OSS" = "x1" -o "x$HAVE_ALSA" = "x1" \) ; then
1029     PKG_CHECK_MODULES(HAL, [ hal >= 0.5.11 ],
1030         [
1031             HAVE_HAL=1
1032             AC_DEFINE([HAVE_HAL], 1, [Have HAL.])
1033         ],
1034         [
1035             HAVE_HAL=0
1036             if test "x$hal" = xyes ; then
1037                 AC_MSG_ERROR([*** HAL support not found])
1038             fi
1039         ])
1040 else
1041     HAVE_HAL=0
1042 fi
1043
1044 AC_SUBST(HAL_CFLAGS)
1045 AC_SUBST(HAL_LIBS)
1046 AC_SUBST(HAVE_HAL)
1047 AM_CONDITIONAL([HAVE_HAL], [test "x$HAVE_HAL" = x1])
1048
1049 #### UDEV support (optional) ####
1050
1051 AC_ARG_ENABLE([udev],
1052     AS_HELP_STRING([--disable-udev],[Disable optional UDEV support]),
1053         [
1054             case "${enableval}" in
1055                 yes) udev=yes ;;
1056                 no) udev=no ;;
1057                 *) AC_MSG_ERROR(bad value ${enableval} for --disable-udev) ;;
1058             esac
1059         ],
1060         [udev=auto])
1061 if test "x${udev}" != xno -a \( "x$HAVE_OSS" = "x1" -o "x$HAVE_ALSA" = "x1" \) ; then
1062     PKG_CHECK_MODULES(UDEV, [ libudev >= 143 ],
1063         [
1064             HAVE_UDEV=1
1065             AC_DEFINE([HAVE_UDEV], 1, [Have UDEV.])
1066         ],
1067         [
1068             HAVE_UDEV=0
1069             if test "x$udev" = xyes ; then
1070                 AC_MSG_ERROR([*** UDEV support not found])
1071             fi
1072         ])
1073 else
1074     HAVE_UDEV=0
1075 fi
1076
1077 AC_SUBST(UDEV_CFLAGS)
1078 AC_SUBST(UDEV_LIBS)
1079 AC_SUBST(HAVE_UDEV)
1080 AM_CONDITIONAL([HAVE_UDEV], [test "x$HAVE_UDEV" = x1])
1081
1082 AC_DEFINE([LIBUDEV_I_KNOW_THE_API_IS_SUBJECT_TO_CHANGE], 1, [I know the API is subject to change.])
1083
1084 #### BlueZ support (optional) ####
1085
1086 AC_ARG_ENABLE([bluez],
1087     AS_HELP_STRING([--disable-bluez],[Disable optional BlueZ support]),
1088         [
1089             case "${enableval}" in
1090                 yes) bluez=yes ;;
1091                 no) bluez=no ;;
1092                 *) AC_MSG_ERROR(bad value ${enableval} for --disable-bluez) ;;
1093             esac
1094         ],
1095         [bluez=auto])
1096 if test "x${bluez}" != xno ; then
1097     PKG_CHECK_MODULES(BLUEZ, [ bluez >= 3.0 ],
1098         HAVE_BLUEZ=1,
1099         [
1100             HAVE_BLUEZ=0
1101             if test "x$bluez" = xyes ; then
1102                 AC_MSG_ERROR([*** BLUEZ support not found])
1103             fi
1104         ])
1105 else
1106     HAVE_BLUEZ=0
1107 fi
1108
1109 AC_SUBST(BLUEZ_CFLAGS)
1110 AC_SUBST(BLUEZ_LIBS)
1111 AC_SUBST(HAVE_BLUEZ)
1112 AM_CONDITIONAL([HAVE_BLUEZ], [test "x$HAVE_BLUEZ" = x1])
1113
1114 #### D-Bus support (optional) ####
1115
1116 AC_ARG_ENABLE([dbus],
1117     AS_HELP_STRING([--disable-dbus],[Disable optional D-Bus support]),
1118         [
1119             case "${enableval}" in
1120                 yes) dbus=yes ;;
1121                 no) dbus=no ;;
1122                 *) AC_MSG_ERROR(bad value ${enableval} for --disable-dbus) ;;
1123             esac
1124         ],
1125         [dbus=auto])
1126
1127 if test "x$HAVE_HAL" = x1 ; then
1128    dbus=yes
1129 fi
1130
1131 if test "x${dbus}" != xno || test "x${bluez}" != xno || test "x${hal}" != xno ; then
1132
1133     PKG_CHECK_MODULES(DBUS, [ dbus-1 >= 1.0.0 ],
1134         [
1135             HAVE_DBUS=1
1136             saved_LIBS="$LIBS"
1137             LIBS="$LIBS $DBUS_LIBS"
1138             AC_CHECK_FUNCS(dbus_watch_get_unix_fd)
1139             LIBS="$saved_LIBS"
1140             AC_DEFINE([HAVE_DBUS], 1, [Have D-Bus.])
1141         ],
1142         [
1143             HAVE_DBUS=0
1144             if test "x$dbus" = xyes ; then
1145                 AC_MSG_ERROR([*** D-Bus support not found])
1146             fi
1147         ])
1148 else
1149     HAVE_DBUS=0
1150 fi
1151
1152 AC_SUBST(DBUS_CFLAGS)
1153 AC_SUBST(DBUS_LIBS)
1154 AC_SUBST(HAVE_DBUS)
1155 AM_CONDITIONAL([HAVE_DBUS], [test "x$HAVE_DBUS" = x1])
1156
1157 ### IPv6 connection support (optional) ###
1158
1159 AC_ARG_ENABLE([ipv6],
1160     AS_HELP_STRING([--disable-ipv6],[Disable optional IPv6 support]),
1161         [
1162             case "${enableval}" in
1163                 yes) ipv6=yes ;;
1164                 no) ipv6=no ;;
1165                 *) AC_MSG_ERROR(bad value ${enableval} for --disable-ipv6) ;;
1166             esac
1167         ],
1168         [ipv6=auto])
1169
1170 if test "x${ipv6}" != xno ; then
1171     AC_DEFINE([HAVE_IPV6], [1], [Define this to enable IPv6 connection support])
1172     HAVE_IPV6=1
1173 else
1174     HAVE_IPV6=0
1175 fi
1176
1177 #### OpenSSL support (optional) ####
1178
1179 AC_ARG_ENABLE([openssl],
1180     AS_HELP_STRING([--disable-openssl],[Disable OpenSSL support (used for Airtunes/RAOP)]),
1181         [
1182             case "${enableval}" in
1183                 yes) openssl=yes ;;
1184                 no) openssl=no ;;
1185                 *) AC_MSG_ERROR(bad value ${enableval} for --disable-openssl) ;;
1186             esac
1187         ],
1188         [openssl=auto])
1189
1190 if test "x${openssl}" != xno ; then
1191
1192     PKG_CHECK_MODULES(OPENSSL, [ openssl > 0.9 ],
1193         [
1194             HAVE_OPENSSL=1
1195             AC_DEFINE([HAVE_OPENSSL], 1, [Have OpenSSL])
1196         ],
1197         [
1198             HAVE_OPENSSL=0
1199             if test "x$openssl" = xyes ; then
1200                 AC_MSG_ERROR([*** OpenSSL support not found])
1201             fi
1202         ])
1203 else
1204     HAVE_OPENSSL=0
1205 fi
1206
1207 AC_SUBST(OPENSSL_CFLAGS)
1208 AC_SUBST(OPENSSL_LIBS)
1209 AC_SUBST(HAVE_OPENSSL)
1210 AM_CONDITIONAL([HAVE_OPENSSL], [test "x$HAVE_OPENSSL" = x1])
1211
1212 ### Build and Install man pages ###
1213 AC_ARG_ENABLE(manpages,
1214         AS_HELP_STRING([--disable-manpages],[Disable building and installation of man pages]),
1215 [case "${enableval}" in
1216   yes) manpages=yes ;;
1217   no)  manpages=no ;;
1218   *) AC_MSG_ERROR([bad value ${enableval} for --disable-manpages]) ;;
1219 esac],[manpages=yes])
1220
1221 AM_CONDITIONAL([BUILD_MANPAGES], [test "x$manpages" = xyes])
1222
1223 #### PulseAudio system group & user  #####
1224
1225 AC_ARG_WITH(system_user, AS_HELP_STRING([--with-system-user=<user>],[User for running the PulseAudio daemon as a system-wide instance (pulse)]))
1226 if test -z "$with_system_user" ; then
1227     PA_SYSTEM_USER=pulse
1228 else
1229     PA_SYSTEM_USER=$with_system_user
1230 fi
1231 AC_SUBST(PA_SYSTEM_USER)
1232 AC_DEFINE_UNQUOTED(PA_SYSTEM_USER,"$PA_SYSTEM_USER", [User for running the PulseAudio system daemon])
1233
1234 AC_ARG_WITH(system_group,AS_HELP_STRING([--with-system-group=<group>],[Group for running the PulseAudio daemon as a system-wide instance (pulse)]))
1235 if test -z "$with_system_group" ; then
1236     PA_SYSTEM_GROUP=pulse
1237 else
1238     PA_SYSTEM_GROUP=$with_system_group
1239 fi
1240 AC_SUBST(PA_SYSTEM_GROUP)
1241 AC_DEFINE_UNQUOTED(PA_SYSTEM_GROUP,"$PA_SYSTEM_GROUP", [Group for the PulseAudio system daemon])
1242
1243 AC_ARG_WITH(access_group,AS_HELP_STRING([--with-access-group=<group>],[Group which is allowed access to a system-wide PulseAudio daemon (pulse-access)]))
1244 if test -z "$with_access_group" ; then
1245     PA_ACCESS_GROUP=pulse-access
1246 else
1247     PA_ACCESS_GROUP=$with_access_group
1248 fi
1249 AC_SUBST(PA_ACCESS_GROUP)
1250 AC_DEFINE_UNQUOTED(PA_ACCESS_GROUP,"$PA_ACCESS_GROUP", [Access group])
1251
1252 AC_ARG_ENABLE(
1253         per_user_esound_socket,
1254         AS_HELP_STRING([--disable-per-user-esound-socket], [Use global esound socket directory /tmp/.esd/socket.]),
1255         [
1256             case "${enableval}" in
1257                 yes) per_user_esound_socket=1 ;;
1258                 no) per_user_esound_socket=0 ;;
1259                 *) AC_MSG_ERROR(bad value ${enableval} for --disable-per-user-esound-socket) ;;
1260             esac
1261         ],
1262         [per_user_esound_socket=1])
1263
1264 if test "x$per_user_esound_socket" = "x1"; then
1265    AC_DEFINE([USE_PER_USER_ESOUND_SOCKET], [1], [Define this if you want per-user esound socket directories])
1266 fi
1267
1268 #### PulseAudio system runtime dir ####
1269 PA_SYSTEM_RUNTIME_PATH="${localstatedir}/run/pulse"
1270 AC_SUBST(PA_SYSTEM_RUNTIME_PATH)
1271 PA_SYSTEM_CONFIG_PATH="${localstatedir}/lib/pulse"
1272 AC_SUBST(PA_SYSTEM_CONFIG_PATH)
1273 PA_SYSTEM_STATE_PATH="${localstatedir}/lib/pulse"
1274 AC_SUBST(PA_SYSTEM_STATE_PATH)
1275
1276 ###################################
1277 #            Output               #
1278 ###################################
1279
1280 AC_ARG_ENABLE([legacy-runtime-dir],
1281         AS_HELP_STRING([--disable-legacy-runtime-dir], [Try to connect on legacy (< 0.9.12) socket paths.]))
1282 if test "x$enable_legacy_runtime_dir" != "xno" ; then
1283         AC_DEFINE(ENABLE_LEGACY_RUNTIME_DIR, [1], [Legacy runtime dir])
1284 fi
1285
1286 AC_ARG_ENABLE(
1287         [static-bins],
1288         AS_HELP_STRING([--enable-static-bins],[Statically link executables.]),
1289         [STATIC_BINS=1], [STATIC_BINS=0])
1290 AM_CONDITIONAL([STATIC_BINS], [test "x$STATIC_BINS" = "x1"])
1291
1292 AC_ARG_WITH(
1293         [preopen-mods],
1294         AS_HELP_STRING([--with-preopen-mods],[Modules to preopen in daemon (default: all).]),
1295         [PREOPEN_MODS=$withval], [PREOPEN_MODS="all"])
1296 AM_CONDITIONAL([PREOPEN_MODS], [test "x$PREOPEN_MODS" != "xall"])
1297 if test "x$PREOPEN_MODS" != "xall" ; then
1298     tmpLIBS=""
1299     for mod in $PREOPEN_MODS; do
1300         tmpLIBS="$tmpLIBS module-$mod.la"
1301     done
1302     PREOPEN_MODS="$tmpLIBS"
1303     AC_SUBST(PREOPEN_MODS)
1304 fi
1305
1306 AC_ARG_WITH(
1307         [module-dir],
1308         AS_HELP_STRING([--with-module-dir],[Directory where to install the modules to (defaults to ${libdir}/pulse-${PA_MAJORMINORMICRO}/modules]),
1309         [modlibexecdir=$withval], [modlibexecdir="${libdir}/pulse-${PA_MAJORMINORMICRO}/modules"])
1310
1311 AC_SUBST(modlibexecdir)
1312
1313 AC_ARG_ENABLE(
1314         [force-preopen],
1315         AS_HELP_STRING([--enable-force-preopen],[Preopen modules, even when dlopen() is supported.]),
1316         [FORCE_PREOPEN=$enableval], [FORCE_PREOPEN=no])
1317 AM_CONDITIONAL([FORCE_PREOPEN], [test "x$FORCE_PREOPEN" = "xyes"])
1318
1319 AC_CONFIG_FILES([
1320 Makefile
1321 src/Makefile
1322 man/Makefile
1323 libpulse.pc
1324 libpulse-simple.pc
1325 libpulse-browse.pc
1326 libpulse-mainloop-glib.pc
1327 doxygen/Makefile
1328 doxygen/doxygen.conf
1329 src/pulse/version.h
1330 po/Makefile.in
1331 ])
1332
1333 AC_OUTPUT
1334
1335 # ==========================================================================
1336 ENABLE_X11=no
1337 if test "x$HAVE_X11" = "x1" ; then
1338    ENABLE_X11=yes
1339 fi
1340
1341 ENABLE_OSS=no
1342 if test "x$HAVE_OSS" = "x1" ; then
1343    ENABLE_OSS=yes
1344 fi
1345
1346 ENABLE_ALSA=no
1347 if test "x$HAVE_ALSA" = "x1" ; then
1348    ENABLE_ALSA=yes
1349 fi
1350
1351 ENABLE_SOLARIS=no
1352 if test "x$HAVE_SOLARIS" = "x1" ; then
1353    ENABLE_SOLARIS=yes
1354 fi
1355
1356 ENABLE_GTK20=no
1357 if test "x$HAVE_GTK20" = "x1" ; then
1358    ENABLE_GTK20=yes
1359 fi
1360
1361 ENABLE_GLIB20=no
1362 if test "x$HAVE_GLIB20" = "x1" ; then
1363    ENABLE_GLIB20=yes
1364 fi
1365
1366 ENABLE_GCONF=no
1367 if test "x$HAVE_GCONF" = "x1" ; then
1368    ENABLE_GCONF=yes
1369 fi
1370
1371 ENABLE_AVAHI=no
1372 if test "x$HAVE_AVAHI" = "x1" ; then
1373    ENABLE_AVAHI=yes
1374 fi
1375
1376 ENABLE_JACK=no
1377 if test "x$HAVE_JACK" = "x1" ; then
1378    ENABLE_JACK=yes
1379 fi
1380
1381 ENABLE_LIBASYNCNS=no
1382 if test "x$HAVE_LIBASYNCNS" = "x1" ; then
1383    ENABLE_LIBASYNCNS=yes
1384 fi
1385
1386 ENABLE_LIRC=no
1387 if test "x$HAVE_LIRC" = "x1" ; then
1388    ENABLE_LIRC=yes
1389 fi
1390
1391 ENABLE_HAL=no
1392 if test "x$HAVE_HAL" = "x1" ; then
1393    ENABLE_HAL=yes
1394 fi
1395
1396 ENABLE_UDEV=no
1397 if test "x$HAVE_UDEV" = "x1" ; then
1398    ENABLE_UDEV=yes
1399 fi
1400
1401 ENABLE_TCPWRAP=no
1402 if test "x${LIBWRAP_LIBS}" != x ; then
1403    ENABLE_TCPWRAP=yes
1404 fi
1405
1406 ENABLE_LIBSAMPLERATE=no
1407 if test "x${HAVE_LIBSAMPLERATE}" = "x1" ; then
1408    ENABLE_LIBSAMPLERATE=yes
1409 fi
1410
1411 ENABLE_BLUEZ=no
1412 if test "x${HAVE_BLUEZ}" = "x1" ; then
1413    ENABLE_BLUEZ=yes
1414 fi
1415
1416 ENABLE_GDBM=no
1417 if test "x${HAVE_GDBM}" = "x1" ; then
1418    ENABLE_GDBM=yes
1419 fi
1420
1421 ENABLE_TDB=no
1422 if test "x${HAVE_TDB}" = "x1" ; then
1423    ENABLE_TDB=yes
1424 fi
1425
1426 ENABLE_OPENSSL=no
1427 if test "x${HAVE_OPENSSL}" = "x1" ; then
1428    ENABLE_OPENSSL=yes
1429 fi
1430
1431 ENABLE_IPV6=no
1432 if test "x${HAVE_IPV6}" = "x1" ; then
1433    ENABLE_IPV6=yes
1434 fi
1435
1436 ENABLE_PER_USER_ESOUND_SOCKET=no
1437 if test "x$per_user_esound_socket" = "x1" ; then
1438    ENABLE_PER_USER_ESOUND_SOCKET=yes
1439 fi
1440
1441 echo "
1442  ---{ $PACKAGE_NAME $VERSION }---
1443
1444     prefix:                        ${prefix}
1445     sysconfdir:                    ${sysconfdir}
1446     localstatedir:                 ${localstatedir}
1447     System Runtime Path:           ${PA_SYSTEM_RUNTIME_PATH}
1448     System State Path:             ${PA_SYSTEM_STATE_PATH}
1449     System Config Path:            ${PA_SYSTEM_CONFIG_PATH}
1450     Compiler:                      ${CC}
1451     CFLAGS:                        ${CFLAGS}
1452
1453     Have X11:                      ${ENABLE_X11}
1454     Enable OSS:                    ${ENABLE_OSS}
1455     Enable Alsa:                   ${ENABLE_ALSA}
1456     Enable Solaris:                ${ENABLE_SOLARIS}
1457     Enable GLib 2.0:               ${ENABLE_GLIB20}
1458     Enable Gtk+ 2.0:               ${ENABLE_GTK20}
1459     Enable GConf:                  ${ENABLE_GCONF}
1460     Enable Avahi:                  ${ENABLE_AVAHI}
1461     Enable Jack:                   ${ENABLE_JACK}
1462     Enable Async DNS:              ${ENABLE_LIBASYNCNS}
1463     Enable LIRC:                   ${ENABLE_LIRC}
1464     Enable HAL:                    ${ENABLE_HAL}
1465     Enable udev:                   ${ENABLE_UDEV}
1466     Enable BlueZ:                  ${ENABLE_BLUEZ}
1467     Enable TCP Wrappers:           ${ENABLE_TCPWRAP}
1468     Enable libsamplerate:          ${ENABLE_LIBSAMPLERATE}
1469     Enable IPv6:                   ${ENABLE_IPV6}
1470     Enable OpenSSL (for Airtunes): ${ENABLE_OPENSSL}
1471     Enable tdb:                    ${ENABLE_TDB}
1472     Enable gdbm:                   ${ENABLE_GDBM}
1473
1474     System User:                   ${PA_SYSTEM_USER}
1475     System Group:                  ${PA_SYSTEM_GROUP}
1476     Access Group:                  ${PA_ACCESS_GROUP}
1477     Enable per-user EsounD socket: ${ENABLE_PER_USER_ESOUND_SOCKET}
1478     Force preopen:                 ${FORCE_PREOPEN}
1479     Preopened modules:             ${PREOPEN_MODS}
1480 "