1 dnl Process this file with autoconf to produce a configure script.
3 AC_INIT(alsa-utils, 1.0.29)
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([alsa/use-case.h], [have_ucm="yes"], [have_ucm="no"],
52 [#include <alsa/asoundlib.h>])
53 AC_CHECK_HEADERS([samplerate.h], [have_samplerate="yes"], [have_samplerate="no"],
54 [#include <samplerate.h>])
56 AM_CONDITIONAL(HAVE_PCM, test "$have_pcm" = "yes")
57 AM_CONDITIONAL(HAVE_MIXER, test "$have_mixer" = "yes")
58 AM_CONDITIONAL(HAVE_RAWMIDI, test "$have_rawmidi" = "yes")
59 AM_CONDITIONAL(HAVE_SEQ, test "$have_seq" = "yes")
60 AM_CONDITIONAL(HAVE_UCM, test "$have_ucm" = "yes")
61 AM_CONDITIONAL(HAVE_SAMPLERATE, test "$have_samplerate" = "yes")
65 AC_MSG_CHECKING(for librt)
67 AS_HELP_STRING([--with-librt], [Use librt for monotonic clock (default = yes)]),
68 [ have_librt="$withval" ], [ have_librt="yes" ])
69 if test "$have_librt" = "yes"; then
70 AC_CHECK_LIB([rt], [clock_gettime], [HAVE_LIBRT="yes"])
71 if test "$HAVE_LIBRT" = "yes" ; then
73 AC_DEFINE([HAVE_LIBRT], 1, [Have librt])
74 AC_DEFINE([HAVE_CLOCK_GETTIME], 1, [Have clock gettime])
85 if test "$have_mixer" = "yes"; then
86 AC_ARG_ENABLE(alsamixer,
87 AS_HELP_STRING([--disable-alsamixer], [Disable alsamixer compilation]),
88 [case "${enableval}" in
89 yes) alsamixer=true ;;
90 no) alsamixer=false ;;
91 *) AC_MSG_ERROR(bad value ${enableval} for --enable-alsamixer) ;;
92 esac],[alsamixer=true])
94 AM_CONDITIONAL(ALSAMIXER, test x$alsamixer = xtrue)
97 AC_ARG_ENABLE(alsaconf,
98 AS_HELP_STRING([--disable-alsaconf], [Disable alsaconf packaging]),
99 [case "${enableval}" in
100 yes) alsaconf=true ;;
101 no) alsaconf=false ;;
102 *) AC_MSG_ERROR(bad value ${enableval} for --enable-alsaconf) ;;
103 esac],[alsaconf=true])
104 AM_CONDITIONAL(ALSACONF, test x$alsaconf = xtrue)
107 AC_ARG_ENABLE(alsaloop,
108 AS_HELP_STRING([--disable-alsaloop], [Disable alsaloop packaging]),
109 [case "${enableval}" in
110 yes) alsaloop=true ;;
111 no) alsaloop=false ;;
112 *) AC_MSG_ERROR(bad value ${enableval} for --enable-alsaloop) ;;
113 esac],[alsaloop=true])
114 AM_CONDITIONAL(ALSALOOP, test x$alsaloop = xtrue)
118 AS_HELP_STRING([--disable-xmlto], [Disable man page creation via xmlto]),
119 xmlto="$enableval", xmlto="yes")
120 if test "$xmlto" = "yes"; then
121 AC_CHECK_PROG([xmlto], [xmlto], [yes])
123 AM_CONDITIONAL(USE_XMLTO, test x"$xmlto" = xyes)
127 AS_HELP_STRING([--with-udev-rules-dir=DIR],[Directory where to install udev rules to (default=auto)]),
128 [udevrulesdir="$withval"],
129 [udevdir=$($PKG_CONFIG udev --variable=udevdir)
130 if test "x$udevdir" = "x"; then
131 udevrulesdir="/lib/udev/rules.d"
133 udevrulesdir="$udevdir/rules.d"
135 AC_SUBST(udevrulesdir)
137 dnl Checks for header files.
139 if test x$alsamixer = xtrue; then
141 AS_HELP_STRING([--with-curses=libname], [Specify the curses library to use (default=auto)]),
142 curseslib="$withval",
147 if test "$curseslib" = "ncursesw" -o \( "$curseslib" = "auto" -a "$USE_NLS" = "yes" \); then
148 dnl First try out pkg-config, then fall back to old config scripts.
149 PKG_CHECK_MODULES([NCURSESW], [ncursesw], [
150 CURSESINC="<ncurses.h>"
151 CURSESLIB="${NCURSESW_LIBS}"
153 CURSES_CFLAGS="${NCURSESW_CFLAGS}"
156 AC_CHECK_PROG([ncursesw5_config], [ncursesw5-config], [yes])
157 if test "$ncursesw5_config" = "yes"; then
158 CURSESINC="<ncurses.h>"
159 CURSESLIB=`ncursesw5-config --libs`
160 CURSESLIBDIR=`ncursesw5-config --libdir`
161 CURSES_CFLAGS=`ncursesw5-config --cflags`
164 AC_CHECK_LIB(ncursesw, initscr,
165 [ CURSESINC='<ncurses.h>'; CURSESLIB='-lncursesw'; curseslib="ncursesw"])
168 if test -n "$CURSESINC"; then
173 if test "$curseslib" = "ncurses" -o "$curseslib" = "auto"; then
174 dnl First try out pkg-config, then fall back to old config scripts.
175 PKG_CHECK_MODULES([NCURSES], [ncurses], [
176 CURSESINC="<ncurses.h>"
177 CURSESLIB="${NCURSES_LIBS}"
179 CURSES_CFLAGS="${NCURSES_CFLAGS}"
182 AC_CHECK_PROG([ncurses5_config], [ncurses5-config], [yes])
183 if test "$ncurses5_config" = "yes"; then
184 CURSESINC="<ncurses.h>"
185 CURSESLIB=`ncurses5-config --libs`
186 CURSESLIBDIR=`ncurses5-config --libdir`
187 CURSES_CFLAGS=`ncurses5-config --cflags`
190 AC_CHECK_LIB(ncurses, initscr,
191 [ CURSESINC='<ncurses.h>'; CURSESLIB='-lncurses'; curseslib="ncurses"])
195 if test "$curseslib" = "curses" -o "$curseslib" = "auto"; then
196 AC_CHECK_LIB(curses, initscr,
197 [ CURSESINC='<curses.h>'; CURSESLIB='-lcurses'; curseslib="curses"])
199 if test -z "$CURSESINC"; then
200 AC_MSG_ERROR(this packages requires a curses library)
203 AC_MSG_CHECKING([for curses library])
204 AC_MSG_RESULT([$curseslib])
205 AC_MSG_CHECKING([for curses header name])
206 AC_MSG_RESULT([$CURSESINC])
207 AC_MSG_CHECKING([for curses compiler flags])
208 AC_MSG_RESULT([$CURSES_CFLAGS])
210 dnl CURSESLIBS might have the library path at the beginning. If so, we cut it
211 dnl off so that we can insert the other curses libraries before the ncurses
212 dnl library but after the library path (which is later again prepended below).
213 if test -n "$CURSESLIBDIR"; then
214 if test "-L$CURSESLIBDIR " = "$(echo $CURSESLIB | cut -c-$((${#CURSESLIBDIR}+3)) )"; then
215 CURSESLIB="$(echo $CURSESLIB | cut -c$((${#CURSESLIBDIR}+4))-)"
219 saved_CFLAGS="$CFLAGS"
220 saved_LDFLAGS="$LDFLAGS"
222 CFLAGS="$CFLAGS $CURSES_CFLAGS"
223 if test -n "$CURSESLIBDIR"; then
224 LDFLAGS="$LDFLAGS -L$CURSESLIBDIR"
226 LIBS="$CURSESLIB $LIBS"
228 AC_TRY_LINK([#include <panel.h>], [set_escdelay(100);],[HAVE_CURSES_ESCDELAY="yes"])
229 if test "$HAVE_CURSES_ESCDELAY" = "yes"; then
230 AC_DEFINE([HAVE_CURSES_ESCDELAY], 1, [Have curses set_escdelay])
233 if test "$USE_NLS" = "yes"; then
234 AC_MSG_CHECKING([for curses NLS support])
235 dnl In theory, a single-byte curses works just fine in ISO 8859-* locales.
236 dnl In practice, however, everybody uses UTF-8 nowadays, so we'd better
237 dnl check for wide-character support.
238 dnl For ncurses/ncursesw, CURSES_NLS was already set above.
239 if test "$curseslib" = "curses"; then
241 #define _XOPEN_SOURCE 1
242 #define _XOPEN_SOURCE_EXTENDED 1
246 setcchar(&wc, L"x", A_NORMAL, 0, 0);
250 AC_MSG_RESULT([$CURSES_NLS])
251 if test "$CURSES_NLS" = "yes"; then
252 AC_DEFINE([ENABLE_NLS_IN_CURSES], [1],
253 [Define if curses-based programs can show translated messages.])
257 AC_CHECK_HEADERS([panel.h menu.h form.h], [],
258 [AC_MSG_ERROR([required curses helper header not found])])
259 AC_CHECK_LIB([panel$NCURSESLIBSUFFIX], [new_panel],
260 [CURSESLIB="-lpanel$NCURSESLIBSUFFIX $CURSESLIB"],
261 [AC_MSG_ERROR([panel$NCURSESLIBSUFFIX library not found])])
262 AC_CHECK_LIB([menu$NCURSESLIBSUFFIX], [new_menu],
263 [CURSESLIB="-lmenu$NCURSESLIBSUFFIX $CURSESLIB"],
264 [AC_MSG_ERROR([menu$NCURSESLIBSUFFIX library not found])])
265 AC_CHECK_LIB([form$NCURSESLIBSUFFIX], [new_form],
266 [CURSESLIB="-lform$NCURSESLIBSUFFIX $CURSESLIB"],
267 [AC_MSG_ERROR([form$NCURSESLIBSUFFIX library not found])])
269 CFLAGS="$saved_CFLAGS"
270 LDFLAGS="$saved_LDFLAGS"
273 if test -n "$CURSESLIBDIR"; then
274 CURSESLIB="-L$CURSESLIBDIR $CURSESLIB"
277 AC_MSG_CHECKING([for curses linker flags])
278 AC_MSG_RESULT([$CURSESLIB])
283 AC_SUBST(CURSES_CFLAGS)
285 test "x$prefix" = xNONE && prefix=$ac_default_prefix
290 *) dir="$prefix/share"
293 soundsdir="$dir/sounds/alsa"
294 AC_DEFINE_UNQUOTED(SOUNDSDIR, "$soundsdir", [directory containing sample data])
296 mydatadir="$dir/alsa"
297 AC_DEFINE_UNQUOTED(DATADIR, "$mydatadir", [directory containing alsa configuration])
300 AC_ARG_WITH(testsound,
301 AS_HELP_STRING([--with-testsound=file], [give the path of test sound file for alsaconf]),
302 TESTSOUND="$withval",
303 TESTSOUND="$dir/test.wav")
306 AC_CONFIG_HEADERS(include/aconfig.h)
308 dnl Checks for typedefs, structures, and compiler characteristics.
313 dnl Checks for library functions.
314 AC_PROG_GCC_TRADITIONAL
316 dnl Enable largefile support
323 dnl Check for systemd
324 AC_ARG_WITH([systemdsystemunitdir],
325 AS_HELP_STRING([--with-systemdsystemunitdir=DIR], [Directory for systemd service files]),
326 [], [with_systemdsystemunitdir=$($PKG_CONFIG --variable=systemdsystemunitdir systemd)])
327 if test "x$with_systemdsystemunitdir" != xno; then
328 AC_SUBST([systemdsystemunitdir], [$with_systemdsystemunitdir])
330 AM_CONDITIONAL(HAVE_SYSTEMD, [test -n "$with_systemdsystemunitdir" -a "x$with_systemdsystemunitdir" != xno ])
332 AC_ARG_WITH([asound-state-dir],
333 AS_HELP_STRING([--with-asound-state-dir=DIR], [Directory to place asound.state file in]),
334 [ASOUND_STATE_DIR="$withval"],
335 [ASOUND_STATE_DIR="/var/lib/alsa"])
336 AC_SUBST(ASOUND_STATE_DIR)
338 AC_ARG_WITH([alsactl-lock-dir],
339 AS_HELP_STRING([--with-alsactl-lock-dir=DIR], [Directory to place lock files in]),
340 [ASOUND_LOCK_DIR="$withval"],
341 [ASOUND_LOCK_DIR="/var/lock"])
342 AC_SUBST(ASOUND_LOCK_DIR)
344 AC_ARG_WITH([alsactl-pidfile-dir],
345 AS_HELP_STRING([--with-alsactl-pidfile-dir=DIR], [Directory to place alsactl.pid file in]),
346 [ALSACTL_PIDFILE_DIR="$withval"],
347 [ALSACTL_PIDFILE_DIR="/var/run"])
348 AC_SUBST(ALSACTL_PIDFILE_DIR)
350 AC_ARG_WITH([alsactl-daemonswitch],
351 AS_HELP_STRING([--with-alsactl-daemonswitch=FILE], [File to test for the daemon mode]),
352 [ALSACTL_DAEMONSWITCH="$withval"],
353 [ALSACTL_DAEMONSWITCH="/etc/alsa/state-daemon.conf"])
354 AC_SUBST(ALSACTL_DAEMONSWITCH)
356 AC_OUTPUT(Makefile alsactl/Makefile alsactl/init/Makefile \
357 alsamixer/Makefile amidi/Makefile amixer/Makefile \
358 m4/Makefile po/Makefile.in \
359 alsaconf/alsaconf alsaconf/Makefile \
360 alsaconf/po/Makefile \
362 aplay/Makefile include/Makefile iecset/Makefile utils/Makefile \
363 utils/alsa-utils.spec seq/Makefile seq/aconnect/Makefile \
364 seq/aplaymidi/Makefile seq/aseqdump/Makefile seq/aseqnet/Makefile \
365 speaker-test/Makefile speaker-test/samples/Makefile \
366 alsaloop/Makefile alsa-info/Makefile)