resetting manifest requested domain to floor
[platform/upstream/alsa-utils.git] / configure.ac
1 dnl Process this file with autoconf to produce a configure script.
2 AC_PREREQ(2.59)
3 AC_INIT(alsa-utils, 1.0.28)
4 AC_CONFIG_SRCDIR([aplay/aplay.c])
5 AC_PREFIX_DEFAULT(/usr)
6 AM_INIT_AUTOMAKE
7
8 AM_MAINTAINER_MODE([enable])
9
10 AM_GNU_GETTEXT([external])
11 AM_GNU_GETTEXT_VERSION([0.15])
12
13 dnl Checks for programs.
14
15 dnl try to gues cross-compiler if not set
16 if test "x$target" != "x$host" -a -z "`echo $CC | grep -e '-gcc'`";
17 then
18   AC_MSG_CHECKING(for cross-compiler)
19
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
25
26   AC_MSG_RESULT($CC)
27 fi
28
29 AC_PROG_CC
30 dnl AC_PROG_CXX
31 AC_PROG_INSTALL
32 AC_PROG_MKDIR_P
33 AC_PROG_LN_S
34 AC_PROG_SED
35 PKG_PROG_PKG_CONFIG
36 AM_PATH_ALSA(1.0.27)
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])])
40 fi
41
42 dnl Check components
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([samplerate.h], [have_samplerate="yes"], [have_samplerate="no"],
52   [#include <samplerate.h>])
53
54 AM_CONDITIONAL(HAVE_PCM, test "$have_pcm" = "yes")
55 AM_CONDITIONAL(HAVE_MIXER, test "$have_mixer" = "yes")
56 AM_CONDITIONAL(HAVE_RAWMIDI, test "$have_rawmidi" = "yes")
57 AM_CONDITIONAL(HAVE_SEQ, test "$have_seq" = "yes")
58 AM_CONDITIONAL(HAVE_SAMPLERATE, test "$have_samplerate" = "yes")
59
60 dnl Check for librt
61 LIBRT=""
62 AC_MSG_CHECKING(for librt)
63 AC_ARG_WITH(librt,
64   AS_HELP_STRING([--with-librt], [Use librt for monotonic clock (default = yes)]),
65   [ have_librt="$withval" ], [ have_librt="yes" ])
66 if test "$have_librt" = "yes"; then
67   AC_CHECK_LIB([rt], [clock_gettime], [HAVE_LIBRT="yes"])
68   if test "$HAVE_LIBRT" = "yes" ; then
69     LIBRT="-lrt"
70     AC_DEFINE([HAVE_LIBRT], 1, [Have librt])
71     AC_DEFINE([HAVE_CLOCK_GETTIME], 1, [Have clock gettime])
72   fi
73 else
74   AC_MSG_RESULT(no)
75 fi
76
77 dnl Disable alsamixer
78 CURSESINC=""
79 CURSESLIB=""
80 CURSES_CFLAGS=""
81 alsamixer=
82 if test "$have_mixer" = "yes"; then
83 AC_ARG_ENABLE(alsamixer,
84      AS_HELP_STRING([--disable-alsamixer], [Disable alsamixer compilation]),
85      [case "${enableval}" in
86        yes) alsamixer=true ;;
87        no)  alsamixer=false ;;
88        *) AC_MSG_ERROR(bad value ${enableval} for --enable-alsamixer) ;;
89      esac],[alsamixer=true])
90 fi
91 AM_CONDITIONAL(ALSAMIXER, test x$alsamixer = xtrue)
92
93 dnl Disable alsaconf
94 AC_ARG_ENABLE(alsaconf,
95      AS_HELP_STRING([--disable-alsaconf], [Disable alsaconf packaging]),
96      [case "${enableval}" in
97        yes) alsaconf=true ;;
98        no)  alsaconf=false ;;
99        *) AC_MSG_ERROR(bad value ${enableval} for --enable-alsaconf) ;;
100      esac],[alsaconf=true])
101 AM_CONDITIONAL(ALSACONF, test x$alsaconf = xtrue)
102
103 dnl Disable alsaloop
104 AC_ARG_ENABLE(alsaloop,
105      AS_HELP_STRING([--disable-alsaloop], [Disable alsaloop packaging]),
106      [case "${enableval}" in
107        yes) alsaloop=true ;;
108        no)  alsaloop=false ;;
109        *) AC_MSG_ERROR(bad value ${enableval} for --enable-alsaloop) ;;
110      esac],[alsaloop=true])
111 AM_CONDITIONAL(ALSALOOP, test x$alsaloop = xtrue)
112
113 xmlto=""
114 AC_ARG_ENABLE(xmlto,
115  AS_HELP_STRING([--disable-xmlto], [Disable man page creation via xmlto]),
116  xmlto="$enableval", xmlto="yes")
117 if test "$xmlto" = "yes"; then
118   AC_CHECK_PROG([xmlto], [xmlto], [yes])
119 fi
120 AM_CONDITIONAL(USE_XMLTO, test x"$xmlto" = xyes)
121
122 AC_ARG_WITH(
123         [udev-rules-dir],
124         AS_HELP_STRING([--with-udev-rules-dir=DIR],[Directory where to install udev rules to (default=auto)]),
125         [udevrulesdir="$withval"],
126         [udevdir=$($PKG_CONFIG udev --variable=udevdir)
127         if test "x$udevdir" = "x"; then
128             udevrulesdir="/lib/udev/rules.d"
129         else
130             udevrulesdir="$udevdir/rules.d"
131         fi])
132 AC_SUBST(udevrulesdir)
133
134 dnl Checks for header files.
135 AC_HEADER_STDC
136 if test x$alsamixer = xtrue; then
137   AC_ARG_WITH(curses,
138     AS_HELP_STRING([--with-curses=libname], [Specify the curses library to use (default=auto)]),
139     curseslib="$withval",
140     curseslib="auto")
141   CURSESLIBDIR=""
142   NCURSESLIBSUFFIX=""
143   CURSES_NLS="no"
144   if test "$curseslib" = "ncursesw" -o \( "$curseslib" = "auto" -a "$USE_NLS" = "yes" \); then
145     dnl First try out pkg-config, then fall back to old config scripts.
146     PKG_CHECK_MODULES([NCURSESW], [ncursesw], [
147         CURSESINC="<ncurses.h>"
148         CURSESLIB="${NCURSESW_LIBS}"
149         CURSESLIBDIR=
150         CURSES_CFLAGS="${NCURSESW_CFLAGS}"
151         curseslib="ncursesw"
152       ], [
153         AC_CHECK_PROG([ncursesw5_config], [ncursesw5-config], [yes])
154         if test "$ncursesw5_config" = "yes"; then
155           CURSESINC="<ncurses.h>"
156           CURSESLIB=`ncursesw5-config --libs`
157           CURSESLIBDIR=`ncursesw5-config --libdir`
158           CURSES_CFLAGS=`ncursesw5-config --cflags`
159           curseslib="ncursesw"
160         else
161           AC_CHECK_LIB(ncursesw, initscr,
162                      [ CURSESINC='<ncurses.h>'; CURSESLIB='-lncursesw'; curseslib="ncursesw"])
163         fi
164       ])
165     if test -n "$CURSESINC"; then
166       NCURSESLIBSUFFIX="w"
167       CURSES_NLS="yes"
168     fi
169   fi
170   if test "$curseslib" = "ncurses" -o "$curseslib" = "auto"; then
171     dnl First try out pkg-config, then fall back to old config scripts.
172     PKG_CHECK_MODULES([NCURSES], [ncurses], [
173         CURSESINC="<ncurses.h>"
174         CURSESLIB="${NCURSES_LIBS}"
175         CURSESLIBDIR=
176         CURSES_CFLAGS="${NCURSES_CFLAGS}"
177         curseslib="ncurses"
178       ], [
179         AC_CHECK_PROG([ncurses5_config], [ncurses5-config], [yes])
180         if test "$ncurses5_config" = "yes"; then
181           CURSESINC="<ncurses.h>"
182           CURSESLIB=`ncurses5-config --libs`
183           CURSESLIBDIR=`ncurses5-config --libdir`
184           CURSES_CFLAGS=`ncurses5-config --cflags`
185           curseslib="ncurses"
186         else
187           AC_CHECK_LIB(ncurses, initscr,
188                      [ CURSESINC='<ncurses.h>'; CURSESLIB='-lncurses'; curseslib="ncurses"])
189         fi
190       ])
191   fi
192   if test "$curseslib" = "curses" -o "$curseslib" = "auto"; then
193     AC_CHECK_LIB(curses, initscr,
194                  [ CURSESINC='<curses.h>'; CURSESLIB='-lcurses'; curseslib="curses"])
195   fi
196   if test -z "$CURSESINC"; then
197      AC_MSG_ERROR(this packages requires a curses library)
198   fi
199
200   AC_MSG_CHECKING([for curses library])
201   AC_MSG_RESULT([$curseslib])
202   AC_MSG_CHECKING([for curses header name])
203   AC_MSG_RESULT([$CURSESINC])
204   AC_MSG_CHECKING([for curses compiler flags])
205   AC_MSG_RESULT([$CURSES_CFLAGS])
206
207   dnl CURSESLIBS might have the library path at the beginning.  If so, we cut it
208   dnl off so that we can insert the other curses libraries before the ncurses
209   dnl library but after the library path (which is later again prepended below).
210   if test -n "$CURSESLIBDIR"; then
211     if test "-L$CURSESLIBDIR " = "$(echo $CURSESLIB | cut -c-$((${#CURSESLIBDIR}+3)) )"; then
212       CURSESLIB="$(echo $CURSESLIB | cut -c$((${#CURSESLIBDIR}+4))-)"
213     fi
214   fi
215
216   saved_CFLAGS="$CFLAGS"
217   saved_LDFLAGS="$LDFLAGS"
218   saved_LIBS="$LIBS"
219   CFLAGS="$CFLAGS $CURSES_CFLAGS"
220   if test -n "$CURSESLIBDIR"; then
221     LDFLAGS="$LDFLAGS -L$CURSESLIBDIR"
222   fi
223   LIBS="$CURSESLIB $LIBS"
224
225   AC_TRY_LINK([#include <panel.h>], [set_escdelay(100);],[HAVE_CURSES_ESCDELAY="yes"])
226   if test "$HAVE_CURSES_ESCDELAY" = "yes"; then
227     AC_DEFINE([HAVE_CURSES_ESCDELAY], 1, [Have curses set_escdelay])
228   fi
229
230   if test "$USE_NLS" = "yes"; then
231     AC_MSG_CHECKING([for curses NLS support])
232     dnl In theory, a single-byte curses works just fine in ISO 8859-* locales.
233     dnl In practice, however, everybody uses UTF-8 nowadays, so we'd better
234     dnl check for wide-character support.
235     dnl For ncurses/ncursesw, CURSES_NLS was already set above.
236     if test "$curseslib" = "curses"; then
237       AC_TRY_LINK([
238           #define _XOPEN_SOURCE 1
239           #define _XOPEN_SOURCE_EXTENDED 1
240           #include <curses.h>
241         ], [
242           cchar_t wc;
243           setcchar(&wc, L"x", A_NORMAL, 0, 0);
244         ],
245         [CURSES_NLS="yes"])
246     fi
247     AC_MSG_RESULT([$CURSES_NLS])
248     if test "$CURSES_NLS" = "yes"; then
249       AC_DEFINE([ENABLE_NLS_IN_CURSES], [1],
250                 [Define if curses-based programs can show translated messages.])
251     fi
252   fi
253
254   AC_CHECK_HEADERS([panel.h menu.h form.h], [],
255                    [AC_MSG_ERROR([required curses helper header not found])])
256   AC_CHECK_LIB([panel$NCURSESLIBSUFFIX], [new_panel],
257                [CURSESLIB="-lpanel$NCURSESLIBSUFFIX $CURSESLIB"],
258                [AC_MSG_ERROR([panel$NCURSESLIBSUFFIX library not found])])
259   AC_CHECK_LIB([menu$NCURSESLIBSUFFIX], [new_menu],
260                [CURSESLIB="-lmenu$NCURSESLIBSUFFIX $CURSESLIB"],
261                [AC_MSG_ERROR([menu$NCURSESLIBSUFFIX library not found])])
262   AC_CHECK_LIB([form$NCURSESLIBSUFFIX], [new_form],
263                [CURSESLIB="-lform$NCURSESLIBSUFFIX $CURSESLIB"],
264                [AC_MSG_ERROR([form$NCURSESLIBSUFFIX library not found])])
265
266   CFLAGS="$saved_CFLAGS"
267   LDFLAGS="$saved_LDFLAGS"
268   LIBS="$saved_LIBS"
269
270   if test -n "$CURSESLIBDIR"; then
271     CURSESLIB="-L$CURSESLIBDIR $CURSESLIB"
272   fi
273
274   AC_MSG_CHECKING([for curses linker flags])
275   AC_MSG_RESULT([$CURSESLIB])
276 fi
277
278 AC_SUBST(CURSESINC)
279 AC_SUBST(CURSESLIB)
280 AC_SUBST(CURSES_CFLAGS)
281
282 test "x$prefix" = xNONE && prefix=$ac_default_prefix
283
284 eval dir="$datadir"
285 case "$dir" in
286 /*) ;;
287 *) dir="$prefix/share"
288 esac
289
290 soundsdir="$dir/sounds/alsa"
291 AC_DEFINE_UNQUOTED(SOUNDSDIR, "$soundsdir", [directory containing sample data])
292
293 mydatadir="$dir/alsa"
294 AC_DEFINE_UNQUOTED(DATADIR, "$mydatadir", [directory containing alsa configuration])
295 AC_SUBST(mydatadir)
296
297 AC_ARG_WITH(testsound,
298   AS_HELP_STRING([--with-testsound=file], [give the path of test sound file for alsaconf]),
299   TESTSOUND="$withval",
300   TESTSOUND="$dir/test.wav")
301 AC_SUBST(TESTSOUND)
302
303 AC_CONFIG_HEADERS(include/aconfig.h)
304
305 dnl Checks for typedefs, structures, and compiler characteristics.
306 AC_C_CONST
307 AC_C_INLINE
308 AC_HEADER_TIME
309
310 dnl Checks for library functions.
311 AC_PROG_GCC_TRADITIONAL
312
313 dnl Enable largefile support
314 AC_SYS_LARGEFILE
315
316 SAVE_UTIL_VERSION
317
318 AC_SUBST(LIBRT)
319
320 dnl Check for systemd
321 AC_ARG_WITH([systemdsystemunitdir],
322         AS_HELP_STRING([--with-systemdsystemunitdir=DIR], [Directory for systemd service files]),
323         [], [with_systemdsystemunitdir=$($PKG_CONFIG --variable=systemdsystemunitdir systemd)])
324 if test "x$with_systemdsystemunitdir" != xno; then
325         AC_SUBST([systemdsystemunitdir], [$with_systemdsystemunitdir])
326 fi
327 AM_CONDITIONAL(HAVE_SYSTEMD, [test -n "$with_systemdsystemunitdir" -a "x$with_systemdsystemunitdir" != xno ])
328
329 AC_ARG_WITH([asound-state-dir],
330         AS_HELP_STRING([--with-asound-state-dir=DIR], [Directory to place asound.state file in]),
331         [ASOUND_STATE_DIR="$withval"],
332         [ASOUND_STATE_DIR="/var/lib/alsa"])
333 AC_SUBST(ASOUND_STATE_DIR)
334
335 AC_ARG_WITH([alsactl-lock-dir],
336         AS_HELP_STRING([--with-alsactl-lock-dir=DIR], [Directory to place lock files in]),
337         [ASOUND_LOCK_DIR="$withval"],
338         [ASOUND_LOCK_DIR="/var/lock"])
339 AC_SUBST(ASOUND_LOCK_DIR)
340
341 AC_ARG_WITH([alsactl-pidfile-dir],
342         AS_HELP_STRING([--with-alsactl-pidfile-dir=DIR], [Directory to place alsactl.pid file in]),
343         [ALSACTL_PIDFILE_DIR="$withval"],
344         [ALSACTL_PIDFILE_DIR="/var/run"])
345 AC_SUBST(ALSACTL_PIDFILE_DIR)
346
347 AC_ARG_WITH([alsactl-daemonswitch],
348         AS_HELP_STRING([--with-alsactl-daemonswitch=FILE], [File to test for the daemon mode]),
349         [ALSACTL_DAEMONSWITCH="$withval"],
350         [ALSACTL_DAEMONSWITCH="/etc/alsa/state-daemon.conf"])
351 AC_SUBST(ALSACTL_DAEMONSWITCH)
352
353 AC_OUTPUT(Makefile alsactl/Makefile alsactl/init/Makefile \
354           alsamixer/Makefile amidi/Makefile amixer/Makefile \
355           m4/Makefile po/Makefile.in \
356           alsaconf/alsaconf alsaconf/Makefile \
357           alsaconf/po/Makefile \
358           alsaucm/Makefile \
359           aplay/Makefile include/Makefile iecset/Makefile utils/Makefile \
360           utils/alsa-utils.spec seq/Makefile seq/aconnect/Makefile \
361           seq/aplaymidi/Makefile seq/aseqdump/Makefile seq/aseqnet/Makefile \
362           speaker-test/Makefile speaker-test/samples/Makefile \
363           alsaloop/Makefile)