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.24.2)
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
34 AC_CHECK_HEADERS([alsa/pcm.h], [have_pcm="yes"], [have_pcm="no"],
35 [#include <alsa/asoundlib.h>])
36 AC_CHECK_HEADERS([alsa/mixer.h], [have_mixer="yes"], [have_mixer="no"],
37 [#include <alsa/asoundlib.h>])
38 AC_CHECK_HEADERS([alsa/rawmidi.h], [have_rawmidi="yes"], [have_rawmidi="no"],
39 [#include <alsa/asoundlib.h>])
40 AC_CHECK_HEADERS([alsa/seq.h], [have_seq="yes"], [have_seq="no"],
41 [#include <alsa/asoundlib.h>])
42 AC_CHECK_HEADERS([samplerate.h], [have_samplerate="yes"], [have_samplerate="no"],
43 [#include <samplerate.h>])
45 AM_CONDITIONAL(HAVE_PCM, test "$have_pcm" = "yes")
46 AM_CONDITIONAL(HAVE_MIXER, test "$have_mixer" = "yes")
47 AM_CONDITIONAL(HAVE_RAWMIDI, test "$have_rawmidi" = "yes")
48 AM_CONDITIONAL(HAVE_SEQ, test "$have_seq" = "yes")
49 AM_CONDITIONAL(HAVE_SAMPLERATE, test "$have_samplerate" = "yes")
53 AC_MSG_CHECKING(for librt)
55 AS_HELP_STRING([--with-librt], [Use librt for monotonic clock (default = yes)]),
56 [ have_librt="$withval" ], [ have_librt="yes" ])
57 if test "$have_librt" = "yes"; then
58 AC_CHECK_LIB([rt], [clock_gettime], [HAVE_LIBRT="yes"])
59 if test "$HAVE_LIBRT" = "yes" ; then
61 AC_DEFINE([HAVE_LIBRT], 1, [Have librt])
62 AC_DEFINE([HAVE_CLOCK_GETTIME], 1, [Have clock gettime])
73 if test "$have_mixer" = "yes"; then
74 AC_ARG_ENABLE(alsamixer,
75 [ --disable-alsamixer Disable alsamixer compilation],
76 [case "${enableval}" in
77 yes) alsamixer=true ;;
78 no) alsamixer=false ;;
79 *) AC_MSG_ERROR(bad value ${enableval} for --enable-alsamixer) ;;
80 esac],[alsamixer=true])
82 AM_CONDITIONAL(ALSAMIXER, test x$alsamixer = xtrue)
85 AC_ARG_ENABLE(alsaconf,
86 [ --disable-alsaconf Disable alsaconf packaging],
87 [case "${enableval}" in
90 *) AC_MSG_ERROR(bad value ${enableval} for --enable-alsaconf) ;;
91 esac],[alsaconf=true])
92 AM_CONDITIONAL(ALSACONF, test x$alsaconf = xtrue)
95 AC_ARG_ENABLE(alsaloop,
96 [ --disable-alsaloop Disable alsaloop packaging],
97 [case "${enableval}" in
100 *) AC_MSG_ERROR(bad value ${enableval} for --enable-alsaloop) ;;
101 esac],[alsaloop=true])
102 AM_CONDITIONAL(ALSALOOP, test x$alsaloop = xtrue)
106 AS_HELP_STRING([--disable-xmlto], [Disable man page creation via xmlto]),
107 xmlto="$enableval", xmlto="yes")
108 if test "$xmlto" = "yes"; then
109 AC_CHECK_PROG([xmlto], [xmlto], [yes])
111 AM_CONDITIONAL(USE_XMLTO, test x"$xmlto" = xyes)
115 AS_HELP_STRING([--with-udev-rules-dir],[Directory where to install udev rules to (defaults to /lib/udev/rules.d)]),
116 [udevrulesdir=$withval], [udevrulesdir="/lib/udev/rules.d"])
117 AC_SUBST(udevrulesdir)
119 dnl Checks for header files.
121 if test x$alsamixer = xtrue; then
123 [ --with-curses libname Specify the curses library to use (default=auto)],
124 curseslib="$withval",
129 if test "$curseslib" = "ncursesw" -o \( "$curseslib" = "auto" -a "$USE_NLS" = "yes" \); then
130 AC_CHECK_PROG([ncursesw5_config], [ncursesw5-config], [yes])
131 if test "$ncursesw5_config" = "yes"; then
132 CURSESINC="<ncurses.h>"
133 CURSESLIB=`ncursesw5-config --libs`
134 CURSESLIBDIR=`ncursesw5-config --libdir`
135 CURSES_CFLAGS=`ncursesw5-config --cflags`
138 AC_CHECK_LIB(ncursesw, initscr,
139 [ CURSESINC='<ncurses.h>'; CURSESLIB='-lncursesw'; curseslib="ncursesw"])
141 if test -n "$CURSESINC"; then
146 if test "$curseslib" = "ncurses" -o "$curseslib" = "auto"; then
147 AC_CHECK_PROG([ncurses5_config], [ncurses5-config], [yes])
148 if test "$ncurses5_config" = "yes"; then
149 CURSESINC="<ncurses.h>"
150 CURSESLIB=`ncurses5-config --libs`
151 CURSESLIBDIR=`ncurses5-config --libdir`
152 CURSES_CFLAGS=`ncurses5-config --cflags`
155 AC_CHECK_LIB(ncurses, initscr,
156 [ CURSESINC='<ncurses.h>'; CURSESLIB='-lncurses'; curseslib="ncurses"])
159 if test "$curseslib" = "curses" -o "$curseslib" = "auto"; then
160 AC_CHECK_LIB(curses, initscr,
161 [ CURSESINC='<curses.h>'; CURSESLIB='-lcurses'; curseslib="curses"])
163 if test -z "$CURSESINC"; then
164 AC_MSG_ERROR(this packages requires a curses library)
167 AC_MSG_CHECKING([for curses library])
168 AC_MSG_RESULT([$curseslib])
169 AC_MSG_CHECKING([for curses header name])
170 AC_MSG_RESULT([$CURSESINC])
171 AC_MSG_CHECKING([for curses compiler flags])
172 AC_MSG_RESULT([$CURSES_CFLAGS])
174 dnl CURSESLIBS might have the library path at the beginning. If so, we cut it
175 dnl off so that we can insert the other curses libraries before the ncurses
176 dnl library but after the library path (which is later again prepended below).
177 if test -n "$CURSESLIBDIR"; then
178 if test "-L$CURSESLIBDIR " = "$(echo $CURSESLIB | cut -c-$((${#CURSESLIBDIR}+3)) )"; then
179 CURSESLIB="$(echo $CURSESLIB | cut -c$((${#CURSESLIBDIR}+4))-)"
183 saved_CFLAGS="$CFLAGS"
184 saved_LDFLAGS="$LDFLAGS"
186 CFLAGS="$CFLAGS $CURSES_CFLAGS"
187 if test -n "$CURSESLIBDIR"; then
188 LDFLAGS="$LDFLAGS -L$CURSESLIBDIR"
190 LIBS="$CURSESLIB $LIBS"
192 AC_TRY_LINK([#include <panel.h>], [set_escdelay(100);],[HAVE_CURSES_ESCDELAY="yes"])
193 if test "$HAVE_CURSES_ESCDELAY" = "yes"; then
194 AC_DEFINE([HAVE_CURSES_ESCDELAY], 1, [Have curses set_escdelay])
197 if test "$USE_NLS" = "yes"; then
198 AC_MSG_CHECKING([for curses NLS support])
199 dnl In theory, a single-byte curses works just fine in ISO 8859-* locales.
200 dnl In practice, however, everybody uses UTF-8 nowadays, so we'd better
201 dnl check for wide-character support.
202 dnl For ncurses/ncursesw, CURSES_NLS was already set above.
203 if test "$curseslib" = "curses"; then
205 #define _XOPEN_SOURCE 1
206 #define _XOPEN_SOURCE_EXTENDED 1
210 setcchar(&wc, L"x", A_NORMAL, 0, 0);
214 AC_MSG_RESULT([$CURSES_NLS])
215 if test "$CURSES_NLS" = "yes"; then
216 AC_DEFINE([ENABLE_NLS_IN_CURSES], [1],
217 [Define if curses-based programs can show translated messages.])
221 AC_CHECK_HEADERS([panel.h menu.h form.h], [],
222 [AC_MSG_ERROR([required curses helper header not found])])
223 AC_CHECK_LIB([panel$NCURSESLIBSUFFIX], [new_panel],
224 [CURSESLIB="-lpanel$NCURSESLIBSUFFIX $CURSESLIB"],
225 [AC_MSG_ERROR([panel$NCURSESLIBSUFFIX library not found])])
226 AC_CHECK_LIB([menu$NCURSESLIBSUFFIX], [new_menu],
227 [CURSESLIB="-lmenu$NCURSESLIBSUFFIX $CURSESLIB"],
228 [AC_MSG_ERROR([menu$NCURSESLIBSUFFIX library not found])])
229 AC_CHECK_LIB([form$NCURSESLIBSUFFIX], [new_form],
230 [CURSESLIB="-lform$NCURSESLIBSUFFIX $CURSESLIB"],
231 [AC_MSG_ERROR([form$NCURSESLIBSUFFIX library not found])])
233 CFLAGS="$saved_CFLAGS"
234 LDFLAGS="$saved_LDFLAGS"
237 if test -n "$CURSESLIBDIR"; then
238 CURSESLIB="-L$CURSESLIBDIR $CURSESLIB"
241 AC_MSG_CHECKING([for curses linker flags])
242 AC_MSG_RESULT([$CURSESLIB])
247 AC_SUBST(CURSES_CFLAGS)
249 test "x$prefix" = xNONE && prefix=$ac_default_prefix
254 *) dir="$prefix/share"
257 soundsdir="$dir/sounds/alsa"
258 AC_DEFINE_UNQUOTED(SOUNDSDIR, "$soundsdir", [directory containing sample data])
260 mydatadir="$dir/alsa"
261 AC_DEFINE_UNQUOTED(DATADIR, "$mydatadir", [directory containing alsa configuration])
263 AC_ARG_WITH(testsound,
264 [ --with-testsound=file give the path of test sound file for alsaconf],
265 TESTSOUND="$withval",
266 TESTSOUND="$dir/test.wav")
269 AM_CONFIG_HEADER(include/aconfig.h)
271 dnl Checks for typedefs, structures, and compiler characteristics.
276 dnl Checks for library functions.
277 AC_PROG_GCC_TRADITIONAL
279 dnl Enable largefile support
286 dnl Check for systemd
288 AC_ARG_WITH([systemdsystemunitdir],
289 AS_HELP_STRING([--with-systemdsystemunitdir=DIR], [Directory for systemd service files]),
290 [], [with_systemdsystemunitdir=$($PKG_CONFIG --variable=systemdsystemunitdir systemd)])
291 if test "x$with_systemdsystemunitdir" != xno; then
292 AC_SUBST([systemdsystemunitdir], [$with_systemdsystemunitdir])
294 AM_CONDITIONAL(HAVE_SYSTEMD, [test -n "$with_systemdsystemunitdir" -a "x$with_systemdsystemunitdir" != xno ])
296 AC_ARG_WITH([asound-state-dir],
297 AS_HELP_STRING([--with-asound-state-dir=DIR], [Directory to place asound.state file in]),
298 [ASOUND_STATE_DIR="$withval"],
299 [ASOUND_STATE_DIR="/var/lib/alsa"])
300 AC_SUBST(ASOUND_STATE_DIR)
302 AC_OUTPUT(Makefile alsactl/Makefile alsactl/init/Makefile \
303 alsamixer/Makefile amidi/Makefile amixer/Makefile \
304 m4/Makefile po/Makefile.in \
305 alsaconf/alsaconf alsaconf/Makefile \
306 alsaconf/po/Makefile \
308 aplay/Makefile include/Makefile iecset/Makefile utils/Makefile \
309 utils/alsa-utils.spec seq/Makefile seq/aconnect/Makefile \
310 seq/aplaymidi/Makefile seq/aseqdump/Makefile seq/aseqnet/Makefile \
311 speaker-test/Makefile speaker-test/samples/Makefile \