1 dnl Process this file with autoconf to produce a configure script.
4 AC_PREFIX_DEFAULT(/usr)
5 AM_INIT_AUTOMAKE(alsa-utils, 1.0.27.2)
7 AM_MAINTAINER_MODE([enable])
9 AM_GNU_GETTEXT([external])
10 AM_GNU_GETTEXT_VERSION([0.15])
12 dnl Checks for programs.
14 dnl try to gues cross-compiler if not set
15 if test "x$target" != "x$host" -a -z "`echo $CC | grep -e '-gcc'`";
17 AC_MSG_CHECKING(for cross-compiler)
19 which ${program_prefix}gcc >/dev/null 2>&1 && CC=${program_prefix}gcc
20 which ${target_cpu}-${target_os}-gcc >/dev/null 2>&1 \
21 && CC=${target_cpu}-${target-os}-gcc
22 which ${target_cpu}-${target_vendor}-${target_os}-gcc >/dev/null 2>&1 \
23 && CC=${target_cpu}-${target_vendor}-${target_os}-gcc
36 if test "x$enable_alsatest" = "xyes"; then
37 AC_CHECK_FUNC([snd_ctl_elem_add_enumerated],
38 , [AC_ERROR([No user enum control support in alsa-lib])])
42 AC_CHECK_HEADERS([alsa/pcm.h], [have_pcm="yes"], [have_pcm="no"],
43 [#include <alsa/asoundlib.h>])
44 AC_CHECK_HEADERS([alsa/mixer.h], [have_mixer="yes"], [have_mixer="no"],
45 [#include <alsa/asoundlib.h>])
46 AC_CHECK_HEADERS([alsa/rawmidi.h], [have_rawmidi="yes"], [have_rawmidi="no"],
47 [#include <alsa/asoundlib.h>])
48 AC_CHECK_HEADERS([alsa/seq.h], [have_seq="yes"], [have_seq="no"],
49 [#include <alsa/asoundlib.h>])
50 AC_CHECK_HEADERS([samplerate.h], [have_samplerate="yes"], [have_samplerate="no"],
51 [#include <samplerate.h>])
53 AM_CONDITIONAL(HAVE_PCM, test "$have_pcm" = "yes")
54 AM_CONDITIONAL(HAVE_MIXER, test "$have_mixer" = "yes")
55 AM_CONDITIONAL(HAVE_RAWMIDI, test "$have_rawmidi" = "yes")
56 AM_CONDITIONAL(HAVE_SEQ, test "$have_seq" = "yes")
57 AM_CONDITIONAL(HAVE_SAMPLERATE, test "$have_samplerate" = "yes")
61 AC_MSG_CHECKING(for librt)
63 AS_HELP_STRING([--with-librt], [Use librt for monotonic clock (default = yes)]),
64 [ have_librt="$withval" ], [ have_librt="yes" ])
65 if test "$have_librt" = "yes"; then
66 AC_CHECK_LIB([rt], [clock_gettime], [HAVE_LIBRT="yes"])
67 if test "$HAVE_LIBRT" = "yes" ; then
69 AC_DEFINE([HAVE_LIBRT], 1, [Have librt])
70 AC_DEFINE([HAVE_CLOCK_GETTIME], 1, [Have clock gettime])
81 if test "$have_mixer" = "yes"; then
82 AC_ARG_ENABLE(alsamixer,
83 AS_HELP_STRING([--disable-alsamixer], [Disable alsamixer compilation]),
84 [case "${enableval}" in
85 yes) alsamixer=true ;;
86 no) alsamixer=false ;;
87 *) AC_MSG_ERROR(bad value ${enableval} for --enable-alsamixer) ;;
88 esac],[alsamixer=true])
90 AM_CONDITIONAL(ALSAMIXER, test x$alsamixer = xtrue)
93 AC_ARG_ENABLE(alsaconf,
94 AS_HELP_STRING([--disable-alsaconf], [Disable alsaconf packaging]),
95 [case "${enableval}" in
98 *) AC_MSG_ERROR(bad value ${enableval} for --enable-alsaconf) ;;
99 esac],[alsaconf=true])
100 AM_CONDITIONAL(ALSACONF, test x$alsaconf = xtrue)
103 AC_ARG_ENABLE(alsaloop,
104 AS_HELP_STRING([--disable-alsaloop], [Disable alsaloop packaging]),
105 [case "${enableval}" in
106 yes) alsaloop=true ;;
107 no) alsaloop=false ;;
108 *) AC_MSG_ERROR(bad value ${enableval} for --enable-alsaloop) ;;
109 esac],[alsaloop=true])
110 AM_CONDITIONAL(ALSALOOP, test x$alsaloop = xtrue)
114 AS_HELP_STRING([--disable-xmlto], [Disable man page creation via xmlto]),
115 xmlto="$enableval", xmlto="yes")
116 if test "$xmlto" = "yes"; then
117 AC_CHECK_PROG([xmlto], [xmlto], [yes])
119 AM_CONDITIONAL(USE_XMLTO, test x"$xmlto" = xyes)
123 AS_HELP_STRING([--with-udev-rules-dir],[Directory where to install udev rules to (defaults to /lib/udev/rules.d)]),
124 [udevrulesdir=$withval], [udevrulesdir="/lib/udev/rules.d"])
125 AC_SUBST(udevrulesdir)
127 dnl Checks for header files.
129 if test x$alsamixer = xtrue; then
131 AS_HELP_STRING([--with-curses=libname], [Specify the curses library to use (default=auto)]),
132 curseslib="$withval",
137 if test "$curseslib" = "ncursesw" -o \( "$curseslib" = "auto" -a "$USE_NLS" = "yes" \); then
138 dnl First try out pkg-config, then fall back to old config scripts.
139 PKG_CHECK_MODULES([NCURSESW], [ncursesw], [
140 CURSESINC="<ncurses.h>"
141 CURSESLIB="${NCURSESW_LIBS}"
143 CURSES_CFLAGS="${NCURSESW_CFLAGS}"
146 AC_CHECK_PROG([ncursesw5_config], [ncursesw5-config], [yes])
147 if test "$ncursesw5_config" = "yes"; then
148 CURSESINC="<ncurses.h>"
149 CURSESLIB=`ncursesw5-config --libs`
150 CURSESLIBDIR=`ncursesw5-config --libdir`
151 CURSES_CFLAGS=`ncursesw5-config --cflags`
154 AC_CHECK_LIB(ncursesw, initscr,
155 [ CURSESINC='<ncurses.h>'; CURSESLIB='-lncursesw'; curseslib="ncursesw"])
158 if test -n "$CURSESINC"; then
163 if test "$curseslib" = "ncurses" -o "$curseslib" = "auto"; then
164 dnl First try out pkg-config, then fall back to old config scripts.
165 PKG_CHECK_MODULES([NCURSES], [ncurses], [
166 CURSESINC="<ncurses.h>"
167 CURSESLIB="${NCURSES_LIBS}"
169 CURSES_CFLAGS="${NCURSES_CFLAGS}"
172 AC_CHECK_PROG([ncurses5_config], [ncurses5-config], [yes])
173 if test "$ncurses5_config" = "yes"; then
174 CURSESINC="<ncurses.h>"
175 CURSESLIB=`ncurses5-config --libs`
176 CURSESLIBDIR=`ncurses5-config --libdir`
177 CURSES_CFLAGS=`ncurses5-config --cflags`
180 AC_CHECK_LIB(ncurses, initscr,
181 [ CURSESINC='<ncurses.h>'; CURSESLIB='-lncurses'; curseslib="ncurses"])
185 if test "$curseslib" = "curses" -o "$curseslib" = "auto"; then
186 AC_CHECK_LIB(curses, initscr,
187 [ CURSESINC='<curses.h>'; CURSESLIB='-lcurses'; curseslib="curses"])
189 if test -z "$CURSESINC"; then
190 AC_MSG_ERROR(this packages requires a curses library)
193 AC_MSG_CHECKING([for curses library])
194 AC_MSG_RESULT([$curseslib])
195 AC_MSG_CHECKING([for curses header name])
196 AC_MSG_RESULT([$CURSESINC])
197 AC_MSG_CHECKING([for curses compiler flags])
198 AC_MSG_RESULT([$CURSES_CFLAGS])
200 dnl CURSESLIBS might have the library path at the beginning. If so, we cut it
201 dnl off so that we can insert the other curses libraries before the ncurses
202 dnl library but after the library path (which is later again prepended below).
203 if test -n "$CURSESLIBDIR"; then
204 if test "-L$CURSESLIBDIR " = "$(echo $CURSESLIB | cut -c-$((${#CURSESLIBDIR}+3)) )"; then
205 CURSESLIB="$(echo $CURSESLIB | cut -c$((${#CURSESLIBDIR}+4))-)"
209 saved_CFLAGS="$CFLAGS"
210 saved_LDFLAGS="$LDFLAGS"
212 CFLAGS="$CFLAGS $CURSES_CFLAGS"
213 if test -n "$CURSESLIBDIR"; then
214 LDFLAGS="$LDFLAGS -L$CURSESLIBDIR"
216 LIBS="$CURSESLIB $LIBS"
218 AC_TRY_LINK([#include <panel.h>], [set_escdelay(100);],[HAVE_CURSES_ESCDELAY="yes"])
219 if test "$HAVE_CURSES_ESCDELAY" = "yes"; then
220 AC_DEFINE([HAVE_CURSES_ESCDELAY], 1, [Have curses set_escdelay])
223 if test "$USE_NLS" = "yes"; then
224 AC_MSG_CHECKING([for curses NLS support])
225 dnl In theory, a single-byte curses works just fine in ISO 8859-* locales.
226 dnl In practice, however, everybody uses UTF-8 nowadays, so we'd better
227 dnl check for wide-character support.
228 dnl For ncurses/ncursesw, CURSES_NLS was already set above.
229 if test "$curseslib" = "curses"; then
231 #define _XOPEN_SOURCE 1
232 #define _XOPEN_SOURCE_EXTENDED 1
236 setcchar(&wc, L"x", A_NORMAL, 0, 0);
240 AC_MSG_RESULT([$CURSES_NLS])
241 if test "$CURSES_NLS" = "yes"; then
242 AC_DEFINE([ENABLE_NLS_IN_CURSES], [1],
243 [Define if curses-based programs can show translated messages.])
247 AC_CHECK_HEADERS([panel.h menu.h form.h], [],
248 [AC_MSG_ERROR([required curses helper header not found])])
249 AC_CHECK_LIB([panel$NCURSESLIBSUFFIX], [new_panel],
250 [CURSESLIB="-lpanel$NCURSESLIBSUFFIX $CURSESLIB"],
251 [AC_MSG_ERROR([panel$NCURSESLIBSUFFIX library not found])])
252 AC_CHECK_LIB([menu$NCURSESLIBSUFFIX], [new_menu],
253 [CURSESLIB="-lmenu$NCURSESLIBSUFFIX $CURSESLIB"],
254 [AC_MSG_ERROR([menu$NCURSESLIBSUFFIX library not found])])
255 AC_CHECK_LIB([form$NCURSESLIBSUFFIX], [new_form],
256 [CURSESLIB="-lform$NCURSESLIBSUFFIX $CURSESLIB"],
257 [AC_MSG_ERROR([form$NCURSESLIBSUFFIX library not found])])
259 CFLAGS="$saved_CFLAGS"
260 LDFLAGS="$saved_LDFLAGS"
263 if test -n "$CURSESLIBDIR"; then
264 CURSESLIB="-L$CURSESLIBDIR $CURSESLIB"
267 AC_MSG_CHECKING([for curses linker flags])
268 AC_MSG_RESULT([$CURSESLIB])
273 AC_SUBST(CURSES_CFLAGS)
275 test "x$prefix" = xNONE && prefix=$ac_default_prefix
280 *) dir="$prefix/share"
283 soundsdir="$dir/sounds/alsa"
284 AC_DEFINE_UNQUOTED(SOUNDSDIR, "$soundsdir", [directory containing sample data])
286 mydatadir="$dir/alsa"
287 AC_DEFINE_UNQUOTED(DATADIR, "$mydatadir", [directory containing alsa configuration])
289 AC_ARG_WITH(testsound,
290 AS_HELP_STRING([--with-testsound=file], [give the path of test sound file for alsaconf]),
291 TESTSOUND="$withval",
292 TESTSOUND="$dir/test.wav")
295 AC_CONFIG_HEADERS(include/aconfig.h)
297 dnl Checks for typedefs, structures, and compiler characteristics.
302 dnl Checks for library functions.
303 AC_PROG_GCC_TRADITIONAL
305 dnl Enable largefile support
312 dnl Check for systemd
313 AC_ARG_WITH([systemdsystemunitdir],
314 AS_HELP_STRING([--with-systemdsystemunitdir=DIR], [Directory for systemd service files]),
315 [], [with_systemdsystemunitdir=$($PKG_CONFIG --variable=systemdsystemunitdir systemd)])
316 if test "x$with_systemdsystemunitdir" != xno; then
317 AC_SUBST([systemdsystemunitdir], [$with_systemdsystemunitdir])
319 AM_CONDITIONAL(HAVE_SYSTEMD, [test -n "$with_systemdsystemunitdir" -a "x$with_systemdsystemunitdir" != xno ])
321 AC_ARG_WITH([asound-state-dir],
322 AS_HELP_STRING([--with-asound-state-dir=DIR], [Directory to place asound.state file in]),
323 [ASOUND_STATE_DIR="$withval"],
324 [ASOUND_STATE_DIR="/var/lib/alsa"])
325 AC_SUBST(ASOUND_STATE_DIR)
327 AC_ARG_WITH([alsactl-pidfile-dir],
328 AS_HELP_STRING([--with-alsactl-pidfile-dir=DIR], [Directory to place alsactl.pid file in]),
329 [ALSACTL_PIDFILE_DIR="$withval"],
330 [ALSACTL_PIDFILE_DIR="/var/run"])
331 AC_SUBST(ALSACTL_PIDFILE_DIR)
333 AC_ARG_WITH([alsactl-daemonswitch],
334 AS_HELP_STRING([--with-alsactl-daemonswitch=FILE], [File to test for the daemon mode]),
335 [ALSACTL_DAEMONSWITCH="$withval"],
336 [ALSACTL_DAEMONSWITCH="/etc/alsa/state-daemon.conf"])
337 AC_SUBST(ALSACTL_DAEMONSWITCH)
339 AC_OUTPUT(Makefile alsactl/Makefile alsactl/init/Makefile \
340 alsamixer/Makefile amidi/Makefile amixer/Makefile \
341 m4/Makefile po/Makefile.in \
342 alsaconf/alsaconf alsaconf/Makefile \
343 alsaconf/po/Makefile \
345 aplay/Makefile include/Makefile iecset/Makefile utils/Makefile \
346 utils/alsa-utils.spec seq/Makefile seq/aconnect/Makefile \
347 seq/aplaymidi/Makefile seq/aseqdump/Makefile seq/aseqnet/Makefile \
348 speaker-test/Makefile speaker-test/samples/Makefile \