1 dnl Process this file with autoconf to produce a configure script.
3 AC_INIT(alsa-utils, 1.2.1)
4 AC_CONFIG_SRCDIR([aplay/aplay.c])
5 AC_PREFIX_DEFAULT(/usr)
8 AM_MAINTAINER_MODE([enable])
10 AM_GNU_GETTEXT([external])
11 AM_GNU_GETTEXT_VERSION([0.19.8])
13 dnl Checks for programs.
23 if test "x$enable_alsatest" = "xyes"; then
24 AC_CHECK_FUNC([snd_ctl_elem_add_enumerated],
25 , [AC_ERROR([No user enum control support in alsa-lib])])
29 AC_CHECK_HEADERS([alsa/pcm.h], [have_pcm="yes"], [have_pcm="no"],
30 [#include <alsa/asoundlib.h>])
31 AC_CHECK_HEADERS([alsa/mixer.h], [have_mixer="yes"], [have_mixer="no"],
32 [#include <alsa/asoundlib.h>])
33 AC_CHECK_HEADERS([alsa/rawmidi.h], [have_rawmidi="yes"], [have_rawmidi="no"],
34 [#include <alsa/asoundlib.h>])
35 AC_CHECK_HEADERS([alsa/seq.h], [have_seq="yes"], [have_seq="no"],
36 [#include <alsa/asoundlib.h>])
37 AC_CHECK_HEADERS([alsa/use-case.h], [have_ucm="yes"], [have_ucm="no"],
38 [#include <alsa/asoundlib.h>])
39 AC_CHECK_HEADERS([alsa/topology.h], [have_topology="yes"], [have_topology="no"],
40 [#include <alsa/asoundlib.h>])
41 AC_CHECK_HEADERS([samplerate.h], [have_samplerate="yes"], [have_samplerate="no"],
42 [#include <samplerate.h>])
44 AC_CHECK_LIB([asound], [snd_seq_client_info_get_card], [HAVE_SEQ_CLIENT_INFO_GET_CARD="yes"])
45 if test "$HAVE_SEQ_CLIENT_INFO_GET_CARD" = "yes" ; then
46 AC_DEFINE([HAVE_SEQ_CLIENT_INFO_GET_CARD], 1, [alsa-lib supports snd_seq_client_info_get_card])
48 AC_CHECK_LIB([asound], [snd_seq_client_info_get_pid], [HAVE_SEQ_CLIENT_INFO_GET_PID="yes"])
49 if test "$HAVE_SEQ_CLIENT_INFO_GET_PID" = "yes" ; then
50 AC_DEFINE([HAVE_SEQ_CLIENT_INFO_GET_PID], 1, [alsa-lib supports snd_seq_client_info_get_pid])
54 # NOTE: The library 'libffado' (at least v2.4.1) executes ctor/dtor of instances
55 # for some objects in startup/finish routines of C runtime. As a result, it
56 # outputs some superfluos messages. Furthermore, it brings much memory leak
57 # internally. Totally, libffado support is not recommended at all in usual
58 # purposes except for technical preview.
60 AC_CHECK_LIB([ffado], [ffado_streaming_init], [have_ffado="yes"], [have_ffado="no"])
61 AS_IF([test x"$have_ffado" = xyes],
62 [AC_DEFINE([WITH_FFADO], [1], [Define if FFADO library is available])])
64 AM_CONDITIONAL(HAVE_PCM, test "$have_pcm" = "yes")
65 AM_CONDITIONAL(HAVE_MIXER, test "$have_mixer" = "yes")
66 AM_CONDITIONAL(HAVE_RAWMIDI, test "$have_rawmidi" = "yes")
67 AM_CONDITIONAL(HAVE_SEQ, test "$have_seq" = "yes")
68 AM_CONDITIONAL(HAVE_UCM, test "$have_ucm" = "yes")
69 AM_CONDITIONAL(HAVE_TOPOLOGY, test "$have_topology" = "yes")
70 AM_CONDITIONAL(HAVE_SAMPLERATE, test "$have_samplerate" = "yes")
71 AM_CONDITIONAL(HAVE_FFADO, test "$have_ffado" = "yes")
75 AC_ARG_ENABLE(alsabat_backend_tiny,
76 AS_HELP_STRING([--enable-alsabat-backend-tiny], [Use tinyalsa for alsabat backend]),
77 [case "${enableval}" in
78 yes) alsabat_backend_tiny=true ;;
79 no) alsabat_backend_tiny=false ;;
80 *) AC_MSG_ERROR(bad value ${enableval} for --enable-alsabat-backend-tiny) ;;
81 esac],[alsabat_backend_tiny=false])
85 if test "$have_pcm" = "yes"; then
87 AS_HELP_STRING([--disable-bat], [Disable bat compilation]),
88 [case "${enableval}" in
91 *) AC_MSG_ERROR(bad value ${enableval} for --enable-bat) ;;
94 AM_CONDITIONAL(BAT, test x$bat = xtrue)
96 if test x$bat = xtrue; then
98 saved_CFLAGS="$CFLAGS"
99 saved_LDFLAGS="$LDFLAGS"
104 dnl Check for libfftw3
106 AC_CHECK_LIB([fftw3f], [fftwf_malloc], , [have_libfftw3="no"])
107 dnl Check for libtinyalsa
109 if test x$alsabat_backend_tiny = xtrue; then
110 have_libtinyalsa="yes"
111 AC_CHECK_LIB([tinyalsa], [pcm_open], , [have_libtinyalsa="no"])
113 AC_CHECK_LIB([m], [sqrtf], , [AC_MSG_ERROR([Error: Need sqrtf])])
114 AC_CHECK_LIB([pthread], [pthread_create], , [AC_MSG_ERROR([Error: need PTHREAD library])])
115 FFTW_CFLAGS="$CFLAGS"
117 CFLAGS="$saved_CFLAGS"
118 LDFLAGS="$saved_LDFLAGS"
122 AC_SUBST(FFTW_CFLAGS)
125 AM_CONDITIONAL(HAVE_LIBFFTW3, test "$have_libfftw3" = "yes")
126 AM_CONDITIONAL(HAVE_LIBTINYALSA, test "$have_libtinyalsa" = "yes")
130 AC_MSG_CHECKING(for librt)
132 AS_HELP_STRING([--with-librt], [Use librt for monotonic clock (default = yes)]),
133 [ have_librt="$withval" ], [ have_librt="yes" ])
134 if test "$have_librt" = "yes"; then
135 AC_CHECK_LIB([rt], [clock_gettime], [HAVE_LIBRT="yes"])
136 if test "$HAVE_LIBRT" = "yes" ; then
138 AC_DEFINE([HAVE_LIBRT], 1, [Have librt])
139 AC_DEFINE([HAVE_CLOCK_GETTIME], 1, [Have clock gettime])
145 dnl Disable alsamixer
150 if test "$have_mixer" = "yes"; then
151 AC_ARG_ENABLE(alsamixer,
152 AS_HELP_STRING([--disable-alsamixer], [Disable alsamixer compilation]),
153 [case "${enableval}" in
154 yes) alsamixer=true ;;
155 no) alsamixer=false ;;
156 *) AC_MSG_ERROR(bad value ${enableval} for --enable-alsamixer) ;;
157 esac],[alsamixer=true])
159 AM_CONDITIONAL(ALSAMIXER, test x$alsamixer = xtrue)
162 AC_ARG_ENABLE(alsaconf,
163 AS_HELP_STRING([--disable-alsaconf], [Disable alsaconf packaging]),
164 [case "${enableval}" in
165 yes) alsaconf=true ;;
166 no) alsaconf=false ;;
167 *) AC_MSG_ERROR(bad value ${enableval} for --enable-alsaconf) ;;
168 esac],[alsaconf=true])
169 AM_CONDITIONAL(ALSACONF, test x$alsaconf = xtrue)
172 AC_ARG_ENABLE(alsaloop,
173 AS_HELP_STRING([--disable-alsaloop], [Disable alsaloop packaging]),
174 [case "${enableval}" in
175 yes) alsaloop=true ;;
176 no) alsaloop=false ;;
177 *) AC_MSG_ERROR(bad value ${enableval} for --enable-alsaloop) ;;
178 esac],[alsaloop=true])
179 AM_CONDITIONAL(ALSALOOP, test x$alsaloop = xtrue)
183 AS_HELP_STRING([--disable-xmlto], [Disable man page creation via xmlto]),
184 xmlto="$enableval", xmlto="yes")
185 if test "$xmlto" = "yes"; then
186 AC_CHECK_PROG([xmlto_available], [xmlto], [yes])
188 AM_CONDITIONAL(USE_XMLTO, test x"$xmlto_available" = xyes)
191 AC_ARG_ENABLE(rst2man,
192 AS_HELP_STRING([--disable-rst2man], [Disable man page creation via rst2man]),
193 rst2man="$enableval", rst2man="yes")
194 if test "$rst2man" = "yes"; then
195 AC_CHECK_PROG([rst2man_available], [rst2man], [yes])
197 AM_CONDITIONAL(USE_RST2MAN, test x"$rst2man_available" = xyes)
201 AS_HELP_STRING([--with-udev-rules-dir=DIR],[Directory where to install udev rules to (default=auto)]),
202 [udevrulesdir="$withval"],
203 [udevdir=$($PKG_CONFIG udev --variable=udevdir)
204 if test "x$udevdir" = "x"; then
205 udevrulesdir="/lib/udev/rules.d"
207 udevrulesdir="$udevdir/rules.d"
209 AC_SUBST(udevrulesdir)
211 dnl Checks for header files.
213 if test x$alsamixer = xtrue; then
215 AS_HELP_STRING([--with-curses=libname], [Specify the curses library to use (default=auto)]),
216 curseslib="$withval",
221 if test "$curseslib" = "ncursesw" -o \( "$curseslib" = "auto" -a "$USE_NLS" = "yes" \); then
222 dnl First try out pkg-config, then fall back to old config scripts.
223 PKG_CHECK_MODULES([NCURSESW], [ncursesw], [
224 CURSESINC="<ncurses.h>"
225 CURSESLIB="${NCURSESW_LIBS}"
227 CURSES_CFLAGS="${NCURSESW_CFLAGS}"
230 AC_CHECK_PROG([ncursesw5_config], [ncursesw5-config], [yes])
231 if test "$ncursesw5_config" = "yes"; then
232 CURSESINC="<ncurses.h>"
233 CURSESLIB=`ncursesw5-config --libs`
234 CURSESLIBDIR=`ncursesw5-config --libdir`
235 CURSES_CFLAGS=`ncursesw5-config --cflags`
238 AC_CHECK_LIB(ncursesw, initscr,
239 [ CURSESINC='<ncurses.h>'; CURSESLIB='-lncursesw'; curseslib="ncursesw"])
242 if test -n "$CURSESINC"; then
247 if test "$curseslib" = "ncurses" -o "$curseslib" = "auto"; then
248 dnl First try out pkg-config, then fall back to old config scripts.
249 PKG_CHECK_MODULES([NCURSES], [ncurses], [
250 CURSESINC="<ncurses.h>"
251 CURSESLIB="${NCURSES_LIBS}"
253 CURSES_CFLAGS="${NCURSES_CFLAGS}"
256 AC_CHECK_PROG([ncurses5_config], [ncurses5-config], [yes])
257 if test "$ncurses5_config" = "yes"; then
258 CURSESINC="<ncurses.h>"
259 CURSESLIB=`ncurses5-config --libs`
260 CURSESLIBDIR=`ncurses5-config --libdir`
261 CURSES_CFLAGS=`ncurses5-config --cflags`
264 AC_CHECK_LIB(ncurses, initscr,
265 [ CURSESINC='<ncurses.h>'; CURSESLIB='-lncurses'; curseslib="ncurses"])
269 if test "$curseslib" = "curses" -o "$curseslib" = "auto"; then
270 AC_CHECK_LIB(curses, initscr,
271 [ CURSESINC='<curses.h>'; CURSESLIB='-lcurses'; curseslib="curses"])
273 if test -z "$CURSESINC"; then
274 AC_MSG_ERROR(this packages requires a curses library)
277 AC_MSG_CHECKING([for curses library])
278 AC_MSG_RESULT([$curseslib])
279 AC_MSG_CHECKING([for curses header name])
280 AC_MSG_RESULT([$CURSESINC])
281 AC_MSG_CHECKING([for curses compiler flags])
282 AC_MSG_RESULT([$CURSES_CFLAGS])
284 dnl CURSESLIBS might have the library path at the beginning. If so, we cut it
285 dnl off so that we can insert the other curses libraries before the ncurses
286 dnl library but after the library path (which is later again prepended below).
287 if test -n "$CURSESLIBDIR"; then
288 if test "-L$CURSESLIBDIR " = "$(echo $CURSESLIB | cut -c-$((${#CURSESLIBDIR}+3)) )"; then
289 CURSESLIB="$(echo $CURSESLIB | cut -c$((${#CURSESLIBDIR}+4))-)"
293 saved_CFLAGS="$CFLAGS"
294 saved_LDFLAGS="$LDFLAGS"
296 CFLAGS="$CFLAGS $CURSES_CFLAGS"
297 if test -n "$CURSESLIBDIR"; then
298 LDFLAGS="$LDFLAGS -L$CURSESLIBDIR"
300 LIBS="$CURSESLIB $LIBS"
302 AC_TRY_LINK([#include <panel.h>], [set_escdelay(100);],[HAVE_CURSES_ESCDELAY="yes"])
303 if test "$HAVE_CURSES_ESCDELAY" = "yes"; then
304 AC_DEFINE([HAVE_CURSES_ESCDELAY], 1, [Have curses set_escdelay])
307 if test "$USE_NLS" = "yes"; then
308 AC_MSG_CHECKING([for curses NLS support])
309 dnl In theory, a single-byte curses works just fine in ISO 8859-* locales.
310 dnl In practice, however, everybody uses UTF-8 nowadays, so we'd better
311 dnl check for wide-character support.
312 dnl For ncurses/ncursesw, CURSES_NLS was already set above.
313 if test "$curseslib" = "curses"; then
315 #define _XOPEN_SOURCE 1
316 #define _XOPEN_SOURCE_EXTENDED 1
320 setcchar(&wc, L"x", A_NORMAL, 0, 0);
324 AC_MSG_RESULT([$CURSES_NLS])
325 if test "$CURSES_NLS" = "yes"; then
326 AC_DEFINE([ENABLE_NLS_IN_CURSES], [1],
327 [Define if curses-based programs can show translated messages.])
331 AC_CHECK_HEADERS([panel.h menu.h form.h], [],
332 [AC_MSG_ERROR([required curses helper header not found])])
333 AC_CHECK_LIB([panel$NCURSESLIBSUFFIX], [new_panel],
334 [CURSESLIB="-lpanel$NCURSESLIBSUFFIX $CURSESLIB"],
335 [AC_MSG_ERROR([panel$NCURSESLIBSUFFIX library not found])])
336 AC_CHECK_LIB([menu$NCURSESLIBSUFFIX], [new_menu],
337 [CURSESLIB="-lmenu$NCURSESLIBSUFFIX $CURSESLIB"],
338 [AC_MSG_ERROR([menu$NCURSESLIBSUFFIX library not found])])
339 AC_CHECK_LIB([form$NCURSESLIBSUFFIX], [new_form],
340 [CURSESLIB="-lform$NCURSESLIBSUFFIX $CURSESLIB"],
341 [AC_MSG_ERROR([form$NCURSESLIBSUFFIX library not found])])
343 CFLAGS="$saved_CFLAGS"
344 LDFLAGS="$saved_LDFLAGS"
347 if test -n "$CURSESLIBDIR"; then
348 CURSESLIB="-L$CURSESLIBDIR $CURSESLIB"
351 AC_MSG_CHECKING([for curses linker flags])
352 AC_MSG_RESULT([$CURSESLIB])
357 AC_SUBST(CURSES_CFLAGS)
359 test "x$prefix" = xNONE && prefix=$ac_default_prefix
364 *) dir="$prefix/share"
367 soundsdir="$dir/sounds/alsa"
368 AC_DEFINE_UNQUOTED(SOUNDSDIR, "$soundsdir", [directory containing sample data])
370 mydatadir="$dir/alsa"
371 AC_DEFINE_UNQUOTED(DATADIR, "$mydatadir", [directory containing alsa configuration])
374 AC_ARG_WITH(testsound,
375 AS_HELP_STRING([--with-testsound=file], [give the path of test sound file for alsaconf]),
376 TESTSOUND="$withval",
377 TESTSOUND="$dir/test.wav")
380 AC_CONFIG_HEADERS(include/aconfig.h)
382 dnl Checks for typedefs, structures, and compiler characteristics.
387 dnl Checks for library functions.
388 AC_PROG_GCC_TRADITIONAL
390 dnl Enable largefile support
397 dnl Check for systemd
398 PKG_CHECK_MODULES(SYSTEMD, [systemd >= 18],
399 [have_min_systemd="yes"],
400 [have_min_systemd="no"])
401 AC_ARG_WITH([systemdsystemunitdir],
402 AS_HELP_STRING([--with-systemdsystemunitdir=DIR], [Directory for systemd service files]),
403 [], [with_systemdsystemunitdir=$($PKG_CONFIG --variable=systemdsystemunitdir systemd)])
404 if test "x$with_systemdsystemunitdir" != xno; then
405 AC_SUBST([systemdsystemunitdir], [$with_systemdsystemunitdir])
407 AM_CONDITIONAL(HAVE_SYSTEMD, [test "$have_min_systemd" = "yes" \
408 -a -n "$with_systemdsystemunitdir" -a "x$with_systemdsystemunitdir" != xno ])
410 AC_ARG_WITH([asound-state-dir],
411 AS_HELP_STRING([--with-asound-state-dir=DIR], [Directory to place asound.state file in]),
412 [ASOUND_STATE_DIR="$withval"],
413 [ASOUND_STATE_DIR="/var/lib/alsa"])
414 AC_SUBST(ASOUND_STATE_DIR)
416 AC_ARG_WITH([alsactl-lock-dir],
417 AS_HELP_STRING([--with-alsactl-lock-dir=DIR], [Directory to place lock files in]),
418 [ASOUND_LOCK_DIR="$withval"],
419 [ASOUND_LOCK_DIR="/var/lock"])
420 AC_SUBST(ASOUND_LOCK_DIR)
422 AC_ARG_WITH([alsactl-pidfile-dir],
423 AS_HELP_STRING([--with-alsactl-pidfile-dir=DIR], [Directory to place alsactl.pid file in]),
424 [ALSACTL_PIDFILE_DIR="$withval"],
425 [ALSACTL_PIDFILE_DIR="/var/run"])
426 AC_SUBST(ALSACTL_PIDFILE_DIR)
428 AC_ARG_WITH([alsactl-daemonswitch],
429 AS_HELP_STRING([--with-alsactl-daemonswitch=FILE], [File to test for the daemon mode]),
430 [ALSACTL_DAEMONSWITCH="$withval"],
431 [ALSACTL_DAEMONSWITCH="/etc/alsa/state-daemon.conf"])
432 AC_SUBST(ALSACTL_DAEMONSWITCH)
434 AC_OUTPUT(Makefile alsactl/Makefile alsactl/init/Makefile \
435 alsamixer/Makefile amidi/Makefile amixer/Makefile \
436 m4/Makefile po/Makefile.in \
437 alsaconf/alsaconf alsaconf/Makefile \
438 alsaconf/po/Makefile \
439 alsaucm/Makefile topology/Makefile \
440 bat/Makefile bat/tests/Makefile bat/tests/asound_state/Makefile \
441 aplay/Makefile include/Makefile iecset/Makefile utils/Makefile \
442 utils/alsa-utils.spec seq/Makefile seq/aconnect/Makefile \
443 seq/aplaymidi/Makefile seq/aseqdump/Makefile seq/aseqnet/Makefile \
444 speaker-test/Makefile speaker-test/samples/Makefile \
445 alsaloop/Makefile alsa-info/Makefile \
446 axfer/Makefile axfer/test/Makefile)