1c72fcc34Sopenharmony_cidnl Process this file with autoconf to produce a configure script.
2c72fcc34Sopenharmony_ciAC_PREREQ(2.59)
3c72fcc34Sopenharmony_ciAC_INIT(alsa-utils, 1.2.11)
4c72fcc34Sopenharmony_ciAC_CONFIG_SRCDIR([aplay/aplay.c])
5c72fcc34Sopenharmony_ciAC_PREFIX_DEFAULT(/usr)
6c72fcc34Sopenharmony_ciAM_INIT_AUTOMAKE([subdir-objects])
7c72fcc34Sopenharmony_ci
8c72fcc34Sopenharmony_ciAM_MAINTAINER_MODE([enable])
9c72fcc34Sopenharmony_ci
10c72fcc34Sopenharmony_ciAM_GNU_GETTEXT([external])
11c72fcc34Sopenharmony_ciAM_GNU_GETTEXT_VERSION([0.19.8])
12c72fcc34Sopenharmony_ci
13c72fcc34Sopenharmony_cidnl Checks for programs.
14c72fcc34Sopenharmony_ci
15c72fcc34Sopenharmony_ciAC_PROG_CC
16c72fcc34Sopenharmony_cidnl AC_PROG_CXX
17c72fcc34Sopenharmony_ciAC_PROG_INSTALL
18c72fcc34Sopenharmony_ciAC_PROG_MKDIR_P
19c72fcc34Sopenharmony_ciAC_PROG_LN_S
20c72fcc34Sopenharmony_ciAC_PROG_SED
21c72fcc34Sopenharmony_ciAC_DISABLE_STATIC
22c72fcc34Sopenharmony_ciAM_PROG_LIBTOOL
23c72fcc34Sopenharmony_ciPKG_PROG_PKG_CONFIG
24c72fcc34Sopenharmony_ciAM_PATH_ALSA(1.2.5)
25c72fcc34Sopenharmony_ciif test "x$enable_alsatest" = "xyes"; then
26c72fcc34Sopenharmony_ciAC_CHECK_FUNC([snd_ctl_elem_add_enumerated],
27c72fcc34Sopenharmony_ci	      , [AC_ERROR([No user enum control support in alsa-lib])])
28c72fcc34Sopenharmony_cifi
29c72fcc34Sopenharmony_ci
30c72fcc34Sopenharmony_ci
31c72fcc34Sopenharmony_ciAC_CHECK_HEADERS([dlfcn.h malloc.h])
32c72fcc34Sopenharmony_ci
33c72fcc34Sopenharmony_cidnl Check components
34c72fcc34Sopenharmony_ciAC_CHECK_HEADERS([alsa/pcm.h], [have_pcm="yes"], [have_pcm="no"],
35c72fcc34Sopenharmony_ci  [#include <alsa/asoundlib.h>])
36c72fcc34Sopenharmony_ciAC_CHECK_HEADERS([alsa/mixer.h], [have_mixer="yes"], [have_mixer="no"],
37c72fcc34Sopenharmony_ci  [#include <alsa/asoundlib.h>])
38c72fcc34Sopenharmony_ciAC_CHECK_HEADERS([alsa/rawmidi.h], [have_rawmidi="yes"], [have_rawmidi="no"],
39c72fcc34Sopenharmony_ci  [#include <alsa/asoundlib.h>])
40c72fcc34Sopenharmony_ciAC_CHECK_HEADERS([alsa/seq.h], [have_seq="yes"], [have_seq="no"],
41c72fcc34Sopenharmony_ci  [#include <alsa/asoundlib.h>])
42c72fcc34Sopenharmony_ciAC_CHECK_HEADERS([alsa/use-case.h], [have_ucm="yes"], [have_ucm="no"],
43c72fcc34Sopenharmony_ci  [#include <alsa/asoundlib.h>])
44c72fcc34Sopenharmony_ciAC_CHECK_HEADERS([alsa/topology.h], [have_topology="yes"], [have_topology="no"],
45c72fcc34Sopenharmony_ci  [#include <alsa/asoundlib.h>])
46c72fcc34Sopenharmony_ciAC_CHECK_HEADERS([samplerate.h], [have_samplerate="yes"], [have_samplerate="no"],
47c72fcc34Sopenharmony_ci  [#include <samplerate.h>])
48c72fcc34Sopenharmony_ci
49c72fcc34Sopenharmony_ciAC_CHECK_LIB([asound], [snd_seq_client_info_get_card], [HAVE_SEQ_CLIENT_INFO_GET_CARD="yes"])
50c72fcc34Sopenharmony_ciif test "$HAVE_SEQ_CLIENT_INFO_GET_CARD" = "yes" ; then
51c72fcc34Sopenharmony_ci    AC_DEFINE([HAVE_SEQ_CLIENT_INFO_GET_CARD], 1, [alsa-lib supports snd_seq_client_info_get_card])
52c72fcc34Sopenharmony_cifi
53c72fcc34Sopenharmony_ciAC_CHECK_LIB([asound], [snd_seq_client_info_get_pid], [HAVE_SEQ_CLIENT_INFO_GET_PID="yes"])
54c72fcc34Sopenharmony_ciif test "$HAVE_SEQ_CLIENT_INFO_GET_PID" = "yes" ; then
55c72fcc34Sopenharmony_ci    AC_DEFINE([HAVE_SEQ_CLIENT_INFO_GET_PID], 1, [alsa-lib supports snd_seq_client_info_get_pid])
56c72fcc34Sopenharmony_cifi
57c72fcc34Sopenharmony_ciAC_CHECK_LIB([asound], [snd_seq_client_info_get_midi_version], [HAVE_SEQ_CLIENT_INFO_GET_MIDI_VERSION="yes"])
58c72fcc34Sopenharmony_ciif test "$HAVE_SEQ_CLIENT_INFO_GET_MIDI_VERSION" = "yes" -a "$have_rawmidi" = "yes"; then
59c72fcc34Sopenharmony_ci    AC_DEFINE([HAVE_SEQ_CLIENT_INFO_GET_MIDI_VERSION], 1, [alsa-lib supports snd_seq_client_info_get_midi_version])
60c72fcc34Sopenharmony_cifi
61c72fcc34Sopenharmony_ciAC_CHECK_LIB([atopology], [snd_tplg_save], [have_topology="yes"], [have_topology="no"])
62c72fcc34Sopenharmony_ci
63c72fcc34Sopenharmony_ci#
64c72fcc34Sopenharmony_ci# NOTE: The library 'libffado' (at least v2.4.1) executes ctor/dtor of instances
65c72fcc34Sopenharmony_ci# for some objects in startup/finish routines of C runtime. As a result, it
66c72fcc34Sopenharmony_ci# outputs some superfluos messages. Furthermore, it brings much memory leak
67c72fcc34Sopenharmony_ci# internally. Totally, libffado support is not recommended at all in usual
68c72fcc34Sopenharmony_ci# purposes except for technical preview.
69c72fcc34Sopenharmony_ci#
70c72fcc34Sopenharmony_ciAC_CHECK_LIB([ffado], [ffado_streaming_init], [have_ffado="yes"], [have_ffado="no"])
71c72fcc34Sopenharmony_ciAS_IF([test x"$have_ffado" = xyes],
72c72fcc34Sopenharmony_ci      [AC_DEFINE([WITH_FFADO], [1], [Define if FFADO library is available])])
73c72fcc34Sopenharmony_ci
74c72fcc34Sopenharmony_ci# Test programs for axfer use shm by memfd_create(2). If not supported, open(2) is used alternatively.
75c72fcc34Sopenharmony_ciAC_CHECK_FUNC([memfd_create], [have_memfd_create="yes"], [have_memfd_create="no"])
76c72fcc34Sopenharmony_ciAS_IF([test x$have_memfd_create = xyes],
77c72fcc34Sopenharmony_ci      [AC_DEFINE([HAVE_MEMFD_CREATE], [1], [Define if Linux kernel supports memfd_create system call])])
78c72fcc34Sopenharmony_ci
79c72fcc34Sopenharmony_ciAM_CONDITIONAL(HAVE_PCM, test "$have_pcm" = "yes")
80c72fcc34Sopenharmony_ciAM_CONDITIONAL(HAVE_MIXER, test "$have_mixer" = "yes")
81c72fcc34Sopenharmony_ciAM_CONDITIONAL(HAVE_RAWMIDI, test "$have_rawmidi" = "yes")
82c72fcc34Sopenharmony_ciAM_CONDITIONAL(HAVE_SEQ, test "$have_seq" = "yes")
83c72fcc34Sopenharmony_ciAM_CONDITIONAL(HAVE_UCM, test "$have_ucm" = "yes")
84c72fcc34Sopenharmony_ciAM_CONDITIONAL(HAVE_TOPOLOGY, test "$have_topology" = "yes" -a "$ac_cv_header_dlfcn_h" = "yes")
85c72fcc34Sopenharmony_ciAM_CONDITIONAL(HAVE_SAMPLERATE, test "$have_samplerate" = "yes")
86c72fcc34Sopenharmony_ciAM_CONDITIONAL(HAVE_FFADO, test "$have_ffado" = "yes")
87c72fcc34Sopenharmony_ci
88c72fcc34Sopenharmony_cidnl Use tinyalsa
89c72fcc34Sopenharmony_cialsabat_backend_tiny=
90c72fcc34Sopenharmony_ciAC_ARG_ENABLE(alsabat_backend_tiny,
91c72fcc34Sopenharmony_ci    AS_HELP_STRING([--enable-alsabat-backend-tiny], [Use tinyalsa for alsabat backend]),
92c72fcc34Sopenharmony_ci    [case "${enableval}" in
93c72fcc34Sopenharmony_ci      yes) alsabat_backend_tiny=true ;;
94c72fcc34Sopenharmony_ci      no) alsabat_backend_tiny=false ;;
95c72fcc34Sopenharmony_ci      *) AC_MSG_ERROR(bad value ${enableval} for --enable-alsabat-backend-tiny) ;;
96c72fcc34Sopenharmony_ci    esac],[alsabat_backend_tiny=false])
97c72fcc34Sopenharmony_ci
98c72fcc34Sopenharmony_cidnl Disable bat
99c72fcc34Sopenharmony_cibat=
100c72fcc34Sopenharmony_ciif test "$have_pcm" = "yes"; then
101c72fcc34Sopenharmony_ciAC_ARG_ENABLE(bat,
102c72fcc34Sopenharmony_ci     AS_HELP_STRING([--disable-bat], [Disable bat compilation]),
103c72fcc34Sopenharmony_ci     [case "${enableval}" in
104c72fcc34Sopenharmony_ci       yes) bat=true ;;
105c72fcc34Sopenharmony_ci       no)  bat=false ;;
106c72fcc34Sopenharmony_ci       *) AC_MSG_ERROR(bad value ${enableval} for --enable-bat) ;;
107c72fcc34Sopenharmony_ci     esac],[bat=true])
108c72fcc34Sopenharmony_cifi
109c72fcc34Sopenharmony_ciAM_CONDITIONAL(BAT, test x$bat = xtrue)
110c72fcc34Sopenharmony_ci
111c72fcc34Sopenharmony_ciif test x$bat = xtrue; then
112c72fcc34Sopenharmony_ci
113c72fcc34Sopenharmony_ci  saved_CFLAGS="$CFLAGS"
114c72fcc34Sopenharmony_ci  saved_LDFLAGS="$LDFLAGS"
115c72fcc34Sopenharmony_ci  saved_LIBS="$LIBS"
116c72fcc34Sopenharmony_ci  FFTW_INC=""
117c72fcc34Sopenharmony_ci  FFTW_LIB=""
118c72fcc34Sopenharmony_ci  FFTW_CFLAGS=""
119c72fcc34Sopenharmony_ci  dnl Check for libfftw3
120c72fcc34Sopenharmony_ci  have_libfftw3="yes"
121c72fcc34Sopenharmony_ci  AC_CHECK_LIB([fftw3f], [fftwf_malloc], , [have_libfftw3="no"])
122c72fcc34Sopenharmony_ci  dnl Check for libtinyalsa
123c72fcc34Sopenharmony_ci  have_libtinyalsa=
124c72fcc34Sopenharmony_ci  if test x$alsabat_backend_tiny = xtrue; then
125c72fcc34Sopenharmony_ci    have_libtinyalsa="yes"
126c72fcc34Sopenharmony_ci    AC_CHECK_LIB([tinyalsa], [pcm_open], , [have_libtinyalsa="no"])
127c72fcc34Sopenharmony_ci  fi
128c72fcc34Sopenharmony_ci  AC_CHECK_LIB([m], [sqrtf], , [AC_MSG_ERROR([Error: Need sqrtf])])
129c72fcc34Sopenharmony_ci  AC_CHECK_LIB([pthread], [pthread_create], , [AC_MSG_ERROR([Error: need PTHREAD library])])
130c72fcc34Sopenharmony_ci  FFTW_CFLAGS="$CFLAGS"
131c72fcc34Sopenharmony_ci  FFTW_LIB="$LIBS"
132c72fcc34Sopenharmony_ci  CFLAGS="$saved_CFLAGS"
133c72fcc34Sopenharmony_ci  LDFLAGS="$saved_LDFLAGS"
134c72fcc34Sopenharmony_ci  LIBS="$saved_LIBS"
135c72fcc34Sopenharmony_ci  AC_SUBST(FFTW_INC)
136c72fcc34Sopenharmony_ci  AC_SUBST(FFTW_LIB)
137c72fcc34Sopenharmony_ci  AC_SUBST(FFTW_CFLAGS)
138c72fcc34Sopenharmony_ci
139c72fcc34Sopenharmony_cifi
140c72fcc34Sopenharmony_ciAM_CONDITIONAL(HAVE_LIBFFTW3, test "$have_libfftw3" = "yes")
141c72fcc34Sopenharmony_ciAM_CONDITIONAL(HAVE_LIBTINYALSA, test "$have_libtinyalsa" = "yes")
142c72fcc34Sopenharmony_ci
143c72fcc34Sopenharmony_cidnl Check for librt
144c72fcc34Sopenharmony_ciLIBRT=""
145c72fcc34Sopenharmony_ciAC_MSG_CHECKING(for librt)
146c72fcc34Sopenharmony_ciAC_ARG_WITH(librt,
147c72fcc34Sopenharmony_ci  AS_HELP_STRING([--with-librt], [Use librt for monotonic clock (default = yes)]),
148c72fcc34Sopenharmony_ci  [ have_librt="$withval" ], [ have_librt="yes" ])
149c72fcc34Sopenharmony_ciif test "$have_librt" = "yes"; then
150c72fcc34Sopenharmony_ci  AC_CHECK_LIB([rt], [clock_gettime], [HAVE_LIBRT="yes"])
151c72fcc34Sopenharmony_ci  if test "$HAVE_LIBRT" = "yes" ; then
152c72fcc34Sopenharmony_ci    LIBRT="-lrt"
153c72fcc34Sopenharmony_ci    AC_DEFINE([HAVE_LIBRT], 1, [Have librt])
154c72fcc34Sopenharmony_ci    AC_DEFINE([HAVE_CLOCK_GETTIME], 1, [Have clock gettime])
155c72fcc34Sopenharmony_ci  fi
156c72fcc34Sopenharmony_cielse
157c72fcc34Sopenharmony_ci  AC_MSG_RESULT(no)
158c72fcc34Sopenharmony_cifi
159c72fcc34Sopenharmony_ci
160c72fcc34Sopenharmony_cidnl Disable alsamixer
161c72fcc34Sopenharmony_ciCURSESINC=""
162c72fcc34Sopenharmony_ciCURSESLIB=""
163c72fcc34Sopenharmony_ciCURSES_CFLAGS=""
164c72fcc34Sopenharmony_cialsamixer=
165c72fcc34Sopenharmony_ciif test "$have_mixer" = "yes"; then
166c72fcc34Sopenharmony_ciAC_ARG_ENABLE(alsamixer,
167c72fcc34Sopenharmony_ci     AS_HELP_STRING([--disable-alsamixer], [Disable alsamixer compilation]),
168c72fcc34Sopenharmony_ci     [case "${enableval}" in
169c72fcc34Sopenharmony_ci       yes) alsamixer=true ;;
170c72fcc34Sopenharmony_ci       no)  alsamixer=false ;;
171c72fcc34Sopenharmony_ci       *) AC_MSG_ERROR(bad value ${enableval} for --enable-alsamixer) ;;
172c72fcc34Sopenharmony_ci     esac],[alsamixer=true])
173c72fcc34Sopenharmony_cifi
174c72fcc34Sopenharmony_ciAM_CONDITIONAL(ALSAMIXER, test x$alsamixer = xtrue)
175c72fcc34Sopenharmony_ci
176c72fcc34Sopenharmony_cidnl Disable alsaconf
177c72fcc34Sopenharmony_ciAC_ARG_ENABLE(alsaconf,
178c72fcc34Sopenharmony_ci     AS_HELP_STRING([--disable-alsaconf], [Disable alsaconf packaging]),
179c72fcc34Sopenharmony_ci     [case "${enableval}" in
180c72fcc34Sopenharmony_ci       yes) alsaconf=true ;;
181c72fcc34Sopenharmony_ci       no)  alsaconf=false ;;
182c72fcc34Sopenharmony_ci       *) AC_MSG_ERROR(bad value ${enableval} for --enable-alsaconf) ;;
183c72fcc34Sopenharmony_ci     esac],[alsaconf=true])
184c72fcc34Sopenharmony_ciAM_CONDITIONAL(ALSACONF, test x$alsaconf = xtrue)
185c72fcc34Sopenharmony_ci
186c72fcc34Sopenharmony_cidnl Disable alsaloop
187c72fcc34Sopenharmony_ciAC_ARG_ENABLE(alsaloop,
188c72fcc34Sopenharmony_ci     AS_HELP_STRING([--disable-alsaloop], [Disable alsaloop packaging]),
189c72fcc34Sopenharmony_ci     [case "${enableval}" in
190c72fcc34Sopenharmony_ci       yes) alsaloop=true ;;
191c72fcc34Sopenharmony_ci       no)  alsaloop=false ;;
192c72fcc34Sopenharmony_ci       *) AC_MSG_ERROR(bad value ${enableval} for --enable-alsaloop) ;;
193c72fcc34Sopenharmony_ci     esac],[alsaloop=true])
194c72fcc34Sopenharmony_ciAM_CONDITIONAL(ALSALOOP, test x$alsaloop = xtrue)
195c72fcc34Sopenharmony_ci
196c72fcc34Sopenharmony_cidnl Disable nhlt
197c72fcc34Sopenharmony_ciAC_ARG_ENABLE(nhlt,
198c72fcc34Sopenharmony_ci     AS_HELP_STRING([--disable-nhlt], [Disable nhlt packaging]),
199c72fcc34Sopenharmony_ci     [case "${enableval}" in
200c72fcc34Sopenharmony_ci       yes) nhlt=true ;;
201c72fcc34Sopenharmony_ci       no)  nhlt=false ;;
202c72fcc34Sopenharmony_ci       *) AC_MSG_ERROR(bad value ${enableval} for --enable-nhlt) ;;
203c72fcc34Sopenharmony_ci     esac],[nhlt=true])
204c72fcc34Sopenharmony_ciAM_CONDITIONAL(NHLT, test x$nhlt = xtrue)
205c72fcc34Sopenharmony_ci
206c72fcc34Sopenharmony_cixmlto_available=""
207c72fcc34Sopenharmony_ciAC_ARG_ENABLE(xmlto,
208c72fcc34Sopenharmony_ci AS_HELP_STRING([--disable-xmlto], [Disable man page creation via xmlto]),
209c72fcc34Sopenharmony_ci xmlto="$enableval", xmlto="yes")
210c72fcc34Sopenharmony_ciif test "$xmlto" = "yes"; then
211c72fcc34Sopenharmony_ci  AC_CHECK_PROG([xmlto_available], [xmlto], [yes])
212c72fcc34Sopenharmony_cifi
213c72fcc34Sopenharmony_ciAM_CONDITIONAL(USE_XMLTO, test x"$xmlto_available" = xyes)
214c72fcc34Sopenharmony_ci
215c72fcc34Sopenharmony_cirst2man_available=""
216c72fcc34Sopenharmony_ciAC_ARG_ENABLE(rst2man,
217c72fcc34Sopenharmony_ci AS_HELP_STRING([--disable-rst2man], [Disable man page creation via rst2man]),
218c72fcc34Sopenharmony_ci rst2man="$enableval", rst2man="yes")
219c72fcc34Sopenharmony_ciif test "$rst2man" = "yes"; then
220c72fcc34Sopenharmony_ci  AC_CHECK_PROG([rst2man_available], [rst2man], [yes])
221c72fcc34Sopenharmony_cifi
222c72fcc34Sopenharmony_ciAM_CONDITIONAL(USE_RST2MAN, test x"$rst2man_available" = xyes)
223c72fcc34Sopenharmony_ci
224c72fcc34Sopenharmony_ciAC_ARG_WITH(
225c72fcc34Sopenharmony_ci        [udev-rules-dir],
226c72fcc34Sopenharmony_ci        AS_HELP_STRING([--with-udev-rules-dir=DIR],[Directory where to install udev rules to (default=auto)]),
227c72fcc34Sopenharmony_ci        [udevrulesdir="$withval"],
228c72fcc34Sopenharmony_ci        [udevdir=$($PKG_CONFIG udev --variable=udevdir)
229c72fcc34Sopenharmony_ci        if test "x$udevdir" = "x"; then
230c72fcc34Sopenharmony_ci            udevrulesdir="/lib/udev/rules.d"
231c72fcc34Sopenharmony_ci        else
232c72fcc34Sopenharmony_ci            udevrulesdir="$udevdir/rules.d"
233c72fcc34Sopenharmony_ci        fi])
234c72fcc34Sopenharmony_ciAC_SUBST(udevrulesdir)
235c72fcc34Sopenharmony_ci
236c72fcc34Sopenharmony_cidnl Checks for header files.
237c72fcc34Sopenharmony_ciAC_HEADER_STDC
238c72fcc34Sopenharmony_ciif test x$alsamixer = xtrue; then
239c72fcc34Sopenharmony_ci  AC_ARG_WITH(curses,
240c72fcc34Sopenharmony_ci    AS_HELP_STRING([--with-curses=libname], [Specify the curses library to use (default=auto)]),
241c72fcc34Sopenharmony_ci    curseslib="$withval",
242c72fcc34Sopenharmony_ci    curseslib="auto")
243c72fcc34Sopenharmony_ci  CURSESLIBDIR=""
244c72fcc34Sopenharmony_ci  NCURSESLIBSUFFIX=""
245c72fcc34Sopenharmony_ci  CURSES_NLS="no"
246c72fcc34Sopenharmony_ci  if test "$curseslib" = "ncursesw" -o \( "$curseslib" = "auto" -a "$USE_NLS" = "yes" \); then
247c72fcc34Sopenharmony_ci    dnl First try out pkg-config, then fall back to old config scripts.
248c72fcc34Sopenharmony_ci    PKG_CHECK_MODULES([NCURSESW], [ncursesw], [
249c72fcc34Sopenharmony_ci        CURSESINC="<ncurses.h>"
250c72fcc34Sopenharmony_ci        CURSESLIB="${NCURSESW_LIBS}"
251c72fcc34Sopenharmony_ci        CURSESLIBDIR=
252c72fcc34Sopenharmony_ci        CURSES_CFLAGS="${NCURSESW_CFLAGS}"
253c72fcc34Sopenharmony_ci        curseslib="ncursesw"
254c72fcc34Sopenharmony_ci      ], [
255c72fcc34Sopenharmony_ci        AC_CHECK_PROG([ncursesw5_config], [ncursesw5-config], [yes])
256c72fcc34Sopenharmony_ci        if test "$ncursesw5_config" = "yes"; then
257c72fcc34Sopenharmony_ci          CURSESINC="<ncurses.h>"
258c72fcc34Sopenharmony_ci          CURSESLIB=`ncursesw5-config --libs`
259c72fcc34Sopenharmony_ci          CURSESLIBDIR=`ncursesw5-config --libdir`
260c72fcc34Sopenharmony_ci          CURSES_CFLAGS=`ncursesw5-config --cflags`
261c72fcc34Sopenharmony_ci          curseslib="ncursesw"
262c72fcc34Sopenharmony_ci        else
263c72fcc34Sopenharmony_ci          AC_CHECK_LIB(ncursesw, initscr,
264c72fcc34Sopenharmony_ci                     [ CURSESINC='<ncurses.h>'; CURSESLIB='-lncursesw'; curseslib="ncursesw"])
265c72fcc34Sopenharmony_ci        fi
266c72fcc34Sopenharmony_ci      ])
267c72fcc34Sopenharmony_ci    if test -n "$CURSESINC"; then
268c72fcc34Sopenharmony_ci      NCURSESLIBSUFFIX="w"
269c72fcc34Sopenharmony_ci      CURSES_NLS="yes"
270c72fcc34Sopenharmony_ci    fi
271c72fcc34Sopenharmony_ci  fi
272c72fcc34Sopenharmony_ci  if test "$curseslib" = "ncurses" -o "$curseslib" = "auto"; then
273c72fcc34Sopenharmony_ci    dnl First try out pkg-config, then fall back to old config scripts.
274c72fcc34Sopenharmony_ci    PKG_CHECK_MODULES([NCURSES], [ncurses], [
275c72fcc34Sopenharmony_ci        CURSESINC="<ncurses.h>"
276c72fcc34Sopenharmony_ci        CURSESLIB="${NCURSES_LIBS}"
277c72fcc34Sopenharmony_ci        CURSESLIBDIR=
278c72fcc34Sopenharmony_ci        CURSES_CFLAGS="${NCURSES_CFLAGS}"
279c72fcc34Sopenharmony_ci        curseslib="ncurses"
280c72fcc34Sopenharmony_ci      ], [
281c72fcc34Sopenharmony_ci        AC_CHECK_PROG([ncurses5_config], [ncurses5-config], [yes])
282c72fcc34Sopenharmony_ci        if test "$ncurses5_config" = "yes"; then
283c72fcc34Sopenharmony_ci          CURSESINC="<ncurses.h>"
284c72fcc34Sopenharmony_ci          CURSESLIB=`ncurses5-config --libs`
285c72fcc34Sopenharmony_ci          CURSESLIBDIR=`ncurses5-config --libdir`
286c72fcc34Sopenharmony_ci          CURSES_CFLAGS=`ncurses5-config --cflags`
287c72fcc34Sopenharmony_ci          curseslib="ncurses"
288c72fcc34Sopenharmony_ci        else
289c72fcc34Sopenharmony_ci          AC_CHECK_LIB(ncurses, initscr,
290c72fcc34Sopenharmony_ci                     [ CURSESINC='<ncurses.h>'; CURSESLIB='-lncurses'; curseslib="ncurses"])
291c72fcc34Sopenharmony_ci        fi
292c72fcc34Sopenharmony_ci      ])
293c72fcc34Sopenharmony_ci  fi
294c72fcc34Sopenharmony_ci  if test "$curseslib" = "curses" -o "$curseslib" = "auto"; then
295c72fcc34Sopenharmony_ci    AC_CHECK_LIB(curses, initscr,
296c72fcc34Sopenharmony_ci                 [ CURSESINC='<curses.h>'; CURSESLIB='-lcurses'; curseslib="curses"])
297c72fcc34Sopenharmony_ci  fi
298c72fcc34Sopenharmony_ci  if test -z "$CURSESINC"; then
299c72fcc34Sopenharmony_ci     AC_MSG_ERROR(this packages requires a curses library)
300c72fcc34Sopenharmony_ci  fi
301c72fcc34Sopenharmony_ci
302c72fcc34Sopenharmony_ci  AC_MSG_CHECKING([for curses library])
303c72fcc34Sopenharmony_ci  AC_MSG_RESULT([$curseslib])
304c72fcc34Sopenharmony_ci  AC_MSG_CHECKING([for curses header name])
305c72fcc34Sopenharmony_ci  AC_MSG_RESULT([$CURSESINC])
306c72fcc34Sopenharmony_ci  AC_MSG_CHECKING([for curses compiler flags])
307c72fcc34Sopenharmony_ci  AC_MSG_RESULT([$CURSES_CFLAGS])
308c72fcc34Sopenharmony_ci
309c72fcc34Sopenharmony_ci  dnl CURSESLIBS might have the library path at the beginning.  If so, we cut it
310c72fcc34Sopenharmony_ci  dnl off so that we can insert the other curses libraries before the ncurses
311c72fcc34Sopenharmony_ci  dnl library but after the library path (which is later again prepended below).
312c72fcc34Sopenharmony_ci  if test -n "$CURSESLIBDIR"; then
313c72fcc34Sopenharmony_ci    if test "-L$CURSESLIBDIR " = "$(echo $CURSESLIB | cut -c-$((${#CURSESLIBDIR}+3)) )"; then
314c72fcc34Sopenharmony_ci      CURSESLIB="$(echo $CURSESLIB | cut -c$((${#CURSESLIBDIR}+4))-)"
315c72fcc34Sopenharmony_ci    fi
316c72fcc34Sopenharmony_ci  fi
317c72fcc34Sopenharmony_ci
318c72fcc34Sopenharmony_ci  saved_CFLAGS="$CFLAGS"
319c72fcc34Sopenharmony_ci  saved_LDFLAGS="$LDFLAGS"
320c72fcc34Sopenharmony_ci  saved_LIBS="$LIBS"
321c72fcc34Sopenharmony_ci  CFLAGS="$CFLAGS $CURSES_CFLAGS"
322c72fcc34Sopenharmony_ci  if test -n "$CURSESLIBDIR"; then
323c72fcc34Sopenharmony_ci    LDFLAGS="$LDFLAGS -L$CURSESLIBDIR"
324c72fcc34Sopenharmony_ci  fi
325c72fcc34Sopenharmony_ci  LIBS="$CURSESLIB $LIBS"
326c72fcc34Sopenharmony_ci
327c72fcc34Sopenharmony_ci  AC_TRY_LINK([#include <panel.h>], [set_escdelay(100);],[HAVE_CURSES_ESCDELAY="yes"])
328c72fcc34Sopenharmony_ci  if test "$HAVE_CURSES_ESCDELAY" = "yes"; then
329c72fcc34Sopenharmony_ci    AC_DEFINE([HAVE_CURSES_ESCDELAY], 1, [Have curses set_escdelay])
330c72fcc34Sopenharmony_ci  fi
331c72fcc34Sopenharmony_ci
332c72fcc34Sopenharmony_ci  if test "$USE_NLS" = "yes"; then
333c72fcc34Sopenharmony_ci    AC_MSG_CHECKING([for curses NLS support])
334c72fcc34Sopenharmony_ci    dnl In theory, a single-byte curses works just fine in ISO 8859-* locales.
335c72fcc34Sopenharmony_ci    dnl In practice, however, everybody uses UTF-8 nowadays, so we'd better
336c72fcc34Sopenharmony_ci    dnl check for wide-character support.
337c72fcc34Sopenharmony_ci    dnl For ncurses/ncursesw, CURSES_NLS was already set above.
338c72fcc34Sopenharmony_ci    if test "$curseslib" = "curses"; then
339c72fcc34Sopenharmony_ci      AC_TRY_LINK([
340c72fcc34Sopenharmony_ci          #define _XOPEN_SOURCE 1
341c72fcc34Sopenharmony_ci          #define _XOPEN_SOURCE_EXTENDED 1
342c72fcc34Sopenharmony_ci          #include <curses.h>
343c72fcc34Sopenharmony_ci        ], [
344c72fcc34Sopenharmony_ci          cchar_t wc;
345c72fcc34Sopenharmony_ci          setcchar(&wc, L"x", A_NORMAL, 0, 0);
346c72fcc34Sopenharmony_ci        ],
347c72fcc34Sopenharmony_ci        [CURSES_NLS="yes"])
348c72fcc34Sopenharmony_ci    fi
349c72fcc34Sopenharmony_ci    AC_MSG_RESULT([$CURSES_NLS])
350c72fcc34Sopenharmony_ci    if test "$CURSES_NLS" = "yes"; then
351c72fcc34Sopenharmony_ci      AC_DEFINE([ENABLE_NLS_IN_CURSES], [1],
352c72fcc34Sopenharmony_ci                [Define if curses-based programs can show translated messages.])
353c72fcc34Sopenharmony_ci    fi
354c72fcc34Sopenharmony_ci  fi
355c72fcc34Sopenharmony_ci
356c72fcc34Sopenharmony_ci  AC_CHECK_HEADERS([panel.h menu.h form.h], [],
357c72fcc34Sopenharmony_ci                   [AC_MSG_ERROR([required curses helper header not found])])
358c72fcc34Sopenharmony_ci  AC_CHECK_LIB([panel$NCURSESLIBSUFFIX], [new_panel],
359c72fcc34Sopenharmony_ci               [CURSESLIB="-lpanel$NCURSESLIBSUFFIX $CURSESLIB"],
360c72fcc34Sopenharmony_ci               [AC_MSG_ERROR([panel$NCURSESLIBSUFFIX library not found])])
361c72fcc34Sopenharmony_ci  AC_CHECK_LIB([menu$NCURSESLIBSUFFIX], [new_menu],
362c72fcc34Sopenharmony_ci               [CURSESLIB="-lmenu$NCURSESLIBSUFFIX $CURSESLIB"],
363c72fcc34Sopenharmony_ci               [AC_MSG_ERROR([menu$NCURSESLIBSUFFIX library not found])])
364c72fcc34Sopenharmony_ci  AC_CHECK_LIB([form$NCURSESLIBSUFFIX], [new_form],
365c72fcc34Sopenharmony_ci               [CURSESLIB="-lform$NCURSESLIBSUFFIX $CURSESLIB"],
366c72fcc34Sopenharmony_ci               [AC_MSG_ERROR([form$NCURSESLIBSUFFIX library not found])])
367c72fcc34Sopenharmony_ci
368c72fcc34Sopenharmony_ci  CFLAGS="$saved_CFLAGS"
369c72fcc34Sopenharmony_ci  LDFLAGS="$saved_LDFLAGS"
370c72fcc34Sopenharmony_ci  LIBS="$saved_LIBS"
371c72fcc34Sopenharmony_ci
372c72fcc34Sopenharmony_ci  if test -n "$CURSESLIBDIR"; then
373c72fcc34Sopenharmony_ci    CURSESLIB="-L$CURSESLIBDIR $CURSESLIB"
374c72fcc34Sopenharmony_ci  fi
375c72fcc34Sopenharmony_ci
376c72fcc34Sopenharmony_ci  AC_MSG_CHECKING([for curses linker flags])
377c72fcc34Sopenharmony_ci  AC_MSG_RESULT([$CURSESLIB])
378c72fcc34Sopenharmony_cifi
379c72fcc34Sopenharmony_ci
380c72fcc34Sopenharmony_ciAC_SUBST(CURSESINC)
381c72fcc34Sopenharmony_ciAC_SUBST(CURSESLIB)
382c72fcc34Sopenharmony_ciAC_SUBST(CURSES_CFLAGS)
383c72fcc34Sopenharmony_ci
384c72fcc34Sopenharmony_citest "x$prefix" = xNONE && prefix=$ac_default_prefix
385c72fcc34Sopenharmony_citest "x$exec_prefix" = xNONE && exec_prefix=$prefix
386c72fcc34Sopenharmony_ci
387c72fcc34Sopenharmony_cieval dir="$datadir"
388c72fcc34Sopenharmony_cicase "$dir" in
389c72fcc34Sopenharmony_ci/*) ;;
390c72fcc34Sopenharmony_ci*) dir="$prefix/share"
391c72fcc34Sopenharmony_ciesac
392c72fcc34Sopenharmony_ci
393c72fcc34Sopenharmony_cisoundsdir="$dir/sounds/alsa"
394c72fcc34Sopenharmony_ciAC_DEFINE_UNQUOTED(SOUNDSDIR, "$soundsdir", [directory containing sample data])
395c72fcc34Sopenharmony_ci
396c72fcc34Sopenharmony_cimydatadir="$dir/alsa"
397c72fcc34Sopenharmony_ciAC_DEFINE_UNQUOTED(DATADIR, "$mydatadir", [directory containing alsa configuration])
398c72fcc34Sopenharmony_ciAC_SUBST(mydatadir)
399c72fcc34Sopenharmony_ci
400c72fcc34Sopenharmony_ciAC_ARG_WITH(testsound,
401c72fcc34Sopenharmony_ci  AS_HELP_STRING([--with-testsound=file], [give the path of test sound file for alsaconf]),
402c72fcc34Sopenharmony_ci  TESTSOUND="$withval",
403c72fcc34Sopenharmony_ci  TESTSOUND="$dir/test.wav")
404c72fcc34Sopenharmony_ciAC_SUBST(TESTSOUND)
405c72fcc34Sopenharmony_ci
406c72fcc34Sopenharmony_ciAC_CONFIG_HEADERS(include/aconfig.h)
407c72fcc34Sopenharmony_ci
408c72fcc34Sopenharmony_cidnl Checks for typedefs, structures, and compiler characteristics.
409c72fcc34Sopenharmony_ciAC_C_CONST
410c72fcc34Sopenharmony_ciAC_C_INLINE
411c72fcc34Sopenharmony_ciAC_HEADER_TIME
412c72fcc34Sopenharmony_ci
413c72fcc34Sopenharmony_cidnl Checks for library functions.
414c72fcc34Sopenharmony_ciAC_PROG_GCC_TRADITIONAL
415c72fcc34Sopenharmony_ci
416c72fcc34Sopenharmony_cidnl Enable largefile support
417c72fcc34Sopenharmony_ciAC_SYS_LARGEFILE
418c72fcc34Sopenharmony_ci
419c72fcc34Sopenharmony_ciSAVE_UTIL_VERSION
420c72fcc34Sopenharmony_ci
421c72fcc34Sopenharmony_ciAC_SUBST(LIBRT)
422c72fcc34Sopenharmony_ci
423c72fcc34Sopenharmony_cidnl Check for systemd
424c72fcc34Sopenharmony_ciPKG_CHECK_MODULES(SYSTEMD, [systemd >= 18],
425c72fcc34Sopenharmony_ci        [have_min_systemd="yes"],
426c72fcc34Sopenharmony_ci        [have_min_systemd="no"])
427c72fcc34Sopenharmony_ciAC_ARG_WITH([systemdsystemunitdir],
428c72fcc34Sopenharmony_ci        AS_HELP_STRING([--with-systemdsystemunitdir=DIR], [Directory for systemd service files]),
429c72fcc34Sopenharmony_ci        [], [with_systemdsystemunitdir=$($PKG_CONFIG --variable=systemdsystemunitdir systemd)])
430c72fcc34Sopenharmony_ciif test "x$with_systemdsystemunitdir" != xno; then
431c72fcc34Sopenharmony_ci        AC_SUBST([systemdsystemunitdir], [$with_systemdsystemunitdir])
432c72fcc34Sopenharmony_cifi
433c72fcc34Sopenharmony_ciAM_CONDITIONAL(HAVE_SYSTEMD, [test "$have_min_systemd" = "yes" \
434c72fcc34Sopenharmony_ci        -a -n "$with_systemdsystemunitdir" -a "x$with_systemdsystemunitdir" != xno ])
435c72fcc34Sopenharmony_ci
436c72fcc34Sopenharmony_ciAC_ARG_WITH([asound-state-dir],
437c72fcc34Sopenharmony_ci        AS_HELP_STRING([--with-asound-state-dir=DIR], [Directory to place asound.state file in]),
438c72fcc34Sopenharmony_ci        [ASOUND_STATE_DIR="$withval"],
439c72fcc34Sopenharmony_ci        [ASOUND_STATE_DIR="/var/lib/alsa"])
440c72fcc34Sopenharmony_ciAC_SUBST(ASOUND_STATE_DIR)
441c72fcc34Sopenharmony_ci
442c72fcc34Sopenharmony_ciAC_ARG_WITH([alsactl-lock-dir],
443c72fcc34Sopenharmony_ci        AS_HELP_STRING([--with-alsactl-lock-dir=DIR], [Directory to place lock files in]),
444c72fcc34Sopenharmony_ci        [ASOUND_LOCK_DIR="$withval"],
445c72fcc34Sopenharmony_ci        [ASOUND_LOCK_DIR="/var/lock"])
446c72fcc34Sopenharmony_ciAC_SUBST(ASOUND_LOCK_DIR)
447c72fcc34Sopenharmony_ci
448c72fcc34Sopenharmony_ciAC_ARG_WITH([alsactl-pidfile-dir],
449c72fcc34Sopenharmony_ci        AS_HELP_STRING([--with-alsactl-pidfile-dir=DIR], [Directory to place alsactl.pid file in]),
450c72fcc34Sopenharmony_ci        [ALSACTL_PIDFILE_DIR="$withval"],
451c72fcc34Sopenharmony_ci        [ALSACTL_PIDFILE_DIR="/var/run"])
452c72fcc34Sopenharmony_ciAC_SUBST(ALSACTL_PIDFILE_DIR)
453c72fcc34Sopenharmony_ci
454c72fcc34Sopenharmony_ciAC_ARG_WITH([alsactl-daemonswitch],
455c72fcc34Sopenharmony_ci        AS_HELP_STRING([--with-alsactl-daemonswitch=FILE], [File to test for the daemon mode]),
456c72fcc34Sopenharmony_ci        [ALSACTL_DAEMONSWITCH="$withval"],
457c72fcc34Sopenharmony_ci        [ALSACTL_DAEMONSWITCH="/etc/alsa/state-daemon.conf"])
458c72fcc34Sopenharmony_ciAC_SUBST(ALSACTL_DAEMONSWITCH)
459c72fcc34Sopenharmony_ci
460c72fcc34Sopenharmony_cidnl pre-process plugin directory
461c72fcc34Sopenharmony_ciAC_ARG_WITH(plugindir,
462c72fcc34Sopenharmony_ci    AS_HELP_STRING([--with-plugindir=dir],
463c72fcc34Sopenharmony_ci	[path where pre-process plugin files are stored]),
464c72fcc34Sopenharmony_ci    plugindir="$withval", plugindir="")
465c72fcc34Sopenharmony_ciif test -z "$plugindir"; then
466c72fcc34Sopenharmony_ci    eval dir="$libdir"
467c72fcc34Sopenharmony_ci    echo ${exec_prefix}
468c72fcc34Sopenharmony_ci    echo $libdir
469c72fcc34Sopenharmony_ci    echo $dir
470c72fcc34Sopenharmony_ci    case "$dir" in
471c72fcc34Sopenharmony_ci    /*) ;;
472c72fcc34Sopenharmony_ci    *) dir="$dir"
473c72fcc34Sopenharmony_ci    esac
474c72fcc34Sopenharmony_ci    plugindir="$dir/alsa-topology"
475c72fcc34Sopenharmony_cifi
476c72fcc34Sopenharmony_ciAC_DEFINE_UNQUOTED(ALSA_TOPOLOGY_PLUGIN_DIR, "$plugindir", [directory containing ALSA topology pre-process plugins])
477c72fcc34Sopenharmony_ciALSA_TOPOLOGY_PLUGIN_DIR="$plugindir"
478c72fcc34Sopenharmony_ciAC_SUBST(ALSA_TOPOLOGY_PLUGIN_DIR)
479c72fcc34Sopenharmony_ci
480c72fcc34Sopenharmony_ciAC_OUTPUT(Makefile alsactl/Makefile alsactl/init/Makefile \
481c72fcc34Sopenharmony_ci	  alsamixer/Makefile amidi/Makefile amixer/Makefile \
482c72fcc34Sopenharmony_ci	  m4/Makefile po/Makefile.in \
483c72fcc34Sopenharmony_ci	  alsaconf/alsaconf alsaconf/Makefile \
484c72fcc34Sopenharmony_ci	  alsaconf/po/Makefile \
485c72fcc34Sopenharmony_ci	  alsaucm/Makefile topology/Makefile topology/nhlt/Makefile \
486c72fcc34Sopenharmony_ci	  bat/Makefile bat/tests/Makefile bat/tests/asound_state/Makefile \
487c72fcc34Sopenharmony_ci	  aplay/Makefile include/Makefile iecset/Makefile utils/Makefile \
488c72fcc34Sopenharmony_ci	  utils/alsa-utils.spec seq/Makefile seq/aconnect/Makefile \
489c72fcc34Sopenharmony_ci	  seq/aplaymidi/Makefile seq/aseqdump/Makefile seq/aseqnet/Makefile \
490c72fcc34Sopenharmony_ci	  speaker-test/Makefile speaker-test/samples/Makefile \
491c72fcc34Sopenharmony_ci	  alsaloop/Makefile alsa-info/Makefile \
492c72fcc34Sopenharmony_ci	  axfer/Makefile axfer/test/Makefile \
493c72fcc34Sopenharmony_ci	  nhlt/Makefile)
494