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.25)
7 AM_GNU_GETTEXT([external])
8 AM_GNU_GETTEXT_VERSION([0.15])
10 dnl Checks for programs.
12 dnl try to gues cross-compiler if not set
13 if test "x$target" != "x$host" -a -z "`echo $CC | grep -e '-gcc'`";
15 AC_MSG_CHECKING(for cross-compiler)
17 which ${program_prefix}gcc >/dev/null 2>&1 && CC=${program_prefix}gcc
18 which ${target_cpu}-${target_os}-gcc >/dev/null 2>&1 \
19 && CC=${target_cpu}-${target-os}-gcc
20 which ${target_cpu}-${target_vendor}-${target_os}-gcc >/dev/null 2>&1 \
21 && CC=${target_cpu}-${target_vendor}-${target_os}-gcc
33 AC_CHECK_FUNC([snd_ctl_elem_add_enumerated],
34 , [AC_ERROR([No user enum control support in alsa-lib])])
37 AC_CHECK_HEADERS([alsa/pcm.h], [have_pcm="yes"], [have_pcm="no"],
38 [#include <alsa/asoundlib.h>])
39 AC_CHECK_HEADERS([alsa/mixer.h], [have_mixer="yes"], [have_mixer="no"],
40 [#include <alsa/asoundlib.h>])
41 AC_CHECK_HEADERS([alsa/rawmidi.h], [have_rawmidi="yes"], [have_rawmidi="no"],
42 [#include <alsa/asoundlib.h>])
43 AC_CHECK_HEADERS([alsa/seq.h], [have_seq="yes"], [have_seq="no"],
44 [#include <alsa/asoundlib.h>])
45 AC_CHECK_HEADERS([samplerate.h], [have_samplerate="yes"], [have_samplerate="no"],
46 [#include <samplerate.h>])
48 AM_CONDITIONAL(HAVE_PCM, test "$have_pcm" = "yes")
49 AM_CONDITIONAL(HAVE_MIXER, test "$have_mixer" = "yes")
50 AM_CONDITIONAL(HAVE_RAWMIDI, test "$have_rawmidi" = "yes")
51 AM_CONDITIONAL(HAVE_SEQ, test "$have_seq" = "yes")
52 AM_CONDITIONAL(HAVE_SAMPLERATE, test "$have_samplerate" = "yes")
56 AC_MSG_CHECKING(for librt)
58 AS_HELP_STRING([--with-librt], [Use librt for monotonic clock (default = yes)]),
59 [ have_librt="$withval" ], [ have_librt="yes" ])
60 if test "$have_librt" = "yes"; then
61 AC_CHECK_LIB([rt], [clock_gettime], [HAVE_LIBRT="yes"])
62 if test "$HAVE_LIBRT" = "yes" ; then
64 AC_DEFINE([HAVE_LIBRT], 1, [Have librt])
65 AC_DEFINE([HAVE_CLOCK_GETTIME], 1, [Have clock gettime])
76 if test "$have_mixer" = "yes"; then
77 AC_ARG_ENABLE(alsamixer,
78 [ --disable-alsamixer Disable alsamixer compilation],
79 [case "${enableval}" in
80 yes) alsamixer=true ;;
81 no) alsamixer=false ;;
82 *) AC_MSG_ERROR(bad value ${enableval} for --enable-alsamixer) ;;
83 esac],[alsamixer=true])
85 AM_CONDITIONAL(ALSAMIXER, test x$alsamixer = xtrue)
88 AC_ARG_ENABLE(alsaconf,
89 [ --disable-alsaconf Disable alsaconf packaging],
90 [case "${enableval}" in
93 *) AC_MSG_ERROR(bad value ${enableval} for --enable-alsaconf) ;;
94 esac],[alsaconf=true])
95 AM_CONDITIONAL(ALSACONF, test x$alsaconf = xtrue)
98 AC_ARG_ENABLE(alsaloop,
99 [ --disable-alsaloop Disable alsaloop packaging],
100 [case "${enableval}" in
101 yes) alsaloop=true ;;
102 no) alsaloop=false ;;
103 *) AC_MSG_ERROR(bad value ${enableval} for --enable-alsaloop) ;;
104 esac],[alsaloop=true])
105 AM_CONDITIONAL(ALSALOOP, test x$alsaloop = xtrue)
109 AS_HELP_STRING([--disable-xmlto], [Disable man page creation via xmlto]),
110 xmlto="$enableval", xmlto="yes")
111 if test "$xmlto" = "yes"; then
112 AC_CHECK_PROG([xmlto], [xmlto], [yes])
114 AM_CONDITIONAL(USE_XMLTO, test x"$xmlto" = xyes)
118 AS_HELP_STRING([--with-udev-rules-dir],[Directory where to install udev rules to (defaults to /lib/udev/rules.d)]),
119 [udevrulesdir=$withval], [udevrulesdir="/lib/udev/rules.d"])
120 AC_SUBST(udevrulesdir)
122 dnl Checks for header files.
124 if test x$alsamixer = xtrue; then
126 [ --with-curses libname Specify the curses library to use (default=auto)],
127 curseslib="$withval",
132 if test "$curseslib" = "ncursesw" -o \( "$curseslib" = "auto" -a "$USE_NLS" = "yes" \); then
133 AC_CHECK_PROG([ncursesw5_config], [ncursesw5-config], [yes])
134 if test "$ncursesw5_config" = "yes"; then
135 CURSESINC="<ncurses.h>"
136 CURSESLIB=`ncursesw5-config --libs`
137 CURSESLIBDIR=`ncursesw5-config --libdir`
138 CURSES_CFLAGS=`ncursesw5-config --cflags`
141 AC_CHECK_LIB(ncursesw, initscr,
142 [ CURSESINC='<ncurses.h>'; CURSESLIB='-lncursesw'; curseslib="ncursesw"])
144 if test -n "$CURSESINC"; then
149 if test "$curseslib" = "ncurses" -o "$curseslib" = "auto"; then
150 AC_CHECK_PROG([ncurses5_config], [ncurses5-config], [yes])
151 if test "$ncurses5_config" = "yes"; then
152 CURSESINC="<ncurses.h>"
153 CURSESLIB=`ncurses5-config --libs`
154 CURSESLIBDIR=`ncurses5-config --libdir`
155 CURSES_CFLAGS=`ncurses5-config --cflags`
158 AC_CHECK_LIB(ncurses, initscr,
159 [ CURSESINC='<ncurses.h>'; CURSESLIB='-lncurses'; curseslib="ncurses"])
162 if test "$curseslib" = "curses" -o "$curseslib" = "auto"; then
163 AC_CHECK_LIB(curses, initscr,
164 [ CURSESINC='<curses.h>'; CURSESLIB='-lcurses'; curseslib="curses"])
166 if test -z "$CURSESINC"; then
167 AC_MSG_ERROR(this packages requires a curses library)
170 AC_MSG_CHECKING([for curses library])
171 AC_MSG_RESULT([$curseslib])
172 AC_MSG_CHECKING([for curses header name])
173 AC_MSG_RESULT([$CURSESINC])
174 AC_MSG_CHECKING([for curses compiler flags])
175 AC_MSG_RESULT([$CURSES_CFLAGS])
177 dnl CURSESLIBS might have the library path at the beginning. If so, we cut it
178 dnl off so that we can insert the other curses libraries before the ncurses
179 dnl library but after the library path (which is later again prepended below).
180 if test -n "$CURSESLIBDIR"; then
181 if test "-L$CURSESLIBDIR " = "$(echo $CURSESLIB | cut -c-$((${#CURSESLIBDIR}+3)) )"; then
182 CURSESLIB="$(echo $CURSESLIB | cut -c$((${#CURSESLIBDIR}+4))-)"
186 saved_CFLAGS="$CFLAGS"
187 saved_LDFLAGS="$LDFLAGS"
189 CFLAGS="$CFLAGS $CURSES_CFLAGS"
190 if test -n "$CURSESLIBDIR"; then
191 LDFLAGS="$LDFLAGS -L$CURSESLIBDIR"
193 LIBS="$CURSESLIB $LIBS"
195 AC_TRY_LINK([#include <panel.h>], [set_escdelay(100);],[HAVE_CURSES_ESCDELAY="yes"])
196 if test "$HAVE_CURSES_ESCDELAY" = "yes"; then
197 AC_DEFINE([HAVE_CURSES_ESCDELAY], 1, [Have curses set_escdelay])
200 if test "$USE_NLS" = "yes"; then
201 AC_MSG_CHECKING([for curses NLS support])
202 dnl In theory, a single-byte curses works just fine in ISO 8859-* locales.
203 dnl In practice, however, everybody uses UTF-8 nowadays, so we'd better
204 dnl check for wide-character support.
205 dnl For ncurses/ncursesw, CURSES_NLS was already set above.
206 if test "$curseslib" = "curses"; then
208 #define _XOPEN_SOURCE 1
209 #define _XOPEN_SOURCE_EXTENDED 1
213 setcchar(&wc, L"x", A_NORMAL, 0, 0);
217 AC_MSG_RESULT([$CURSES_NLS])
218 if test "$CURSES_NLS" = "yes"; then
219 AC_DEFINE([ENABLE_NLS_IN_CURSES], [1],
220 [Define if curses-based programs can show translated messages.])
224 AC_CHECK_HEADERS([panel.h menu.h form.h], [],
225 [AC_MSG_ERROR([required curses helper header not found])])
226 AC_CHECK_LIB([panel$NCURSESLIBSUFFIX], [new_panel],
227 [CURSESLIB="-lpanel$NCURSESLIBSUFFIX $CURSESLIB"],
228 [AC_MSG_ERROR([panel$NCURSESLIBSUFFIX library not found])])
229 AC_CHECK_LIB([menu$NCURSESLIBSUFFIX], [new_menu],
230 [CURSESLIB="-lmenu$NCURSESLIBSUFFIX $CURSESLIB"],
231 [AC_MSG_ERROR([menu$NCURSESLIBSUFFIX library not found])])
232 AC_CHECK_LIB([form$NCURSESLIBSUFFIX], [new_form],
233 [CURSESLIB="-lform$NCURSESLIBSUFFIX $CURSESLIB"],
234 [AC_MSG_ERROR([form$NCURSESLIBSUFFIX library not found])])
236 CFLAGS="$saved_CFLAGS"
237 LDFLAGS="$saved_LDFLAGS"
240 if test -n "$CURSESLIBDIR"; then
241 CURSESLIB="-L$CURSESLIBDIR $CURSESLIB"
244 AC_MSG_CHECKING([for curses linker flags])
245 AC_MSG_RESULT([$CURSESLIB])
250 AC_SUBST(CURSES_CFLAGS)
252 test "x$prefix" = xNONE && prefix=$ac_default_prefix
257 *) dir="$prefix/share"
260 soundsdir="$dir/sounds/alsa"
261 AC_DEFINE_UNQUOTED(SOUNDSDIR, "$soundsdir", [directory containing sample data])
263 mydatadir="$dir/alsa"
264 AC_DEFINE_UNQUOTED(DATADIR, "$mydatadir", [directory containing alsa configuration])
266 AC_ARG_WITH(testsound,
267 [ --with-testsound=file give the path of test sound file for alsaconf],
268 TESTSOUND="$withval",
269 TESTSOUND="$dir/test.wav")
272 AM_CONFIG_HEADER(include/aconfig.h)
274 dnl Checks for typedefs, structures, and compiler characteristics.
279 dnl Checks for library functions.
280 AC_PROG_GCC_TRADITIONAL
282 dnl Enable largefile support
289 dnl Check for systemd
291 AC_ARG_WITH([systemdsystemunitdir],
292 AS_HELP_STRING([--with-systemdsystemunitdir=DIR], [Directory for systemd service files]),
293 [], [with_systemdsystemunitdir=$($PKG_CONFIG --variable=systemdsystemunitdir systemd)])
294 if test "x$with_systemdsystemunitdir" != xno; then
295 AC_SUBST([systemdsystemunitdir], [$with_systemdsystemunitdir])
297 AM_CONDITIONAL(HAVE_SYSTEMD, [test -n "$with_systemdsystemunitdir" -a "x$with_systemdsystemunitdir" != xno ])
299 AC_ARG_WITH([asound-state-dir],
300 AS_HELP_STRING([--with-asound-state-dir=DIR], [Directory to place asound.state file in]),
301 [ASOUND_STATE_DIR="$withval"],
302 [ASOUND_STATE_DIR="/var/lib/alsa"])
303 AC_SUBST(ASOUND_STATE_DIR)
305 AC_OUTPUT(Makefile alsactl/Makefile alsactl/init/Makefile \
306 alsamixer/Makefile amidi/Makefile amixer/Makefile \
307 m4/Makefile po/Makefile.in \
308 alsaconf/alsaconf alsaconf/Makefile \
309 alsaconf/po/Makefile \
311 aplay/Makefile include/Makefile iecset/Makefile utils/Makefile \
312 utils/alsa-utils.spec seq/Makefile seq/aconnect/Makefile \
313 seq/aplaymidi/Makefile seq/aseqdump/Makefile seq/aseqnet/Makefile \
314 speaker-test/Makefile speaker-test/samples/Makefile \