• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1dnl Process this file with autoconf to produce a configure script.
2AC_PREREQ(2.59)
3AC_INIT(alsa-lib, 1.2.6)
4
5AC_CONFIG_SRCDIR([src/control/control.c])
6AC_CONFIG_MACRO_DIR([m4])
7
8dnl *************************************************
9dnl current:revision:age
10dnl change (without API) = c:r+1:a
11dnl change API = c+1:0:a
12dnl add API = c+1:0:a+1
13dnl remove API = c+1:0:0
14dnl *************************************************
15AC_CANONICAL_HOST
16AM_INIT_AUTOMAKE
17eval LIBTOOL_VERSION_INFO="2:0:0"
18dnl *************************************************
19AM_CONDITIONAL([INSTALL_M4], [test -n "${ACLOCAL}"])
20
21AM_MAINTAINER_MODE([enable])
22
23# Test for new silent rules and enable only if they are available
24m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
25
26AC_PREFIX_DEFAULT(/usr)
27
28dnl Checks for programs.
29
30AC_PROG_CC
31AC_PROG_CPP
32AC_USE_SYSTEM_EXTENSIONS
33AC_PROG_INSTALL
34AC_PROG_LN_S
35AC_DISABLE_STATIC
36AC_LIBTOOL_DLOPEN
37AM_PROG_LIBTOOL
38
39CC_NOUNDEFINED
40
41dnl Checks for header files.
42AC_HEADER_STDC
43AC_CONFIG_HEADERS(include/config.h)
44
45dnl Checks for typedefs, structures, and compiler characteristics.
46AC_C_CONST
47AC_C_INLINE
48AC_HEADER_TIME
49
50dnl Checks for library functions.
51AC_PROG_GCC_TRADITIONAL
52AC_CHECK_FUNCS([uselocale])
53AC_CHECK_FUNCS([eaccess])
54
55SAVE_LIBRARY_VERSION
56AC_SUBST(LIBTOOL_VERSION_INFO)
57
58test "x$prefix" = xNONE && prefix=$ac_default_prefix
59
60dnl Do not build static and shared libraries together
61if test "$enable_static" = "$enable_shared" -a "$enable_static" = "yes"; then
62cat <<EOF
63  Please, do not try to compile static and shared libraries together.
64  See INSTALL file for more details (do not use --enable-shared=yes with
65  --enable-static=yes).
66EOF
67  exit 1
68fi
69
70dnl ALSA configuration directory
71AC_ARG_WITH(configdir,
72    AS_HELP_STRING([--with-configdir=dir],
73	[path where ALSA config files are stored]),
74    confdir="$withval", confdir="")
75if test -z "$confdir"; then
76    eval dir="$datadir"
77    case "$dir" in
78    /*) ;;
79    *) dir="$prefix/share"
80    esac
81    confdir="$dir/alsa"
82fi
83ALSA_CONFIG_DIR="$confdir"
84AC_DEFINE_UNQUOTED(ALSA_CONFIG_DIR, "$confdir", [directory containing ALSA configuration database])
85AC_SUBST(ALSA_CONFIG_DIR)
86
87dnl ALSA plugin directory
88test "x$exec_prefix" = xNONE && exec_prefix=$prefix
89
90AC_ARG_WITH(plugindir,
91    AS_HELP_STRING([--with-plugindir=dir],
92	[path where ALSA plugin files are stored]),
93    plugindir="$withval", plugindir="")
94if test -z "$plugindir"; then
95    eval dir="$libdir"
96    case "$dir" in
97    /*) ;;
98    *) dir="$dir"
99    esac
100    plugindir="$dir/$PACKAGE"
101fi
102AC_DEFINE_UNQUOTED(ALSA_PLUGIN_DIR, "$plugindir", [directory containing ALSA add-on modules])
103ALSA_PLUGIN_DIR="$plugindir"
104AC_SUBST(ALSA_PLUGIN_DIR)
105
106AC_ARG_WITH(pkgconfdir,
107    AS_HELP_STRING([--with-pkgconfdir=dir],
108	[path where pkgconfig files are stored]),
109    pkgconfdir="$withval", pkgconfdir="")
110if test -z "$pkgconfdir"; then
111    eval dir="$libdir"
112    case "$dir" in
113    /*) ;;
114    *) dir="$dir"
115    esac
116    pkgconfdir="$dir/pkgconfig"
117fi
118AC_DEFINE_UNQUOTED(ALSA_PKGCONF_DIR, "$pkgconfdir", [directory containing pkgconfig files])
119ALSA_PKGCONF_DIR="$pkgconfdir"
120AC_SUBST(ALSA_PKGCONF_DIR)
121
122dnl Check for versioned symbols
123AC_MSG_CHECKING(for versioned symbols)
124AC_ARG_WITH(versioned,
125  AS_HELP_STRING([--with-versioned],
126    [shared library will be compiled with versioned symbols (default = yes)]),
127  versioned="$withval", versioned="yes")
128if test "$versioned" = "yes"; then
129  # it seems that GNU ld versions since 2.10 are not broken
130  xres=`grep '^VERSION=' ${srcdir}/ltmain.sh | cut -d = -f 2 | cut -d \" -f 2`
131  major=`echo $xres | cut -d . -f 1`
132  minor=`echo $xres | cut -d . -f 2`
133  pass=0
134  if test $major -eq 1 && test $minor -gt 3; then
135    pass=1
136  else
137    if test $major -gt 1; then
138      pass=1
139    fi
140  fi
141  if test $pass -eq 1; then
142    AC_DEFINE(VERSIONED_SYMBOLS,,[compiled with versioned symbols])
143    AC_MSG_RESULT(yes)
144  else
145    AC_MSG_RESULT(broken libtool - use libtool v1.4+; no versions)
146  fi
147else
148  AC_MSG_RESULT(no)
149fi
150AM_CONDITIONAL([VERSIONED_SYMBOLS], [test x$versioned = xyes])
151
152dnl Check for symbolic-functions
153AC_MSG_CHECKING(for symbolic-functions)
154AC_ARG_ENABLE(symbolic-functions,
155  AS_HELP_STRING([--enable-symbolic-functions],
156    [use -Bsymbolic-functions option if available (optmization for size and speed)]),
157  symfuncs="$enableval", symfuncs="no")
158if test "$symfuncs" = "yes"; then
159  if ld --help | grep -q -- '-Bsymbolic-functions'; then
160    AC_MSG_RESULT(yes)
161  else
162    AC_MSG_RESULT(not supported by ld)
163    symfuncs="no"
164  fi
165else
166  AC_MSG_RESULT(no)
167fi
168AM_CONDITIONAL([SYMBOLIC_FUNCTIONS], [test x"$symfuncs" = xyes])
169
170dnl See if toolchain has a custom prefix for symbols ...
171AC_MSG_CHECKING(for custom symbol prefixes)
172SYMBOL_PREFIX=` \
173	echo "PREFIX=__USER_LABEL_PREFIX__" \
174		| ${CPP-${CC-gcc} -E} - 2>&1 \
175		| ${EGREP-grep} "^PREFIX=" \
176		| ${SED-sed} "s:^PREFIX=::"`
177AC_DEFINE_UNQUOTED([__SYMBOL_PREFIX], "$SYMBOL_PREFIX", [Toolchain Symbol Prefix])
178AC_SUBST(SYMBOL_PREFIX)
179AC_MSG_RESULT($SYMBOL_PREFIX)
180
181dnl Check for debug...
182AC_MSG_CHECKING(for debug)
183AC_ARG_WITH(debug,
184  AS_HELP_STRING([--with-debug],
185    [library will be compiled with asserts (default = yes)]),
186  debug="$withval", debug="yes")
187if test "$debug" = "yes"; then
188  AC_MSG_RESULT(yes)
189else
190  AC_DEFINE(NDEBUG,,[No assert debug])
191  AC_MSG_RESULT(no)
192fi
193
194if test "$debug" = "yes"; then
195  AC_MSG_CHECKING(for debug assert)
196  AC_ARG_ENABLE(debug-assert,
197    AS_HELP_STRING([--enable-debug],
198      [enable assert call at the default error message handler]),
199    debug_assert="$enableval", debug_assert="no")
200  if test "$debug_assert" = "yes"; then
201    AC_MSG_RESULT(yes)
202    AC_DEFINE(ALSA_DEBUG_ASSERT,,[Enable assert at error message handler])
203  else
204    AC_MSG_RESULT(no)
205  fi
206fi
207
208dnl Temporary directory
209AC_MSG_CHECKING(for tmpdir)
210AC_ARG_WITH(tmpdir,
211  AS_HELP_STRING([--with-tmpdir=directory],
212    [directory to put tmp socket files (/tmp)]),
213  tmpdir="$withval", tmpdir="/tmp")
214AC_MSG_RESULT($tmpdir)
215AC_DEFINE_UNQUOTED(TMPDIR, "$tmpdir", [directory to put tmp socket files])
216
217dnl Check for softfloat...
218AC_MSG_CHECKING(for softfloat)
219AC_ARG_WITH(softfloat,
220  AS_HELP_STRING([--with-softfloat],
221    [do you have floating point unit on this machine? (optional)]),
222  [case "$withval" in
223	y|yes) softfloat=yes ;;
224	*) softfloat=no ;;
225   esac],)
226if test "$softfloat" = "yes" ; then
227  AC_DEFINE(HAVE_SOFT_FLOAT, "1", [Avoid calculation in float])
228  AC_MSG_RESULT(yes)
229else
230  AC_MSG_RESULT(no)
231fi
232
233ALSA_DEPLIBS=""
234if test "$softfloat" != "yes"; then
235  ALSA_DEPLIBS="-lm"
236fi
237
238dnl Check for libdl
239AC_MSG_CHECKING(for libdl)
240AC_ARG_WITH(libdl,
241  AS_HELP_STRING([--with-libdl], [Use libdl for plugins (default = yes)]),
242  [ have_libdl="$withval" ], [ have_libdl="yes" ])
243HAVE_LIBDL=
244if test "$have_libdl" = "yes"; then
245  AC_CHECK_LIB([dl], [dlsym], [HAVE_LIBDL="yes"])
246  if test "$HAVE_LIBDL" = "yes" ; then
247    ALSA_DEPLIBS="$ALSA_DEPLIBS -ldl"
248    AC_DEFINE([HAVE_LIBDL], 1, [Have libdl])
249  fi
250else
251  AC_MSG_RESULT(no)
252fi
253AM_CONDITIONAL([BUILD_MODULES], [test "$HAVE_LIBDL" = "yes"])
254
255dnl Check for pthread
256AC_MSG_CHECKING(for pthread)
257AC_ARG_WITH(pthread,
258  AS_HELP_STRING([--with-pthread], [Use pthread (default = yes)]),
259  [ have_pthread="$withval" ], [ have_pthread="yes" ])
260if test "$have_pthread" = "yes"; then
261  AC_CHECK_LIB([pthread], [pthread_join], [HAVE_LIBPTHREAD="yes"])
262  if test "$HAVE_LIBPTHREAD" = "yes"; then
263    ALSA_DEPLIBS="$ALSA_DEPLIBS -lpthread"
264    AC_DEFINE([HAVE_LIBPTHREAD], 1, [Have libpthread])
265  fi
266else
267  AC_MSG_RESULT(no)
268fi
269
270dnl Check for pthread
271if test "$HAVE_LIBPTHREAD" = "yes"; then
272  AC_CHECK_DECL(PTHREAD_MUTEX_RECURSIVE,
273    AC_DEFINE(HAVE_PTHREAD_MUTEX_RECURSIVE, [],
274      [Define if your pthreads implementation have PTHREAD_MUTEX_RECURSIVE]),
275    ,
276    [#include <pthread.h>])
277fi
278
279dnl Check for __thread
280AC_MSG_CHECKING([for __thread])
281AC_LINK_IFELSE([AC_LANG_PROGRAM([#if defined(__GNUC__) && (defined(__i386__) || defined(__x86_64__)) && ((__GNUC__ < 4) || (__GNUC__ == 4 && __GNUC_MINOR__ < 1) || (__GNUC__ == 4 && __GNUC_MINOR__ == 1 && __GNUC_PATCHLEVEL__ < 2))
282#error gcc has this bug: http://gcc.gnu.org/ml/gcc-bugs/2006-09/msg02275.html
283#endif], [static __thread int p = 0])],
284[AC_DEFINE(HAVE___THREAD, 1,
285Define to 1 if compiler supports __thread)
286AC_MSG_RESULT([yes])],
287[AC_MSG_RESULT([no])])
288
289dnl Check for librt
290AC_MSG_CHECKING(for librt)
291AC_ARG_WITH(librt,
292  AS_HELP_STRING([--with-librt], [Use librt for monotonic clock (default = yes)]),
293  [ have_librt="$withval" ], [ have_librt="yes" ])
294if test "$have_librt" = "yes"; then
295  AC_CHECK_LIB([rt], [clock_gettime], [HAVE_LIBRT="yes"])
296  if test "$HAVE_LIBRT" = "yes" ; then
297    ALSA_DEPLIBS="$ALSA_DEPLIBS -lrt"
298    AC_DEFINE([HAVE_LIBRT], 1, [Have librt])
299    AC_DEFINE([HAVE_CLOCK_GETTIME], 1, [Have clock gettime])
300  fi
301else
302  AC_MSG_RESULT(no)
303fi
304
305AC_SUBST(ALSA_DEPLIBS)
306
307dnl Check for use of wordexp...
308AC_MSG_CHECKING(for use of wordexp)
309AC_ARG_WITH(wordexp,
310  AS_HELP_STRING([--with-wordexp],
311    [Use wordexp when expanding configs (default = no)]),
312  [case "$withval" in
313	y|yes) wordexp=yes ;;
314	*) wordexp=no ;;
315   esac],)
316if test "$wordexp" = "yes" ; then
317  AC_DEFINE(HAVE_WORDEXP, "1", [Enable use of wordexp])
318  AC_MSG_RESULT(yes)
319  AC_CHECK_HEADER([wordexp.h],[], [AC_MSG_ERROR([Couldn't find wordexp.h])])
320else
321  AC_MSG_RESULT(no)
322fi
323
324dnl Check for headers
325AC_CHECK_HEADERS([endian.h sys/endian.h sys/shm.h])
326
327dnl Check for resmgr support...
328AC_MSG_CHECKING(for resmgr support)
329AC_ARG_ENABLE(resmgr,
330  AS_HELP_STRING([--enable-resmgr], [support resmgr (optional)]),
331  resmgr="$enableval", resmgr="no")
332AC_MSG_RESULT($resmgr)
333if test "$resmgr" = "yes"; then
334  AC_CHECK_LIB(resmgr, rsm_open_device,,
335    AC_ERROR([Cannot find libresmgr]))
336  AC_DEFINE(SUPPORT_RESMGR, "1", [Support resmgr with alsa-lib])
337fi
338
339dnl Check for aload* support...
340AC_MSG_CHECKING(for aload* support)
341AC_ARG_ENABLE(aload,
342  AS_HELP_STRING([--disable-aload], [disable reading /dev/aload*]),
343  aload="$enableval", aload="yes")
344AC_MSG_RESULT($aload)
345if test "$aload" = "yes"; then
346  AC_DEFINE(SUPPORT_ALOAD, "1", [Support /dev/aload* access for auto-loading])
347fi
348
349dnl Check for non-standard /dev directory
350AC_MSG_CHECKING([for ALSA device file directory])
351AC_ARG_WITH(alsa-devdir,
352  AS_HELP_STRING([--with-alsa-devdir=dir],
353    [directory with ALSA device files (default /dev/snd)]),
354  [alsa_dev_dir="$withval"],
355  [alsa_dev_dir="/dev/snd"])
356dnl make sure it has a trailing slash
357if echo "$alsa_dev_dir" | grep -v '/$' > /dev/null; then
358  alsa_dev_dir="$alsa_dev_dir/"
359fi
360AC_DEFINE_UNQUOTED(ALSA_DEVICE_DIRECTORY, "$alsa_dev_dir", [Directory with ALSA device files])
361AC_MSG_RESULT([$alsa_dev_dir])
362
363AC_MSG_CHECKING([for aload* device file directory])
364AC_ARG_WITH(aload-devdir,
365  AS_HELP_STRING([--with-aload-devdir=dir],
366    [directory with aload* device files (default /dev)]),
367  [aload_dev_dir="$withval"],
368  [aload_dev_dir="/dev"])
369if echo "$aload_dev_dir" | grep -v '/$' > /dev/null; then
370  aload_dev_dir="$aload_dev_dir/"
371fi
372AC_DEFINE_UNQUOTED(ALOAD_DEVICE_DIRECTORY, "$aload_dev_dir", [Directory with aload* device files])
373AC_MSG_RESULT([$aload_dev_dir])
374
375dnl Build conditions
376AC_ARG_ENABLE(mixer,
377  AS_HELP_STRING([--disable-mixer], [disable the mixer component]),
378  [build_mixer="$enableval"], [build_mixer="yes"])
379AC_ARG_ENABLE(pcm,
380  AS_HELP_STRING([--disable-pcm], [disable the PCM component]),
381  [build_pcm="$enableval"], [build_pcm="yes"])
382AC_ARG_ENABLE(rawmidi,
383  AS_HELP_STRING([--disable-rawmidi], [disable the raw MIDI component]),
384  [build_rawmidi="$enableval"], [build_rawmidi="yes"])
385AC_ARG_ENABLE(hwdep,
386  AS_HELP_STRING([--disable-hwdep], [disable the hwdep component]),
387  [build_hwdep="$enableval"], [build_hwdep="yes"])
388AC_ARG_ENABLE(seq,
389  AS_HELP_STRING([--disable-seq], [disable the sequencer component]),
390  [build_seq="$enableval"], [build_seq="yes"])
391AC_ARG_ENABLE(ucm,
392  AS_HELP_STRING([--disable-ucm], [disable the use-case-manager component]),
393  [build_ucm="$enableval"], [build_ucm="yes"])
394AC_ARG_ENABLE(topology,
395  AS_HELP_STRING([--disable-topology], [disable the DSP topology component]),
396  [build_topology="$enableval"], [build_topology="yes"])
397AC_ARG_ENABLE(alisp,
398  AS_HELP_STRING([--enable-alisp], [enable the alisp component]),
399  [build_alisp="$enableval"], [build_alisp="no"])
400test "$softfloat" = "yes" && build_alisp="no"
401AC_ARG_ENABLE(old-symbols,
402  AS_HELP_STRING([--disable-old-symbols], [disable old obsoleted symbols]),
403  [keep_old_symbols="$enableval"], [keep_old_symbols="yes"])
404AM_CONDITIONAL([KEEP_OLD_SYMBOLS], [test x$keep_old_symbols = xyes])
405
406AC_ARG_ENABLE(mixer-modules,
407  AS_HELP_STRING([--enable-mixer-modules], [enable the additional mixer modules (experimental)]),
408  [build_mixer_modules="$enableval"], [build_mixer_modules="no"])
409
410AC_ARG_ENABLE(mixer-pymods,
411  AS_HELP_STRING([--enable-mixer-pymods], [enable the mixer python modules (experimental)]),
412  [build_mixer_pymodules="$enableval"], [build_mixer_pymodules="no"])
413
414AC_ARG_ENABLE(python,
415  AS_HELP_STRING([--disable-python], [disable the python components]),
416  [build_python="$enableval"], [build_python="yes"])
417
418AC_ARG_ENABLE(python2,
419  AS_HELP_STRING([--enable-python2], [prefer python2]),
420  [build_python2="$enableval"], [build_python2="no"])
421PYTHON_LIBS=""
422PYTHON_INCLUDES=""
423if test "$build_python" = "yes" -a "$build_mixer_pymodules" = "yes"; then
424  pythonlibs0=
425  pythoninc0=
426  if test "$build_python2" != "yes"; then
427    pythonlibs0=$(python3-config --libs --embed 2> /dev/null)
428    if test -z "$pythonlibs0"; then
429      pythonlibs0=$(python3-config --libs)
430    fi
431    pythoninc0=$(python3-config --includes)
432  fi
433  if test -z "$pythonlibs0"; then
434    pythonlibs0=$(python-config --libs)
435    pythoninc0=$(python-config --includes)
436  fi
437  AC_ARG_WITH(pythonlibs,
438    AS_HELP_STRING([--with-pythonlibs=ldflags],
439      [specify python libraries (-lpthread -lm -ldl -lpython2.4)]),
440    pythonlibs="$withval", pythonlibs=$pythonlibs0)
441  AC_ARG_WITH(pythonincludes,
442    AS_HELP_STRING([--with-pythonincludes=Cflags],
443      [specify python C header files (-I/usr/include/python)]),
444    pythonincludes="$withval", pythonincludes=$pythoninc0)
445  if test -z "$pythonlibs"; then
446    echo "Unable to determine python libraries! Probably python-config is not"
447    echo "available on this system. Please, use --with-pythonlibs and"
448    echo "--with-pythonincludes options. Python components are disabled in this build."
449    build_python="no"
450  else
451    PYTHON_LIBS="$pythonlibs"
452    PYTHON_INCLUDES="$pythonincludes"
453  fi
454fi
455if test "$build_python" != "yes"; then
456  build_mixer_pymodules=
457fi
458AC_SUBST(PYTHON_LIBS)
459AC_SUBST(PYTHON_INCLUDES)
460
461AM_CONDITIONAL([BUILD_MIXER], [test x$build_mixer = xyes])
462AM_CONDITIONAL([BUILD_PCM], [test x$build_pcm = xyes])
463AM_CONDITIONAL([BUILD_RAWMIDI], [test x$build_rawmidi = xyes])
464AM_CONDITIONAL([BUILD_HWDEP], [test x$build_hwdep = xyes])
465AM_CONDITIONAL([BUILD_SEQ], [test x$build_seq = xyes])
466AM_CONDITIONAL([BUILD_UCM], [test x$build_ucm = xyes])
467AM_CONDITIONAL([BUILD_TOPOLOGY], [test x$build_topology = xyes])
468AM_CONDITIONAL([BUILD_ALISP], [test x$build_alisp = xyes])
469AM_CONDITIONAL([BUILD_MIXER_MODULES], [test x$build_mixer_modules = xyes])
470AM_CONDITIONAL([BUILD_MIXER_PYMODULES], [test x$build_mixer_pymodules = xyes])
471
472if test "$build_mixer" = "yes"; then
473  AC_DEFINE([BUILD_MIXER], "1", [Build mixer component])
474fi
475if test "$build_pcm" = "yes"; then
476  AC_DEFINE([BUILD_PCM], "1", [Build PCM component])
477fi
478if test "$build_rawmidi" = "yes"; then
479  AC_DEFINE([BUILD_RAWMIDI], "1", [Build raw MIDI component])
480fi
481if test "$build_hwdep" = "yes"; then
482  AC_DEFINE([BUILD_HWDEP], "1", [Build hwdep component])
483fi
484if test "$build_seq" = "yes"; then
485  AC_DEFINE([BUILD_SEQ], "1", [Build sequencer component])
486fi
487if test "$build_ucm" = "yes"; then
488  AC_DEFINE([BUILD_UCM], "1", [Build UCM component])
489fi
490if test "$build_topology" = "yes"; then
491  AC_DEFINE([BUILD_TOPOLOGY], "1", [Build DSP Topology component])
492fi
493
494dnl PCM Plugins
495
496if test "$build_pcm" = "yes"; then
497AC_ARG_WITH(pcm-plugins,
498  AS_HELP_STRING([--with-pcm-plugins=<list>],
499    [build PCM plugins (default = all)]),
500  [pcm_plugins="$withval"], [pcm_plugins="all"])
501else
502pcm_plugins=""
503fi
504
505dnl check atomics for pcm_meter
506
507AC_MSG_CHECKING([whether GCC supports builtin atomic intrinsics])
508if test -z "$gcc_have_atomics"; then
509  gcc_have_atomics=no
510  AC_TRY_LINK([],
511    [int i;
512     __atomic_load_n(&i, __ATOMIC_SEQ_CST);
513     __atomic_add_fetch(&i, 0, __ATOMIC_SEQ_CST);
514    ],
515    [gcc_have_atomics=yes],
516    [gcc_have_atomics=no])
517fi
518AC_MSG_RESULT($gcc_have_atomics)
519
520dnl check mmx register for pcm_dmix_i386
521
522AC_TRY_LINK([],
523    [__asm__ volatile ("" : : : "mm0");],
524    [AC_DEFINE([HAVE_MMX], "1", [MMX technology is enabled])],
525    [])
526
527PCM_PLUGIN_LIST="copy linear route mulaw alaw adpcm rate plug multi shm file null empty share meter hooks lfloat ladspa dmix dshare dsnoop asym iec958 softvol extplug ioplug mmap_emul"
528
529build_pcm_plugin="no"
530for t in $PCM_PLUGIN_LIST; do
531  eval build_pcm_$t="no"
532done
533
534pcm_plugins=`echo $pcm_plugins | sed 's/,/ /g'`
535for p in $pcm_plugins; do
536  for t in $PCM_PLUGIN_LIST; do
537    if test "$p" = "$t" -o "$p" = "all"; then
538      eval build_pcm_$t="yes"
539      build_pcm_plugin="yes"
540    fi
541  done
542done
543
544dnl special dependencies
545if test "$build_pcm_plug" = "yes"; then
546  build_pcm_linear="yes"
547  build_pcm_copy="yes"
548fi
549
550if test "$build_pcm_ioplug" = "yes"; then
551  build_pcm_extplug="yes"
552fi
553
554if test "$HAVE_LIBDL" != "yes"; then
555  build_pcm_meter="no"
556  build_pcm_ladspa="no"
557  build_pcm_pcm_ioplug="no"
558  build_pcm_pcm_extplug="no"
559fi
560
561if test "$HAVE_LIBPTHREAD" != "yes"; then
562  build_pcm_share="no"
563fi
564
565if test "$softfloat" = "yes"; then
566  build_pcm_lfloat="no"
567  build_pcm_ladspa="no"
568fi
569
570if test "$gcc_have_atomics" != "yes"; then
571  build_pcm_meter="no"
572fi
573
574if test "$ac_cv_header_sys_shm_h" != "yes"; then
575  build_pcm_dmix="no"
576  build_pcm_dshare="no"
577  build_pcm_dsnoop="no"
578  build_pcm_shm="no"
579fi
580
581AM_CONDITIONAL([BUILD_PCM_PLUGIN], [test x$build_pcm_plugin = xyes])
582AM_CONDITIONAL([BUILD_PCM_PLUGIN_COPY], [test x$build_pcm_copy = xyes])
583AM_CONDITIONAL([BUILD_PCM_PLUGIN_LINEAR], [test x$build_pcm_linear = xyes])
584AM_CONDITIONAL([BUILD_PCM_PLUGIN_ROUTE], [test x$build_pcm_route = xyes])
585AM_CONDITIONAL([BUILD_PCM_PLUGIN_MULAW], [test x$build_pcm_mulaw = xyes])
586AM_CONDITIONAL([BUILD_PCM_PLUGIN_ALAW], [test x$build_pcm_alaw = xyes])
587AM_CONDITIONAL([BUILD_PCM_PLUGIN_ADPCM], [test x$build_pcm_adpcm = xyes])
588AM_CONDITIONAL([BUILD_PCM_PLUGIN_RATE], [test x$build_pcm_rate = xyes])
589AM_CONDITIONAL([BUILD_PCM_PLUGIN_PLUG], [test x$build_pcm_plug = xyes])
590AM_CONDITIONAL([BUILD_PCM_PLUGIN_MULTI], [test x$build_pcm_multi = xyes])
591AM_CONDITIONAL([BUILD_PCM_PLUGIN_SHM], [test x$build_pcm_shm = xyes])
592AM_CONDITIONAL([BUILD_PCM_PLUGIN_FILE], [test x$build_pcm_file = xyes])
593AM_CONDITIONAL([BUILD_PCM_PLUGIN_NULL], [test x$build_pcm_null = xyes])
594AM_CONDITIONAL([BUILD_PCM_PLUGIN_EMPTY], [test x$build_pcm_empty = xyes])
595AM_CONDITIONAL([BUILD_PCM_PLUGIN_SHARE], [test x$build_pcm_share = xyes])
596AM_CONDITIONAL([BUILD_PCM_PLUGIN_METER], [test x$build_pcm_meter = xyes])
597AM_CONDITIONAL([BUILD_PCM_PLUGIN_HOOKS], [test x$build_pcm_hooks = xyes])
598AM_CONDITIONAL([BUILD_PCM_PLUGIN_LFLOAT], [test x$build_pcm_lfloat = xyes])
599AM_CONDITIONAL([BUILD_PCM_PLUGIN_LADSPA], [test x$build_pcm_ladspa = xyes])
600AM_CONDITIONAL([BUILD_PCM_PLUGIN_DMIX], [test x$build_pcm_dmix = xyes])
601AM_CONDITIONAL([BUILD_PCM_PLUGIN_DSHARE], [test x$build_pcm_dshare = xyes])
602AM_CONDITIONAL([BUILD_PCM_PLUGIN_DSNOOP], [test x$build_pcm_dsnoop = xyes])
603AM_CONDITIONAL([BUILD_PCM_PLUGIN_ASYM], [test x$build_pcm_asym = xyes])
604AM_CONDITIONAL([BUILD_PCM_PLUGIN_IEC958], [test x$build_pcm_iec958 = xyes])
605AM_CONDITIONAL([BUILD_PCM_PLUGIN_SOFTVOL], [test x$build_pcm_softvol = xyes])
606AM_CONDITIONAL([BUILD_PCM_PLUGIN_EXTPLUG], [test x$build_pcm_extplug = xyes])
607AM_CONDITIONAL([BUILD_PCM_PLUGIN_IOPLUG], [test x$build_pcm_ioplug = xyes])
608AM_CONDITIONAL([BUILD_PCM_PLUGIN_MMAP_EMUL], [test x$build_pcm_mmap_emul = xyes])
609
610dnl Defines for plug plugin
611if test "$build_pcm_rate" = "yes"; then
612  AC_DEFINE([BUILD_PCM_PLUGIN_RATE], "1", [Build PCM rate plugin])
613fi
614if test "$build_pcm_route" = "yes"; then
615  AC_DEFINE([BUILD_PCM_PLUGIN_ROUTE], "1", [Build PCM route plugin])
616fi
617if test "$build_pcm_lfloat" = "yes"; then
618  AC_DEFINE([BUILD_PCM_PLUGIN_LFLOAT], "1", [Build PCM lfloat plugin])
619fi
620if test "$build_pcm_adpcm" = "yes"; then
621  AC_DEFINE([BUILD_PCM_PLUGIN_ADPCM], "1", [Build PCM adpcm plugin])
622fi
623if test "$build_pcm_mulaw" = "yes"; then
624  AC_DEFINE([BUILD_PCM_PLUGIN_MULAW], "1", [Build PCM mulaw plugin])
625fi
626if test "$build_pcm_alaw" = "yes"; then
627  AC_DEFINE([BUILD_PCM_PLUGIN_ALAW], "1", [Build PCM alaw plugin])
628fi
629if test "$build_pcm_mmap_emul" = "yes"; then
630  AC_DEFINE([BUILD_PCM_PLUGIN_MMAP_EMUL], "1", [Build PCM mmap-emul plugin])
631fi
632
633if test "$build_pcm_dmix" = "yes"; then
634AC_MSG_CHECKING(for default lockless dmix)
635AC_ARG_ENABLE(lockless-dmix,
636  AS_HELP_STRING([--enable-lockless-dmix],
637    [use lockless dmix as default on x86]),
638  lockless_dmix="$enableval", lockless_dmix="no")
639if test "$lockless_dmix" = "yes"; then
640  AC_MSG_RESULT(yes)
641  AC_DEFINE([LOCKLESS_DMIX_DEFAULT], "1", [Lockless dmix as default])
642else
643  AC_MSG_RESULT(no)
644fi
645fi
646
647dnl Create PCM plugin symbol list for static library
648rm -f "$srcdir"/src/pcm/pcm_symbols_list.c
649touch "$srcdir"/src/pcm/pcm_symbols_list.c
650for t in $PCM_PLUGIN_LIST; do
651  if eval test \$build_pcm_$t = yes; then
652    echo \&_snd_module_pcm_$t, >> "$srcdir"/src/pcm/pcm_symbols_list.c
653  fi
654done
655
656dnl Control Plugins
657
658AC_ARG_WITH(ctl-plugins,
659  AS_HELP_STRING([--with-ctl-plugins=<list>],
660    [build control plugins (default = all)]),
661  [ctl_plugins="$withval"], [ctl_plugins="all"])
662
663CTL_PLUGIN_LIST="remap shm ext"
664
665build_ctl_plugin="no"
666for t in $CTL_PLUGIN_LIST; do
667  eval build_ctl_$t="no"
668done
669
670ctl_plugins=`echo $ctl_plugins | sed 's/,/ /g'`
671for p in $ctl_plugins; do
672  for t in $CTL_PLUGIN_LIST; do
673    if test "$p" = "$t" -o "$p" = "all"; then
674      eval build_ctl_$t="yes"
675      build_ctl_plugin="yes"
676    fi
677  done
678done
679
680if test "$ac_cv_header_sys_shm_h" != "yes"; then
681  build_ctl_shm="no"
682fi
683
684AM_CONDITIONAL([BUILD_CTL_PLUGIN], [test x$build_ctl_plugin = xyes])
685AM_CONDITIONAL([BUILD_CTL_PLUGIN_REMAP], [test x$build_ctl_remap = xyes])
686AM_CONDITIONAL([BUILD_CTL_PLUGIN_SHM], [test x$build_ctl_shm = xyes])
687AM_CONDITIONAL([BUILD_CTL_PLUGIN_EXT], [test x$build_ctl_ext = xyes])
688
689dnl Create ctl plugin symbol list for static library
690rm -f "$srcdir"/src/control/ctl_symbols_list.c
691touch "$srcdir"/src/control/ctl_symbols_list.c
692for t in $CTL_PLUGIN_LIST; do
693  if eval test \$build_ctl_$t = yes; then
694    echo \&_snd_module_control_$t, >> "$srcdir"/src/control/ctl_symbols_list.c
695  fi
696done
697
698dnl Max number of cards
699AC_MSG_CHECKING(for max number of cards)
700AC_ARG_WITH(max-cards,
701  AS_HELP_STRING([--with-max-cards], [Specify the max number of cards (default = 32)]),
702  [ max_cards="$withval" ], [ max_cards="32" ])
703AC_MSG_RESULT([$max_cards])
704
705if test "$max_cards" -lt 1; then
706   AC_ERROR([Invalid max cards $max_cards])
707elif test "$max_cards" -gt 256; then
708   AC_ERROR([Invalid max cards $max_cards])
709fi
710AC_DEFINE_UNQUOTED(SND_MAX_CARDS, $max_cards, [Max number of cards])
711
712dnl Check for thread-safe API functions
713if test "$HAVE_LIBPTHREAD" = "yes"; then
714AC_MSG_CHECKING(for thread-safe API functions)
715AC_ARG_ENABLE(thread-safety,
716  AS_HELP_STRING([--disable-thread-safety],
717    [disable thread-safe API functions]),
718  threadsafe="$enableval", threadsafe="yes")
719if test "$threadsafe" = "yes"; then
720  AC_MSG_RESULT(yes)
721  AC_DEFINE([THREAD_SAFE_API], "1", [Disable thread-safe API functions])
722else
723  AC_MSG_RESULT(no)
724fi
725fi
726
727dnl Make a symlink for inclusion of alsa/xxx.h
728if test ! -L "$srcdir"/include/alsa ; then
729  echo "Making a symlink include/alsa"
730  rm -f "$srcdir"/include/alsa
731  ln -sf . "$srcdir"/include/alsa
732fi
733
734AC_OUTPUT(Makefile doc/Makefile doc/pictures/Makefile doc/doxygen.cfg \
735	  include/Makefile include/sound/Makefile include/sound/uapi/Makefile \
736	  src/Versions src/Makefile \
737          src/control/Makefile src/mixer/Makefile \
738	  src/pcm/Makefile src/pcm/scopes/Makefile \
739	  src/rawmidi/Makefile src/timer/Makefile \
740          src/hwdep/Makefile src/seq/Makefile src/ucm/Makefile \
741          src/alisp/Makefile src/topology/Makefile \
742	  src/conf/Makefile \
743	  src/conf/cards/Makefile \
744	  src/conf/ctl/Makefile \
745	  src/conf/pcm/Makefile \
746	  modules/Makefile modules/mixer/Makefile modules/mixer/simple/Makefile \
747	  alsalisp/Makefile aserver/Makefile \
748	  test/Makefile test/lsb/Makefile \
749	  utils/Makefile utils/alsa-lib.spec utils/alsa.pc utils/alsa-topology.pc)
750
751dnl Create asoundlib.h dynamically according to configure options
752echo "Creating asoundlib.h..."
753cp "$srcdir"/include/asoundlib-head.h include/asoundlib.h
754test "$ac_cv_header_endian_h" = "yes" && echo "#include <endian.h>" >> include/asoundlib.h
755if test "$ac_cv_header_sys_endian_h" = "yes"; then
756cat >> include/asoundlib.h <<EOF
757#include <sys/endian.h>
758#ifndef __BYTE_ORDER
759#define __BYTE_ORDER BYTE_ORDER
760#endif
761#ifndef __LITTLE_ENDIAN
762#define __LITTLE_ENDIAN LITTLE_ENDIAN
763#endif
764#ifndef __BIG_ENDIAN
765#define __BIG_ENDIAN BIG_ENDIAN
766#endif
767EOF
768fi
769cat >> include/asoundlib.h <<EOF
770
771#ifndef __GNUC__
772#define __inline__ inline
773#endif
774
775#include <alsa/asoundef.h>
776#include <alsa/version.h>
777#include <alsa/global.h>
778#include <alsa/input.h>
779#include <alsa/output.h>
780#include <alsa/error.h>
781#include <alsa/conf.h>
782EOF
783test "$build_pcm" = "yes" && echo "#include <alsa/pcm.h>" >> include/asoundlib.h
784test "$build_rawmidi" = "yes" && echo "#include <alsa/rawmidi.h>" >> include/asoundlib.h
785test "$build_pcm" = "yes" && echo "#include <alsa/timer.h>" >> include/asoundlib.h
786test "$build_hwdep" = "yes" && echo "#include <alsa/hwdep.h>" >> include/asoundlib.h
787echo "#include <alsa/control.h>" >> include/asoundlib.h
788test "$build_mixer" = "yes" && echo "#include <alsa/mixer.h>" >> include/asoundlib.h
789test "$build_seq" = "yes" && echo "#include <alsa/seq_event.h>" >> include/asoundlib.h
790test "$build_seq" = "yes" && echo "#include <alsa/seq.h>" >> include/asoundlib.h
791test "$build_seq" = "yes" && echo "#include <alsa/seqmid.h>" >> include/asoundlib.h
792test "$build_seq" = "yes" && echo "#include <alsa/seq_midi_event.h>" >> include/asoundlib.h
793cat "$srcdir"/include/asoundlib-tail.h >> include/asoundlib.h
794