1 dnl Process this file with autoconf to produce a configure script.
3 AC_INIT(alsa-utils, 1.0.28)
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.15])
13 dnl Checks for programs.
15 dnl try to gues cross-compiler if not set
16 if test "x$target" != "x$host" -a -z "`echo $CC | grep -e '-gcc'`";
18 AC_MSG_CHECKING(for cross-compiler)
20 which ${program_prefix}gcc >/dev/null 2>&1 && CC=${program_prefix}gcc
21 which ${target_cpu}-${target_os}-gcc >/dev/null 2>&1 \
22 && CC=${target_cpu}-${target-os}-gcc
23 which ${target_cpu}-${target_vendor}-${target_os}-gcc >/dev/null 2>&1 \
24 && CC=${target_cpu}-${target_vendor}-${target_os}-gcc
37 if test "x$enable_alsatest" = "xyes"; then
38 AC_CHECK_FUNC([snd_ctl_elem_add_enumerated],
39 , [AC_ERROR([No user enum control support in alsa-lib])])
43 AC_CHECK_HEADERS([alsa/pcm.h], [have_pcm="yes"], [have_pcm="no"],
44 [#include <alsa/asoundlib.h>])
45 AC_CHECK_HEADERS([alsa/mixer.h], [have_mixer="yes"], [have_mixer="no"],
46 [#include <alsa/asoundlib.h>])
47 AC_CHECK_HEADERS([alsa/rawmidi.h], [have_rawmidi="yes"], [have_rawmidi="no"],
48 [#include <alsa/asoundlib.h>])
49 AC_CHECK_HEADERS([alsa/seq.h], [have_seq="yes"], [have_seq="no"],
50 [#include <alsa/asoundlib.h>])
51 AC_CHECK_HEADERS([samplerate.h], [have_samplerate="yes"], [have_samplerate="no"],
52 [#include <samplerate.h>])
54 AM_CONDITIONAL(HAVE_PCM, test "$have_pcm" = "yes")
55 AM_CONDITIONAL(HAVE_MIXER, test "$have_mixer" = "yes")
56 AM_CONDITIONAL(HAVE_RAWMIDI, test "$have_rawmidi" = "yes")
57 AM_CONDITIONAL(HAVE_SEQ, test "$have_seq" = "yes")
58 AM_CONDITIONAL(HAVE_SAMPLERATE, test "$have_samplerate" = "yes")
62 AC_MSG_CHECKING(for librt)
64 AS_HELP_STRING([--with-librt], [Use librt for monotonic clock (default = yes)]),
65 [ have_librt="$withval" ], [ have_librt="yes" ])
66 if test "$have_librt" = "yes"; then
67 AC_CHECK_LIB([rt], [clock_gettime], [HAVE_LIBRT="yes"])
68 if test "$HAVE_LIBRT" = "yes" ; then
70 AC_DEFINE([HAVE_LIBRT], 1, [Have librt])
71 AC_DEFINE([HAVE_CLOCK_GETTIME], 1, [Have clock gettime])
82 if test "$have_mixer" = "yes"; then
83 AC_ARG_ENABLE(alsamixer,
84 AS_HELP_STRING([--disable-alsamixer], [Disable alsamixer compilation]),
85 [case "${enableval}" in
86 yes) alsamixer=true ;;
87 no) alsamixer=false ;;
88 *) AC_MSG_ERROR(bad value ${enableval} for --enable-alsamixer) ;;
89 esac],[alsamixer=true])
91 AM_CONDITIONAL(ALSAMIXER, test x$alsamixer = xtrue)
94 AC_ARG_ENABLE(alsaconf,
95 AS_HELP_STRING([--disable-alsaconf], [Disable alsaconf packaging]),
96 [case "${enableval}" in
99 *) AC_MSG_ERROR(bad value ${enableval} for --enable-alsaconf) ;;
100 esac],[alsaconf=true])
101 AM_CONDITIONAL(ALSACONF, test x$alsaconf = xtrue)
104 AC_ARG_ENABLE(alsaloop,
105 AS_HELP_STRING([--disable-alsaloop], [Disable alsaloop packaging]),
106 [case "${enableval}" in
107 yes) alsaloop=true ;;
108 no) alsaloop=false ;;
109 *) AC_MSG_ERROR(bad value ${enableval} for --enable-alsaloop) ;;
110 esac],[alsaloop=true])
111 AM_CONDITIONAL(ALSALOOP, test x$alsaloop = xtrue)
115 AS_HELP_STRING([--disable-xmlto], [Disable man page creation via xmlto]),
116 xmlto="$enableval", xmlto="yes")
117 if test "$xmlto" = "yes"; then
118 AC_CHECK_PROG([xmlto], [xmlto], [yes])
120 AM_CONDITIONAL(USE_XMLTO, test x"$xmlto" = xyes)
124 AS_HELP_STRING([--with-udev-rules-dir=DIR],[Directory where to install udev rules to (default=auto)]),
125 [udevrulesdir="$withval"],
126 [udevdir=$($PKG_CONFIG udev --variable=udevdir)
127 if test "x$udevdir" = "x"; then
128 udevrulesdir="/lib/udev/rules.d"
130 udevrulesdir="$udevdir/rules.d"
132 AC_SUBST(udevrulesdir)
134 dnl Checks for header files.
136 if test x$alsamixer = xtrue; then
138 AS_HELP_STRING([--with-curses=libname], [Specify the curses library to use (default=auto)]),
139 curseslib="$withval",
144 if test "$curseslib" = "ncursesw" -o \( "$curseslib" = "auto" -a "$USE_NLS" = "yes" \); then
145 dnl First try out pkg-config, then fall back to old config scripts.
146 PKG_CHECK_MODULES([NCURSESW], [ncursesw], [
147 CURSESINC="<ncurses.h>"
148 CURSESLIB="${NCURSESW_LIBS}"
150 CURSES_CFLAGS="${NCURSESW_CFLAGS}"
153 AC_CHECK_PROG([ncursesw5_config], [ncursesw5-config], [yes])
154 if test "$ncursesw5_config" = "yes"; then
155 CURSESINC="<ncurses.h>"
156 CURSESLIB=`ncursesw5-config --libs`
157 CURSESLIBDIR=`ncursesw5-config --libdir`
158 CURSES_CFLAGS=`ncursesw5-config --cflags`
161 AC_CHECK_LIB(ncursesw, initscr,
162 [ CURSESINC='<ncurses.h>'; CURSESLIB='-lncursesw'; curseslib="ncursesw"])
165 if test -n "$CURSESINC"; then
170 if test "$curseslib" = "ncurses" -o "$curseslib" = "auto"; then
171 dnl First try out pkg-config, then fall back to old config scripts.
172 PKG_CHECK_MODULES([NCURSES], [ncurses], [
173 CURSESINC="<ncurses.h>"
174 CURSESLIB="${NCURSES_LIBS}"
176 CURSES_CFLAGS="${NCURSES_CFLAGS}"
179 AC_CHECK_PROG([ncurses5_config], [ncurses5-config], [yes])
180 if test "$ncurses5_config" = "yes"; then
181 CURSESINC="<ncurses.h>"
182 CURSESLIB=`ncurses5-config --libs`
183 CURSESLIBDIR=`ncurses5-config --libdir`
184 CURSES_CFLAGS=`ncurses5-config --cflags`
187 AC_CHECK_LIB(ncurses, initscr,
188 [ CURSESINC='<ncurses.h>'; CURSESLIB='-lncurses'; curseslib="ncurses"])
192 if test "$curseslib" = "curses" -o "$curseslib" = "auto"; then
193 AC_CHECK_LIB(curses, initscr,
194 [ CURSESINC='<curses.h>'; CURSESLIB='-lcurses'; curseslib="curses"])
196 if test -z "$CURSESINC"; then
197 AC_MSG_ERROR(this packages requires a curses library)
200 AC_MSG_CHECKING([for curses library])
201 AC_MSG_RESULT([$curseslib])
202 AC_MSG_CHECKING([for curses header name])
203 AC_MSG_RESULT([$CURSESINC])
204 AC_MSG_CHECKING([for curses compiler flags])
205 AC_MSG_RESULT([$CURSES_CFLAGS])
207 dnl CURSESLIBS might have the library path at the beginning. If so, we cut it
208 dnl off so that we can insert the other curses libraries before the ncurses
209 dnl library but after the library path (which is later again prepended below).
210 if test -n "$CURSESLIBDIR"; then
211 if test "-L$CURSESLIBDIR " = "$(echo $CURSESLIB | cut -c-$((${#CURSESLIBDIR}+3)) )"; then
212 CURSESLIB="$(echo $CURSESLIB | cut -c$((${#CURSESLIBDIR}+4))-)"
216 saved_CFLAGS="$CFLAGS"
217 saved_LDFLAGS="$LDFLAGS"
219 CFLAGS="$CFLAGS $CURSES_CFLAGS"
220 if test -n "$CURSESLIBDIR"; then
221 LDFLAGS="$LDFLAGS -L$CURSESLIBDIR"
223 LIBS="$CURSESLIB $LIBS"
225 AC_TRY_LINK([#include <panel.h>], [set_escdelay(100);],[HAVE_CURSES_ESCDELAY="yes"])
226 if test "$HAVE_CURSES_ESCDELAY" = "yes"; then
227 AC_DEFINE([HAVE_CURSES_ESCDELAY], 1, [Have curses set_escdelay])
230 if test "$USE_NLS" = "yes"; then
231 AC_MSG_CHECKING([for curses NLS support])
232 dnl In theory, a single-byte curses works just fine in ISO 8859-* locales.
233 dnl In practice, however, everybody uses UTF-8 nowadays, so we'd better
234 dnl check for wide-character support.
235 dnl For ncurses/ncursesw, CURSES_NLS was already set above.
236 if test "$curseslib" = "curses"; then
238 #define _XOPEN_SOURCE 1
239 #define _XOPEN_SOURCE_EXTENDED 1
243 setcchar(&wc, L"x", A_NORMAL, 0, 0);
247 AC_MSG_RESULT([$CURSES_NLS])
248 if test "$CURSES_NLS" = "yes"; then
249 AC_DEFINE([ENABLE_NLS_IN_CURSES], [1],
250 [Define if curses-based programs can show translated messages.])
254 AC_CHECK_HEADERS([panel.h menu.h form.h], [],
255 [AC_MSG_ERROR([required curses helper header not found])])
256 AC_CHECK_LIB([panel$NCURSESLIBSUFFIX], [new_panel],
257 [CURSESLIB="-lpanel$NCURSESLIBSUFFIX $CURSESLIB"],
258 [AC_MSG_ERROR([panel$NCURSESLIBSUFFIX library not found])])
259 AC_CHECK_LIB([menu$NCURSESLIBSUFFIX], [new_menu],
260 [CURSESLIB="-lmenu$NCURSESLIBSUFFIX $CURSESLIB"],
261 [AC_MSG_ERROR([menu$NCURSESLIBSUFFIX library not found])])
262 AC_CHECK_LIB([form$NCURSESLIBSUFFIX], [new_form],
263 [CURSESLIB="-lform$NCURSESLIBSUFFIX $CURSESLIB"],
264 [AC_MSG_ERROR([form$NCURSESLIBSUFFIX library not found])])
266 CFLAGS="$saved_CFLAGS"
267 LDFLAGS="$saved_LDFLAGS"
270 if test -n "$CURSESLIBDIR"; then
271 CURSESLIB="-L$CURSESLIBDIR $CURSESLIB"
274 AC_MSG_CHECKING([for curses linker flags])
275 AC_MSG_RESULT([$CURSESLIB])
280 AC_SUBST(CURSES_CFLAGS)
282 test "x$prefix" = xNONE && prefix=$ac_default_prefix
287 *) dir="$prefix/share"
290 soundsdir="$dir/sounds/alsa"
291 AC_DEFINE_UNQUOTED(SOUNDSDIR, "$soundsdir", [directory containing sample data])
293 mydatadir="$dir/alsa"
294 AC_DEFINE_UNQUOTED(DATADIR, "$mydatadir", [directory containing alsa configuration])
297 AC_ARG_WITH(testsound,
298 AS_HELP_STRING([--with-testsound=file], [give the path of test sound file for alsaconf]),
299 TESTSOUND="$withval",
300 TESTSOUND="$dir/test.wav")
303 AC_CONFIG_HEADERS(include/aconfig.h)
305 dnl Checks for typedefs, structures, and compiler characteristics.
310 dnl Checks for library functions.
311 AC_PROG_GCC_TRADITIONAL
313 dnl Enable largefile support
320 dnl Check for systemd
321 AC_ARG_WITH([systemdsystemunitdir],
322 AS_HELP_STRING([--with-systemdsystemunitdir=DIR], [Directory for systemd service files]),
323 [], [with_systemdsystemunitdir=$($PKG_CONFIG --variable=systemdsystemunitdir systemd)])
324 if test "x$with_systemdsystemunitdir" != xno; then
325 AC_SUBST([systemdsystemunitdir], [$with_systemdsystemunitdir])
327 AM_CONDITIONAL(HAVE_SYSTEMD, [test -n "$with_systemdsystemunitdir" -a "x$with_systemdsystemunitdir" != xno ])
329 AC_ARG_WITH([asound-state-dir],
330 AS_HELP_STRING([--with-asound-state-dir=DIR], [Directory to place asound.state file in]),
331 [ASOUND_STATE_DIR="$withval"],
332 [ASOUND_STATE_DIR="/var/lib/alsa"])
333 AC_SUBST(ASOUND_STATE_DIR)
335 AC_ARG_WITH([alsactl-lock-dir],
336 AS_HELP_STRING([--with-alsactl-lock-dir=DIR], [Directory to place lock files in]),
337 [ASOUND_LOCK_DIR="$withval"],
338 [ASOUND_LOCK_DIR="/var/lock"])
339 AC_SUBST(ASOUND_LOCK_DIR)
341 AC_ARG_WITH([alsactl-pidfile-dir],
342 AS_HELP_STRING([--with-alsactl-pidfile-dir=DIR], [Directory to place alsactl.pid file in]),
343 [ALSACTL_PIDFILE_DIR="$withval"],
344 [ALSACTL_PIDFILE_DIR="/var/run"])
345 AC_SUBST(ALSACTL_PIDFILE_DIR)
347 AC_ARG_WITH([alsactl-daemonswitch],
348 AS_HELP_STRING([--with-alsactl-daemonswitch=FILE], [File to test for the daemon mode]),
349 [ALSACTL_DAEMONSWITCH="$withval"],
350 [ALSACTL_DAEMONSWITCH="/etc/alsa/state-daemon.conf"])
351 AC_SUBST(ALSACTL_DAEMONSWITCH)
353 AC_OUTPUT(Makefile alsactl/Makefile alsactl/init/Makefile \
354 alsamixer/Makefile amidi/Makefile amixer/Makefile \
355 m4/Makefile po/Makefile.in \
356 alsaconf/alsaconf alsaconf/Makefile \
357 alsaconf/po/Makefile \
359 aplay/Makefile include/Makefile iecset/Makefile utils/Makefile \
360 utils/alsa-utils.spec seq/Makefile seq/aconnect/Makefile \
361 seq/aplaymidi/Makefile seq/aseqdump/Makefile seq/aseqnet/Makefile \
362 speaker-test/Makefile speaker-test/samples/Makefile \