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