OSDN Git Service

speaker-test: Always show chmap channel names if available
[android-x86/external-alsa-utils.git] / configure.in
1 dnl Process this file with autoconf to produce a configure script.
2 AC_PREREQ(2.59)
3 AC_INIT(aplay/aplay.c)
4 AC_PREFIX_DEFAULT(/usr)
5 AM_INIT_AUTOMAKE(alsa-utils, 1.0.27.2)
6
7 AM_MAINTAINER_MODE([enable])
8
9 AM_GNU_GETTEXT([external])
10 AM_GNU_GETTEXT_VERSION([0.15])
11
12 dnl Checks for programs.
13
14 dnl try to gues cross-compiler if not set
15 if test "x$target" != "x$host" -a -z "`echo $CC | grep -e '-gcc'`";
16 then
17   AC_MSG_CHECKING(for cross-compiler)
18
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
24
25   AC_MSG_RESULT($CC)
26 fi
27
28 AC_PROG_CC
29 dnl AC_PROG_CXX
30 AC_PROG_INSTALL
31 AC_PROG_MKDIR_P
32 AC_PROG_LN_S
33 AC_PROG_SED
34 PKG_PROG_PKG_CONFIG
35 AM_PATH_ALSA(1.0.27)
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])])
39 fi
40
41 dnl Check components
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>])
52
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")
58
59 dnl Check for librt
60 LIBRT=""
61 AC_MSG_CHECKING(for librt)
62 AC_ARG_WITH(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
68     LIBRT="-lrt"
69     AC_DEFINE([HAVE_LIBRT], 1, [Have librt])
70     AC_DEFINE([HAVE_CLOCK_GETTIME], 1, [Have clock gettime])
71   fi
72 else
73   AC_MSG_RESULT(no)
74 fi
75
76 dnl Disable alsamixer
77 CURSESINC=""
78 CURSESLIB=""
79 CURSES_CFLAGS=""
80 alsamixer=
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])
89 fi
90 AM_CONDITIONAL(ALSAMIXER, test x$alsamixer = xtrue)
91
92 dnl Disable alsaconf
93 AC_ARG_ENABLE(alsaconf,
94      AS_HELP_STRING([--disable-alsaconf], [Disable alsaconf packaging]),
95      [case "${enableval}" in
96        yes) alsaconf=true ;;
97        no)  alsaconf=false ;;
98        *) AC_MSG_ERROR(bad value ${enableval} for --enable-alsaconf) ;;
99      esac],[alsaconf=true])
100 AM_CONDITIONAL(ALSACONF, test x$alsaconf = xtrue)
101
102 dnl Disable alsaloop
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)
111
112 xmlto=""
113 AC_ARG_ENABLE(xmlto,
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])
118 fi
119 AM_CONDITIONAL(USE_XMLTO, test x"$xmlto" = xyes)
120
121 AC_ARG_WITH(
122         [udev-rules-dir],
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)
126
127 dnl Checks for header files.
128 AC_HEADER_STDC
129 if test x$alsamixer = xtrue; then
130   AC_ARG_WITH(curses,
131     AS_HELP_STRING([--with-curses=libname], [Specify the curses library to use (default=auto)]),
132     curseslib="$withval",
133     curseslib="auto")
134   CURSESLIBDIR=""
135   NCURSESLIBSUFFIX=""
136   CURSES_NLS="no"
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}"
142         CURSESLIBDIR=
143         CURSES_CFLAGS="${NCURSESW_CFLAGS}"
144         curseslib="ncursesw"
145       ], [
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`
152           curseslib="ncursesw"
153         else
154           AC_CHECK_LIB(ncursesw, initscr,
155                      [ CURSESINC='<ncurses.h>'; CURSESLIB='-lncursesw'; curseslib="ncursesw"])
156         fi
157       ])
158     if test -n "$CURSESINC"; then
159       NCURSESLIBSUFFIX="w"
160       CURSES_NLS="yes"
161     fi
162   fi
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}"
168         CURSESLIBDIR=
169         CURSES_CFLAGS="${NCURSES_CFLAGS}"
170         curseslib="ncurses"
171       ], [
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`
178           curseslib="ncurses"
179         else
180           AC_CHECK_LIB(ncurses, initscr,
181                      [ CURSESINC='<ncurses.h>'; CURSESLIB='-lncurses'; curseslib="ncurses"])
182         fi
183       ])
184   fi
185   if test "$curseslib" = "curses" -o "$curseslib" = "auto"; then
186     AC_CHECK_LIB(curses, initscr,
187                  [ CURSESINC='<curses.h>'; CURSESLIB='-lcurses'; curseslib="curses"])
188   fi
189   if test -z "$CURSESINC"; then
190      AC_MSG_ERROR(this packages requires a curses library)
191   fi
192
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])
199
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))-)"
206     fi
207   fi
208
209   saved_CFLAGS="$CFLAGS"
210   saved_LDFLAGS="$LDFLAGS"
211   saved_LIBS="$LIBS"
212   CFLAGS="$CFLAGS $CURSES_CFLAGS"
213   if test -n "$CURSESLIBDIR"; then
214     LDFLAGS="$LDFLAGS -L$CURSESLIBDIR"
215   fi
216   LIBS="$CURSESLIB $LIBS"
217
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])
221   fi
222
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
230       AC_TRY_LINK([
231           #define _XOPEN_SOURCE 1
232           #define _XOPEN_SOURCE_EXTENDED 1
233           #include <curses.h>
234         ], [
235           cchar_t wc;
236           setcchar(&wc, L"x", A_NORMAL, 0, 0);
237         ],
238         [CURSES_NLS="yes"])
239     fi
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.])
244     fi
245   fi
246
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])])
258
259   CFLAGS="$saved_CFLAGS"
260   LDFLAGS="$saved_LDFLAGS"
261   LIBS="$saved_LIBS"
262
263   if test -n "$CURSESLIBDIR"; then
264     CURSESLIB="-L$CURSESLIBDIR $CURSESLIB"
265   fi
266
267   AC_MSG_CHECKING([for curses linker flags])
268   AC_MSG_RESULT([$CURSESLIB])
269 fi
270
271 AC_SUBST(CURSESINC)
272 AC_SUBST(CURSESLIB)
273 AC_SUBST(CURSES_CFLAGS)
274
275 test "x$prefix" = xNONE && prefix=$ac_default_prefix
276
277 eval dir="$datadir"
278 case "$dir" in
279 /*) ;;
280 *) dir="$prefix/share"
281 esac
282
283 soundsdir="$dir/sounds/alsa"
284 AC_DEFINE_UNQUOTED(SOUNDSDIR, "$soundsdir", [directory containing sample data])
285
286 mydatadir="$dir/alsa"
287 AC_DEFINE_UNQUOTED(DATADIR, "$mydatadir", [directory containing alsa configuration])
288
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")
293 AC_SUBST(TESTSOUND)
294
295 AC_CONFIG_HEADERS(include/aconfig.h)
296
297 dnl Checks for typedefs, structures, and compiler characteristics.
298 AC_C_CONST
299 AC_C_INLINE
300 AC_HEADER_TIME
301
302 dnl Checks for library functions.
303 AC_PROG_GCC_TRADITIONAL
304
305 dnl Enable largefile support
306 AC_SYS_LARGEFILE
307
308 SAVE_UTIL_VERSION
309
310 AC_SUBST(LIBRT)
311
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])
318 fi
319 AM_CONDITIONAL(HAVE_SYSTEMD, [test -n "$with_systemdsystemunitdir" -a "x$with_systemdsystemunitdir" != xno ])
320
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)
326
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)
332
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)
338
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 \
344           alsaucm/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 \
349           alsaloop/Makefile)