diff --git a/0020-minor-malloc-changes.patch b/0020-minor-malloc-changes.patch new file mode 100644 index 0000000..f390694 --- /dev/null +++ b/0020-minor-malloc-changes.patch @@ -0,0 +1,52 @@ +From 670e228c693cbff9714856e5be93a88d137c5c30 Mon Sep 17 00:00:00 2001 +From: Olivier Langlois +Date: Thu, 12 Dec 2013 23:47:20 -0500 +Subject: [PATCH] minor malloc changes + +replace malloc + memset with calloc since calloc may skip the memset if +returned memory comes directly from sbrk() + +use malloc instead of malloc if first thing done with allocated memory is +to flip all bits to 1. + +Signed-off-by: Olivier Langlois +Signed-off-by: Takashi Iwai +--- + src/alisp/alisp.c | 3 +-- + src/pcm/pcm_ladspa.c | 2 +- + 2 files changed, 2 insertions(+), 3 deletions(-) + +diff --git a/src/alisp/alisp.c b/src/alisp/alisp.c +index 1796c33c3faf..3c61bb1754c3 100644 +--- a/src/alisp/alisp.c ++++ b/src/alisp/alisp.c +@@ -3202,12 +3202,11 @@ int alsa_lisp(struct alisp_cfg *cfg, struct alisp_instance **_instance) + struct alisp_object *p, *p1; + int i, j, retval = 0; + +- instance = (struct alisp_instance *)malloc(sizeof(struct alisp_instance)); ++ instance = (struct alisp_instance *)calloc(1, sizeof(struct alisp_instance)); + if (instance == NULL) { + nomem(); + return -ENOMEM; + } +- memset(instance, 0, sizeof(struct alisp_instance)); + instance->verbose = cfg->verbose && cfg->vout; + instance->warning = cfg->warning && cfg->wout; + instance->debug = cfg->debug && cfg->dout; +diff --git a/src/pcm/pcm_ladspa.c b/src/pcm/pcm_ladspa.c +index 0a9c52e975e6..9ce5242e2359 100644 +--- a/src/pcm/pcm_ladspa.c ++++ b/src/pcm/pcm_ladspa.c +@@ -1326,7 +1326,7 @@ static int snd_pcm_ladspa_parse_bindings(snd_pcm_ladspa_plugin_t *lplug, + count = (unsigned int)(channel + 1); + } + if (count > 0) { +- array = (unsigned int *)calloc(count, sizeof(unsigned int)); ++ array = (unsigned int *)malloc(count * sizeof(unsigned int)); + if (! array) + return -ENOMEM; + memset(array, 0xff, count * sizeof(unsigned int)); +-- +1.9.0 + diff --git a/0021-alsa-lib-minor-typo-in-pcm-doc.patch b/0021-alsa-lib-minor-typo-in-pcm-doc.patch new file mode 100644 index 0000000..e62302a --- /dev/null +++ b/0021-alsa-lib-minor-typo-in-pcm-doc.patch @@ -0,0 +1,29 @@ +From 3baf1bee843d8f0559f1481f26e9b8235b5e85ee Mon Sep 17 00:00:00 2001 +From: Olivier Langlois +Date: Sun, 5 Jan 2014 23:12:44 -0500 +Subject: [PATCH] alsa-lib: minor typo in pcm doc + +Added a missing 'f' in the word 'diferent' + +Signed-off-by: Olivier Langlois +Signed-off-by: Jaroslav Kysela +--- + src/pcm/pcm.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/src/pcm/pcm.c b/src/pcm/pcm.c +index c54fa06974fc..7e46014627c2 100644 +--- a/src/pcm/pcm.c ++++ b/src/pcm/pcm.c +@@ -105,7 +105,7 @@ The poll or select functions (see 'man 2 poll' or 'man 2 select' for further + details) allows to receive requests/events from the device while + an application is waiting on events from other sources (like keyboard, screen, + network etc.), too. \ref snd_pcm_poll_descriptors can be used to get file +-descriptors to poll or select on (note that wait direction might be diferent ++descriptors to poll or select on (note that wait direction might be different + than expected - do not use only returned file descriptors, but handle + events member as well - see \ref snd_pcm_poll_descriptors function + description for more details and \ref snd_pcm_poll_descriptors_revents for +-- +1.9.0 + diff --git a/0022-control_hw-fix-potential-memory-leak.patch b/0022-control_hw-fix-potential-memory-leak.patch new file mode 100644 index 0000000..626229b --- /dev/null +++ b/0022-control_hw-fix-potential-memory-leak.patch @@ -0,0 +1,30 @@ +From 336dc58beba0ca7cf5650dc12ed3eb72d61ac6d3 Mon Sep 17 00:00:00 2001 +From: Ivan Sorokin +Date: Wed, 22 Jan 2014 00:12:50 +0400 +Subject: [PATCH] control_hw: fix potential memory leak + +Signed-off-by: Ivan Sorokin +Signed-off-by: Takashi Iwai +--- + src/control/control_hw.c | 4 +++- + 1 file changed, 3 insertions(+), 1 deletion(-) + +diff --git a/src/control/control_hw.c b/src/control/control_hw.c +index 148097facd90..dfc9dcd51e20 100644 +--- a/src/control/control_hw.c ++++ b/src/control/control_hw.c +@@ -240,8 +240,10 @@ static int snd_ctl_hw_elem_tlv(snd_ctl_t *handle, int op_flag, + return -errno; + } + if (op_flag == 0) { +- if (xtlv->tlv[1] + 2 * sizeof(unsigned int) > tlv_size) ++ if (xtlv->tlv[1] + 2 * sizeof(unsigned int) > tlv_size) { ++ free(xtlv); + return -EFAULT; ++ } + memcpy(tlv, xtlv->tlv, xtlv->tlv[1] + 2 * sizeof(unsigned int)); + } + free(xtlv); +-- +1.9.0 + diff --git a/0023-pcm-initialize-pcm_dmix-monotonic-field.patch b/0023-pcm-initialize-pcm_dmix-monotonic-field.patch new file mode 100644 index 0000000..ab5fea3 --- /dev/null +++ b/0023-pcm-initialize-pcm_dmix-monotonic-field.patch @@ -0,0 +1,78 @@ +From e51cd448971c472d75dd700b0000988f6197b4da Mon Sep 17 00:00:00 2001 +From: Olivier Langlois +Date: Wed, 22 Jan 2014 19:04:45 -0500 +Subject: [PATCH] pcm: initialize pcm_dmix monotonic field + +not doing so, leaves the pcm object in an inconsistent state since +'info' field is copied from the slave which is then used when +snd_pcm_hw_params_is_monotonic() is called. + +For instance, when using dmix with aplay and an underrun is occuring, the following +info is returned: + +underrun!!! (at least 1248687948.256 ms long) +Status: + state : XRUN + trigger_time: 1390347762.628483000 + tstamp : 1390347766.184350000 + delay : -635 + avail : 15687 + avail_max : 15675 + +now is computed from CLOCK_MONOTONIC while pcm status tstamps are from gettimeofday(). + +After the fix, underruns are still occuring on my setup but at least the displayed info +is correct: + +underrun!!! (at least 7630.409 ms long) +Status: + state : XRUN + trigger_time: 7652.739201431 + tstamp : 7660.369600636 + delay : -624 + avail : 15676 + avail_max : 15664 + +Signed-off-by: Olivier Langlois +Signed-off-by: Takashi Iwai +--- + src/pcm/pcm_direct.c | 2 ++ + src/pcm/pcm_dmix.c | 2 +- + 2 files changed, 3 insertions(+), 1 deletion(-) + +diff --git a/src/pcm/pcm_direct.c b/src/pcm/pcm_direct.c +index 899c250401df..5416cf71674c 100644 +--- a/src/pcm/pcm_direct.c ++++ b/src/pcm/pcm_direct.c +@@ -857,6 +857,7 @@ static void save_slave_setting(snd_pcm_direct_t *dmix, snd_pcm_t *spcm) + COPY_SLAVE(buffer_time); + COPY_SLAVE(sample_bits); + COPY_SLAVE(frame_bits); ++ COPY_SLAVE(monotonic); + } + + #undef COPY_SLAVE +@@ -1220,6 +1221,7 @@ static void copy_slave_setting(snd_pcm_direct_t *dmix, snd_pcm_t *spcm) + COPY_SLAVE(buffer_time); + COPY_SLAVE(sample_bits); + COPY_SLAVE(frame_bits); ++ COPY_SLAVE(monotonic); + + spcm->info &= ~SND_PCM_INFO_PAUSE; + spcm->boundary = recalc_boundary_size(dmix->shmptr->s.boundary, spcm->buffer_size); +diff --git a/src/pcm/pcm_dmix.c b/src/pcm/pcm_dmix.c +index 2bd5d398d280..4aa6d4eab4a2 100644 +--- a/src/pcm/pcm_dmix.c ++++ b/src/pcm/pcm_dmix.c +@@ -1104,7 +1104,7 @@ int snd_pcm_dmix_open(snd_pcm_t **pcmp, const char *name, + + pcm->poll_fd = dmix->poll_fd; + pcm->poll_events = POLLIN; /* it's different than other plugins */ +- ++ pcm->monotonic = spcm->monotonic; + pcm->mmap_rw = 1; + snd_pcm_set_hw_ptr(pcm, &dmix->hw_ptr, -1, 0); + snd_pcm_set_appl_ptr(pcm, &dmix->appl_ptr, -1, 0); +-- +1.9.0 + diff --git a/0024-pcm-initialize-monotonic-field-for-dshare-and-dsnoop.patch b/0024-pcm-initialize-monotonic-field-for-dshare-and-dsnoop.patch new file mode 100644 index 0000000..ce189a8 --- /dev/null +++ b/0024-pcm-initialize-monotonic-field-for-dshare-and-dsnoop.patch @@ -0,0 +1,43 @@ +From 507cdc13187f5eeb222eeb43550cf6a67c3b29c9 Mon Sep 17 00:00:00 2001 +From: Takashi Iwai +Date: Thu, 23 Jan 2014 09:46:37 +0100 +Subject: [PATCH] pcm: initialize monotonic field for dshare and dsnoop, too + +Just like the previous fix for dmix, we need update for dshare and +dsnoop plugins. + +Signed-off-by: Takashi Iwai +--- + src/pcm/pcm_dshare.c | 2 +- + src/pcm/pcm_dsnoop.c | 2 +- + 2 files changed, 2 insertions(+), 2 deletions(-) + +diff --git a/src/pcm/pcm_dshare.c b/src/pcm/pcm_dshare.c +index 5b329510481e..f2d1103a6bfb 100644 +--- a/src/pcm/pcm_dshare.c ++++ b/src/pcm/pcm_dshare.c +@@ -792,7 +792,7 @@ int snd_pcm_dshare_open(snd_pcm_t **pcmp, const char *name, + + pcm->poll_fd = dshare->poll_fd; + pcm->poll_events = POLLIN; /* it's different than other plugins */ +- ++ pcm->monotonic = spcm->monotonic; + pcm->mmap_rw = 1; + snd_pcm_set_hw_ptr(pcm, &dshare->hw_ptr, -1, 0); + snd_pcm_set_appl_ptr(pcm, &dshare->appl_ptr, -1, 0); +diff --git a/src/pcm/pcm_dsnoop.c b/src/pcm/pcm_dsnoop.c +index 055e4f498343..76379140c133 100644 +--- a/src/pcm/pcm_dsnoop.c ++++ b/src/pcm/pcm_dsnoop.c +@@ -690,7 +690,7 @@ int snd_pcm_dsnoop_open(snd_pcm_t **pcmp, const char *name, + + pcm->poll_fd = dsnoop->poll_fd; + pcm->poll_events = POLLIN; /* it's different than other plugins */ +- ++ pcm->monotonic = spcm->monotonic; + pcm->mmap_rw = 1; + snd_pcm_set_hw_ptr(pcm, &dsnoop->hw_ptr, -1, 0); + snd_pcm_set_appl_ptr(pcm, &dsnoop->appl_ptr, -1, 0); +-- +1.9.0 + diff --git a/0025-pcm-use-CLOCK_REALTIME-for-non-monotonic-ts.patch b/0025-pcm-use-CLOCK_REALTIME-for-non-monotonic-ts.patch new file mode 100644 index 0000000..881ff81 --- /dev/null +++ b/0025-pcm-use-CLOCK_REALTIME-for-non-monotonic-ts.patch @@ -0,0 +1,46 @@ +From 66f07aa3b77e4013110f7b12640e204d0c15ac8d Mon Sep 17 00:00:00 2001 +From: Olivier Langlois +Date: Thu, 23 Jan 2014 19:03:00 -0500 +Subject: [PATCH] pcm: use CLOCK_REALTIME for non-monotonic ts + +gettimeofday() is the same than clock_gettime(CLOCK_REALTIME) +except for the loss of precision and the double unnecessary +conversion timespec <-> timeval. + +Signed-off-by: Olivier Langlois +Signed-off-by: Takashi Iwai +--- + src/pcm/pcm_local.h | 8 ++++++-- + 1 file changed, 6 insertions(+), 2 deletions(-) + +diff --git a/src/pcm/pcm_local.h b/src/pcm/pcm_local.h +index e1c0baa871f6..8a6c7431cc40 100644 +--- a/src/pcm/pcm_local.h ++++ b/src/pcm/pcm_local.h +@@ -961,17 +961,21 @@ typedef union snd_tmp_double { + /* get the current timestamp */ + static inline void gettimestamp(snd_htimestamp_t *tstamp, int monotonic) + { +-#if defined(HAVE_CLOCK_GETTIME) && defined(CLOCK_MONOTONIC) ++#if defined(HAVE_CLOCK_GETTIME) ++#if defined(CLOCK_MONOTONIC) + if (monotonic) { + clock_gettime(CLOCK_MONOTONIC, tstamp); + } else { + #endif ++ clock_gettime(CLOCK_REALTIME, tstamp); ++#else + struct timeval tv; + + gettimeofday(&tv, 0); + tstamp->tv_sec = tv.tv_sec; + tstamp->tv_nsec = tv.tv_usec * 1000L; +-#if defined(HAVE_CLOCK_GETTIME) && defined(CLOCK_MONOTONIC) ++#endif ++#if defined(HAVE_CLOCK_GETTIME) + } + #endif + } +-- +1.9.0 + diff --git a/0026-alsa-lib-heavy-pcm-atomics-cleanup.patch b/0026-alsa-lib-heavy-pcm-atomics-cleanup.patch new file mode 100644 index 0000000..49b1866 --- /dev/null +++ b/0026-alsa-lib-heavy-pcm-atomics-cleanup.patch @@ -0,0 +1,1257 @@ +From 326c6802e49e5499e16cf141e1cdb0360fce14aa Mon Sep 17 00:00:00 2001 +From: Riku Voipio +Date: Fri, 7 Feb 2014 15:38:58 +0200 +Subject: [PATCH] alsa-lib: heavy pcm atomics cleanup + +The following patch comes from the realization that at least ARM code +for atomics is quite broken and nobody has cared for a decade. + +A quick dive shows that only snd_atomic_{read,write}_{begin,end} +appear to be used widely. These are implemented using wmb/rmb. + +Only other use of atomic functions is in pcm_meter.c. +The #SND_PCM_TYPE_METER plugin type appears rarely, if ever, used. +I presume these days anyone who wants a meter/scope will do in pulseaudio +layer instead of alsa. + +It would seem better fit to have pcm_meter in alsa-plugins instead +of alsa-lib, but I guess that would be an ABI break... + +So instead, I'm proposing here + +1. Removal of all hand-crafted atomics from iatomic.h apart from barriers, + which are used in snd_atomic_{read,write}_{begin,end}. + +2. Using __sync_synchronize as the default fallback for barriers. This + has been available since gcc 4.1, so it shouldn't be a problem. + +3. Defining the few atomics used by pcm_meter.c withing pcm_meter.c + itself, using gcc atomic builtins[1]. + +4. Since gcc atomic builtins are available only since gcc 4.7, add a check for + that in gcc configure.in, and don't build pcm meter plugin if using + older gcc. + +The last point has the impact, that if there actually is someone who 1) +uses the meter plugin 2) wants to upgrade to 2014 alsa-lib 3) but +does not want to use a 2012+ gcc - that someone will be inconvenienced. + +Finally remove the unneeded configure check for cpu type. We can +trust the gcc to set right flags for us. + +[1] http://gcc.gnu.org/onlinedocs/gcc/_005f_005fatomic-Builtins.html + +Signed-off-by: Riku Voipio +Signed-off-by: Takashi Iwai +--- + configure.in | 53 +-- + include/iatomic.h | 1044 +-------------------------------------------------- + src/pcm/pcm_meter.c | 9 +- + 3 files changed, 33 insertions(+), 1073 deletions(-) + +diff --git a/configure.in b/configure.in +index 35fd89fc298a..bb56eb653ccc 100644 +--- a/configure.in ++++ b/configure.in +@@ -309,40 +309,6 @@ fi + + AC_SUBST(ALSA_DEPLIBS) + +-dnl Check for architecture +-AC_MSG_CHECKING(for architecture) +-case "$host" in +-i?86*) +- AC_MSG_RESULT(x86) +- ;; +-x86_64*) +- AC_MSG_RESULT(x86) +- ;; +-alpha*) +- AC_MSG_RESULT(alpha) +- ;; +-powerpc*|ppc*) +- AC_MSG_RESULT(ppc) +- CPPFLAGS="$CPPFLAGS -D__ppc__" +- ;; +-ia64*) +- AC_MSG_RESULT(ia64) +- CPPFLAGS="$CPPFLAGS -D__ia64__" +- ;; +-mips*) +- AC_MSG_RESULT(mips) +- CPPFLAGS="$CPPFLAGS -D__mips__" +- ;; +-arm*) +- AC_MSG_RESULT(arm) +- CPPFLAGS="$CPPFLAGS -D__arm__" +- ;; +-*) +- AC_MSG_RESULT($host_cpu) +- echo "No atomic operations supported.." +- ;; +-esac +- + dnl Check for wordexp.h + AC_CHECK_HEADERS([wordexp.h]) + +@@ -488,6 +454,21 @@ else + pcm_plugins="" + fi + ++dnl check atomics for pcm_meter ++ ++AC_MSG_CHECKING([whether GCC supports builtin atomic intrinsics]) ++if test -z "$gcc_have_atomics"; then ++ gcc_have_atomics=no ++ AC_TRY_LINK([], ++ [int i; ++ __atomic_load_n(&i, __ATOMIC_SEQ_CST); ++ __atomic_add_fetch(&i, 0, __ATOMIC_SEQ_CST); ++ ], ++ [gcc_have_atomics=yes], ++ [gcc_have_atomics=no]) ++fi ++AC_MSG_RESULT($gcc_have_atomics) ++ + PCM_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" + + build_pcm_plugin="no" +@@ -531,6 +512,10 @@ if test "$softfloat" = "yes"; then + build_pcm_ladspa="no" + fi + ++if test "$gcc_have_atomics" != "yes"; then ++ build_pcm_meter="no" ++fi ++ + AM_CONDITIONAL([BUILD_PCM_PLUGIN], [test x$build_pcm_plugin = xyes]) + AM_CONDITIONAL([BUILD_PCM_PLUGIN_COPY], [test x$build_pcm_copy = xyes]) + AM_CONDITIONAL([BUILD_PCM_PLUGIN_LINEAR], [test x$build_pcm_linear = xyes]) +diff --git a/include/iatomic.h b/include/iatomic.h +index 2393297557cc..acdd3e29c13a 100644 +--- a/include/iatomic.h ++++ b/include/iatomic.h +@@ -1,349 +1,21 @@ + #ifndef __ALSA_IATOMIC_H + #define __ALSA_IATOMIC_H + +-#if defined(__i386__) || defined(__x86_64__) +- +-/* +- * Atomic operations that C can't guarantee us. Useful for +- * resource counting etc.. +- */ +- +-#define ATOMIC_SMP_LOCK "lock ; " +- +-/* +- * Make sure gcc doesn't try to be clever and move things around +- * on us. We need to use _exactly_ the address the user gave us, +- * not some alias that contains the same information. +- */ +-typedef struct { volatile int counter; } atomic_t; +- +-#define ATOMIC_INIT(i) { (i) } +- +-/** +- * atomic_read - read atomic variable +- * @v: pointer of type atomic_t +- * +- * Atomically reads the value of @v. Note that the guaranteed +- * useful range of an atomic_t is only 24 bits. +- */ +-#define atomic_read(v) ((v)->counter) +- +-/** +- * atomic_set - set atomic variable +- * @v: pointer of type atomic_t +- * @i: required value +- * +- * Atomically sets the value of @v to @i. Note that the guaranteed +- * useful range of an atomic_t is only 24 bits. +- */ +-#define atomic_set(v,i) (((v)->counter) = (i)) +- +-/** +- * atomic_add - add integer to atomic variable +- * @i: integer value to add +- * @v: pointer of type atomic_t +- * +- * Atomically adds @i to @v. Note that the guaranteed useful range +- * of an atomic_t is only 24 bits. +- */ +-static __inline__ void atomic_add(int i, atomic_t *v) +-{ +- __asm__ __volatile__( +- ATOMIC_SMP_LOCK "addl %1,%0" +- :"=m" (v->counter) +- :"ir" (i), "m" (v->counter)); +-} +- +-/** +- * atomic_sub - subtract the atomic variable +- * @i: integer value to subtract +- * @v: pointer of type atomic_t +- * +- * Atomically subtracts @i from @v. Note that the guaranteed +- * useful range of an atomic_t is only 24 bits. +- */ +-static __inline__ void atomic_sub(int i, atomic_t *v) +-{ +- __asm__ __volatile__( +- ATOMIC_SMP_LOCK "subl %1,%0" +- :"=m" (v->counter) +- :"ir" (i), "m" (v->counter)); +-} +- +-/** +- * atomic_sub_and_test - subtract value from variable and test result +- * @i: integer value to subtract +- * @v: pointer of type atomic_t +- * +- * Atomically subtracts @i from @v and returns +- * true if the result is zero, or false for all +- * other cases. Note that the guaranteed +- * useful range of an atomic_t is only 24 bits. +- */ +-static __inline__ int atomic_sub_and_test(int i, atomic_t *v) +-{ +- unsigned char c; +- +- __asm__ __volatile__( +- ATOMIC_SMP_LOCK "subl %2,%0; sete %1" +- :"=m" (v->counter), "=qm" (c) +- :"ir" (i), "m" (v->counter) : "memory"); +- return c; +-} +- +-/** +- * atomic_inc - increment atomic variable +- * @v: pointer of type atomic_t +- * +- * Atomically increments @v by 1. Note that the guaranteed +- * useful range of an atomic_t is only 24 bits. +- */ +-static __inline__ void atomic_inc(atomic_t *v) +-{ +- __asm__ __volatile__( +- ATOMIC_SMP_LOCK "incl %0" +- :"=m" (v->counter) +- :"m" (v->counter)); +-} +- +-/** +- * atomic_dec - decrement atomic variable +- * @v: pointer of type atomic_t +- * +- * Atomically decrements @v by 1. Note that the guaranteed +- * useful range of an atomic_t is only 24 bits. +- */ +-static __inline__ void atomic_dec(atomic_t *v) +-{ +- __asm__ __volatile__( +- ATOMIC_SMP_LOCK "decl %0" +- :"=m" (v->counter) +- :"m" (v->counter)); +-} +- +-/** +- * atomic_dec_and_test - decrement and test +- * @v: pointer of type atomic_t +- * +- * Atomically decrements @v by 1 and +- * returns true if the result is 0, or false for all other +- * cases. Note that the guaranteed +- * useful range of an atomic_t is only 24 bits. +- */ +-static __inline__ int atomic_dec_and_test(atomic_t *v) +-{ +- unsigned char c; +- +- __asm__ __volatile__( +- ATOMIC_SMP_LOCK "decl %0; sete %1" +- :"=m" (v->counter), "=qm" (c) +- :"m" (v->counter) : "memory"); +- return c != 0; +-} +- +-/** +- * atomic_inc_and_test - increment and test +- * @v: pointer of type atomic_t +- * +- * Atomically increments @v by 1 +- * and returns true if the result is zero, or false for all +- * other cases. Note that the guaranteed +- * useful range of an atomic_t is only 24 bits. +- */ +-static __inline__ int atomic_inc_and_test(atomic_t *v) +-{ +- unsigned char c; +- +- __asm__ __volatile__( +- ATOMIC_SMP_LOCK "incl %0; sete %1" +- :"=m" (v->counter), "=qm" (c) +- :"m" (v->counter) : "memory"); +- return c != 0; +-} +- +-/** +- * atomic_add_negative - add and test if negative +- * @v: pointer of type atomic_t +- * @i: integer value to add +- * +- * Atomically adds @i to @v and returns true +- * if the result is negative, or false when +- * result is greater than or equal to zero. Note that the guaranteed +- * useful range of an atomic_t is only 24 bits. +- */ +-static __inline__ int atomic_add_negative(int i, atomic_t *v) +-{ +- unsigned char c; +- +- __asm__ __volatile__( +- ATOMIC_SMP_LOCK "addl %2,%0; sets %1" +- :"=m" (v->counter), "=qm" (c) +- :"ir" (i), "m" (v->counter) : "memory"); +- return c; +-} +- +-/* These are x86-specific, used by some header files */ +-#define atomic_clear_mask(mask, addr) \ +-__asm__ __volatile__(ATOMIC_SMP_LOCK "andl %0,%1" \ +-: : "r" (~(mask)),"m" (*addr) : "memory") +- +-#define atomic_set_mask(mask, addr) \ +-__asm__ __volatile__(ATOMIC_SMP_LOCK "orl %0,%1" \ +-: : "r" (mask),"m" (*addr) : "memory") +- +-/* +- * Force strict CPU ordering. +- * And yes, this is required on UP too when we're talking +- * to devices. +- * +- * For now, "wmb()" doesn't actually do anything, as all +- * Intel CPU's follow what Intel calls a *Processor Order*, +- * in which all writes are seen in the program order even +- * outside the CPU. +- * +- * I expect future Intel CPU's to have a weaker ordering, +- * but I'd also expect them to finally get their act together +- * and add some real memory barriers if so. +- */ +- + #ifdef __i386__ + #define mb() __asm__ __volatile__ ("lock; addl $0,0(%%esp)": : :"memory") + #define rmb() mb() + #define wmb() __asm__ __volatile__ ("": : :"memory") +-#else ++#define IATOMIC_DEFINED 1 ++#endif ++ ++#ifdef __x86_64__ + #define mb() asm volatile("mfence":::"memory") + #define rmb() asm volatile("lfence":::"memory") + #define wmb() asm volatile("sfence":::"memory") +-#endif +- +-#undef ATOMIC_SMP_LOCK +- + #define IATOMIC_DEFINED 1 +- +-#endif /* __i386__ */ ++#endif + + #ifdef __ia64__ +- +-/* +- * On IA-64, counter must always be volatile to ensure that that the +- * memory accesses are ordered. +- */ +-typedef struct { volatile int counter; } atomic_t; +- +-#define ATOMIC_INIT(i) ((atomic_t) { (i) }) +- +-#define atomic_read(v) ((v)->counter) +-#define atomic_set(v,i) (((v)->counter) = (i)) +- +-/* stripped version - we need only 4byte version */ +-#define ia64_cmpxchg(sem,ptr,old,new,size) \ +-({ \ +- __typeof__(ptr) _p_ = (ptr); \ +- __typeof__(new) _n_ = (new); \ +- unsigned long _o_, _r_; \ +- _o_ = (unsigned int) (long) (old); \ +- __asm__ __volatile__ ("mov ar.ccv=%0;;" :: "rO"(_o_)); \ +- __asm__ __volatile__ ("cmpxchg4."sem" %0=[%1],%2,ar.ccv" \ +- : "=r"(_r_) : "r"(_p_), "r"(_n_) : "memory"); \ +- (__typeof__(old)) _r_; \ +-}) +- +-static __inline__ int +-ia64_atomic_add (int i, atomic_t *v) +-{ +- int old, new; +- // CMPXCHG_BUGCHECK_DECL +- +- do { +- // CMPXCHG_BUGCHECK(v); +- old = atomic_read(v); +- new = old + i; +- } while (ia64_cmpxchg("acq", v, old, old + i, sizeof(atomic_t)) != old); +- return new; +-} +- +-static __inline__ int +-ia64_atomic_sub (int i, atomic_t *v) +-{ +- int old, new; +- // CMPXCHG_BUGCHECK_DECL +- +- do { +- // CMPXCHG_BUGCHECK(v); +- old = atomic_read(v); +- new = old - i; +- } while (ia64_cmpxchg("acq", v, old, new, sizeof(atomic_t)) != old); +- return new; +-} +- +-#define IA64_FETCHADD(tmp,v,n,sz) \ +-({ \ +- switch (sz) { \ +- case 4: \ +- __asm__ __volatile__ ("fetchadd4.rel %0=[%1],%2" \ +- : "=r"(tmp) : "r"(v), "i"(n) : "memory"); \ +- break; \ +- \ +- case 8: \ +- __asm__ __volatile__ ("fetchadd8.rel %0=[%1],%2" \ +- : "=r"(tmp) : "r"(v), "i"(n) : "memory"); \ +- break; \ +- } \ +-}) +- +-#define ia64_fetch_and_add(i,v) \ +-({ \ +- unsigned long _tmp; \ +- volatile __typeof__(*(v)) *_v = (v); \ +- switch (i) { \ +- case -16: IA64_FETCHADD(_tmp, _v, -16, sizeof(*(v))); break; \ +- case -8: IA64_FETCHADD(_tmp, _v, -8, sizeof(*(v))); break; \ +- case -4: IA64_FETCHADD(_tmp, _v, -4, sizeof(*(v))); break; \ +- case -1: IA64_FETCHADD(_tmp, _v, -1, sizeof(*(v))); break; \ +- case 1: IA64_FETCHADD(_tmp, _v, 1, sizeof(*(v))); break; \ +- case 4: IA64_FETCHADD(_tmp, _v, 4, sizeof(*(v))); break; \ +- case 8: IA64_FETCHADD(_tmp, _v, 8, sizeof(*(v))); break; \ +- case 16: IA64_FETCHADD(_tmp, _v, 16, sizeof(*(v))); break; \ +- } \ +- (__typeof__(*v)) (_tmp + (i)); /* return new value */ \ +-}) +- +-/* +- * Atomically add I to V and return TRUE if the resulting value is +- * negative. +- */ +-static __inline__ int +-atomic_add_negative (int i, atomic_t *v) +-{ +- return ia64_atomic_add(i, v) < 0; +-} +- +-#define atomic_add_return(i,v) \ +- ((__builtin_constant_p(i) && \ +- ( (i == 1) || (i == 4) || (i == 8) || (i == 16) \ +- || (i == -1) || (i == -4) || (i == -8) || (i == -16))) \ +- ? ia64_fetch_and_add(i, &(v)->counter) \ +- : ia64_atomic_add(i, v)) +- +-#define atomic_sub_return(i,v) \ +- ((__builtin_constant_p(i) && \ +- ( (i == 1) || (i == 4) || (i == 8) || (i == 16) \ +- || (i == -1) || (i == -4) || (i == -8) || (i == -16))) \ +- ? ia64_fetch_and_add(-(i), &(v)->counter) \ +- : ia64_atomic_sub(i, v)) +- +-#define atomic_dec_return(v) atomic_sub_return(1, (v)) +-#define atomic_inc_return(v) atomic_add_return(1, (v)) +- +-#define atomic_sub_and_test(i,v) (atomic_sub_return((i), (v)) == 0) +-#define atomic_dec_and_test(v) (atomic_sub_return(1, (v)) == 0) +-#define atomic_inc_and_test(v) (atomic_add_return(1, (v)) != 0) +- +-#define atomic_add(i,v) atomic_add_return((i), (v)) +-#define atomic_sub(i,v) atomic_sub_return((i), (v)) +-#define atomic_inc(v) atomic_add(1, (v)) +-#define atomic_dec(v) atomic_sub(1, (v)) +- + /* + * Macros to force memory ordering. In these descriptions, "previous" + * and "subsequent" refer to program order; "visible" means that all +@@ -376,111 +48,6 @@ atomic_add_negative (int i, atomic_t *v) + + #ifdef __alpha__ + +-/* +- * Atomic operations that C can't guarantee us. Useful for +- * resource counting etc... +- * +- * But use these as seldom as possible since they are much slower +- * than regular operations. +- */ +- +- +-/* +- * Counter is volatile to make sure gcc doesn't try to be clever +- * and move things around on us. We need to use _exactly_ the address +- * the user gave us, not some alias that contains the same information. +- */ +-typedef struct { volatile int counter; } atomic_t; +- +-#define ATOMIC_INIT(i) ( (atomic_t) { (i) } ) +- +-#define atomic_read(v) ((v)->counter) +-#define atomic_set(v,i) ((v)->counter = (i)) +- +-/* +- * To get proper branch prediction for the main line, we must branch +- * forward to code at the end of this object's .text section, then +- * branch back to restart the operation. +- */ +- +-static __inline__ void atomic_add(int i, atomic_t * v) +-{ +- unsigned long temp; +- __asm__ __volatile__( +- "1: ldl_l %0,%1\n" +- " addl %0,%2,%0\n" +- " stl_c %0,%1\n" +- " beq %0,2f\n" +- ".subsection 2\n" +- "2: br 1b\n" +- ".previous" +- :"=&r" (temp), "=m" (v->counter) +- :"Ir" (i), "m" (v->counter)); +-} +- +-static __inline__ void atomic_sub(int i, atomic_t * v) +-{ +- unsigned long temp; +- __asm__ __volatile__( +- "1: ldl_l %0,%1\n" +- " subl %0,%2,%0\n" +- " stl_c %0,%1\n" +- " beq %0,2f\n" +- ".subsection 2\n" +- "2: br 1b\n" +- ".previous" +- :"=&r" (temp), "=m" (v->counter) +- :"Ir" (i), "m" (v->counter)); +-} +- +-/* +- * Same as above, but return the result value +- */ +-static __inline__ long atomic_add_return(int i, atomic_t * v) +-{ +- long temp, result; +- __asm__ __volatile__( +- "1: ldl_l %0,%1\n" +- " addl %0,%3,%2\n" +- " addl %0,%3,%0\n" +- " stl_c %0,%1\n" +- " beq %0,2f\n" +- " mb\n" +- ".subsection 2\n" +- "2: br 1b\n" +- ".previous" +- :"=&r" (temp), "=m" (v->counter), "=&r" (result) +- :"Ir" (i), "m" (v->counter) : "memory"); +- return result; +-} +- +-static __inline__ long atomic_sub_return(int i, atomic_t * v) +-{ +- long temp, result; +- __asm__ __volatile__( +- "1: ldl_l %0,%1\n" +- " subl %0,%3,%2\n" +- " subl %0,%3,%0\n" +- " stl_c %0,%1\n" +- " beq %0,2f\n" +- " mb\n" +- ".subsection 2\n" +- "2: br 1b\n" +- ".previous" +- :"=&r" (temp), "=m" (v->counter), "=&r" (result) +- :"Ir" (i), "m" (v->counter) : "memory"); +- return result; +-} +- +-#define atomic_dec_return(v) atomic_sub_return(1,(v)) +-#define atomic_inc_return(v) atomic_add_return(1,(v)) +- +-#define atomic_sub_and_test(i,v) (atomic_sub_return((i), (v)) == 0) +-#define atomic_dec_and_test(v) (atomic_sub_return(1, (v)) == 0) +- +-#define atomic_inc(v) atomic_add(1,(v)) +-#define atomic_dec(v) atomic_sub(1,(v)) +- + #define mb() \ + __asm__ __volatile__("mb": : :"memory") + +@@ -496,168 +63,6 @@ __asm__ __volatile__("wmb": : :"memory") + + #ifdef __powerpc__ + +-typedef struct { volatile int counter; } atomic_t; +- +-#define ATOMIC_INIT(i) { (i) } +- +-#define atomic_read(v) ((v)->counter) +-#define atomic_set(v,i) (((v)->counter) = (i)) +- +-extern void atomic_clear_mask(unsigned long mask, unsigned long *addr); +-extern void atomic_set_mask(unsigned long mask, unsigned long *addr); +- +-#define SMP_ISYNC "\n\tisync" +- +-static __inline__ void atomic_add(int a, atomic_t *v) +-{ +- int t; +- +- __asm__ __volatile__( +-"1: lwarx %0,0,%3 # atomic_add\n\ +- add %0,%2,%0\n\ +- stwcx. %0,0,%3\n\ +- bne- 1b" +- : "=&r" (t), "=m" (v->counter) +- : "r" (a), "r" (&v->counter), "m" (v->counter) +- : "cc"); +-} +- +-static __inline__ int atomic_add_return(int a, atomic_t *v) +-{ +- int t; +- +- __asm__ __volatile__( +-"1: lwarx %0,0,%2 # atomic_add_return\n\ +- add %0,%1,%0\n\ +- stwcx. %0,0,%2\n\ +- bne- 1b" +- SMP_ISYNC +- : "=&r" (t) +- : "r" (a), "r" (&v->counter) +- : "cc", "memory"); +- +- return t; +-} +- +-static __inline__ void atomic_sub(int a, atomic_t *v) +-{ +- int t; +- +- __asm__ __volatile__( +-"1: lwarx %0,0,%3 # atomic_sub\n\ +- subf %0,%2,%0\n\ +- stwcx. %0,0,%3\n\ +- bne- 1b" +- : "=&r" (t), "=m" (v->counter) +- : "r" (a), "r" (&v->counter), "m" (v->counter) +- : "cc"); +-} +- +-static __inline__ int atomic_sub_return(int a, atomic_t *v) +-{ +- int t; +- +- __asm__ __volatile__( +-"1: lwarx %0,0,%2 # atomic_sub_return\n\ +- subf %0,%1,%0\n\ +- stwcx. %0,0,%2\n\ +- bne- 1b" +- SMP_ISYNC +- : "=&r" (t) +- : "r" (a), "r" (&v->counter) +- : "cc", "memory"); +- +- return t; +-} +- +-static __inline__ void atomic_inc(atomic_t *v) +-{ +- int t; +- +- __asm__ __volatile__( +-"1: lwarx %0,0,%2 # atomic_inc\n\ +- addic %0,%0,1\n\ +- stwcx. %0,0,%2\n\ +- bne- 1b" +- : "=&r" (t), "=m" (v->counter) +- : "r" (&v->counter), "m" (v->counter) +- : "cc"); +-} +- +-static __inline__ int atomic_inc_return(atomic_t *v) +-{ +- int t; +- +- __asm__ __volatile__( +-"1: lwarx %0,0,%1 # atomic_inc_return\n\ +- addic %0,%0,1\n\ +- stwcx. %0,0,%1\n\ +- bne- 1b" +- SMP_ISYNC +- : "=&r" (t) +- : "r" (&v->counter) +- : "cc", "memory"); +- +- return t; +-} +- +-static __inline__ void atomic_dec(atomic_t *v) +-{ +- int t; +- +- __asm__ __volatile__( +-"1: lwarx %0,0,%2 # atomic_dec\n\ +- addic %0,%0,-1\n\ +- stwcx. %0,0,%2\n\ +- bne- 1b" +- : "=&r" (t), "=m" (v->counter) +- : "r" (&v->counter), "m" (v->counter) +- : "cc"); +-} +- +-static __inline__ int atomic_dec_return(atomic_t *v) +-{ +- int t; +- +- __asm__ __volatile__( +-"1: lwarx %0,0,%1 # atomic_dec_return\n\ +- addic %0,%0,-1\n\ +- stwcx. %0,0,%1\n\ +- bne- 1b" +- SMP_ISYNC +- : "=&r" (t) +- : "r" (&v->counter) +- : "cc", "memory"); +- +- return t; +-} +- +-#define atomic_sub_and_test(a, v) (atomic_sub_return((a), (v)) == 0) +-#define atomic_dec_and_test(v) (atomic_dec_return((v)) == 0) +- +-/* +- * Atomically test *v and decrement if it is greater than 0. +- * The function returns the old value of *v minus 1. +- */ +-static __inline__ int atomic_dec_if_positive(atomic_t *v) +-{ +- int t; +- +- __asm__ __volatile__( +-"1: lwarx %0,0,%1 # atomic_dec_if_positive\n\ +- addic. %0,%0,-1\n\ +- blt- 2f\n\ +- stwcx. %0,0,%1\n\ +- bne- 1b" +- SMP_ISYNC +- "\n\ +-2:" : "=&r" (t) +- : "r" (&v->counter) +- : "cc", "memory"); +- +- return t; +-} +- + /* + * Memory barrier. + * The sync instruction guarantees that all memory accesses initiated +@@ -682,447 +87,14 @@ static __inline__ int atomic_dec_if_positive(atomic_t *v) + + #endif /* __powerpc__ */ + +-#ifdef __mips__ +- +-typedef struct { volatile int counter; } atomic_t; +- +-#define ATOMIC_INIT(i) { (i) } +- +-/* +- * atomic_read - read atomic variable +- * @v: pointer of type atomic_t +- * +- * Atomically reads the value of @v. Note that the guaranteed +- * useful range of an atomic_t is only 24 bits. +- */ +-#define atomic_read(v) ((v)->counter) +- +-/* +- * atomic_set - set atomic variable +- * @v: pointer of type atomic_t +- * @i: required value +- * +- * Atomically sets the value of @v to @i. Note that the guaranteed +- * useful range of an atomic_t is only 24 bits. +- */ +-#define atomic_set(v,i) ((v)->counter = (i)) +- +-/* +- * for MIPS II and better we can use ll/sc instruction, and kernel 2.4.3+ +- * will emulate it on MIPS I. +- */ +- +-/* +- * atomic_add - add integer to atomic variable +- * @i: integer value to add +- * @v: pointer of type atomic_t +- * +- * Atomically adds @i to @v. Note that the guaranteed useful range +- * of an atomic_t is only 24 bits. +- */ +-static __inline__ void atomic_add(int i, atomic_t * v) +-{ +- unsigned long temp; +- +- __asm__ __volatile__( +- ".set push \n" +- ".set mips2 \n" +- "1: ll %0, %1 # atomic_add\n" +- " addu %0, %2 \n" +- " sc %0, %1 \n" +- " beqz %0, 1b \n" +- ".set pop \n" +- : "=&r" (temp), "=m" (v->counter) +- : "Ir" (i), "m" (v->counter)); +-} +- +-/* +- * atomic_sub - subtract the atomic variable +- * @i: integer value to subtract +- * @v: pointer of type atomic_t +- * +- * Atomically subtracts @i from @v. Note that the guaranteed +- * useful range of an atomic_t is only 24 bits. +- */ +-static __inline__ void atomic_sub(int i, atomic_t * v) +-{ +- unsigned long temp; +- +- __asm__ __volatile__( +- ".set push \n" +- ".set mips2 \n" +- "1: ll %0, %1 # atomic_sub\n" +- " subu %0, %2 \n" +- " sc %0, %1 \n" +- " beqz %0, 1b \n" +- ".set pop \n" +- : "=&r" (temp), "=m" (v->counter) +- : "Ir" (i), "m" (v->counter)); +-} +- +-/* +- * Same as above, but return the result value +- */ +-static __inline__ int atomic_add_return(int i, atomic_t * v) +-{ +- unsigned long temp, result; +- +- __asm__ __volatile__( +- ".set push # atomic_add_return\n" +- ".set noreorder \n" +- ".set mips2 \n" +- "1: ll %1, %2 \n" +- " addu %0, %1, %3 \n" +- " sc %0, %2 \n" +- " beqz %0, 1b \n" +- " addu %0, %1, %3 \n" +- ".set pop \n" +- : "=&r" (result), "=&r" (temp), "=m" (v->counter) +- : "Ir" (i), "m" (v->counter) +- : "memory"); +- +- return result; +-} +- +-static __inline__ int atomic_sub_return(int i, atomic_t * v) +-{ +- unsigned long temp, result; +- +- __asm__ __volatile__( +- ".set push \n" +- ".set mips2 \n" +- ".set noreorder # atomic_sub_return\n" +- "1: ll %1, %2 \n" +- " subu %0, %1, %3 \n" +- " sc %0, %2 \n" +- " beqz %0, 1b \n" +- " subu %0, %1, %3 \n" +- ".set pop \n" +- : "=&r" (result), "=&r" (temp), "=m" (v->counter) +- : "Ir" (i), "m" (v->counter) +- : "memory"); +- +- return result; +-} +- +-#define atomic_dec_return(v) atomic_sub_return(1,(v)) +-#define atomic_inc_return(v) atomic_add_return(1,(v)) +- +-/* +- * atomic_sub_and_test - subtract value from variable and test result +- * @i: integer value to subtract +- * @v: pointer of type atomic_t +- * +- * Atomically subtracts @i from @v and returns +- * true if the result is zero, or false for all +- * other cases. Note that the guaranteed +- * useful range of an atomic_t is only 24 bits. +- */ +-#define atomic_sub_and_test(i,v) (atomic_sub_return((i), (v)) == 0) +- +-/* +- * atomic_inc_and_test - increment and test +- * @v: pointer of type atomic_t +- * +- * Atomically increments @v by 1 +- * and returns true if the result is zero, or false for all +- * other cases. Note that the guaranteed +- * useful range of an atomic_t is only 24 bits. +- */ +-#define atomic_inc_and_test(v) (atomic_inc_return(1, (v)) == 0) +- +-/* +- * atomic_dec_and_test - decrement by 1 and test +- * @v: pointer of type atomic_t +- * +- * Atomically decrements @v by 1 and +- * returns true if the result is 0, or false for all other +- * cases. Note that the guaranteed +- * useful range of an atomic_t is only 24 bits. +- */ +-#define atomic_dec_and_test(v) (atomic_sub_return(1, (v)) == 0) +- +-/* +- * atomic_inc - increment atomic variable +- * @v: pointer of type atomic_t +- * +- * Atomically increments @v by 1. Note that the guaranteed +- * useful range of an atomic_t is only 24 bits. +- */ +-#define atomic_inc(v) atomic_add(1,(v)) +- +-/* +- * atomic_dec - decrement and test +- * @v: pointer of type atomic_t +- * +- * Atomically decrements @v by 1. Note that the guaranteed +- * useful range of an atomic_t is only 24 bits. +- */ +-#define atomic_dec(v) atomic_sub(1,(v)) +- +-/* +- * atomic_add_negative - add and test if negative +- * @v: pointer of type atomic_t +- * @i: integer value to add +- * +- * Atomically adds @i to @v and returns true +- * if the result is negative, or false when +- * result is greater than or equal to zero. Note that the guaranteed +- * useful range of an atomic_t is only 24 bits. +- * +- * Currently not implemented for MIPS. +- */ +- +-#define mb() \ +-__asm__ __volatile__( \ +- "# prevent instructions being moved around\n\t" \ +- ".set\tnoreorder\n\t" \ +- "# 8 nops to fool the R4400 pipeline\n\t" \ +- "nop;nop;nop;nop;nop;nop;nop;nop\n\t" \ +- ".set\treorder" \ +- : /* no output */ \ +- : /* no input */ \ +- : "memory") +-#define rmb() mb() +-#define wmb() mb() +- +-#define IATOMIC_DEFINED 1 +- +-#endif /* __mips__ */ +- +-#ifdef __arm__ +- +-/* +- * FIXME: bellow code is valid only for SA11xx +- */ +- +-/* +- * Save the current interrupt enable state & disable IRQs +- */ +-#define local_irq_save(x) \ +- ({ \ +- unsigned long temp; \ +- __asm__ __volatile__( \ +- "mrs %0, cpsr @ local_irq_save\n" \ +-" orr %1, %0, #128\n" \ +-" msr cpsr_c, %1" \ +- : "=r" (x), "=r" (temp) \ +- : \ +- : "memory"); \ +- }) +- +-/* +- * restore saved IRQ & FIQ state +- */ +-#define local_irq_restore(x) \ +- __asm__ __volatile__( \ +- "msr cpsr_c, %0 @ local_irq_restore\n" \ +- : \ +- : "r" (x) \ +- : "memory") +- +-#define __save_flags_cli(x) local_irq_save(x) +-#define __restore_flags(x) local_irq_restore(x) +- +-typedef struct { volatile int counter; } atomic_t; +- +-#define ATOMIC_INIT(i) { (i) } +- +-#define atomic_read(v) ((v)->counter) +-#define atomic_set(v,i) (((v)->counter) = (i)) +- +-static __inline__ void atomic_add(int i, volatile atomic_t *v) +-{ +- unsigned long flags; +- +- __save_flags_cli(flags); +- v->counter += i; +- __restore_flags(flags); +-} +- +-static __inline__ void atomic_sub(int i, volatile atomic_t *v) +-{ +- unsigned long flags; +- +- __save_flags_cli(flags); +- v->counter -= i; +- __restore_flags(flags); +-} +- +-static __inline__ void atomic_inc(volatile atomic_t *v) +-{ +- unsigned long flags; +- +- __save_flags_cli(flags); +- v->counter += 1; +- __restore_flags(flags); +-} +- +-static __inline__ void atomic_dec(volatile atomic_t *v) +-{ +- unsigned long flags; +- +- __save_flags_cli(flags); +- v->counter -= 1; +- __restore_flags(flags); +-} +- +-static __inline__ int atomic_dec_and_test(volatile atomic_t *v) +-{ +- unsigned long flags; +- int result; +- +- __save_flags_cli(flags); +- v->counter -= 1; +- result = (v->counter == 0); +- __restore_flags(flags); +- +- return result; +-} +- +-static __inline__ int atomic_add_negative(int i, volatile atomic_t *v) +-{ +- unsigned long flags; +- int result; +- +- __save_flags_cli(flags); +- v->counter += i; +- result = (v->counter < 0); +- __restore_flags(flags); +- +- return result; +-} +- +-static __inline__ void atomic_clear_mask(unsigned long mask, unsigned long *addr) +-{ +- unsigned long flags; +- +- __save_flags_cli(flags); +- *addr &= ~mask; +- __restore_flags(flags); +-} +- +-#define mb() __asm__ __volatile__ ("" : : : "memory") +-#define rmb() mb() +-#define wmb() mb() +- +-#define IATOMIC_DEFINED 1 +- +-#endif /* __arm__ */ +- +-#ifdef __sh__ +- +-typedef struct { volatile int counter; } atomic_t; +- +-#define ATOMIC_INIT(i) { (i) } +- +-#define atomic_read(v) ((v)->counter) +-#define atomic_set(v,i) (((v)->counter) = (i)) +- +-#define atomic_dec_return(v) atomic_sub_return(1,(v)) +-#define atomic_inc_return(v) atomic_add_return(1,(v)) +- +-#define atomic_sub_and_test(i,v) (atomic_sub_return((i), (v)) == 0) +-#define atomic_dec_and_test(v) (atomic_sub_return(1, (v)) == 0) +-#define atomic_inc_and_test(v) (atomic_add_return(1, (v)) != 0) +- +-#define atomic_add(i,v) atomic_add_return((i),(v)) +-#define atomic_sub(i,v) atomic_sub_return((i),(v)) +-#define atomic_inc(v) atomic_add(1,(v)) +-#define atomic_dec(v) atomic_sub(1,(v)) +- +-static __inline__ int atomic_add_return(int i, volatile atomic_t *v) +-{ +- int result; +- +- asm volatile ( +- " .align 2\n" +- " mova 99f, r0\n" +- " mov r15, r1\n" +- " mov #-6, r15\n" +- " mov.l @%2, %0\n" +- " add %1, %0\n" +- " mov.l %0, @%2\n" +- "99: mov r1, r15" +- : "=&r"(result) +- : "r"(i), "r"(v) +- : "r0", "r1"); +- +- return result; +-} +- +-static __inline__ int atomic_sub_return(int i, volatile atomic_t *v) +-{ +- int result; +- +- asm volatile ( +- " .align 2\n" +- " mova 99f, r0\n" +- " mov r15, r1\n" +- " mov #-6, r15\n" +- " mov.l @%2, %0\n" +- " sub %1, %0\n" +- " mov.l %0, @%2\n" +- "99: mov r1, r15" +- : "=&r"(result) +- : "r"(i), "r"(v) +- : "r0", "r1"); +- +- return result; +-} +- +-#define mb() __asm__ __volatile__ ("" : : : "memory") +-#define rmb() mb() +-#define wmb() mb() +- +-#define IATOMIC_DEFINED 1 +- +-#endif /* __sh__ */ +- +-#ifdef __bfin__ +- +-#include +- +-typedef struct { volatile int counter; } atomic_t; +- +-#define ATOMIC_INIT(i) { (i) } ++#ifndef IATOMIC_DEFINED + +-#define atomic_read(v) ((v)->counter) +-#define atomic_set(v,i) (((v)->counter) = (i)) +-#define atomic_add(i,v) bfin_atomic_add32(&(v)->counter, i) +-#define atomic_sub(i,v) bfin_atomic_sub32(&(v)->counter, i) +-#define atomic_inc(v) bfin_atomic_inc32(&(v)->counter); +-#define atomic_dec(v) bfin_atomic_dec32(&(v)->counter); ++/* Generic __sync_synchronize is available from gcc 4.1 */ + +-#define mb() __asm__ __volatile__ ("" : : : "memory") ++#define mb() __sync_synchronize() + #define rmb() mb() + #define wmb() mb() + +-#define IATOMIC_DEFINED 1 +- +-#endif /* __bfin__ */ +- +-#ifndef IATOMIC_DEFINED +-/* +- * non supported architecture. +- */ +-#warning "Atomic operations are not supported on this architecture." +- +-typedef struct { volatile int counter; } atomic_t; +- +-#define ATOMIC_INIT(i) { (i) } +- +-#define atomic_read(v) ((v)->counter) +-#define atomic_set(v,i) (((v)->counter) = (i)) +-#define atomic_add(i,v) (((v)->counter) += (i)) +-#define atomic_sub(i,v) (((v)->counter) -= (i)) +-#define atomic_inc(v) (((v)->counter)++) +-#define atomic_dec(v) (((v)->counter)--) +- +-#define mb() +-#define rmb() +-#define wmb() +- + #define IATOMIC_DEFINED 1 + + #endif /* IATOMIC_DEFINED */ +diff --git a/src/pcm/pcm_meter.c b/src/pcm/pcm_meter.c +index 573b6fe59d1d..676fbef89c30 100644 +--- a/src/pcm/pcm_meter.c ++++ b/src/pcm/pcm_meter.c +@@ -33,7 +33,10 @@ + #include + #include "pcm_local.h" + #include "pcm_plugin.h" +-#include "iatomic.h" ++ ++#define atomic_read(ptr) __atomic_load_n(ptr, __ATOMIC_SEQ_CST ) ++#define atomic_add(ptr, n) __atomic_add_fetch(ptr, n, __ATOMIC_SEQ_CST) ++#define atomic_dec(ptr) __atomic_sub_fetch(ptr, 1, __ATOMIC_SEQ_CST) + + #ifndef PIC + /* entry for static linking */ +@@ -61,7 +64,7 @@ typedef struct _snd_pcm_meter { + struct list_head scopes; + int closed; + int running; +- atomic_t reset; ++ int reset; + pthread_t thread; + pthread_mutex_t update_mutex; + pthread_mutex_t running_mutex; +@@ -288,7 +291,7 @@ static int snd_pcm_meter_prepare(snd_pcm_t *pcm) + { + snd_pcm_meter_t *meter = pcm->private_data; + int err; +- atomic_inc(&meter->reset); ++ atomic_add(&meter->reset, 1); + err = snd_pcm_prepare(meter->gen.slave); + if (err >= 0) { + if (pcm->stream == SND_PCM_STREAM_PLAYBACK) +-- +1.9.0 + diff --git a/0027-conf-Add-basic-infrastructure-for-2.1-surround-sound.patch b/0027-conf-Add-basic-infrastructure-for-2.1-surround-sound.patch new file mode 100644 index 0000000..6fcf613 --- /dev/null +++ b/0027-conf-Add-basic-infrastructure-for-2.1-surround-sound.patch @@ -0,0 +1,119 @@ +From 57b5076c30b3453ee843912c0aeb3df8dbee3f68 Mon Sep 17 00:00:00 2001 +From: David Henningsson +Date: Tue, 18 Feb 2014 16:41:48 +0100 +Subject: [PATCH] conf: Add basic infrastructure for 2.1 surround sound + +For now, we do 2.1 over 5.1, because that's what ALSA allows per default. + +Signed-off-by: David Henningsson +Signed-off-by: Takashi Iwai +--- + src/conf/alsa.conf | 3 +++ + src/conf/pcm/Makefile.am | 2 +- + src/conf/pcm/surround21.conf | 62 ++++++++++++++++++++++++++++++++++++++++++++ + 3 files changed, 66 insertions(+), 1 deletion(-) + create mode 100644 src/conf/pcm/surround21.conf + +diff --git a/src/conf/alsa.conf b/src/conf/alsa.conf +index bc91df3b93a5..5c928e8afbcd 100644 +--- a/src/conf/alsa.conf ++++ b/src/conf/alsa.conf +@@ -90,6 +90,8 @@ defaults.pcm.center_lfe.card defaults.pcm.card + defaults.pcm.center_lfe.device defaults.pcm.device + defaults.pcm.side.card defaults.pcm.card + defaults.pcm.side.device defaults.pcm.device ++defaults.pcm.surround21.card defaults.pcm.card ++defaults.pcm.surround21.device defaults.pcm.device + defaults.pcm.surround40.card defaults.pcm.card + defaults.pcm.surround40.device defaults.pcm.device + defaults.pcm.surround41.card defaults.pcm.card +@@ -131,6 +133,7 @@ pcm.front cards.pcm.front + pcm.rear cards.pcm.rear + pcm.center_lfe cards.pcm.center_lfe + pcm.side cards.pcm.side ++pcm.surround21 cards.pcm.surround21 + pcm.surround40 cards.pcm.surround40 + pcm.surround41 cards.pcm.surround41 + pcm.surround50 cards.pcm.surround50 +diff --git a/src/conf/pcm/Makefile.am b/src/conf/pcm/Makefile.am +index cc3286e6ddf0..c548660d1696 100644 +--- a/src/conf/pcm/Makefile.am ++++ b/src/conf/pcm/Makefile.am +@@ -1,5 +1,5 @@ + cfg_files = default.conf front.conf rear.conf center_lfe.conf side.conf\ +- surround40.conf surround41.conf \ ++ surround21.conf surround40.conf surround41.conf \ + surround50.conf surround51.conf \ + surround71.conf iec958.conf hdmi.conf modem.conf \ + dmix.conf dsnoop.conf \ +diff --git a/src/conf/pcm/surround21.conf b/src/conf/pcm/surround21.conf +new file mode 100644 +index 000000000000..be29020f24c7 +--- /dev/null ++++ b/src/conf/pcm/surround21.conf +@@ -0,0 +1,62 @@ ++# ++# Hardware output from 2.1 speakers. ++# Samples must be positioned: ++# chn0 - front left ++# chn1 - front right ++# chn2 - LFE ++# ++ ++pcm.!surround21 { ++ @args [ CARD DEV ] ++ @args.CARD { ++ type string ++ default { ++ @func getenv ++ vars [ ++ ALSA_SURROUND21_CARD ++ ALSA_PCM_CARD ++ ALSA_CARD ++ ] ++ default { ++ @func refer ++ name defaults.pcm.surround21.card ++ } ++ } ++ } ++ @args.DEV { ++ type integer ++ default { ++ @func igetenv ++ vars [ ++ ALSA_SURROUND21_DEVICE ++ ] ++ default { ++ @func refer ++ name defaults.pcm.surround21.device ++ } ++ } ++ } ++ type route ++ slave.pcm { ++ @func refer ++ name { ++ @func concat ++ strings [ ++ "cards." ++ { ++ @func card_driver ++ card $CARD ++ } ++ ".pcm.surround51." $DEV ":CARD=" $CARD ++ ] ++ } ++ } ++ slave.channels 6 ++ ttable.0.0 1 ++ ttable.1.1 1 ++ ttable.2.5 1 ++ hint { ++ description "2.1 Surround output to Front and Subwoofer speakers" ++ device $DEV ++ } ++} +-- +1.9.0 + diff --git a/0028-conf-Add-surround-2.1-support-to-all-cards.patch b/0028-conf-Add-surround-2.1-support-to-all-cards.patch new file mode 100644 index 0000000..2ed93a1 --- /dev/null +++ b/0028-conf-Add-surround-2.1-support-to-all-cards.patch @@ -0,0 +1,381 @@ +From 1af088e39b75a0a0897c7036487b143e983cd423 Mon Sep 17 00:00:00 2001 +From: David Henningsson +Date: Tue, 18 Feb 2014 16:41:49 +0100 +Subject: [PATCH] conf: Add surround 2.1 support to all cards + +All cards that support 4.1 surround now also support 2.1 surround, +because they both have surround 5.1 as slave. + +Signed-off-by: David Henningsson +Signed-off-by: Takashi Iwai +--- + src/conf/cards/ATIIXP-SPDMA.conf | 1 + + src/conf/cards/ATIIXP.conf | 1 + + src/conf/cards/Audigy.conf | 1 + + src/conf/cards/Audigy2.conf | 1 + + src/conf/cards/Aureon51.conf | 1 + + src/conf/cards/Aureon71.conf | 1 + + src/conf/cards/CA0106.conf | 1 + + src/conf/cards/CMI8738-MC6.conf | 1 + + src/conf/cards/CMI8738-MC8.conf | 1 + + src/conf/cards/CMI8788.conf | 2 +- + src/conf/cards/CS46xx.conf | 1 + + src/conf/cards/EMU10K1.conf | 1 + + src/conf/cards/EMU10K1X.conf | 1 + + src/conf/cards/FM801.conf | 1 + + src/conf/cards/FireWave.conf | 1 + + src/conf/cards/HDA-Intel.conf | 1 + + src/conf/cards/ICE1712.conf | 1 + + src/conf/cards/ICE1724.conf | 1 + + src/conf/cards/ICH.conf | 1 + + src/conf/cards/ICH4.conf | 1 + + src/conf/cards/Loopback.conf | 1 + + src/conf/cards/NFORCE.conf | 1 + + src/conf/cards/SB-XFi.conf | 1 + + src/conf/cards/SI7018.conf | 1 + + src/conf/cards/USB-Audio.conf | 1 + + src/conf/cards/VIA8233.conf | 1 + + src/conf/cards/VIA8233A.conf | 1 + + src/conf/cards/VIA8237.conf | 1 + + 28 files changed, 28 insertions(+), 1 deletion(-) + +diff --git a/src/conf/cards/ATIIXP-SPDMA.conf b/src/conf/cards/ATIIXP-SPDMA.conf +index 5c80815ddaf6..42540d6817c0 100644 +--- a/src/conf/cards/ATIIXP-SPDMA.conf ++++ b/src/conf/cards/ATIIXP-SPDMA.conf +@@ -77,6 +77,7 @@ ATIIXP-SPDMA.pcm.surround40.0 { + } + } + ++ + + + +diff --git a/src/conf/cards/ATIIXP.conf b/src/conf/cards/ATIIXP.conf +index 38d802345bfb..c4d33ef34a68 100644 +--- a/src/conf/cards/ATIIXP.conf ++++ b/src/conf/cards/ATIIXP.conf +@@ -77,6 +77,7 @@ ATIIXP.pcm.surround40.0 { + } + } + ++ + + + +diff --git a/src/conf/cards/Audigy.conf b/src/conf/cards/Audigy.conf +index 4fe387327633..1c92496653e0 100644 +--- a/src/conf/cards/Audigy.conf ++++ b/src/conf/cards/Audigy.conf +@@ -143,6 +143,7 @@ Audigy.pcm.center_lfe.0 { + } + } + ++ + + + +diff --git a/src/conf/cards/Audigy2.conf b/src/conf/cards/Audigy2.conf +index db45776e54c4..cbec78358882 100644 +--- a/src/conf/cards/Audigy2.conf ++++ b/src/conf/cards/Audigy2.conf +@@ -195,6 +195,7 @@ Audigy2.pcm.side.0 { + } + } + ++ + + + +diff --git a/src/conf/cards/Aureon51.conf b/src/conf/cards/Aureon51.conf +index 24b4d949174b..07be4a77aa12 100644 +--- a/src/conf/cards/Aureon51.conf ++++ b/src/conf/cards/Aureon51.conf +@@ -86,6 +86,7 @@ Aureon51.pcm.surround40.0 { + channels 4 + } + ++ + + + +diff --git a/src/conf/cards/Aureon71.conf b/src/conf/cards/Aureon71.conf +index 1479c25cce21..a43ce2cee5fa 100644 +--- a/src/conf/cards/Aureon71.conf ++++ b/src/conf/cards/Aureon71.conf +@@ -86,6 +86,7 @@ Aureon71.pcm.surround40.0 { + channels 4 + } + ++ + + + +diff --git a/src/conf/cards/CA0106.conf b/src/conf/cards/CA0106.conf +index 9d21770f84ad..2f0eaf0afdc8 100644 +--- a/src/conf/cards/CA0106.conf ++++ b/src/conf/cards/CA0106.conf +@@ -108,6 +108,7 @@ CA0106.pcm.surround40.0 { + ] + } + ++ + + + +diff --git a/src/conf/cards/CMI8738-MC6.conf b/src/conf/cards/CMI8738-MC6.conf +index 171c772809ab..edc67d44d96a 100644 +--- a/src/conf/cards/CMI8738-MC6.conf ++++ b/src/conf/cards/CMI8738-MC6.conf +@@ -77,6 +77,7 @@ CMI8738-MC6.pcm.surround40.0 { + } + } + ++ + + + +diff --git a/src/conf/cards/CMI8738-MC8.conf b/src/conf/cards/CMI8738-MC8.conf +index a5bf6cb4889a..ddff75304bc3 100644 +--- a/src/conf/cards/CMI8738-MC8.conf ++++ b/src/conf/cards/CMI8738-MC8.conf +@@ -105,6 +105,7 @@ CMI8738-MC8.pcm.surround40.0 { + } + + ++ + + + +diff --git a/src/conf/cards/CMI8788.conf b/src/conf/cards/CMI8788.conf +index 0ca71e9d28de..edcb0c9ccc36 100644 +--- a/src/conf/cards/CMI8788.conf ++++ b/src/conf/cards/CMI8788.conf +@@ -48,7 +48,7 @@ CMI8788.pcm.surround40.0 { + channels 4 + } + +- ++ + + + +diff --git a/src/conf/cards/CS46xx.conf b/src/conf/cards/CS46xx.conf +index 1983142548fd..b71c30aad514 100644 +--- a/src/conf/cards/CS46xx.conf ++++ b/src/conf/cards/CS46xx.conf +@@ -112,6 +112,7 @@ CS46xx.pcm.surround40.0 { + ] + } + ++ + + + +diff --git a/src/conf/cards/EMU10K1.conf b/src/conf/cards/EMU10K1.conf +index d51f6dc02fac..ef193fe0c460 100644 +--- a/src/conf/cards/EMU10K1.conf ++++ b/src/conf/cards/EMU10K1.conf +@@ -217,6 +217,7 @@ EMU10K1.pcm.surround40.0 { + ] + } + ++ + + + +diff --git a/src/conf/cards/EMU10K1X.conf b/src/conf/cards/EMU10K1X.conf +index b5fc708c4cb2..f742863679cb 100644 +--- a/src/conf/cards/EMU10K1X.conf ++++ b/src/conf/cards/EMU10K1X.conf +@@ -96,6 +96,7 @@ EMU10K1X.pcm.surround40.0 { + ] + } + ++ + + + +diff --git a/src/conf/cards/FM801.conf b/src/conf/cards/FM801.conf +index 997b2184f38c..0ddf799cd029 100644 +--- a/src/conf/cards/FM801.conf ++++ b/src/conf/cards/FM801.conf +@@ -40,6 +40,7 @@ FM801.pcm.default { + + FM801.pcm.surround40.0 "cards.FM801.pcm.front.0" + ++ + + + +diff --git a/src/conf/cards/FireWave.conf b/src/conf/cards/FireWave.conf +index 63fb23d96bc0..fcfc83ccfb19 100644 +--- a/src/conf/cards/FireWave.conf ++++ b/src/conf/cards/FireWave.conf +@@ -25,6 +25,7 @@ FireWave.pcm.front.0 { + card $CARD + } + ++ + + + +diff --git a/src/conf/cards/HDA-Intel.conf b/src/conf/cards/HDA-Intel.conf +index 7976b6c52ee9..fa9f6946376f 100644 +--- a/src/conf/cards/HDA-Intel.conf ++++ b/src/conf/cards/HDA-Intel.conf +@@ -71,6 +71,7 @@ HDA-Intel.pcm.default { + hint.device 0 + } + ++ + + + +diff --git a/src/conf/cards/ICE1712.conf b/src/conf/cards/ICE1712.conf +index f5b8add6322c..398fa7ad5307 100644 +--- a/src/conf/cards/ICE1712.conf ++++ b/src/conf/cards/ICE1712.conf +@@ -74,6 +74,7 @@ ICE1712.pcm.surround40.0 { + slave.channels 10 + } + ++ + + + +diff --git a/src/conf/cards/ICE1724.conf b/src/conf/cards/ICE1724.conf +index e806b36d92a1..61cac0132f07 100644 +--- a/src/conf/cards/ICE1724.conf ++++ b/src/conf/cards/ICE1724.conf +@@ -95,6 +95,7 @@ ICE1724.pcm.surround40.0 { + } + } + ++ + + + +diff --git a/src/conf/cards/ICH.conf b/src/conf/cards/ICH.conf +index 47ffef96531c..6fc9a5a236c1 100644 +--- a/src/conf/cards/ICH.conf ++++ b/src/conf/cards/ICH.conf +@@ -98,6 +98,7 @@ ICH.pcm.surround40.0 { + } + } + ++ + + + +diff --git a/src/conf/cards/ICH4.conf b/src/conf/cards/ICH4.conf +index 1bf5605bfd7f..64ec883d9c73 100644 +--- a/src/conf/cards/ICH4.conf ++++ b/src/conf/cards/ICH4.conf +@@ -98,6 +98,7 @@ ICH4.pcm.surround40.0 { + } + } + ++ + + + +diff --git a/src/conf/cards/Loopback.conf b/src/conf/cards/Loopback.conf +index 5365fa1bec52..974aa7535340 100644 +--- a/src/conf/cards/Loopback.conf ++++ b/src/conf/cards/Loopback.conf +@@ -63,6 +63,7 @@ Loopback.pcm.default { + hint.device 0 + } + ++ + + + +diff --git a/src/conf/cards/NFORCE.conf b/src/conf/cards/NFORCE.conf +index 6ebefe3da29e..64d15479291b 100644 +--- a/src/conf/cards/NFORCE.conf ++++ b/src/conf/cards/NFORCE.conf +@@ -98,6 +98,7 @@ NFORCE.pcm.surround40.0 { + } + } + ++ + + + +diff --git a/src/conf/cards/SB-XFi.conf b/src/conf/cards/SB-XFi.conf +index 38d0027fb4f2..eb2218bfdcc7 100644 +--- a/src/conf/cards/SB-XFi.conf ++++ b/src/conf/cards/SB-XFi.conf +@@ -53,6 +53,7 @@ SB-XFi.pcm.side.0 { + hint.device 3 + } + ++ + + + +diff --git a/src/conf/cards/SI7018.conf b/src/conf/cards/SI7018.conf +index 7417bd5bf2e4..02b8fc877ff3 100644 +--- a/src/conf/cards/SI7018.conf ++++ b/src/conf/cards/SI7018.conf +@@ -78,6 +78,7 @@ SI7018.pcm.surround40.0 { + ] + } + ++ + + + +diff --git a/src/conf/cards/USB-Audio.conf b/src/conf/cards/USB-Audio.conf +index 8a6d9cac6ead..ce3ae019f7f6 100644 +--- a/src/conf/cards/USB-Audio.conf ++++ b/src/conf/cards/USB-Audio.conf +@@ -314,6 +314,7 @@ USB-Audio.pcm.surround40_two_stereo_devices { + } + } + ++ + + + +diff --git a/src/conf/cards/VIA8233.conf b/src/conf/cards/VIA8233.conf +index 668bfd9e421b..9ad321f713a9 100644 +--- a/src/conf/cards/VIA8233.conf ++++ b/src/conf/cards/VIA8233.conf +@@ -86,6 +86,7 @@ VIA8233.pcm.surround40.0 { + } + } + ++ + + + +diff --git a/src/conf/cards/VIA8233A.conf b/src/conf/cards/VIA8233A.conf +index 97d2a7daf335..679fccf3d06f 100644 +--- a/src/conf/cards/VIA8233A.conf ++++ b/src/conf/cards/VIA8233A.conf +@@ -84,6 +84,7 @@ VIA8233A.pcm.surround40.0 { + } + } + ++ + + + +diff --git a/src/conf/cards/VIA8237.conf b/src/conf/cards/VIA8237.conf +index 404e19075cbd..29d8e00f6601 100644 +--- a/src/conf/cards/VIA8237.conf ++++ b/src/conf/cards/VIA8237.conf +@@ -79,6 +79,7 @@ VIA8237.pcm.surround40.0 { + } + } + ++ + + + +-- +1.9.0 + diff --git a/0029-Portability-fix-look-for-sys-endian.h-as-well-as-end.patch b/0029-Portability-fix-look-for-sys-endian.h-as-well-as-end.patch new file mode 100644 index 0000000..71a8845 --- /dev/null +++ b/0029-Portability-fix-look-for-sys-endian.h-as-well-as-end.patch @@ -0,0 +1,150 @@ +From 7a6e8ca348c4c2640cbc337914d1376333fdbc17 Mon Sep 17 00:00:00 2001 +From: Patrick Welche +Date: Sun, 23 Feb 2014 11:12:48 +0000 +Subject: [PATCH] Portability fix: look for sys/endian.h as well as endian.h + +- define __BYTE_ORDER and friends. +- adjust asoundlib.h accordingly. + +Signed-off-by: Patrick Welche +Signed-off-by: Takashi Iwai +--- + configure.in | 33 +++++++++++++++++++++++++++++++-- + include/asoundlib-head.h | 13 ------------- + include/local.h | 18 +++++++++++++++++- + src/pcm/pcm_file.c | 1 - + 4 files changed, 48 insertions(+), 17 deletions(-) + +diff --git a/configure.in b/configure.in +index bb56eb653ccc..9463b5ad4766 100644 +--- a/configure.in ++++ b/configure.in +@@ -309,8 +309,8 @@ fi + + AC_SUBST(ALSA_DEPLIBS) + +-dnl Check for wordexp.h +-AC_CHECK_HEADERS([wordexp.h]) ++dnl Check for headers ++AC_CHECK_HEADERS([wordexp.h endian.h sys/endian.h]) + + dnl Check for resmgr support... + AC_MSG_CHECKING(for resmgr support) +@@ -660,6 +660,35 @@ AC_OUTPUT(Makefile doc/Makefile doc/pictures/Makefile doc/doxygen.cfg \ + dnl Create asoundlib.h dynamically according to configure options + echo "Creating asoundlib.h..." + cp "$srcdir"/include/asoundlib-head.h include/asoundlib.h ++test "$ac_cv_header_endian_h" = "yes" && echo "#include " >> include/asoundlib.h ++if test "$ac_cv_header_sys_endian_h" = "yes"; then ++cat >> include/asoundlib.h < ++#ifndef __BYTE_ORDER ++#define __BYTE_ORDER BYTE_ORDER ++#endif ++#ifndef __LITTLE_ENDIAN ++#define __LITTLE_ENDIAN LITTLE_ENDIAN ++#endif ++#ifndef __BIG_ENDIAN ++#define __BIG_ENDIAN BIG_ENDIAN ++#endif ++EOF ++fi ++cat >> include/asoundlib.h < ++#include ++#include ++#include ++#include ++#include ++#include ++EOF + test "$build_pcm" = "yes" && echo "#include " >> include/asoundlib.h + test "$build_rawmidi" = "yes" && echo "#include " >> include/asoundlib.h + test "$build_pcm" = "yes" && echo "#include " >> include/asoundlib.h +diff --git a/include/asoundlib-head.h b/include/asoundlib-head.h +index 71b5c29f61c4..1ec611e56b8e 100644 +--- a/include/asoundlib-head.h ++++ b/include/asoundlib-head.h +@@ -35,19 +35,6 @@ + #include + #include + #include +-#include + #include + #include + #include +- +-#ifndef __GNUC__ +-#define __inline__ inline +-#endif +- +-#include +-#include +-#include +-#include +-#include +-#include +-#include +diff --git a/include/local.h b/include/local.h +index 9464efa49642..2fe9a273f0b0 100644 +--- a/include/local.h ++++ b/include/local.h +@@ -22,13 +22,30 @@ + #ifndef __LOCAL_H + #define __LOCAL_H + ++#include "config.h" ++ + #include + #include + #include + #include + #include + #include ++#ifdef HAVE_ENDIAN_H + #include ++#elif defined(HAVE_SYS_ENDIAN_H) ++#include ++#ifndef __BYTE_ORDER ++#define __BYTE_ORDER BYTE_ORDER ++#endif ++#ifndef __LITTLE_ENDIAN ++#define __LITTLE_ENDIAN LITTLE_ENDIAN ++#endif ++#ifndef __BIG_ENDIAN ++#define __BIG_ENDIAN BIG_ENDIAN ++#endif ++#else ++#error Header defining endianness not defined ++#endif + #include + #include + #include +@@ -36,7 +53,6 @@ + #include + #include + +-#include "config.h" + #ifdef SUPPORT_RESMGR + #include + #endif +diff --git a/src/pcm/pcm_file.c b/src/pcm/pcm_file.c +index 712302598a9f..b1f23304633f 100644 +--- a/src/pcm/pcm_file.c ++++ b/src/pcm/pcm_file.c +@@ -26,7 +26,6 @@ + * + */ + +-#include + #include + #include + #include +-- +1.9.0 + diff --git a/0030-autotools-update-style.patch b/0030-autotools-update-style.patch new file mode 100644 index 0000000..bb6b42a --- /dev/null +++ b/0030-autotools-update-style.patch @@ -0,0 +1,1665 @@ +From b669b50de2c0d0f18db924a4a5b556ffcc094421 Mon Sep 17 00:00:00 2001 +From: Patrick Welche +Date: Tue, 25 Feb 2014 12:40:21 +0000 +Subject: [PATCH] autotools: update style + +- rename configure.in to configure.ac +- replace INCLUDES with AM_CPPFLAGS +- modernize AM_INIT_AUTOMAKE invocation + +Signed-off-by: Patrick Welche +Signed-off-by: Takashi Iwai +--- + Makefile.am | 2 +- + alsalisp/Makefile.am | 2 +- + aserver/Makefile.am | 2 +- + configure.ac | 704 +++++++++++++++++++++++++++++++++++++++ + configure.in | 703 -------------------------------------- + doc/Makefile.am | 2 +- + include/Makefile.am | 4 +- + modules/mixer/simple/Makefile.am | 2 +- + src/Makefile.am | 2 +- + src/alisp/Makefile.am | 2 +- + src/control/Makefile.am | 2 +- + src/hwdep/Makefile.am | 2 +- + src/mixer/Makefile.am | 2 +- + src/pcm/Makefile.am | 2 +- + src/rawmidi/Makefile.am | 2 +- + src/seq/Makefile.am | 2 +- + src/timer/Makefile.am | 2 +- + src/ucm/Makefile.am | 2 +- + test/Makefile.am | 2 +- + utils/Makefile.am | 2 +- + 20 files changed, 723 insertions(+), 722 deletions(-) + create mode 100644 configure.ac + delete mode 100644 configure.in + +diff --git a/Makefile.am b/Makefile.am +index f0c39c1de48e..52f7654ac0a7 100644 +--- a/Makefile.am ++++ b/Makefile.am +@@ -17,7 +17,7 @@ EXTRA_DIST=ChangeLog INSTALL TODO NOTES configure gitcompile libtool \ + depcomp version MEMORY-LEAK m4/attributes.m4 + AUTOMAKE_OPTIONS=foreign + +-INCLUDES=-I$(top_srcdir)/include ++AM_CPPFLAGS=-I$(top_srcdir)/include + + rpm: dist + $(MAKE) -C utils rpm +diff --git a/alsalisp/Makefile.am b/alsalisp/Makefile.am +index 6df915a1e6be..8e3e0159c0ee 100644 +--- a/alsalisp/Makefile.am ++++ b/alsalisp/Makefile.am +@@ -5,4 +5,4 @@ alsalisp_LDADD = ../src/libasound.la + + all: alsalisp + +-INCLUDES=-I$(top_srcdir)/include -I$(top_srcdir)/src/alisp ++AM_CPPFLAGS=-I$(top_srcdir)/include -I$(top_srcdir)/src/alisp +diff --git a/aserver/Makefile.am b/aserver/Makefile.am +index 116f578b56d1..fbdb94cf9402 100644 +--- a/aserver/Makefile.am ++++ b/aserver/Makefile.am +@@ -5,7 +5,7 @@ aserver_LDADD = ../src/libasound.la + + all: aserver + +-INCLUDES=-I$(top_srcdir)/include -I$(top_srcdir)/src/pcm ++AM_CPPFLAGS=-I$(top_srcdir)/include -I$(top_srcdir)/src/pcm + + ../src/libasound.la: + $(MAKE) -C ../src libasound.la +diff --git a/configure.ac b/configure.ac +new file mode 100644 +index 000000000000..d744867a3acb +--- /dev/null ++++ b/configure.ac +@@ -0,0 +1,704 @@ ++dnl Process this file with autoconf to produce a configure script. ++AC_PREREQ(2.59) ++AC_INIT(alsa-lib, 1.0.27.2) ++ ++AC_CONFIG_SRCDIR([src/control/control.c]) ++AC_CONFIG_MACRO_DIR([m4]) ++ ++dnl ************************************************* ++dnl current:revision:age ++dnl change (without API) = c:r+1:a ++dnl change API = c+1:0:a ++dnl add API = c+1:0:a+1 ++dnl remove API = c+1:0:0 ++dnl ************************************************* ++AC_CANONICAL_HOST ++AM_INIT_AUTOMAKE ++eval LIBTOOL_VERSION_INFO="2:0:0" ++dnl ************************************************* ++AM_CONDITIONAL([INSTALL_M4], [test -n "${ACLOCAL}"]) ++ ++AM_MAINTAINER_MODE([enable]) ++ ++# Test for new silent rules and enable only if they are available ++m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])]) ++ ++AC_PREFIX_DEFAULT(/usr) ++ ++dnl Checks for programs. ++ ++dnl try to gues cross-compiler if not set ++if test "x$host" != "x$build" -a -z "`echo $CC | grep -e '-gcc'`"; ++then ++ AC_MSG_CHECKING(for cross-compiler) ++ ++ which ${program_prefix}gcc >/dev/null 2>&1 && CC=${program_prefix}gcc ++ which ${host_cpu}-${host_os}-gcc >/dev/null 2>&1 \ ++ && CC=${host_cpu}-${host_os}-gcc ++ which ${host_cpu}-${host_vendor}-${host_os}-gcc >/dev/null 2>&1 \ ++ && CC=${host_cpu}-${host_vendor}-${host_os}-gcc ++ ++ AC_MSG_RESULT($CC) ++fi ++ ++CFLAGS="$CFLAGS -D_GNU_SOURCE" ++ ++ ++AC_PROG_CC ++AC_PROG_CPP ++AC_PROG_INSTALL ++AC_PROG_LN_S ++AC_DISABLE_STATIC ++AC_LIBTOOL_DLOPEN ++AM_PROG_LIBTOOL ++ ++CC_NOUNDEFINED ++ ++dnl Checks for header files. ++AC_HEADER_STDC ++AC_CONFIG_HEADERS(include/config.h) ++ ++dnl Checks for typedefs, structures, and compiler characteristics. ++AC_C_CONST ++AC_C_INLINE ++AC_HEADER_TIME ++ ++dnl Checks for library functions. ++AC_PROG_GCC_TRADITIONAL ++AC_CHECK_FUNCS([uselocale]) ++ ++SAVE_LIBRARY_VERSION ++AC_SUBST(LIBTOOL_VERSION_INFO) ++ ++test "x$prefix" = xNONE && prefix=$ac_default_prefix ++ ++dnl Do not build static and shared libraries together ++if test "$enable_static" = "$enable_shared" -a "$enable_static" = "yes"; then ++cat <&1 \ ++ | ${EGREP-grep} "^PREFIX=" \ ++ | ${SED-sed} "s:^PREFIX=::"` ++AC_DEFINE_UNQUOTED([__SYMBOL_PREFIX], "$SYMBOL_PREFIX", [Toolchain Symbol Prefix]) ++AC_SUBST(SYMBOL_PREFIX) ++AC_MSG_RESULT($SYMBOL_PREFIX) ++ ++dnl Check for debug... ++AC_MSG_CHECKING(for debug) ++AC_ARG_WITH(debug, ++ AS_HELP_STRING([--with-debug], ++ [library will be compiled with asserts (default = yes)]), ++ debug="$withval", debug="yes") ++if test "$debug" = "yes"; then ++ AC_MSG_RESULT(yes) ++else ++ AC_DEFINE(NDEBUG,,[No assert debug]) ++ AC_MSG_RESULT(no) ++fi ++ ++if test "$debug" = "yes"; then ++ AC_MSG_CHECKING(for debug assert) ++ AC_ARG_ENABLE(debug-assert, ++ AS_HELP_STRING([--enable-debug], ++ [enable assert call at the default error message handler]), ++ debug_assert="$enableval", debug_assert="no") ++ if test "$debug_assert" = "yes"; then ++ AC_MSG_RESULT(yes) ++ AC_DEFINE(ALSA_DEBUG_ASSERT,,[Enable assert at error message handler]) ++ else ++ AC_MSG_RESULT(no) ++ fi ++fi ++ ++dnl Temporary directory ++AC_MSG_CHECKING(for tmpdir) ++AC_ARG_WITH(tmpdir, ++ AS_HELP_STRING([--with-tmpdir=directory], ++ [directory to put tmp socket files (/tmp)]), ++ tmpdir="$withval", tmpdir="/tmp") ++AC_MSG_RESULT($tmpdir) ++AC_DEFINE_UNQUOTED(TMPDIR, "$tmpdir", [directory to put tmp socket files]) ++ ++dnl Check for softfloat... ++AC_MSG_CHECKING(for softfloat) ++AC_ARG_WITH(softfloat, ++ AS_HELP_STRING([--with-softfloat], ++ [do you have floating point unit on this machine? (optional)]), ++ [case "$withval" in ++ y|yes) softfloat=yes ;; ++ *) softfloat=no ;; ++ esac],) ++if test "$softfloat" = "yes" ; then ++ AC_DEFINE(HAVE_SOFT_FLOAT, "1", [Avoid calculation in float]) ++ AC_MSG_RESULT(yes) ++else ++ AC_MSG_RESULT(no) ++fi ++ ++ALSA_DEPLIBS="" ++if test "$softfloat" != "yes"; then ++ ALSA_DEPLIBS="-lm" ++fi ++ ++dnl Check for libdl ++AC_MSG_CHECKING(for libdl) ++AC_ARG_WITH(libdl, ++ AS_HELP_STRING([--with-libdl], [Use libdl for plugins (default = yes)]), ++ [ have_libdl="$withval" ], [ have_libdl="yes" ]) ++HAVE_LIBDL= ++if test "$have_libdl" = "yes"; then ++ AC_CHECK_LIB([dl], [dlsym], [HAVE_LIBDL="yes"]) ++ if test "$HAVE_LIBDL" = "yes" ; then ++ ALSA_DEPLIBS="$ALSA_DEPLIBS -ldl" ++ AC_DEFINE([HAVE_LIBDL], 1, [Have libdl]) ++ fi ++else ++ AC_MSG_RESULT(no) ++fi ++AM_CONDITIONAL([BUILD_MODULES], [test "$HAVE_LIBDL" = "yes"]) ++ ++dnl Check for pthread ++AC_MSG_CHECKING(for pthread) ++AC_ARG_WITH(pthread, ++ AS_HELP_STRING([--with-pthread], [Use pthread (default = yes)]), ++ [ have_pthread="$withval" ], [ have_pthread="yes" ]) ++if test "$have_pthread" = "yes"; then ++ AC_CHECK_LIB([pthread], [pthread_join], [HAVE_LIBPTHREAD="yes"]) ++ if test "$HAVE_LIBPTHREAD" = "yes"; then ++ ALSA_DEPLIBS="$ALSA_DEPLIBS -lpthread" ++ AC_DEFINE([HAVE_LIBPTHREAD], 1, [Have libpthread]) ++ fi ++else ++ AC_MSG_RESULT(no) ++fi ++ ++dnl Check for __thread ++AC_MSG_CHECKING([for __thread]) ++AC_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)) ++#error gcc has this bug: http://gcc.gnu.org/ml/gcc-bugs/2006-09/msg02275.html ++#endif], [static __thread int p = 0])], ++[AC_DEFINE(HAVE___THREAD, 1, ++Define to 1 if compiler supports __thread) ++AC_MSG_RESULT([yes])], ++[AC_MSG_RESULT([no])]) ++ ++dnl Check for librt ++AC_MSG_CHECKING(for librt) ++AC_ARG_WITH(librt, ++ AS_HELP_STRING([--with-librt], [Use librt for monotonic clock (default = yes)]), ++ [ have_librt="$withval" ], [ have_librt="yes" ]) ++if test "$have_librt" = "yes"; then ++ AC_CHECK_LIB([rt], [clock_gettime], [HAVE_LIBRT="yes"]) ++ if test "$HAVE_LIBRT" = "yes" ; then ++ ALSA_DEPLIBS="$ALSA_DEPLIBS -lrt" ++ AC_DEFINE([HAVE_LIBRT], 1, [Have librt]) ++ AC_DEFINE([HAVE_CLOCK_GETTIME], 1, [Have clock gettime]) ++ fi ++else ++ AC_MSG_RESULT(no) ++fi ++ ++AC_SUBST(ALSA_DEPLIBS) ++ ++dnl Check for headers ++AC_CHECK_HEADERS([wordexp.h endian.h sys/endian.h]) ++ ++dnl Check for resmgr support... ++AC_MSG_CHECKING(for resmgr support) ++AC_ARG_ENABLE(resmgr, ++ AS_HELP_STRING([--enable-resmgr], [support resmgr (optional)]), ++ resmgr="$enableval", resmgr="no") ++AC_MSG_RESULT($resmgr) ++if test "$resmgr" = "yes"; then ++ AC_CHECK_LIB(resmgr, rsm_open_device,, ++ AC_ERROR([Cannot find libresmgr])) ++ AC_DEFINE(SUPPORT_RESMGR, "1", [Support resmgr with alsa-lib]) ++fi ++ ++dnl Check for aload* support... ++AC_MSG_CHECKING(for aload* support) ++AC_ARG_ENABLE(aload, ++ AS_HELP_STRING([--disable-aload], [disable reading /dev/aload*]), ++ aload="$enableval", aload="yes") ++AC_MSG_RESULT($aload) ++if test "$aload" = "yes"; then ++ AC_DEFINE(SUPPORT_ALOAD, "1", [Support /dev/aload* access for auto-loading]) ++fi ++ ++dnl Check for non-standard /dev directory ++AC_MSG_CHECKING([for ALSA device file directory]) ++AC_ARG_WITH(alsa-devdir, ++ AS_HELP_STRING([--with-alsa-devdir=dir], ++ [directory with ALSA device files (default /dev/snd)]), ++ [alsa_dev_dir="$withval"], ++ [alsa_dev_dir="/dev/snd"]) ++dnl make sure it has a trailing slash ++if echo "$alsa_dev_dir" | grep -v '/$' > /dev/null; then ++ alsa_dev_dir="$alsa_dev_dir/" ++fi ++AC_DEFINE_UNQUOTED(ALSA_DEVICE_DIRECTORY, "$alsa_dev_dir", [Directory with ALSA device files]) ++AC_MSG_RESULT([$alsa_dev_dir]) ++ ++AC_MSG_CHECKING([for aload* device file directory]) ++AC_ARG_WITH(aload-devdir, ++ AS_HELP_STRING([--with-aload-devdir=dir], ++ [directory with aload* device files (default /dev)]), ++ [aload_dev_dir="$withval"], ++ [aload_dev_dir="/dev"]) ++if echo "$aload_dev_dir" | grep -v '/$' > /dev/null; then ++ aload_dev_dir="$aload_dev_dir/" ++fi ++AC_DEFINE_UNQUOTED(ALOAD_DEVICE_DIRECTORY, "$aload_dev_dir", [Directory with aload* device files]) ++AC_MSG_RESULT([$aload_dev_dir]) ++ ++dnl Build conditions ++AC_ARG_ENABLE(mixer, ++ AS_HELP_STRING([--disable-mixer], [disable the mixer component]), ++ [build_mixer="$enableval"], [build_mixer="yes"]) ++AC_ARG_ENABLE(pcm, ++ AS_HELP_STRING([--disable-pcm], [disable the PCM component]), ++ [build_pcm="$enableval"], [build_pcm="yes"]) ++AC_ARG_ENABLE(rawmidi, ++ AS_HELP_STRING([--disable-rawmidi], [disable the raw MIDI component]), ++ [build_rawmidi="$enableval"], [build_rawmidi="yes"]) ++AC_ARG_ENABLE(hwdep, ++ AS_HELP_STRING([--disable-hwdep], [disable the hwdep component]), ++ [build_hwdep="$enableval"], [build_hwdep="yes"]) ++AC_ARG_ENABLE(seq, ++ AS_HELP_STRING([--disable-seq], [disable the sequencer component]), ++ [build_seq="$enableval"], [build_seq="yes"]) ++AC_ARG_ENABLE(ucm, ++ AS_HELP_STRING([--disable-ucm], [disable the use-case-manager component]), ++ [build_ucm="$enableval"], [build_ucm="yes"]) ++AC_ARG_ENABLE(alisp, ++ AS_HELP_STRING([--disable-alisp], [disable the alisp component]), ++ [build_alisp="$enableval"], [build_alisp="yes"]) ++test "$softfloat" = "yes" && build_alisp="no" ++AC_ARG_ENABLE(old-symbols, ++ AS_HELP_STRING([--disable-old-symbols], [disable old obsoleted symbols]), ++ [keep_old_symbols="$enableval"], [keep_old_symbols="yes"]) ++AM_CONDITIONAL([KEEP_OLD_SYMBOLS], [test x$keep_old_symbols = xyes]) ++ ++AC_ARG_ENABLE(python, ++ AS_HELP_STRING([--disable-python], [disable the python components]), ++ [build_python="$enableval"], [build_python="yes"]) ++PYTHON_LIBS="" ++PYTHON_INCLUDES="" ++if test "$build_python" = "yes"; then ++ AC_ARG_WITH(pythonlibs, ++ AS_HELP_STRING([--with-pythonlibs=ldflags], ++ [specify python libraries (-lpthread -lm -ldl -lpython2.4)]), ++ pythonlibs="$withval", pythonlibs=`python-config --libs`) ++ AC_ARG_WITH(pythonincludes, ++ AS_HELP_STRING([--with-pythonincludes=Cflags], ++ [specify python C header files (-I/usr/include/python)]), ++ pythonincludes="$withval", pythonincludes=`python-config --includes`) ++ if test -z "$pythonlibs"; then ++ echo "Unable to determine python libraries! Probably python-config is not" ++ echo "available on this system. Please, use --with-pythonlibs and" ++ echo "--with-pythonincludes options. Python components are disabled in this build." ++ build_python="no" ++ else ++ PYTHON_LIBS="$pythonlibs" ++ PYTHON_INCLUDES="$pythonincludes" ++ fi ++fi ++AC_SUBST(PYTHON_LIBS) ++AC_SUBST(PYTHON_INCLUDES) ++ ++AM_CONDITIONAL([BUILD_MIXER], [test x$build_mixer = xyes]) ++AM_CONDITIONAL([BUILD_PCM], [test x$build_pcm = xyes]) ++AM_CONDITIONAL([BUILD_RAWMIDI], [test x$build_rawmidi = xyes]) ++AM_CONDITIONAL([BUILD_HWDEP], [test x$build_hwdep = xyes]) ++AM_CONDITIONAL([BUILD_SEQ], [test x$build_seq = xyes]) ++AM_CONDITIONAL([BUILD_UCM], [test x$build_ucm = xyes]) ++AM_CONDITIONAL([BUILD_ALISP], [test x$build_alisp = xyes]) ++AM_CONDITIONAL([BUILD_PYTHON], [test x$build_python = xyes]) ++ ++if test "$build_mixer" = "yes"; then ++ AC_DEFINE([BUILD_MIXER], "1", [Build mixer component]) ++fi ++if test "$build_pcm" = "yes"; then ++ AC_DEFINE([BUILD_PCM], "1", [Build PCM component]) ++fi ++if test "$build_rawmidi" = "yes"; then ++ AC_DEFINE([BUILD_RAWMIDI], "1", [Build raw MIDI component]) ++fi ++if test "$build_hwdep" = "yes"; then ++ AC_DEFINE([BUILD_HWDEP], "1", [Build hwdep component]) ++fi ++if test "$build_seq" = "yes"; then ++ AC_DEFINE([BUILD_SEQ], "1", [Build sequencer component]) ++fi ++if test "$build_ucm" = "yes"; then ++ AC_DEFINE([BUILD_UCM], "1", [Build UCM component]) ++fi ++ ++dnl PCM Plugins ++ ++if test "$build_pcm" = "yes"; then ++AC_ARG_WITH(pcm-plugins, ++ AS_HELP_STRING([--with-pcm-plugins=], ++ [build PCM plugins (default = all)]), ++ [pcm_plugins="$withval"], [pcm_plugins="all"]) ++else ++pcm_plugins="" ++fi ++ ++dnl check atomics for pcm_meter ++ ++AC_MSG_CHECKING([whether GCC supports builtin atomic intrinsics]) ++if test -z "$gcc_have_atomics"; then ++ gcc_have_atomics=no ++ AC_TRY_LINK([], ++ [int i; ++ __atomic_load_n(&i, __ATOMIC_SEQ_CST); ++ __atomic_add_fetch(&i, 0, __ATOMIC_SEQ_CST); ++ ], ++ [gcc_have_atomics=yes], ++ [gcc_have_atomics=no]) ++fi ++AC_MSG_RESULT($gcc_have_atomics) ++ ++PCM_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" ++ ++build_pcm_plugin="no" ++for t in $PCM_PLUGIN_LIST; do ++ eval build_pcm_$t="no" ++done ++ ++pcm_plugins=`echo $pcm_plugins | sed 's/,/ /g'` ++for p in $pcm_plugins; do ++ for t in $PCM_PLUGIN_LIST; do ++ if test "$p" = "$t" -o "$p" = "all"; then ++ eval build_pcm_$t="yes" ++ build_pcm_plugin="yes" ++ fi ++ done ++done ++ ++dnl special dependencies ++if test "$build_pcm_plug" = "yes"; then ++ build_pcm_linear="yes" ++ build_pcm_copy="yes" ++fi ++ ++if test "$build_pcm_ioplug" = "yes"; then ++ build_pcm_extplug="yes" ++fi ++ ++if test "$HAVE_LIBDL" != "yes"; then ++ build_pcm_meter="no" ++ build_pcm_ladspa="no" ++ build_pcm_pcm_ioplug="no" ++ build_pcm_pcm_extplug="no" ++fi ++ ++if test "$HAVE_LIBPTHREAD" != "yes"; then ++ build_pcm_share="no" ++fi ++ ++if test "$softfloat" = "yes"; then ++ build_pcm_lfloat="no" ++ build_pcm_ladspa="no" ++fi ++ ++if test "$gcc_have_atomics" != "yes"; then ++ build_pcm_meter="no" ++fi ++ ++AM_CONDITIONAL([BUILD_PCM_PLUGIN], [test x$build_pcm_plugin = xyes]) ++AM_CONDITIONAL([BUILD_PCM_PLUGIN_COPY], [test x$build_pcm_copy = xyes]) ++AM_CONDITIONAL([BUILD_PCM_PLUGIN_LINEAR], [test x$build_pcm_linear = xyes]) ++AM_CONDITIONAL([BUILD_PCM_PLUGIN_ROUTE], [test x$build_pcm_route = xyes]) ++AM_CONDITIONAL([BUILD_PCM_PLUGIN_MULAW], [test x$build_pcm_mulaw = xyes]) ++AM_CONDITIONAL([BUILD_PCM_PLUGIN_ALAW], [test x$build_pcm_alaw = xyes]) ++AM_CONDITIONAL([BUILD_PCM_PLUGIN_ADPCM], [test x$build_pcm_adpcm = xyes]) ++AM_CONDITIONAL([BUILD_PCM_PLUGIN_RATE], [test x$build_pcm_rate = xyes]) ++AM_CONDITIONAL([BUILD_PCM_PLUGIN_PLUG], [test x$build_pcm_plug = xyes]) ++AM_CONDITIONAL([BUILD_PCM_PLUGIN_MULTI], [test x$build_pcm_multi = xyes]) ++AM_CONDITIONAL([BUILD_PCM_PLUGIN_SHM], [test x$build_pcm_shm = xyes]) ++AM_CONDITIONAL([BUILD_PCM_PLUGIN_FILE], [test x$build_pcm_file = xyes]) ++AM_CONDITIONAL([BUILD_PCM_PLUGIN_NULL], [test x$build_pcm_null = xyes]) ++AM_CONDITIONAL([BUILD_PCM_PLUGIN_EMPTY], [test x$build_pcm_empty = xyes]) ++AM_CONDITIONAL([BUILD_PCM_PLUGIN_SHARE], [test x$build_pcm_share = xyes]) ++AM_CONDITIONAL([BUILD_PCM_PLUGIN_METER], [test x$build_pcm_meter = xyes]) ++AM_CONDITIONAL([BUILD_PCM_PLUGIN_HOOKS], [test x$build_pcm_hooks = xyes]) ++AM_CONDITIONAL([BUILD_PCM_PLUGIN_LFLOAT], [test x$build_pcm_lfloat = xyes]) ++AM_CONDITIONAL([BUILD_PCM_PLUGIN_LADSPA], [test x$build_pcm_ladspa = xyes]) ++AM_CONDITIONAL([BUILD_PCM_PLUGIN_DMIX], [test x$build_pcm_dmix = xyes]) ++AM_CONDITIONAL([BUILD_PCM_PLUGIN_DSHARE], [test x$build_pcm_dshare = xyes]) ++AM_CONDITIONAL([BUILD_PCM_PLUGIN_DSNOOP], [test x$build_pcm_dsnoop = xyes]) ++AM_CONDITIONAL([BUILD_PCM_PLUGIN_ASYM], [test x$build_pcm_asym = xyes]) ++AM_CONDITIONAL([BUILD_PCM_PLUGIN_IEC958], [test x$build_pcm_iec958 = xyes]) ++AM_CONDITIONAL([BUILD_PCM_PLUGIN_SOFTVOL], [test x$build_pcm_softvol = xyes]) ++AM_CONDITIONAL([BUILD_PCM_PLUGIN_EXTPLUG], [test x$build_pcm_extplug = xyes]) ++AM_CONDITIONAL([BUILD_PCM_PLUGIN_IOPLUG], [test x$build_pcm_ioplug = xyes]) ++AM_CONDITIONAL([BUILD_PCM_PLUGIN_MMAP_EMUL], [test x$build_pcm_mmap_emul = xyes]) ++ ++dnl Defines for plug plugin ++if test "$build_pcm_rate" = "yes"; then ++ AC_DEFINE([BUILD_PCM_PLUGIN_RATE], "1", [Build PCM rate plugin]) ++fi ++if test "$build_pcm_route" = "yes"; then ++ AC_DEFINE([BUILD_PCM_PLUGIN_ROUTE], "1", [Build PCM route plugin]) ++fi ++if test "$build_pcm_lfloat" = "yes"; then ++ AC_DEFINE([BUILD_PCM_PLUGIN_LFLOAT], "1", [Build PCM lfloat plugin]) ++fi ++if test "$build_pcm_adpcm" = "yes"; then ++ AC_DEFINE([BUILD_PCM_PLUGIN_ADPCM], "1", [Build PCM adpcm plugin]) ++fi ++if test "$build_pcm_mulaw" = "yes"; then ++ AC_DEFINE([BUILD_PCM_PLUGIN_MULAW], "1", [Build PCM mulaw plugin]) ++fi ++if test "$build_pcm_alaw" = "yes"; then ++ AC_DEFINE([BUILD_PCM_PLUGIN_ALAW], "1", [Build PCM alaw plugin]) ++fi ++if test "$build_pcm_mmap_emul" = "yes"; then ++ AC_DEFINE([BUILD_PCM_PLUGIN_MMAP_EMUL], "1", [Build PCM mmap-emul plugin]) ++fi ++ ++ ++dnl Create PCM plugin symbol list for static library ++rm -f "$srcdir"/src/pcm/pcm_symbols_list.c ++touch "$srcdir"/src/pcm/pcm_symbols_list.c ++for t in $PCM_PLUGIN_LIST; do ++ if eval test \$build_pcm_$t = yes; then ++ echo \&_snd_module_pcm_$t, >> "$srcdir"/src/pcm/pcm_symbols_list.c ++ fi ++done ++ ++dnl Control Plugins ++ ++AC_ARG_WITH(ctl-plugins, ++ AS_HELP_STRING([--with-ctl-plugins=], ++ [build control plugins (default = all)]), ++ [ctl_plugins="$withval"], [ctl_plugins="all"]) ++ ++CTL_PLUGIN_LIST="shm ext" ++ ++build_ctl_plugin="no" ++for t in $CTL_PLUGIN_LIST; do ++ eval build_ctl_$t="no" ++done ++ ++ctl_plugins=`echo $ctl_plugins | sed 's/,/ /g'` ++for p in $ctl_plugins; do ++ for t in $CTL_PLUGIN_LIST; do ++ if test "$p" = "$t" -o "$p" = "all"; then ++ eval build_ctl_$t="yes" ++ build_ctl_plugin="yes" ++ fi ++ done ++done ++ ++AM_CONDITIONAL([BUILD_CTL_PLUGIN], [test x$build_ctl_plugin = xyes]) ++AM_CONDITIONAL([BUILD_CTL_PLUGIN_SHM], [test x$build_ctl_shm = xyes]) ++AM_CONDITIONAL([BUILD_CTL_PLUGIN_EXT], [test x$build_ctl_ext = xyes]) ++ ++dnl Create ctl plugin symbol list for static library ++rm -f "$srcdir"/src/control/ctl_symbols_list.c ++touch "$srcdir"/src/control/ctl_symbols_list.c ++for t in $CTL_PLUGIN_LIST; do ++ if eval test \$build_ctl_$t = yes; then ++ echo \&_snd_module_control_$t, >> "$srcdir"/src/control/ctl_symbols_list.c ++ fi ++done ++ ++dnl Max number of cards ++AC_MSG_CHECKING(for max number of cards) ++AC_ARG_WITH(max-cards, ++ AS_HELP_STRING([--with-max-cards], [Specify the max number of cards (default = 32)]), ++ [ max_cards="$withval" ], [ max_cards="32" ]) ++AC_MSG_RESULT([$max_cards]) ++ ++if test "$max_cards" -lt 1; then ++ AC_ERROR([Invalid max cards $max_cards]) ++elif test "$max_cards" -gt 256; then ++ AC_ERROR([Invalid max cards $max_cards]) ++fi ++AC_DEFINE_UNQUOTED(SND_MAX_CARDS, $max_cards, [Max number of cards]) ++ ++dnl Make a symlink for inclusion of alsa/xxx.h ++if test ! -L "$srcdir"/include/alsa ; then ++ echo "Making a symlink include/alsa" ++ rm -f "$srcdir"/include/alsa ++ ln -sf . "$srcdir"/include/alsa ++fi ++ ++AC_OUTPUT(Makefile doc/Makefile doc/pictures/Makefile doc/doxygen.cfg \ ++ include/Makefile include/sound/Makefile src/Versions src/Makefile \ ++ src/control/Makefile src/mixer/Makefile \ ++ src/pcm/Makefile src/pcm/scopes/Makefile \ ++ src/rawmidi/Makefile src/timer/Makefile \ ++ src/hwdep/Makefile src/seq/Makefile src/ucm/Makefile \ ++ src/alisp/Makefile \ ++ src/conf/Makefile src/conf/alsa.conf.d/Makefile \ ++ src/conf/cards/Makefile \ ++ src/conf/pcm/Makefile \ ++ src/conf/ucm/Makefile \ ++ src/conf/ucm/DAISY-I2S/Makefile \ ++ src/conf/ucm/PandaBoard/Makefile \ ++ src/conf/ucm/PandaBoardES/Makefile \ ++ src/conf/ucm/SDP4430/Makefile \ ++ src/conf/ucm/tegraalc5632/Makefile \ ++ modules/Makefile modules/mixer/Makefile modules/mixer/simple/Makefile \ ++ alsalisp/Makefile aserver/Makefile \ ++ test/Makefile test/lsb/Makefile \ ++ utils/Makefile utils/alsa-lib.spec utils/alsa.pc) ++ ++dnl Create asoundlib.h dynamically according to configure options ++echo "Creating asoundlib.h..." ++cp "$srcdir"/include/asoundlib-head.h include/asoundlib.h ++test "$ac_cv_header_endian_h" = "yes" && echo "#include " >> include/asoundlib.h ++if test "$ac_cv_header_sys_endian_h" = "yes"; then ++cat >> include/asoundlib.h < ++#ifndef __BYTE_ORDER ++#define __BYTE_ORDER BYTE_ORDER ++#endif ++#ifndef __LITTLE_ENDIAN ++#define __LITTLE_ENDIAN LITTLE_ENDIAN ++#endif ++#ifndef __BIG_ENDIAN ++#define __BIG_ENDIAN BIG_ENDIAN ++#endif ++EOF ++fi ++cat >> include/asoundlib.h < ++#include ++#include ++#include ++#include ++#include ++#include ++EOF ++test "$build_pcm" = "yes" && echo "#include " >> include/asoundlib.h ++test "$build_rawmidi" = "yes" && echo "#include " >> include/asoundlib.h ++test "$build_pcm" = "yes" && echo "#include " >> include/asoundlib.h ++test "$build_hwdep" = "yes" && echo "#include " >> include/asoundlib.h ++echo "#include " >> include/asoundlib.h ++test "$build_mixer" = "yes" && echo "#include " >> include/asoundlib.h ++test "$build_seq" = "yes" && echo "#include " >> include/asoundlib.h ++test "$build_seq" = "yes" && echo "#include " >> include/asoundlib.h ++test "$build_seq" = "yes" && echo "#include " >> include/asoundlib.h ++test "$build_seq" = "yes" && echo "#include " >> include/asoundlib.h ++cat "$srcdir"/include/asoundlib-tail.h >> include/asoundlib.h ++ +diff --git a/configure.in b/configure.in +deleted file mode 100644 +index 9463b5ad4766..000000000000 +--- a/configure.in ++++ /dev/null +@@ -1,703 +0,0 @@ +-dnl Process this file with autoconf to produce a configure script. +-AC_PREREQ(2.59) +-AC_INIT(src/control/control.c) +- +-AC_CONFIG_MACRO_DIR([m4]) +- +-dnl ************************************************* +-dnl current:revision:age +-dnl change (without API) = c:r+1:a +-dnl change API = c+1:0:a +-dnl add API = c+1:0:a+1 +-dnl remove API = c+1:0:0 +-dnl ************************************************* +-AC_CANONICAL_HOST +-AM_INIT_AUTOMAKE(alsa-lib, 1.0.27.2) +-eval LIBTOOL_VERSION_INFO="2:0:0" +-dnl ************************************************* +-AM_CONDITIONAL([INSTALL_M4], [test -n "${ACLOCAL}"]) +- +-AM_MAINTAINER_MODE([enable]) +- +-# Test for new silent rules and enable only if they are available +-m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])]) +- +-AC_PREFIX_DEFAULT(/usr) +- +-dnl Checks for programs. +- +-dnl try to gues cross-compiler if not set +-if test "x$host" != "x$build" -a -z "`echo $CC | grep -e '-gcc'`"; +-then +- AC_MSG_CHECKING(for cross-compiler) +- +- which ${program_prefix}gcc >/dev/null 2>&1 && CC=${program_prefix}gcc +- which ${host_cpu}-${host_os}-gcc >/dev/null 2>&1 \ +- && CC=${host_cpu}-${host_os}-gcc +- which ${host_cpu}-${host_vendor}-${host_os}-gcc >/dev/null 2>&1 \ +- && CC=${host_cpu}-${host_vendor}-${host_os}-gcc +- +- AC_MSG_RESULT($CC) +-fi +- +-CFLAGS="$CFLAGS -D_GNU_SOURCE" +- +- +-AC_PROG_CC +-AC_PROG_CPP +-AC_PROG_INSTALL +-AC_PROG_LN_S +-AC_DISABLE_STATIC +-AC_LIBTOOL_DLOPEN +-AM_PROG_LIBTOOL +- +-CC_NOUNDEFINED +- +-dnl Checks for header files. +-AC_HEADER_STDC +-AC_CONFIG_HEADERS(include/config.h) +- +-dnl Checks for typedefs, structures, and compiler characteristics. +-AC_C_CONST +-AC_C_INLINE +-AC_HEADER_TIME +- +-dnl Checks for library functions. +-AC_PROG_GCC_TRADITIONAL +-AC_CHECK_FUNCS([uselocale]) +- +-SAVE_LIBRARY_VERSION +-AC_SUBST(LIBTOOL_VERSION_INFO) +- +-test "x$prefix" = xNONE && prefix=$ac_default_prefix +- +-dnl Do not build static and shared libraries together +-if test "$enable_static" = "$enable_shared" -a "$enable_static" = "yes"; then +-cat <&1 \ +- | ${EGREP-grep} "^PREFIX=" \ +- | ${SED-sed} "s:^PREFIX=::"` +-AC_DEFINE_UNQUOTED([__SYMBOL_PREFIX], "$SYMBOL_PREFIX", [Toolchain Symbol Prefix]) +-AC_SUBST(SYMBOL_PREFIX) +-AC_MSG_RESULT($SYMBOL_PREFIX) +- +-dnl Check for debug... +-AC_MSG_CHECKING(for debug) +-AC_ARG_WITH(debug, +- AS_HELP_STRING([--with-debug], +- [library will be compiled with asserts (default = yes)]), +- debug="$withval", debug="yes") +-if test "$debug" = "yes"; then +- AC_MSG_RESULT(yes) +-else +- AC_DEFINE(NDEBUG,,[No assert debug]) +- AC_MSG_RESULT(no) +-fi +- +-if test "$debug" = "yes"; then +- AC_MSG_CHECKING(for debug assert) +- AC_ARG_ENABLE(debug-assert, +- AS_HELP_STRING([--enable-debug], +- [enable assert call at the default error message handler]), +- debug_assert="$enableval", debug_assert="no") +- if test "$debug_assert" = "yes"; then +- AC_MSG_RESULT(yes) +- AC_DEFINE(ALSA_DEBUG_ASSERT,,[Enable assert at error message handler]) +- else +- AC_MSG_RESULT(no) +- fi +-fi +- +-dnl Temporary directory +-AC_MSG_CHECKING(for tmpdir) +-AC_ARG_WITH(tmpdir, +- AS_HELP_STRING([--with-tmpdir=directory], +- [directory to put tmp socket files (/tmp)]), +- tmpdir="$withval", tmpdir="/tmp") +-AC_MSG_RESULT($tmpdir) +-AC_DEFINE_UNQUOTED(TMPDIR, "$tmpdir", [directory to put tmp socket files]) +- +-dnl Check for softfloat... +-AC_MSG_CHECKING(for softfloat) +-AC_ARG_WITH(softfloat, +- AS_HELP_STRING([--with-softfloat], +- [do you have floating point unit on this machine? (optional)]), +- [case "$withval" in +- y|yes) softfloat=yes ;; +- *) softfloat=no ;; +- esac],) +-if test "$softfloat" = "yes" ; then +- AC_DEFINE(HAVE_SOFT_FLOAT, "1", [Avoid calculation in float]) +- AC_MSG_RESULT(yes) +-else +- AC_MSG_RESULT(no) +-fi +- +-ALSA_DEPLIBS="" +-if test "$softfloat" != "yes"; then +- ALSA_DEPLIBS="-lm" +-fi +- +-dnl Check for libdl +-AC_MSG_CHECKING(for libdl) +-AC_ARG_WITH(libdl, +- AS_HELP_STRING([--with-libdl], [Use libdl for plugins (default = yes)]), +- [ have_libdl="$withval" ], [ have_libdl="yes" ]) +-HAVE_LIBDL= +-if test "$have_libdl" = "yes"; then +- AC_CHECK_LIB([dl], [dlsym], [HAVE_LIBDL="yes"]) +- if test "$HAVE_LIBDL" = "yes" ; then +- ALSA_DEPLIBS="$ALSA_DEPLIBS -ldl" +- AC_DEFINE([HAVE_LIBDL], 1, [Have libdl]) +- fi +-else +- AC_MSG_RESULT(no) +-fi +-AM_CONDITIONAL([BUILD_MODULES], [test "$HAVE_LIBDL" = "yes"]) +- +-dnl Check for pthread +-AC_MSG_CHECKING(for pthread) +-AC_ARG_WITH(pthread, +- AS_HELP_STRING([--with-pthread], [Use pthread (default = yes)]), +- [ have_pthread="$withval" ], [ have_pthread="yes" ]) +-if test "$have_pthread" = "yes"; then +- AC_CHECK_LIB([pthread], [pthread_join], [HAVE_LIBPTHREAD="yes"]) +- if test "$HAVE_LIBPTHREAD" = "yes"; then +- ALSA_DEPLIBS="$ALSA_DEPLIBS -lpthread" +- AC_DEFINE([HAVE_LIBPTHREAD], 1, [Have libpthread]) +- fi +-else +- AC_MSG_RESULT(no) +-fi +- +-dnl Check for __thread +-AC_MSG_CHECKING([for __thread]) +-AC_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)) +-#error gcc has this bug: http://gcc.gnu.org/ml/gcc-bugs/2006-09/msg02275.html +-#endif], [static __thread int p = 0])], +-[AC_DEFINE(HAVE___THREAD, 1, +-Define to 1 if compiler supports __thread) +-AC_MSG_RESULT([yes])], +-[AC_MSG_RESULT([no])]) +- +-dnl Check for librt +-AC_MSG_CHECKING(for librt) +-AC_ARG_WITH(librt, +- AS_HELP_STRING([--with-librt], [Use librt for monotonic clock (default = yes)]), +- [ have_librt="$withval" ], [ have_librt="yes" ]) +-if test "$have_librt" = "yes"; then +- AC_CHECK_LIB([rt], [clock_gettime], [HAVE_LIBRT="yes"]) +- if test "$HAVE_LIBRT" = "yes" ; then +- ALSA_DEPLIBS="$ALSA_DEPLIBS -lrt" +- AC_DEFINE([HAVE_LIBRT], 1, [Have librt]) +- AC_DEFINE([HAVE_CLOCK_GETTIME], 1, [Have clock gettime]) +- fi +-else +- AC_MSG_RESULT(no) +-fi +- +-AC_SUBST(ALSA_DEPLIBS) +- +-dnl Check for headers +-AC_CHECK_HEADERS([wordexp.h endian.h sys/endian.h]) +- +-dnl Check for resmgr support... +-AC_MSG_CHECKING(for resmgr support) +-AC_ARG_ENABLE(resmgr, +- AS_HELP_STRING([--enable-resmgr], [support resmgr (optional)]), +- resmgr="$enableval", resmgr="no") +-AC_MSG_RESULT($resmgr) +-if test "$resmgr" = "yes"; then +- AC_CHECK_LIB(resmgr, rsm_open_device,, +- AC_ERROR([Cannot find libresmgr])) +- AC_DEFINE(SUPPORT_RESMGR, "1", [Support resmgr with alsa-lib]) +-fi +- +-dnl Check for aload* support... +-AC_MSG_CHECKING(for aload* support) +-AC_ARG_ENABLE(aload, +- AS_HELP_STRING([--disable-aload], [disable reading /dev/aload*]), +- aload="$enableval", aload="yes") +-AC_MSG_RESULT($aload) +-if test "$aload" = "yes"; then +- AC_DEFINE(SUPPORT_ALOAD, "1", [Support /dev/aload* access for auto-loading]) +-fi +- +-dnl Check for non-standard /dev directory +-AC_MSG_CHECKING([for ALSA device file directory]) +-AC_ARG_WITH(alsa-devdir, +- AS_HELP_STRING([--with-alsa-devdir=dir], +- [directory with ALSA device files (default /dev/snd)]), +- [alsa_dev_dir="$withval"], +- [alsa_dev_dir="/dev/snd"]) +-dnl make sure it has a trailing slash +-if echo "$alsa_dev_dir" | grep -v '/$' > /dev/null; then +- alsa_dev_dir="$alsa_dev_dir/" +-fi +-AC_DEFINE_UNQUOTED(ALSA_DEVICE_DIRECTORY, "$alsa_dev_dir", [Directory with ALSA device files]) +-AC_MSG_RESULT([$alsa_dev_dir]) +- +-AC_MSG_CHECKING([for aload* device file directory]) +-AC_ARG_WITH(aload-devdir, +- AS_HELP_STRING([--with-aload-devdir=dir], +- [directory with aload* device files (default /dev)]), +- [aload_dev_dir="$withval"], +- [aload_dev_dir="/dev"]) +-if echo "$aload_dev_dir" | grep -v '/$' > /dev/null; then +- aload_dev_dir="$aload_dev_dir/" +-fi +-AC_DEFINE_UNQUOTED(ALOAD_DEVICE_DIRECTORY, "$aload_dev_dir", [Directory with aload* device files]) +-AC_MSG_RESULT([$aload_dev_dir]) +- +-dnl Build conditions +-AC_ARG_ENABLE(mixer, +- AS_HELP_STRING([--disable-mixer], [disable the mixer component]), +- [build_mixer="$enableval"], [build_mixer="yes"]) +-AC_ARG_ENABLE(pcm, +- AS_HELP_STRING([--disable-pcm], [disable the PCM component]), +- [build_pcm="$enableval"], [build_pcm="yes"]) +-AC_ARG_ENABLE(rawmidi, +- AS_HELP_STRING([--disable-rawmidi], [disable the raw MIDI component]), +- [build_rawmidi="$enableval"], [build_rawmidi="yes"]) +-AC_ARG_ENABLE(hwdep, +- AS_HELP_STRING([--disable-hwdep], [disable the hwdep component]), +- [build_hwdep="$enableval"], [build_hwdep="yes"]) +-AC_ARG_ENABLE(seq, +- AS_HELP_STRING([--disable-seq], [disable the sequencer component]), +- [build_seq="$enableval"], [build_seq="yes"]) +-AC_ARG_ENABLE(ucm, +- AS_HELP_STRING([--disable-ucm], [disable the use-case-manager component]), +- [build_ucm="$enableval"], [build_ucm="yes"]) +-AC_ARG_ENABLE(alisp, +- AS_HELP_STRING([--disable-alisp], [disable the alisp component]), +- [build_alisp="$enableval"], [build_alisp="yes"]) +-test "$softfloat" = "yes" && build_alisp="no" +-AC_ARG_ENABLE(old-symbols, +- AS_HELP_STRING([--disable-old-symbols], [disable old obsoleted symbols]), +- [keep_old_symbols="$enableval"], [keep_old_symbols="yes"]) +-AM_CONDITIONAL([KEEP_OLD_SYMBOLS], [test x$keep_old_symbols = xyes]) +- +-AC_ARG_ENABLE(python, +- AS_HELP_STRING([--disable-python], [disable the python components]), +- [build_python="$enableval"], [build_python="yes"]) +-PYTHON_LIBS="" +-PYTHON_INCLUDES="" +-if test "$build_python" = "yes"; then +- AC_ARG_WITH(pythonlibs, +- AS_HELP_STRING([--with-pythonlibs=ldflags], +- [specify python libraries (-lpthread -lm -ldl -lpython2.4)]), +- pythonlibs="$withval", pythonlibs=`python-config --libs`) +- AC_ARG_WITH(pythonincludes, +- AS_HELP_STRING([--with-pythonincludes=Cflags], +- [specify python C header files (-I/usr/include/python)]), +- pythonincludes="$withval", pythonincludes=`python-config --includes`) +- if test -z "$pythonlibs"; then +- echo "Unable to determine python libraries! Probably python-config is not" +- echo "available on this system. Please, use --with-pythonlibs and" +- echo "--with-pythonincludes options. Python components are disabled in this build." +- build_python="no" +- else +- PYTHON_LIBS="$pythonlibs" +- PYTHON_INCLUDES="$pythonincludes" +- fi +-fi +-AC_SUBST(PYTHON_LIBS) +-AC_SUBST(PYTHON_INCLUDES) +- +-AM_CONDITIONAL([BUILD_MIXER], [test x$build_mixer = xyes]) +-AM_CONDITIONAL([BUILD_PCM], [test x$build_pcm = xyes]) +-AM_CONDITIONAL([BUILD_RAWMIDI], [test x$build_rawmidi = xyes]) +-AM_CONDITIONAL([BUILD_HWDEP], [test x$build_hwdep = xyes]) +-AM_CONDITIONAL([BUILD_SEQ], [test x$build_seq = xyes]) +-AM_CONDITIONAL([BUILD_UCM], [test x$build_ucm = xyes]) +-AM_CONDITIONAL([BUILD_ALISP], [test x$build_alisp = xyes]) +-AM_CONDITIONAL([BUILD_PYTHON], [test x$build_python = xyes]) +- +-if test "$build_mixer" = "yes"; then +- AC_DEFINE([BUILD_MIXER], "1", [Build mixer component]) +-fi +-if test "$build_pcm" = "yes"; then +- AC_DEFINE([BUILD_PCM], "1", [Build PCM component]) +-fi +-if test "$build_rawmidi" = "yes"; then +- AC_DEFINE([BUILD_RAWMIDI], "1", [Build raw MIDI component]) +-fi +-if test "$build_hwdep" = "yes"; then +- AC_DEFINE([BUILD_HWDEP], "1", [Build hwdep component]) +-fi +-if test "$build_seq" = "yes"; then +- AC_DEFINE([BUILD_SEQ], "1", [Build sequencer component]) +-fi +-if test "$build_ucm" = "yes"; then +- AC_DEFINE([BUILD_UCM], "1", [Build UCM component]) +-fi +- +-dnl PCM Plugins +- +-if test "$build_pcm" = "yes"; then +-AC_ARG_WITH(pcm-plugins, +- AS_HELP_STRING([--with-pcm-plugins=], +- [build PCM plugins (default = all)]), +- [pcm_plugins="$withval"], [pcm_plugins="all"]) +-else +-pcm_plugins="" +-fi +- +-dnl check atomics for pcm_meter +- +-AC_MSG_CHECKING([whether GCC supports builtin atomic intrinsics]) +-if test -z "$gcc_have_atomics"; then +- gcc_have_atomics=no +- AC_TRY_LINK([], +- [int i; +- __atomic_load_n(&i, __ATOMIC_SEQ_CST); +- __atomic_add_fetch(&i, 0, __ATOMIC_SEQ_CST); +- ], +- [gcc_have_atomics=yes], +- [gcc_have_atomics=no]) +-fi +-AC_MSG_RESULT($gcc_have_atomics) +- +-PCM_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" +- +-build_pcm_plugin="no" +-for t in $PCM_PLUGIN_LIST; do +- eval build_pcm_$t="no" +-done +- +-pcm_plugins=`echo $pcm_plugins | sed 's/,/ /g'` +-for p in $pcm_plugins; do +- for t in $PCM_PLUGIN_LIST; do +- if test "$p" = "$t" -o "$p" = "all"; then +- eval build_pcm_$t="yes" +- build_pcm_plugin="yes" +- fi +- done +-done +- +-dnl special dependencies +-if test "$build_pcm_plug" = "yes"; then +- build_pcm_linear="yes" +- build_pcm_copy="yes" +-fi +- +-if test "$build_pcm_ioplug" = "yes"; then +- build_pcm_extplug="yes" +-fi +- +-if test "$HAVE_LIBDL" != "yes"; then +- build_pcm_meter="no" +- build_pcm_ladspa="no" +- build_pcm_pcm_ioplug="no" +- build_pcm_pcm_extplug="no" +-fi +- +-if test "$HAVE_LIBPTHREAD" != "yes"; then +- build_pcm_share="no" +-fi +- +-if test "$softfloat" = "yes"; then +- build_pcm_lfloat="no" +- build_pcm_ladspa="no" +-fi +- +-if test "$gcc_have_atomics" != "yes"; then +- build_pcm_meter="no" +-fi +- +-AM_CONDITIONAL([BUILD_PCM_PLUGIN], [test x$build_pcm_plugin = xyes]) +-AM_CONDITIONAL([BUILD_PCM_PLUGIN_COPY], [test x$build_pcm_copy = xyes]) +-AM_CONDITIONAL([BUILD_PCM_PLUGIN_LINEAR], [test x$build_pcm_linear = xyes]) +-AM_CONDITIONAL([BUILD_PCM_PLUGIN_ROUTE], [test x$build_pcm_route = xyes]) +-AM_CONDITIONAL([BUILD_PCM_PLUGIN_MULAW], [test x$build_pcm_mulaw = xyes]) +-AM_CONDITIONAL([BUILD_PCM_PLUGIN_ALAW], [test x$build_pcm_alaw = xyes]) +-AM_CONDITIONAL([BUILD_PCM_PLUGIN_ADPCM], [test x$build_pcm_adpcm = xyes]) +-AM_CONDITIONAL([BUILD_PCM_PLUGIN_RATE], [test x$build_pcm_rate = xyes]) +-AM_CONDITIONAL([BUILD_PCM_PLUGIN_PLUG], [test x$build_pcm_plug = xyes]) +-AM_CONDITIONAL([BUILD_PCM_PLUGIN_MULTI], [test x$build_pcm_multi = xyes]) +-AM_CONDITIONAL([BUILD_PCM_PLUGIN_SHM], [test x$build_pcm_shm = xyes]) +-AM_CONDITIONAL([BUILD_PCM_PLUGIN_FILE], [test x$build_pcm_file = xyes]) +-AM_CONDITIONAL([BUILD_PCM_PLUGIN_NULL], [test x$build_pcm_null = xyes]) +-AM_CONDITIONAL([BUILD_PCM_PLUGIN_EMPTY], [test x$build_pcm_empty = xyes]) +-AM_CONDITIONAL([BUILD_PCM_PLUGIN_SHARE], [test x$build_pcm_share = xyes]) +-AM_CONDITIONAL([BUILD_PCM_PLUGIN_METER], [test x$build_pcm_meter = xyes]) +-AM_CONDITIONAL([BUILD_PCM_PLUGIN_HOOKS], [test x$build_pcm_hooks = xyes]) +-AM_CONDITIONAL([BUILD_PCM_PLUGIN_LFLOAT], [test x$build_pcm_lfloat = xyes]) +-AM_CONDITIONAL([BUILD_PCM_PLUGIN_LADSPA], [test x$build_pcm_ladspa = xyes]) +-AM_CONDITIONAL([BUILD_PCM_PLUGIN_DMIX], [test x$build_pcm_dmix = xyes]) +-AM_CONDITIONAL([BUILD_PCM_PLUGIN_DSHARE], [test x$build_pcm_dshare = xyes]) +-AM_CONDITIONAL([BUILD_PCM_PLUGIN_DSNOOP], [test x$build_pcm_dsnoop = xyes]) +-AM_CONDITIONAL([BUILD_PCM_PLUGIN_ASYM], [test x$build_pcm_asym = xyes]) +-AM_CONDITIONAL([BUILD_PCM_PLUGIN_IEC958], [test x$build_pcm_iec958 = xyes]) +-AM_CONDITIONAL([BUILD_PCM_PLUGIN_SOFTVOL], [test x$build_pcm_softvol = xyes]) +-AM_CONDITIONAL([BUILD_PCM_PLUGIN_EXTPLUG], [test x$build_pcm_extplug = xyes]) +-AM_CONDITIONAL([BUILD_PCM_PLUGIN_IOPLUG], [test x$build_pcm_ioplug = xyes]) +-AM_CONDITIONAL([BUILD_PCM_PLUGIN_MMAP_EMUL], [test x$build_pcm_mmap_emul = xyes]) +- +-dnl Defines for plug plugin +-if test "$build_pcm_rate" = "yes"; then +- AC_DEFINE([BUILD_PCM_PLUGIN_RATE], "1", [Build PCM rate plugin]) +-fi +-if test "$build_pcm_route" = "yes"; then +- AC_DEFINE([BUILD_PCM_PLUGIN_ROUTE], "1", [Build PCM route plugin]) +-fi +-if test "$build_pcm_lfloat" = "yes"; then +- AC_DEFINE([BUILD_PCM_PLUGIN_LFLOAT], "1", [Build PCM lfloat plugin]) +-fi +-if test "$build_pcm_adpcm" = "yes"; then +- AC_DEFINE([BUILD_PCM_PLUGIN_ADPCM], "1", [Build PCM adpcm plugin]) +-fi +-if test "$build_pcm_mulaw" = "yes"; then +- AC_DEFINE([BUILD_PCM_PLUGIN_MULAW], "1", [Build PCM mulaw plugin]) +-fi +-if test "$build_pcm_alaw" = "yes"; then +- AC_DEFINE([BUILD_PCM_PLUGIN_ALAW], "1", [Build PCM alaw plugin]) +-fi +-if test "$build_pcm_mmap_emul" = "yes"; then +- AC_DEFINE([BUILD_PCM_PLUGIN_MMAP_EMUL], "1", [Build PCM mmap-emul plugin]) +-fi +- +- +-dnl Create PCM plugin symbol list for static library +-rm -f "$srcdir"/src/pcm/pcm_symbols_list.c +-touch "$srcdir"/src/pcm/pcm_symbols_list.c +-for t in $PCM_PLUGIN_LIST; do +- if eval test \$build_pcm_$t = yes; then +- echo \&_snd_module_pcm_$t, >> "$srcdir"/src/pcm/pcm_symbols_list.c +- fi +-done +- +-dnl Control Plugins +- +-AC_ARG_WITH(ctl-plugins, +- AS_HELP_STRING([--with-ctl-plugins=], +- [build control plugins (default = all)]), +- [ctl_plugins="$withval"], [ctl_plugins="all"]) +- +-CTL_PLUGIN_LIST="shm ext" +- +-build_ctl_plugin="no" +-for t in $CTL_PLUGIN_LIST; do +- eval build_ctl_$t="no" +-done +- +-ctl_plugins=`echo $ctl_plugins | sed 's/,/ /g'` +-for p in $ctl_plugins; do +- for t in $CTL_PLUGIN_LIST; do +- if test "$p" = "$t" -o "$p" = "all"; then +- eval build_ctl_$t="yes" +- build_ctl_plugin="yes" +- fi +- done +-done +- +-AM_CONDITIONAL([BUILD_CTL_PLUGIN], [test x$build_ctl_plugin = xyes]) +-AM_CONDITIONAL([BUILD_CTL_PLUGIN_SHM], [test x$build_ctl_shm = xyes]) +-AM_CONDITIONAL([BUILD_CTL_PLUGIN_EXT], [test x$build_ctl_ext = xyes]) +- +-dnl Create ctl plugin symbol list for static library +-rm -f "$srcdir"/src/control/ctl_symbols_list.c +-touch "$srcdir"/src/control/ctl_symbols_list.c +-for t in $CTL_PLUGIN_LIST; do +- if eval test \$build_ctl_$t = yes; then +- echo \&_snd_module_control_$t, >> "$srcdir"/src/control/ctl_symbols_list.c +- fi +-done +- +-dnl Max number of cards +-AC_MSG_CHECKING(for max number of cards) +-AC_ARG_WITH(max-cards, +- AS_HELP_STRING([--with-max-cards], [Specify the max number of cards (default = 32)]), +- [ max_cards="$withval" ], [ max_cards="32" ]) +-AC_MSG_RESULT([$max_cards]) +- +-if test "$max_cards" -lt 1; then +- AC_ERROR([Invalid max cards $max_cards]) +-elif test "$max_cards" -gt 256; then +- AC_ERROR([Invalid max cards $max_cards]) +-fi +-AC_DEFINE_UNQUOTED(SND_MAX_CARDS, $max_cards, [Max number of cards]) +- +-dnl Make a symlink for inclusion of alsa/xxx.h +-if test ! -L "$srcdir"/include/alsa ; then +- echo "Making a symlink include/alsa" +- rm -f "$srcdir"/include/alsa +- ln -sf . "$srcdir"/include/alsa +-fi +- +-AC_OUTPUT(Makefile doc/Makefile doc/pictures/Makefile doc/doxygen.cfg \ +- include/Makefile include/sound/Makefile src/Versions src/Makefile \ +- src/control/Makefile src/mixer/Makefile \ +- src/pcm/Makefile src/pcm/scopes/Makefile \ +- src/rawmidi/Makefile src/timer/Makefile \ +- src/hwdep/Makefile src/seq/Makefile src/ucm/Makefile \ +- src/alisp/Makefile \ +- src/conf/Makefile src/conf/alsa.conf.d/Makefile \ +- src/conf/cards/Makefile \ +- src/conf/pcm/Makefile \ +- src/conf/ucm/Makefile \ +- src/conf/ucm/DAISY-I2S/Makefile \ +- src/conf/ucm/PandaBoard/Makefile \ +- src/conf/ucm/PandaBoardES/Makefile \ +- src/conf/ucm/SDP4430/Makefile \ +- src/conf/ucm/tegraalc5632/Makefile \ +- modules/Makefile modules/mixer/Makefile modules/mixer/simple/Makefile \ +- alsalisp/Makefile aserver/Makefile \ +- test/Makefile test/lsb/Makefile \ +- utils/Makefile utils/alsa-lib.spec utils/alsa.pc) +- +-dnl Create asoundlib.h dynamically according to configure options +-echo "Creating asoundlib.h..." +-cp "$srcdir"/include/asoundlib-head.h include/asoundlib.h +-test "$ac_cv_header_endian_h" = "yes" && echo "#include " >> include/asoundlib.h +-if test "$ac_cv_header_sys_endian_h" = "yes"; then +-cat >> include/asoundlib.h < +-#ifndef __BYTE_ORDER +-#define __BYTE_ORDER BYTE_ORDER +-#endif +-#ifndef __LITTLE_ENDIAN +-#define __LITTLE_ENDIAN LITTLE_ENDIAN +-#endif +-#ifndef __BIG_ENDIAN +-#define __BIG_ENDIAN BIG_ENDIAN +-#endif +-EOF +-fi +-cat >> include/asoundlib.h < +-#include +-#include +-#include +-#include +-#include +-#include +-EOF +-test "$build_pcm" = "yes" && echo "#include " >> include/asoundlib.h +-test "$build_rawmidi" = "yes" && echo "#include " >> include/asoundlib.h +-test "$build_pcm" = "yes" && echo "#include " >> include/asoundlib.h +-test "$build_hwdep" = "yes" && echo "#include " >> include/asoundlib.h +-echo "#include " >> include/asoundlib.h +-test "$build_mixer" = "yes" && echo "#include " >> include/asoundlib.h +-test "$build_seq" = "yes" && echo "#include " >> include/asoundlib.h +-test "$build_seq" = "yes" && echo "#include " >> include/asoundlib.h +-test "$build_seq" = "yes" && echo "#include " >> include/asoundlib.h +-test "$build_seq" = "yes" && echo "#include " >> include/asoundlib.h +-cat "$srcdir"/include/asoundlib-tail.h >> include/asoundlib.h +- +diff --git a/doc/Makefile.am b/doc/Makefile.am +index 406fde763ede..e087f42449a5 100644 +--- a/doc/Makefile.am ++++ b/doc/Makefile.am +@@ -2,7 +2,7 @@ SUBDIRS=pictures + + EXTRA_DIST=README.1st asoundrc.txt doxygen.cfg index.doxygen + +-INCLUDES=-I$(top_srcdir)/include ++AM_CPPFLAGS=-I$(top_srcdir)/include + + doc: + test -e doxygen.cfg || sed s:[@]top_srcdir[@]:..:g doxygen.cfg.in > doxygen.cfg +diff --git a/include/Makefile.am b/include/Makefile.am +index de37f2cc3996..0127d5c4b200 100644 +--- a/include/Makefile.am ++++ b/include/Makefile.am +@@ -61,7 +61,7 @@ alsa: + version.h: stamp-vh alsa + @: + +-stamp-vh: $(top_builddir)/configure.in ++stamp-vh: $(top_builddir)/configure.ac + @echo "/*" > ver.tmp + @echo " * version.h" >> ver.tmp + @echo " */" >> ver.tmp +@@ -83,7 +83,7 @@ stamp-vh: $(top_builddir)/configure.in + echo timestamp > stamp-vh) + -@rm -f ver.tmp + +-INCLUDES=-I$(top_srcdir)/include ++AM_CPPFLAGS=-I$(top_srcdir)/include + + install-data-hook: + test -d $(DESTDIR)$(sysincludedir) || mkdir -p $(DESTDIR)$(sysincludedir) +diff --git a/modules/mixer/simple/Makefile.am b/modules/mixer/simple/Makefile.am +index bad09444fb04..cb64ee8ca665 100644 +--- a/modules/mixer/simple/Makefile.am ++++ b/modules/mixer/simple/Makefile.am +@@ -3,7 +3,7 @@ pkglibdir = $(alsaplugindir)/smixer + + AM_CFLAGS = -g -O2 -W -Wall + +-INCLUDES=-I$(top_srcdir)/include ++AM_CPPFLAGS=-I$(top_srcdir)/include + + pkglib_LTLIBRARIES = smixer-sbase.la \ + smixer-ac97.la \ +diff --git a/src/Makefile.am b/src/Makefile.am +index 8f789fecc125..fa255ff43ee0 100644 +--- a/src/Makefile.am ++++ b/src/Makefile.am +@@ -87,4 +87,4 @@ instr/libinstr.la: + alisp/libalisp.la: + $(MAKE) -C alisp libalisp.la + +-INCLUDES=-I$(top_srcdir)/include ++AM_CPPFLAGS=-I$(top_srcdir)/include +diff --git a/src/alisp/Makefile.am b/src/alisp/Makefile.am +index e6d4ac537961..1234e111e388 100644 +--- a/src/alisp/Makefile.am ++++ b/src/alisp/Makefile.am +@@ -8,4 +8,4 @@ noinst_HEADERS = alisp_local.h + + all: libalisp.la + +-INCLUDES=-I$(top_srcdir)/include ++AM_CPPFLAGS=-I$(top_srcdir)/include +diff --git a/src/control/Makefile.am b/src/control/Makefile.am +index 8076c732b77d..3d476a210e6e 100644 +--- a/src/control/Makefile.am ++++ b/src/control/Makefile.am +@@ -15,4 +15,4 @@ noinst_HEADERS = control_local.h + all: libcontrol.la + + +-INCLUDES=-I$(top_srcdir)/include ++AM_CPPFLAGS=-I$(top_srcdir)/include +diff --git a/src/hwdep/Makefile.am b/src/hwdep/Makefile.am +index 0b626b904a02..b543e581e473 100644 +--- a/src/hwdep/Makefile.am ++++ b/src/hwdep/Makefile.am +@@ -5,4 +5,4 @@ noinst_HEADERS = hwdep_local.h + all: libhwdep.la + + +-INCLUDES=-I$(top_srcdir)/include ++AM_CPPFLAGS=-I$(top_srcdir)/include +diff --git a/src/mixer/Makefile.am b/src/mixer/Makefile.am +index c0749a476d7d..6eeff8af459a 100644 +--- a/src/mixer/Makefile.am ++++ b/src/mixer/Makefile.am +@@ -11,4 +11,4 @@ noinst_HEADERS = mixer_local.h mixer_simple.h + all: libmixer.la + + +-INCLUDES=-I$(top_srcdir)/include ++AM_CPPFLAGS=-I$(top_srcdir)/include +diff --git a/src/pcm/Makefile.am b/src/pcm/Makefile.am +index 28faa5425550..81598f634bc3 100644 +--- a/src/pcm/Makefile.am ++++ b/src/pcm/Makefile.am +@@ -114,4 +114,4 @@ alsadir = $(datadir)/alsa + + all: libpcm.la + +-INCLUDES=-I$(top_srcdir)/include ++AM_CPPFLAGS=-I$(top_srcdir)/include +diff --git a/src/rawmidi/Makefile.am b/src/rawmidi/Makefile.am +index 2470c7ad0e06..41858a1fb07e 100644 +--- a/src/rawmidi/Makefile.am ++++ b/src/rawmidi/Makefile.am +@@ -9,4 +9,4 @@ noinst_HEADERS = rawmidi_local.h + all: librawmidi.la + + +-INCLUDES=-I$(top_srcdir)/include ++AM_CPPFLAGS=-I$(top_srcdir)/include +diff --git a/src/seq/Makefile.am b/src/seq/Makefile.am +index 1ea92f02d80f..6cefe3970f4a 100644 +--- a/src/seq/Makefile.am ++++ b/src/seq/Makefile.am +@@ -10,4 +10,4 @@ noinst_HEADERS = seq_local.h + all: libseq.la + + +-INCLUDES=-I$(top_srcdir)/include ++AM_CPPFLAGS=-I$(top_srcdir)/include +diff --git a/src/timer/Makefile.am b/src/timer/Makefile.am +index e7cf77b64995..7cfbe455af56 100644 +--- a/src/timer/Makefile.am ++++ b/src/timer/Makefile.am +@@ -6,4 +6,4 @@ noinst_HEADERS = timer_local.h + all: libtimer.la + + +-INCLUDES=-I$(top_srcdir)/include ++AM_CPPFLAGS=-I$(top_srcdir)/include +diff --git a/src/ucm/Makefile.am b/src/ucm/Makefile.am +index 7435d90333c4..9d66b24439c2 100644 +--- a/src/ucm/Makefile.am ++++ b/src/ucm/Makefile.am +@@ -7,4 +7,4 @@ noinst_HEADERS = ucm_local.h + all: libucm.la + + +-INCLUDES=-I$(top_srcdir)/include ++AM_CPPFLAGS=-I$(top_srcdir)/include +diff --git a/test/Makefile.am b/test/Makefile.am +index 87054021a70c..a06e79b39d18 100644 +--- a/test/Makefile.am ++++ b/test/Makefile.am +@@ -22,7 +22,7 @@ code_CFLAGS=-Wall -pipe -g -O2 + chmap_LDADD=../src/libasound.la + audio_time_LDADD=../src/libasound.la + +-INCLUDES=-I$(top_srcdir)/include ++AM_CPPFLAGS=-I$(top_srcdir)/include + AM_CFLAGS=-Wall -pipe -g + + EXTRA_DIST=seq-decoder.c seq-sender.c midifile.h midifile.c midifile.3 +diff --git a/utils/Makefile.am b/utils/Makefile.am +index 447d5251207d..7220c02029f4 100644 +--- a/utils/Makefile.am ++++ b/utils/Makefile.am +@@ -11,4 +11,4 @@ pkgconfig_DATA = alsa.pc + rpm: buildrpm alsa-lib.spec + VERSION=$(VERSION) $(srcdir)/buildrpm + +-INCLUDES=-I$(top_srcdir)/include ++AM_CPPFLAGS=-I$(top_srcdir)/include +-- +1.9.0 + diff --git a/0031-pcm-Insert-linear-to-float-conversion-when-rate-or-c.patch b/0031-pcm-Insert-linear-to-float-conversion-when-rate-or-c.patch new file mode 100644 index 0000000..22d63b6 --- /dev/null +++ b/0031-pcm-Insert-linear-to-float-conversion-when-rate-or-c.patch @@ -0,0 +1,45 @@ +From 2da7b0c2c194a457de9d9a1a9b93c47e2dad1507 Mon Sep 17 00:00:00 2001 +From: Maarten Baert +Date: Wed, 26 Feb 2014 14:23:45 +0100 +Subject: [PATCH] pcm: Insert linear-to-float conversion when rate or channel + count is incorrect + +This fixes a bug where snd_pcm_plug_insert_plugins fails when both +client and slave use format float, but the rate or channel count does +not match. I also removed some redundant code. + +Signed-off-by: Maarten Baert +Signed-off-by: Takashi Iwai +--- + src/pcm/pcm_plug.c | 14 ++++++-------- + 1 file changed, 6 insertions(+), 8 deletions(-) + +diff --git a/src/pcm/pcm_plug.c b/src/pcm/pcm_plug.c +index fa84eaacaedc..ede9c1525a74 100644 +--- a/src/pcm/pcm_plug.c ++++ b/src/pcm/pcm_plug.c +@@ -522,15 +522,13 @@ static int snd_pcm_plug_change_format(snd_pcm_t *pcm, snd_pcm_t **new, snd_pcm_p + } + #ifdef BUILD_PCM_PLUGIN_LFLOAT + } else if (snd_pcm_format_float(slv->format)) { +- /* Conversion is done in another plugin */ +- if (clt->format == slv->format && +- clt->rate == slv->rate && +- clt->channels == slv->channels) +- return 0; +- cfmt = clt->format; +- if (snd_pcm_format_linear(clt->format)) ++ if (snd_pcm_format_linear(clt->format)) { ++ cfmt = clt->format; + f = snd_pcm_lfloat_open; +- else ++ } else if (clt->rate != slv->rate || clt->channels != slv->channels) { ++ cfmt = SND_PCM_FORMAT_S16; ++ f = snd_pcm_lfloat_open; ++ } else + return -EINVAL; + #endif + #ifdef BUILD_PCM_NONLINEAR +-- +1.9.0 + diff --git a/0032-pcm-route-Allow-chmap-syntax-for-slave-channels-in-t.patch b/0032-pcm-route-Allow-chmap-syntax-for-slave-channels-in-t.patch new file mode 100644 index 0000000..d116478 --- /dev/null +++ b/0032-pcm-route-Allow-chmap-syntax-for-slave-channels-in-t.patch @@ -0,0 +1,68 @@ +From 8ad8d22216f818872a764ef5dafcaae1adeee211 Mon Sep 17 00:00:00 2001 +From: David Henningsson +Date: Fri, 28 Feb 2014 08:57:05 +0100 +Subject: [PATCH] pcm: route: Allow chmap syntax for slave channels in ttable + +Instead of writing e g "0" and "1", one can now write "FL" and "FR" instead. + +E g: + ttable.0.FL 1 + ttable.1.FR 1 + ttable.2.LFE 1 + +Signed-off-by: David Henningsson +Signed-off-by: Takashi Iwai +--- + src/pcm/pcm_route.c | 22 ++++++++++++++++++++-- + 1 file changed, 20 insertions(+), 2 deletions(-) + +diff --git a/src/pcm/pcm_route.c b/src/pcm/pcm_route.c +index 2beedf68c3e0..56318d47bcbf 100644 +--- a/src/pcm/pcm_route.c ++++ b/src/pcm/pcm_route.c +@@ -789,6 +789,24 @@ static void snd_pcm_route_dump(snd_pcm_t *pcm, snd_output_t *out) + snd_pcm_dump(route->plug.gen.slave, out); + } + ++static int strtochannel(const char *id, long *channel) ++{ ++ int err; ++ int ch; ++ err = safe_strtol(id, channel); ++ if (err >= 0) ++ return err; ++ ++ ch = (int) snd_pcm_chmap_from_string(id); ++ if (ch == -1) ++ return -EINVAL; ++ ++ /* For now, assume standard channel mapping */ ++ *channel = ch - SND_CHMAP_FL; ++ return 0; ++} ++ ++ + static const snd_pcm_ops_t snd_pcm_route_ops = { + .close = snd_pcm_route_close, + .info = snd_pcm_generic_info, +@@ -983,7 +1001,7 @@ int snd_pcm_route_determine_ttable(snd_config_t *tt, + const char *id; + if (snd_config_get_id(jnode, &id) < 0) + continue; +- err = safe_strtol(id, &schannel); ++ err = strtochannel(id, &schannel); + if (err < 0) { + SNDERR("Invalid slave channel: %s", id); + return -EINVAL; +@@ -1046,7 +1064,7 @@ int snd_pcm_route_load_ttable(snd_config_t *tt, snd_pcm_route_ttable_entry_t *tt + const char *id; + if (snd_config_get_id(jnode, &id) < 0) + continue; +- err = safe_strtol(id, &schannel); ++ err = strtochannel(id, &schannel); + if (err < 0 || + schannel < 0 || (unsigned int) schannel > tt_ssize || + (schannels > 0 && schannel >= schannels)) { +-- +1.9.0 + diff --git a/0033-pcm-route-Select-slave-chmap-based-on-ttable-informa.patch b/0033-pcm-route-Select-slave-chmap-based-on-ttable-informa.patch new file mode 100644 index 0000000..acd435e --- /dev/null +++ b/0033-pcm-route-Select-slave-chmap-based-on-ttable-informa.patch @@ -0,0 +1,475 @@ +From 5c4cd46810cef8850b037fca9e38ffd43b0bff22 Mon Sep 17 00:00:00 2001 +From: David Henningsson +Date: Fri, 28 Feb 2014 08:57:06 +0100 +Subject: [PATCH] pcm: route: Select slave chmap based on ttable information + +It means we need to initialize this order: + + 1) Read the ttable to figure out which channels are present + 2) Open slave pcm and find a matching chmap + 3) Determine size of ttable (this can now depend on the chmap) + 4) Read ttable coefficients + 5) At prepare time, select the matching chmap + +Signed-off-by: David Henningsson +Signed-off-by: Takashi Iwai +--- + src/pcm/pcm_route.c | 319 +++++++++++++++++++++++++++++++++++++++++++++------- + 1 file changed, 276 insertions(+), 43 deletions(-) + +diff --git a/src/pcm/pcm_route.c b/src/pcm/pcm_route.c +index 56318d47bcbf..ab17fa78be2c 100644 +--- a/src/pcm/pcm_route.c ++++ b/src/pcm/pcm_route.c +@@ -103,6 +103,7 @@ typedef struct { + snd_pcm_format_t sformat; + int schannels; + snd_pcm_route_params_t params; ++ snd_pcm_chmap_t *chmap; + } snd_pcm_route_t; + + #endif /* DOC_HIDDEN */ +@@ -518,6 +519,7 @@ static int snd_pcm_route_close(snd_pcm_t *pcm) + } + free(params->dsts); + } ++ free(route->chmap); + return snd_pcm_generic_close(pcm); + } + +@@ -789,21 +791,187 @@ static void snd_pcm_route_dump(snd_pcm_t *pcm, snd_output_t *out) + snd_pcm_dump(route->plug.gen.slave, out); + } + +-static int strtochannel(const char *id, long *channel) ++/* ++ * Converts a string to an array of channel indices: ++ * - Given a number, the result is an array with one element, ++ * containing that number ++ * - Given a channel name (e g "FL") and a chmap, ++ * it will look this up in the chmap and return all matches ++ * - Given a channel name and no chmap, the result is an array with one element, ++ containing alsa standard channel map. Note that this might be a negative ++ number in case of "UNKNOWN", "NA" or "MONO". ++ * Return value is number of matches written. ++ */ ++static int strtochannel(const char *id, snd_pcm_chmap_t *chmap, ++ long *channel, int channel_size) + { +- int err; + int ch; +- err = safe_strtol(id, channel); +- if (err >= 0) +- return err; ++ if (safe_strtol(id, channel) >= 0) ++ return 1; + + ch = (int) snd_pcm_chmap_from_string(id); + if (ch == -1) + return -EINVAL; + +- /* For now, assume standard channel mapping */ +- *channel = ch - SND_CHMAP_FL; ++ if (chmap) { ++ int i, r = 0; ++ /* Start with highest channel to simplify implementation of ++ determine ttable size */ ++ for (i = chmap->channels - 1; i >= 0; i--) { ++ if ((int) chmap->pos[i] != ch) ++ continue; ++ if (r >= channel_size) ++ continue; ++ channel[r++] = i; ++ } ++ return r; ++ } ++ else { ++ /* Assume ALSA standard channel mapping */ ++ *channel = ch - SND_CHMAP_FL; ++ return 1; ++ } ++} ++ ++#define MAX_CHMAP_CHANNELS 256 ++ ++static int determine_chmap(snd_config_t *tt, snd_pcm_chmap_t **tt_chmap) ++{ ++ snd_config_iterator_t i, inext; ++ snd_pcm_chmap_t *chmap; ++ ++ assert(tt && tt_chmap); ++ chmap = malloc(sizeof(snd_pcm_chmap_t) + ++ MAX_CHMAP_CHANNELS * sizeof(unsigned int)); ++ ++ chmap->channels = 0; ++ snd_config_for_each(i, inext, tt) { ++ const char *id; ++ snd_config_iterator_t j, jnext; ++ snd_config_t *in = snd_config_iterator_entry(i); ++ ++ if (!snd_config_get_id(in, &id) < 0) ++ continue; ++ if (snd_config_get_type(in) != SND_CONFIG_TYPE_COMPOUND) ++ goto err; ++ snd_config_for_each(j, jnext, in) { ++ int ch, k, found; ++ long schannel; ++ snd_config_t *jnode = snd_config_iterator_entry(j); ++ if (snd_config_get_id(jnode, &id) < 0) ++ continue; ++ if (safe_strtol(id, &schannel) >= 0) ++ continue; ++ ch = (int) snd_pcm_chmap_from_string(id); ++ if (ch == -1) ++ goto err; ++ ++ found = 0; ++ for (k = 0; k < (int) chmap->channels; k++) ++ if (ch == (int) chmap->pos[k]) { ++ found = 1; ++ break; ++ } ++ if (found) ++ continue; ++ ++ if (chmap->channels >= MAX_CHMAP_CHANNELS) { ++ SNDERR("Too many channels in ttable chmap"); ++ goto err; ++ } ++ chmap->pos[chmap->channels++] = ch; ++ } ++ } ++ ++ ++ *tt_chmap = chmap; + return 0; ++ ++err: ++ *tt_chmap = NULL; ++ free(chmap); ++ return -EINVAL; ++} ++ ++static int find_matching_chmap(snd_pcm_t *spcm, snd_pcm_chmap_t *tt_chmap, ++ snd_pcm_chmap_t **found_chmap, int *schannels) ++{ ++ snd_pcm_chmap_query_t** chmaps = snd_pcm_query_chmaps(spcm); ++ int i; ++ ++ *found_chmap = NULL; ++ ++ if (chmaps == NULL) ++ return 0; /* chmap API not supported for this slave */ ++ ++ for (i = 0; chmaps[i]; i++) { ++ unsigned int j, k; ++ int match = 1; ++ snd_pcm_chmap_t *c = &chmaps[i]->map; ++ if (*schannels >= 0 && (int) c->channels != *schannels) ++ continue; ++ ++ for (j = 0; j < tt_chmap->channels; j++) { ++ int found = 0; ++ unsigned int ch = tt_chmap->pos[j]; ++ for (k = 0; k < c->channels; k++) ++ if (c->pos[k] == ch) { ++ found = 1; ++ break; ++ } ++ if (!found) { ++ match = 0; ++ break; ++ } ++ } ++ ++ if (match) { ++ int size = sizeof(snd_pcm_chmap_t) + c->channels * sizeof(unsigned int); ++ *found_chmap = malloc(size); ++ if (!*found_chmap) { ++ snd_pcm_free_chmaps(chmaps); ++ return -ENOMEM; ++ } ++ memcpy(*found_chmap, c, size); ++ *schannels = c->channels; ++ break; ++ } ++ } ++ ++ snd_pcm_free_chmaps(chmaps); ++ ++ if (*found_chmap == NULL) { ++ SNDERR("Found no matching channel map"); ++ return -EINVAL; ++ } ++ return 0; ++} ++ ++static int route_chmap_init(snd_pcm_t *pcm) ++{ ++ int set_map = 0; ++ snd_pcm_chmap_t *current; ++ snd_pcm_route_t *route = pcm->private_data; ++ if (!route->chmap) ++ return 0; ++ if (snd_pcm_state(pcm) != SND_PCM_STATE_PREPARED) ++ return 0; ++ ++ /* Check if we really need to set the chmap or not. ++ This is important in case set_chmap is not implemented. */ ++ current = snd_pcm_get_chmap(route->plug.gen.slave); ++ if (!current) ++ return -ENOSYS; ++ if (current->channels != route->chmap->channels) ++ set_map = 1; ++ else ++ set_map = memcmp(current->pos, route->chmap->pos, ++ current->channels); ++ free(current); ++ if (!set_map) ++ return 0; ++ ++ return snd_pcm_set_chmap(route->plug.gen.slave, route->chmap); + } + + +@@ -939,6 +1107,7 @@ int snd_pcm_route_open(snd_pcm_t **pcmp, const char *name, + route->plug.undo_write = snd_pcm_plugin_undo_write_generic; + route->plug.gen.slave = slave; + route->plug.gen.close_slave = close_slave; ++ route->plug.init = route_chmap_init; + + err = snd_pcm_new(&pcm, SND_PCM_TYPE_ROUTE, name, slave->stream, slave->mode); + if (err < 0) { +@@ -963,16 +1132,10 @@ int snd_pcm_route_open(snd_pcm_t **pcmp, const char *name, + return 0; + } + +-/** +- * \brief Determine route matrix sizes +- * \param tt Configuration root describing route matrix +- * \param tt_csize Returned client size in elements +- * \param tt_ssize Returned slave size in elements +- * \retval zero on success otherwise a negative error code +- */ +-int snd_pcm_route_determine_ttable(snd_config_t *tt, +- unsigned int *tt_csize, +- unsigned int *tt_ssize) ++static int _snd_pcm_route_determine_ttable(snd_config_t *tt, ++ unsigned int *tt_csize, ++ unsigned int *tt_ssize, ++ snd_pcm_chmap_t *chmap) + { + snd_config_iterator_t i, inext; + long csize = 0, ssize = 0; +@@ -1001,7 +1164,7 @@ int snd_pcm_route_determine_ttable(snd_config_t *tt, + const char *id; + if (snd_config_get_id(jnode, &id) < 0) + continue; +- err = strtochannel(id, &schannel); ++ err = strtochannel(id, chmap, &schannel, 1); + if (err < 0) { + SNDERR("Invalid slave channel: %s", id); + return -EINVAL; +@@ -1020,6 +1183,20 @@ int snd_pcm_route_determine_ttable(snd_config_t *tt, + } + + /** ++ * \brief Determine route matrix sizes ++ * \param tt Configuration root describing route matrix ++ * \param tt_csize Returned client size in elements ++ * \param tt_ssize Returned slave size in elements ++ * \retval zero on success otherwise a negative error code ++ */ ++int snd_pcm_route_determine_ttable(snd_config_t *tt, ++ unsigned int *tt_csize, ++ unsigned int *tt_ssize) ++{ ++ return _snd_pcm_route_determine_ttable(tt, tt_csize, tt_ssize, NULL); ++} ++ ++/** + * \brief Load route matrix + * \param tt Configuration root describing route matrix + * \param ttable Returned route matrix +@@ -1030,10 +1207,10 @@ int snd_pcm_route_determine_ttable(snd_config_t *tt, + * \param schannels Slave channels + * \retval zero on success otherwise a negative error code + */ +-int snd_pcm_route_load_ttable(snd_config_t *tt, snd_pcm_route_ttable_entry_t *ttable, +- unsigned int tt_csize, unsigned int tt_ssize, +- unsigned int *tt_cused, unsigned int *tt_sused, +- int schannels) ++static int _snd_pcm_route_load_ttable(snd_config_t *tt, snd_pcm_route_ttable_entry_t *ttable, ++ unsigned int tt_csize, unsigned int tt_ssize, ++ unsigned int *tt_cused, unsigned int *tt_sused, ++ int schannels, snd_pcm_chmap_t *chmap) + { + int cused = -1; + int sused = -1; +@@ -1060,17 +1237,18 @@ int snd_pcm_route_load_ttable(snd_config_t *tt, snd_pcm_route_ttable_entry_t *tt + snd_config_for_each(j, jnext, in) { + snd_config_t *jnode = snd_config_iterator_entry(j); + double value; +- long schannel; ++ int ss; ++ long *scha = alloca(tt_ssize * sizeof(long)); + const char *id; + if (snd_config_get_id(jnode, &id) < 0) + continue; +- err = strtochannel(id, &schannel); +- if (err < 0 || +- schannel < 0 || (unsigned int) schannel > tt_ssize || +- (schannels > 0 && schannel >= schannels)) { ++ ++ ss = strtochannel(id, chmap, scha, tt_ssize); ++ if (ss < 0) { + SNDERR("Invalid slave channel: %s", id); + return -EINVAL; + } ++ + err = snd_config_get_real(jnode, &value); + if (err < 0) { + long v; +@@ -1081,9 +1259,18 @@ int snd_pcm_route_load_ttable(snd_config_t *tt, snd_pcm_route_ttable_entry_t *tt + } + value = v; + } +- ttable[cchannel * tt_ssize + schannel] = value; +- if (schannel > sused) +- sused = schannel; ++ ++ for (k = 0; (int) k < ss; k++) { ++ long schannel = scha[k]; ++ if (schannel < 0 || (unsigned int) schannel > tt_ssize || ++ (schannels > 0 && schannel >= schannels)) { ++ SNDERR("Invalid slave channel: %s", id); ++ return -EINVAL; ++ } ++ ttable[cchannel * tt_ssize + schannel] = value; ++ if (schannel > sused) ++ sused = schannel; ++ } + } + if (cchannel > cused) + cused = cchannel; +@@ -1093,6 +1280,26 @@ int snd_pcm_route_load_ttable(snd_config_t *tt, snd_pcm_route_ttable_entry_t *tt + return 0; + } + ++/** ++ * \brief Load route matrix ++ * \param tt Configuration root describing route matrix ++ * \param ttable Returned route matrix ++ * \param tt_csize Client size in elements ++ * \param tt_ssize Slave size in elements ++ * \param tt_cused Used client elements ++ * \param tt_sused Used slave elements ++ * \param schannels Slave channels ++ * \retval zero on success otherwise a negative error code ++ */ ++int snd_pcm_route_load_ttable(snd_config_t *tt, snd_pcm_route_ttable_entry_t *ttable, ++ unsigned int tt_csize, unsigned int tt_ssize, ++ unsigned int *tt_cused, unsigned int *tt_sused, ++ int schannels) ++{ ++ return _snd_pcm_route_load_ttable(tt, ttable, tt_csize, tt_ssize, ++ tt_cused, tt_sused, schannels, NULL); ++} ++ + /*! \page pcm_plugins + + \section pcm_plugins_route Plugin: Route & Volume +@@ -1100,6 +1307,9 @@ int snd_pcm_route_load_ttable(snd_config_t *tt, snd_pcm_route_ttable_entry_t *tt + This plugin converts channels and applies volume during the conversion. + The format and rate must match for both of them. + ++SCHANNEL can be a channel name instead of a number (e g FL, LFE). ++If so, a matching channel map will be selected for the slave. ++ + \code + pcm.name { + type route # Route & Volume conversion PCM +@@ -1150,6 +1360,7 @@ int _snd_pcm_route_open(snd_pcm_t **pcmp, const char *name, + int err; + snd_pcm_t *spcm; + snd_config_t *slave = NULL, *sconf; ++ snd_pcm_chmap_t *tt_chmap, *chmap; + snd_pcm_format_t sformat = SND_PCM_FORMAT_UNKNOWN; + int schannels = -1; + snd_config_t *tt = NULL; +@@ -1198,37 +1409,59 @@ int _snd_pcm_route_open(snd_pcm_t **pcmp, const char *name, + return -EINVAL; + } + +- err = snd_pcm_route_determine_ttable(tt, &csize, &ssize); ++ err = determine_chmap(tt, &tt_chmap); + if (err < 0) { +- snd_config_delete(sconf); ++ free(ttable); + return err; + } +- ttable = malloc(csize * ssize * sizeof(snd_pcm_route_ttable_entry_t)); +- if (ttable == NULL) { +- snd_config_delete(sconf); +- return -ENOMEM; +- } +- err = snd_pcm_route_load_ttable(tt, ttable, csize, ssize, +- &cused, &sused, schannels); ++ ++ err = snd_pcm_open_slave(&spcm, root, sconf, stream, mode, conf); ++ snd_config_delete(sconf); + if (err < 0) { ++ free(tt_chmap); + free(ttable); +- snd_config_delete(sconf); + return err; + } + +- err = snd_pcm_open_slave(&spcm, root, sconf, stream, mode, conf); +- snd_config_delete(sconf); ++ if (tt_chmap) { ++ err = find_matching_chmap(spcm, tt_chmap, &chmap, &schannels); ++ free(tt_chmap); ++ if (err < 0) ++ return err; ++ } ++ ++ err = _snd_pcm_route_determine_ttable(tt, &csize, &ssize, chmap); ++ if (err < 0) { ++ free(chmap); ++ snd_pcm_close(spcm); ++ return err; ++ } ++ ttable = malloc(csize * ssize * sizeof(snd_pcm_route_ttable_entry_t)); ++ if (ttable == NULL) { ++ free(chmap); ++ snd_pcm_close(spcm); ++ return -ENOMEM; ++ } ++ err = _snd_pcm_route_load_ttable(tt, ttable, csize, ssize, ++ &cused, &sused, schannels, chmap); + if (err < 0) { ++ free(chmap); + free(ttable); ++ snd_pcm_close(spcm); + return err; + } ++ + err = snd_pcm_route_open(pcmp, name, sformat, schannels, + ttable, ssize, + cused, sused, + spcm, 1); + free(ttable); +- if (err < 0) ++ if (err < 0) { ++ free(chmap); + snd_pcm_close(spcm); ++ } ++ ((snd_pcm_route_t*) (*pcmp)->private_data)->chmap = chmap; ++ + return err; + } + #ifndef DOC_HIDDEN +-- +1.9.0 + diff --git a/0034-conf-Allow-2.1-surround-to-use-different-number-of-c.patch b/0034-conf-Allow-2.1-surround-to-use-different-number-of-c.patch new file mode 100644 index 0000000..0720a88 --- /dev/null +++ b/0034-conf-Allow-2.1-surround-to-use-different-number-of-c.patch @@ -0,0 +1,42 @@ +From 48f1b308cc66152eb6db66742dd0d08d888cda8d Mon Sep 17 00:00:00 2001 +From: David Henningsson +Date: Fri, 28 Feb 2014 08:57:07 +0100 +Subject: [PATCH] conf: Allow 2.1 surround to use different number of channels + +This way, cards that support LFE on four channels (e g laptop with +internal subwoofer) can do that, and other cards on a six channel setup +can use that as well. + +Well, note that there is still a reference to "pcm.surround51" left here. +In practice, for HDA Intel sound cards this does not matter as both +surround51 and surround40 reference the same definition. +(And that's the only card I currently know of that actually does +surround2.1 over four channels.) + +Signed-off-by: David Henningsson +Signed-off-by: Takashi Iwai +--- + src/conf/pcm/surround21.conf | 7 +++---- + 1 file changed, 3 insertions(+), 4 deletions(-) + +diff --git a/src/conf/pcm/surround21.conf b/src/conf/pcm/surround21.conf +index be29020f24c7..7f4676b3f714 100644 +--- a/src/conf/pcm/surround21.conf ++++ b/src/conf/pcm/surround21.conf +@@ -51,10 +51,9 @@ pcm.!surround21 { + ] + } + } +- slave.channels 6 +- ttable.0.0 1 +- ttable.1.1 1 +- ttable.2.5 1 ++ ttable.0.FL 1 ++ ttable.1.FR 1 ++ ttable.2.LFE 1 + hint { + description "2.1 Surround output to Front and Subwoofer speakers" + device $DEV +-- +1.9.0 + diff --git a/0035-pcm-Wrap-hw_ptr-to-boundary-in-pcm_ioplug.patch b/0035-pcm-Wrap-hw_ptr-to-boundary-in-pcm_ioplug.patch new file mode 100644 index 0000000..20bbd12 --- /dev/null +++ b/0035-pcm-Wrap-hw_ptr-to-boundary-in-pcm_ioplug.patch @@ -0,0 +1,31 @@ +From 688004a6acf7d1d568a660546816a092b6cc32ed Mon Sep 17 00:00:00 2001 +From: "MONTANARO Luciano (MM)" +Date: Tue, 4 Mar 2014 12:51:36 +0100 +Subject: [PATCH] pcm: Wrap hw_ptr to boundary in pcm_ioplug + +The function snd_pcm_ioplug_hw_ptr_update() always increased the hw_ptr +by delta, without wrapping it to the boundary. This would lead to +problems when after many hours, the hw_ptr would overflow. + +Signed-off-by: Luciano Montanaro +Signed-off-by: Jaroslav Kysela +--- + src/pcm/pcm_ioplug.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/src/pcm/pcm_ioplug.c b/src/pcm/pcm_ioplug.c +index a90c844598bd..c1c3a9835d47 100644 +--- a/src/pcm/pcm_ioplug.c ++++ b/src/pcm/pcm_ioplug.c +@@ -60,7 +60,7 @@ static void snd_pcm_ioplug_hw_ptr_update(snd_pcm_t *pcm) + delta = hw - io->last_hw; + else + delta = pcm->buffer_size + hw - io->last_hw; +- io->data->hw_ptr += delta; ++ snd_pcm_mmap_hw_forward(io->data->pcm, delta); + io->last_hw = hw; + } else + io->data->state = SNDRV_PCM_STATE_XRUN; +-- +1.9.0 + diff --git a/0036-src-conf-cards-Add-missing-entry-for-Loopback.conf.patch b/0036-src-conf-cards-Add-missing-entry-for-Loopback.conf.patch new file mode 100644 index 0000000..21d15eb --- /dev/null +++ b/0036-src-conf-cards-Add-missing-entry-for-Loopback.conf.patch @@ -0,0 +1,25 @@ +From cbcc78031b676413265719113c7109481fa0242d Mon Sep 17 00:00:00 2001 +From: Takashi Iwai +Date: Tue, 11 Mar 2014 10:59:21 +0100 +Subject: [PATCH] src/conf/cards: Add missing entry for Loopback.conf + +Signed-off-by: Takashi Iwai +--- + src/conf/cards/Makefile.am | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/src/conf/cards/Makefile.am b/src/conf/cards/Makefile.am +index ee7991be28e8..008d399fdc34 100644 +--- a/src/conf/cards/Makefile.am ++++ b/src/conf/cards/Makefile.am +@@ -35,6 +35,7 @@ cfg_files = aliases.conf \ + ICH.conf \ + ICH4.conf \ + ICH-MODEM.conf \ ++ Loopback.conf \ + Maestro3.conf \ + NFORCE.conf \ + PC-Speaker.conf \ +-- +1.9.0 + diff --git a/Loopback.conf b/Loopback.conf new file mode 100644 index 0000000..306b9ba --- /dev/null +++ b/Loopback.conf @@ -0,0 +1,74 @@ +# +# Configuration for the Intel HD audio (ICH6/ICH7) +# + + + +Loopback.pcm.front.0 { + @args [ CARD ] + @args.CARD { + type string + } + type softvol + slave.pcm { + type hw + card $CARD + } + control { + name "PCM Playback Volume" + card $CARD + } +} + +# default with dmix+softvol & dsnoop +Loopback.pcm.default { + @args [ CARD ] + @args.CARD { + type string + } + type asym + playback.pcm { + type plug + slave.pcm { + type softvol + slave.pcm { + @func concat + strings [ "dmix:" $CARD ] + } + control { + name "PCM Playback Volume" + card $CARD + } + } + } + capture.pcm { + type plug + slave.pcm { + type softvol + slave.pcm { + @func concat + strings [ "dsnoop:" $CARD ] + } + control { + name "Digital Capture Volume" + card $CARD + } + min_dB -30.0 + max_dB 30.0 + resolution 121 + } + # to avoid possible phase inversions with digital mics + route_policy copy + } + hint.device 0 +} + + + + + + + +Loopback.pcm.surround40.0 cards.Loopback.pcm.front.0 +Loopback.pcm.surround51.0 cards.Loopback.pcm.front.0 +Loopback.pcm.surround71.0 cards.Loopback.pcm.front.0 diff --git a/alsa-info.sh b/alsa-info.sh index df8058d..958b628 100644 --- a/alsa-info.sh +++ b/alsa-info.sh @@ -1,6 +1,6 @@ #!/bin/bash -SCRIPT_VERSION=0.4.61 +SCRIPT_VERSION=0.4.63 CHANGELOG="http://www.alsa-project.org/alsa-info.sh.changelog" ################################################################################# @@ -227,7 +227,7 @@ withsysfs() { echo "!!-----------" >> $FILE echo "" >> $FILE fi - for f in init_pin_configs driver_pin_configs user_pin_configs init_verbs; do + for f in init_pin_configs driver_pin_configs user_pin_configs init_verbs hints; do echo "$i/$f:" >> $FILE cat $i/$f >> $FILE echo >> $FILE @@ -246,7 +246,7 @@ withdmesg() { echo "!!ALSA/HDA dmesg" >> $FILE echo "!!--------------" >> $FILE echo "" >> $FILE - dmesg | grep -C1 -E 'ALSA|HDA|HDMI|sound|hda.codec|hda.intel' >> $FILE + dmesg | grep -C1 -E 'ALSA|HDA|HDMI|snd[_-]|sound|hda.codec|hda.intel' >> $FILE echo "" >> $FILE echo "" >> $FILE } @@ -370,7 +370,7 @@ information about your ALSA installation and sound related hardware. See '$0 --help' for command line options. " -if [[ -n "$DIALOG" ]]; then +if [ -n "$DIALOG" ]; then dialog --backtitle "$BGTITLE" \ --title "ALSA-Info script v $SCRIPT_VERSION" \ --msgbox "$greeting_message" 20 80 @@ -392,10 +392,11 @@ trap cleanup 0 if [ "$PROCEED" = "yes" ]; then -if [[ -z "$LSPCI" ]] -then - echo "This script requires lspci. Please install it, and re-run this script." - exit 0 +if [ -z "$LSPCI" ]; then + if [ -d /sys/bus/pci ]; then + echo "This script requires lspci. Please install it, and re-run this script." + exit 0 + fi fi #Fetch the info and store in temp files/variables @@ -404,12 +405,10 @@ KERNEL_VERSION=`uname -r` KERNEL_PROCESSOR=`uname -p` KERNEL_MACHINE=`uname -m` KERNEL_OS=`uname -o` -[[ `uname -v |grep SMP` ]] && KERNEL_SMP="Yes" || KERNEL_SMP="No" +[[ `uname -v | grep SMP` ]] && KERNEL_SMP="Yes" || KERNEL_SMP="No" ALSA_DRIVER_VERSION=`cat /proc/asound/version |head -n1|awk {'print $7'} |sed 's/\.$//'` get_alsa_library_version ALSA_UTILS_VERSION=`amixer -v |awk {'print $3'}` -VENDOR_ID=`lspci -vn |grep 040[1-3] | awk -F':' '{print $3}'|awk {'print substr($0, 2);}' >$TEMPDIR/vendor_id.tmp` -DEVICE_ID=`lspci -vn |grep 040[1-3] | awk -F':' '{print $4}'|awk {'print $1'} >$TEMPDIR/device_id.tmp` LAST_CARD=$((`grep "]: " /proc/asound/cards | wc -l` - 1 )) ESDINST=$(which esd 2>/dev/null| sed 's|^[^/]*||' 2>/dev/null) @@ -435,7 +434,9 @@ fi cat /proc/asound/modules 2>/dev/null|awk {'print $2'}>$TEMPDIR/alsamodules.tmp cat /proc/asound/cards >$TEMPDIR/alsacards.tmp +if [[ ! -z "$LSPCI" ]]; then lspci |grep -i "multi\|audio">$TEMPDIR/lspci.tmp +fi #Check for HDA-Intel cards codec#* cat /proc/asound/card*/codec\#* > $TEMPDIR/alsa-hda-intel.tmp 2> /dev/null @@ -548,6 +549,8 @@ echo "" >> $FILE cat $TEMPDIR/alsacards.tmp >> $FILE echo "" >> $FILE echo "" >> $FILE + +if [[ ! -z "$LSPCI" ]]; then echo "!!PCI Soundcards installed in the system" >> $FILE echo "!!--------------------------------------" >> $FILE echo "" >> $FILE @@ -560,6 +563,7 @@ echo "" >> $FILE lspci -vvn |grep -A1 040[1-3] >> $FILE echo "" >> $FILE echo "" >> $FILE +fi if [ "$SNDOPTIONS" ] then @@ -587,8 +591,7 @@ done echo "" >> $FILE fi -if [ -s "$TEMPDIR/alsa-hda-intel.tmp" ] -then +if [ -s "$TEMPDIR/alsa-hda-intel.tmp" ]; then echo "!!HDA-Intel Codec information" >> $FILE echo "!!---------------------------" >> $FILE echo "--startcollapse--" >> $FILE @@ -599,8 +602,7 @@ then echo "" >> $FILE fi -if [ -s "$TEMPDIR/alsa-ac97.tmp" ] -then +if [ -s "$TEMPDIR/alsa-ac97.tmp" ]; then echo "!!AC97 Codec information" >> $FILE echo "!!----------------------" >> $FILE echo "--startcollapse--" >> $FILE @@ -613,8 +615,7 @@ then echo "" >> $FILE fi -if [ -s "$TEMPDIR/alsa-usbmixer.tmp" ] -then +if [ -s "$TEMPDIR/alsa-usbmixer.tmp" ]; then echo "!!USB Mixer information" >> $FILE echo "!!---------------------" >> $FILE echo "--startcollapse--" >> $FILE @@ -626,8 +627,7 @@ then fi #If no command line options are specified, then run as though --with-all was specified -if [[ -z "$1" ]] -then +if [ -z "$1" ]; then update withall pbcheck @@ -636,8 +636,7 @@ fi fi # proceed #loop through command line arguments, until none are left. -if [[ -n "$1" ]] -then +if [ -n "$1" ]; then until [ -z "$1" ] do case "$1" in @@ -767,7 +766,7 @@ if [ "$PROCEED" = "no" ]; then fi if [ "$UPLOAD" = "ask" ]; then - if [[ -n "$DIALOG" ]]; then + if [ -n "$DIALOG" ]; then dialog --backtitle "$BGTITLE" --title "Information collected" --yes-label " UPLOAD / SHARE " --no-label " SAVE LOCALLY " --defaultno --yesno "\n\nAutomatically upload ALSA information to $WWWSERVICE?" 10 80 DIALOG_EXIT_CODE=$? if [ $DIALOG_EXIT_CODE != 0 ]; then @@ -882,27 +881,26 @@ echo "" fi #dialog #See if tput is available, and use it if it is. -if [[ -n "$TPUT" ]] -then +if [ -n "$TPUT" ]; then if [[ -z $PASTEBIN ]]; then FINAL_URL=`tput setaf 1; grep "SUCCESS:" $TEMPDIR/wget.tmp | cut -d ' ' -f 2 ; tput sgr0` else - FINAL_URL=`tput setaf 1; grep "SUCCESS:" $TEMPDIR/wget.tmp |sed -n 's/.*\:\([0-9]\+\).*/http:\/\/pastebin.ca\/\1/p';tput sgr0` + FINAL_URL=`tput setaf 1; grep "SUCCESS:" $TEMPDIR/wget.tmp | sed -n 's/.*\:\([0-9]\+\).*/http:\/\/pastebin.ca\/\1/p';tput sgr0` fi else if [[ -z $PASTEBIN ]]; then FINAL_URL=`grep "SUCCESS:" $TEMPDIR/wget.tmp | cut -d ' ' -f 2` else - FINAL_URL=`grep "SUCCESS:" $TEMPDIR/wget.tmp |sed -n 's/.*\:\([0-9]\+\).*/http:\/\/pastebin.ca\/\1/p'` + FINAL_URL=`grep "SUCCESS:" $TEMPDIR/wget.tmp | sed -n 's/.*\:\([0-9]\+\).*/http:\/\/pastebin.ca\/\1/p'` fi fi -#Output the URL of the uploaded file. +# Output the URL of the uploaded file. echo "Your ALSA information is located at $FINAL_URL" echo "Please inform the person helping you." echo "" -#We couldnt find a suitable wget, so tell the user to upload manually. +# We couldnt find a suitable wget, so tell the user to upload manually. else mv -f $FILE $NFILE || exit 1 KEEP_OUTPUT="yes" @@ -935,5 +933,3 @@ else fi fi fi - - diff --git a/alsa.changes b/alsa.changes index cf01890..89c98f2 100644 --- a/alsa.changes +++ b/alsa.changes @@ -1,3 +1,30 @@ +------------------------------------------------------------------- +Tue Mar 11 10:47:01 CET 2014 - tiwai@suse.de + +- Update alsa-info.sh to match dmesg with snd_ +- Run spec-cleaner +- Add missing Loopback.conf manually +- Upstream fixes: minor clean ups, 2.1 PCM channel config support, + portability improvements, PCM float format conversion fix, + fix for ioplug 32bit hwptr wrap, etc. + 0020-minor-malloc-changes.patch + 0021-alsa-lib-minor-typo-in-pcm-doc.patch + 0022-control_hw-fix-potential-memory-leak.patch + 0023-pcm-initialize-pcm_dmix-monotonic-field.patch + 0024-pcm-initialize-monotonic-field-for-dshare-and-dsnoop.patch + 0025-pcm-use-CLOCK_REALTIME-for-non-monotonic-ts.patch + 0026-alsa-lib-heavy-pcm-atomics-cleanup.patch + 0027-conf-Add-basic-infrastructure-for-2.1-surround-sound.patch + 0028-conf-Add-surround-2.1-support-to-all-cards.patch + 0029-Portability-fix-look-for-sys-endian.h-as-well-as-end.patch + 0030-autotools-update-style.patch + 0031-pcm-Insert-linear-to-float-conversion-when-rate-or-c.patch + 0032-pcm-route-Allow-chmap-syntax-for-slave-channels-in-t.patch + 0033-pcm-route-Select-slave-chmap-based-on-ttable-informa.patch + 0034-conf-Allow-2.1-surround-to-use-different-number-of-c.patch + 0035-pcm-Wrap-hw_ptr-to-boundary-in-pcm_ioplug.patch + 0036-src-conf-cards-Add-missing-entry-for-Loopback.conf.patch + ------------------------------------------------------------------- Mon Feb 24 16:37:33 CET 2014 - tiwai@suse.de diff --git a/alsa.spec b/alsa.spec index fb76898..bf095e4 100644 --- a/alsa.spec +++ b/alsa.spec @@ -16,29 +16,20 @@ # -Name: alsa -BuildRequires: doxygen -BuildRequires: libtool -%if %suse_version > 1200 -BuildRequires: libudev-devel -%else -BuildRequires: udev -%endif -BuildRequires: pkg-config %define package_version 1.0.27.2 -Requires: alsa-utils -Recommends: alsa-plugins alsa-oss -PreReq: %insserv_prereq %fillup_prereq -# bug437293 -%ifarch ppc64 -Obsoletes: alsa-64bit +%if 0%{?suse_version} > 1200 +%define _udevdir %(pkg-config --variable=udevdir udev) +%else +%define _udevdir /lib/udev %endif +Name: alsa +Version: 1.0.27.2 +Release: 0 # Summary: Advanced Linux Sound Architecture License: LGPL-2.1+ Group: System/Libraries -Version: 1.0.27.2 -Release: 0 +Url: http://www.alsa-project.org/ Source: ftp://ftp.alsa-project.org/pub/lib/alsa-lib-%{package_version}.tar.bz2 Source2: baselibs.conf Source8: 40-alsa.rules @@ -58,6 +49,7 @@ Source33: alsa-info.sh Source34: alsa-init.sh Source40: 50-alsa.conf Source41: install-snd-module +Source50: Loopback.conf # Patch: alsa-lib-git-fixes.diff # upstream fixes Patch1: 0001-local.h-use-__kernel_off_t-from-linux-types.h.patch @@ -79,14 +71,43 @@ Patch16: 0016-pcm_file-fixed-memory-leak.patch Patch17: 0017-pcm_file-don-t-touch-infile-on-playback-and-output-f.patch Patch18: 0018-pcm_file-document-new-argument-to-snd_pcm_file_open.patch Patch19: 0019-dmix-Don-t-use-assert-and-abort.patch +Patch20: 0020-minor-malloc-changes.patch +Patch21: 0021-alsa-lib-minor-typo-in-pcm-doc.patch +Patch22: 0022-control_hw-fix-potential-memory-leak.patch +Patch23: 0023-pcm-initialize-pcm_dmix-monotonic-field.patch +Patch24: 0024-pcm-initialize-monotonic-field-for-dshare-and-dsnoop.patch +Patch25: 0025-pcm-use-CLOCK_REALTIME-for-non-monotonic-ts.patch +Patch26: 0026-alsa-lib-heavy-pcm-atomics-cleanup.patch +Patch27: 0027-conf-Add-basic-infrastructure-for-2.1-surround-sound.patch +Patch28: 0028-conf-Add-surround-2.1-support-to-all-cards.patch +Patch29: 0029-Portability-fix-look-for-sys-endian.h-as-well-as-end.patch +Patch30: 0030-autotools-update-style.patch +Patch31: 0031-pcm-Insert-linear-to-float-conversion-when-rate-or-c.patch +Patch32: 0032-pcm-route-Allow-chmap-syntax-for-slave-channels-in-t.patch +Patch33: 0033-pcm-route-Select-slave-chmap-based-on-ttable-informa.patch +Patch34: 0034-conf-Allow-2.1-surround-to-use-different-number-of-c.patch +Patch35: 0035-pcm-Wrap-hw_ptr-to-boundary-in-pcm_ioplug.patch +Patch36: 0036-src-conf-cards-Add-missing-entry-for-Loopback.conf.patch # rest suse patches Patch99: alsa-lib-doxygen-avoid-crash-for-11.3.diff -Url: http://www.alsa-project.org/ +BuildRequires: doxygen +BuildRequires: libtool +BuildRequires: pkg-config +Requires: alsa-utils +# FIXME: use proper Requires(pre/post/preun/...) +PreReq: %fillup_prereq +PreReq: %insserv_prereq +Recommends: alsa-oss +Recommends: alsa-plugins BuildRoot: %{_tmppath}/%{name}-%{version}-build -%if %suse_version > 1200 -%define _udevdir %(pkg-config --variable=udevdir udev) +%if 0%{?suse_version} > 1200 +BuildRequires: libudev-devel %else -%define _udevdir /lib/udev +BuildRequires: udev +%endif +# bug437293 +%ifarch ppc64 +Obsoletes: alsa-64bit %endif %description @@ -114,7 +135,7 @@ to develop applications that require these. Summary: Additional Package Documentation License: GPL-2.0+ Group: Documentation/Other -%if %suse_version > 1110 +%if 0%{?suse_version} > 1110 BuildArch: noarch %endif @@ -134,6 +155,7 @@ Architecture. %prep %setup -q -n alsa-lib-%{package_version} +cp %{SOURCE50} src/conf/cards # %patch -p1 %patch1 -p1 %patch2 -p1 @@ -154,12 +176,29 @@ Architecture. %patch17 -p1 %patch18 -p1 %patch19 -p1 -%if %suse_version == 1130 +%patch20 -p1 +%patch21 -p1 +%patch22 -p1 +%patch23 -p1 +%patch24 -p1 +%patch25 -p1 +%patch26 -p1 +%patch27 -p1 +%patch28 -p1 +%patch29 -p1 +%patch30 -p1 +%patch31 -p1 +%patch32 -p1 +%patch33 -p1 +%patch34 -p1 +%patch35 -p1 +%patch36 -p1 +%if 0%{?suse_version} == 1130 %patch99 -p1 %endif # hack to fix build on older distros -%if %suse_version < 1100 -%ifarch %ix86 +%if 0%{?suse_version} < 1100 +%ifarch %{ix86} test -f $RPM_SOURCE_DIR/baselibs.conf && \ sed -i -e'/recommends.*alsa-oss/d' $RPM_SOURCE_DIR/baselibs.conf %endif @@ -177,88 +216,88 @@ autoreconf -fi --disable-python make V=1 %{?_smp_mflags} # run doxygen -make -C doc doc +make -C doc doc %{?_smp_mflags} %install # install shared library -%makeinstall +make DESTDIR=%{buildroot} install %{?_smp_mflags} # clean up unneeded files -rm -f $RPM_BUILD_ROOT%{_libdir}/*.*a -rm -f $RPM_BUILD_ROOT%{_libdir}/alsa-lib/smixer/*.*a -rm -f $RPM_BUILD_ROOT%{_bindir}/aserver +rm -f %{buildroot}%{_libdir}/*.*a +rm -f %{buildroot}%{_libdir}/alsa-lib/smixer/*.*a +rm -f %{buildroot}%{_bindir}/aserver # # install helper scripts -mkdir -p $RPM_BUILD_ROOT%{_bindir} -mkdir -p $RPM_BUILD_ROOT%{_sbindir} -install -c -m 0755 %{SOURCE16} $RPM_BUILD_ROOT%{_bindir} -install -c -m 0755 %{SOURCE34} $RPM_BUILD_ROOT%{_sbindir}/alsa-init -%if %suse_version < 1140 -sed -i -e 's@/var/lib/alsa/asound.state@/etc/asound.state@g' $RPM_BUILD_ROOT%{_bindir}/set_default_volume -sed -i -e 's@/var/lib/alsa/asound.state@/etc/asound.state@g' $RPM_BUILD_ROOT%{_sbindir}/alsa-init +mkdir -p %{buildroot}%{_bindir} +mkdir -p %{buildroot}%{_sbindir} +install -c -m 0755 %{SOURCE16} %{buildroot}%{_bindir} +install -c -m 0755 %{SOURCE34} %{buildroot}%{_sbindir}/alsa-init +%if 0%{?suse_version} < 1140 +sed -i -e 's@%{_localstatedir}/lib/alsa/asound.state@%{_sysconfdir}/asound.state@g' %{buildroot}%{_bindir}/set_default_volume +sed -i -e 's@%{_localstatedir}/lib/alsa/asound.state@%{_sysconfdir}/asound.state@g' %{buildroot}%{_sbindir}/alsa-init %endif # install test wave file -mkdir -p $RPM_BUILD_ROOT%{_datadir}/sounds/alsa -install -c -m 0644 %{SOURCE17} $RPM_BUILD_ROOT%{_datadir}/sounds/alsa/test.wav +mkdir -p %{buildroot}%{_datadir}/sounds/alsa +install -c -m 0644 %{SOURCE17} %{buildroot}%{_datadir}/sounds/alsa/test.wav # install all_notes_off stuff -install -c -m 0755 %{SOURCE30} $RPM_BUILD_ROOT%{_bindir} -mkdir -p $RPM_BUILD_ROOT/usr/lib -install -c -m 0644 %{SOURCE31} $RPM_BUILD_ROOT/usr/lib -install -c -m 0644 %{SOURCE32} $RPM_BUILD_ROOT/usr/lib -%if %suse_version <= 1310 +install -c -m 0755 %{SOURCE30} %{buildroot}%{_bindir} +mkdir -p %{buildroot}%{_prefix}/lib +install -c -m 0644 %{SOURCE31} %{buildroot}%{_prefix}/lib +install -c -m 0644 %{SOURCE32} %{buildroot}%{_prefix}/lib +%if 0%{?suse_version} <= 1310 # # install init scripts # -mkdir -p $RPM_BUILD_ROOT/etc/init.d -install -c -m 0755 %{SOURCE11} $RPM_BUILD_ROOT/etc/init.d -install -c -m 0755 %{SOURCE13} $RPM_BUILD_ROOT/etc/init.d -%if %suse_version < 1140 -sed -i -e 's@/var/lib/alsa/asound.state@/etc/asound.state@g' $RPM_BUILD_ROOT/etc/init.d/alsasound +mkdir -p %{buildroot}%{_sysconfdir}/init.d +install -c -m 0755 %{SOURCE11} %{buildroot}%{_sysconfdir}/init.d +install -c -m 0755 %{SOURCE13} %{buildroot}%{_sysconfdir}/init.d +%if 0%{?suse_version} < 1140 +sed -i -e 's@%{_localstatedir}/lib/alsa/asound.state@%{_sysconfdir}/asound.state@g' %{buildroot}%{_initddir}/alsasound %endif -rm -f $RPM_BUILD_ROOT%{_sbindir}/rcalsasound -ln -s ../../etc/init.d/alsasound $RPM_BUILD_ROOT%{_sbindir}/rcalsasound -rm -f $RPM_BUILD_ROOT%{_sbindir}/rcjoystick -ln -s ../../etc/init.d/joystick $RPM_BUILD_ROOT%{_sbindir}/rcjoystick +rm -f %{buildroot}%{_sbindir}/rcalsasound +ln -s ../..%{_initddir}/alsasound %{buildroot}%{_sbindir}/rcalsasound +rm -f %{buildroot}%{_sbindir}/rcjoystick +ln -s ../..%{_initddir}/joystick %{buildroot}%{_sbindir}/rcjoystick %endif # # udev rules (only for non-systemd) # -mkdir -p $RPM_BUILD_ROOT%{_udevdir}/rules.d -%if %suse_version < 1140 -install -c -m 0644 %{S:8} $RPM_BUILD_ROOT%{_udevdir}/rules.d +mkdir -p %{buildroot}%{_udevdir}/rules.d +%if 0%{?suse_version} < 1140 +install -c -m 0644 %{SOURCE8} %{buildroot}%{_udevdir}/rules.d %endif -install -c -m 0644 %{S:9} $RPM_BUILD_ROOT%{_udevdir}/rules.d +install -c -m 0644 %{SOURCE9} %{buildroot}%{_udevdir}/rules.d # # modprobe config and the module install script for loading OSS-emulation # and sequencer modules automatically -%if %suse_version > 1220 -mkdir -p $RPM_BUILD_ROOT/etc/modprobe.d -install -c -m 0644 %{S:40} $RPM_BUILD_ROOT/etc/modprobe.d -mkdir -p $RPM_BUILD_ROOT/sbin -install -c -m 0755 %{S:41} $RPM_BUILD_ROOT/sbin +%if 0%{?suse_version} > 1220 +mkdir -p %{buildroot}%{_sysconfdir}/modprobe.d +install -c -m 0644 %{SOURCE40} %{buildroot}%{_sysconfdir}/modprobe.d +mkdir -p %{buildroot}/sbin +install -c -m 0755 %{SOURCE41} %{buildroot}/sbin %endif # # install template to update rc.config and sysconfig files: # (updating the actual files is done in the %post-script) # -mkdir -p -m 755 $RPM_BUILD_ROOT/var/adm/fillup-templates -mkdir -p -m 755 $RPM_BUILD_ROOT/etc/sysconfig -install -m 644 $RPM_SOURCE_DIR/sysconfig.sound $RPM_BUILD_ROOT/var/adm/fillup-templates -%if %suse_version <= 1310 -install -m 644 $RPM_SOURCE_DIR/sysconfig.joystick $RPM_BUILD_ROOT/var/adm/fillup-templates +mkdir -p -m 755 %{buildroot}%{_localstatedir}/adm/fillup-templates +mkdir -p -m 755 %{buildroot}%{_sysconfdir}/sysconfig +install -m 644 $RPM_SOURCE_DIR/sysconfig.sound %{buildroot}%{_localstatedir}/adm/fillup-templates +%if 0%{?suse_version} <= 1310 +install -m 644 $RPM_SOURCE_DIR/sysconfig.joystick %{buildroot}%{_localstatedir}/adm/fillup-templates %endif # # documents # -mkdir -p $RPM_BUILD_ROOT%{_docdir}/%{name} -cp $RPM_SOURCE_DIR/README* $RPM_BUILD_ROOT%{_docdir}/%{name} -mkdir -p $RPM_BUILD_ROOT%{_docdir}/%{name}/alsa-lib -cp COPYING ChangeLog INSTALL TODO MEMORY-LEAK $RPM_BUILD_ROOT%{_docdir}/%{name}/alsa-lib -cp doc/asoundrc.txt $RPM_BUILD_ROOT%{_docdir}/%{name}/alsa-lib +mkdir -p %{buildroot}%{_docdir}/%{name} +cp $RPM_SOURCE_DIR/README* %{buildroot}%{_docdir}/%{name} +mkdir -p %{buildroot}%{_docdir}/%{name}/alsa-lib +cp COPYING ChangeLog INSTALL TODO MEMORY-LEAK %{buildroot}%{_docdir}/%{name}/alsa-lib +cp doc/asoundrc.txt %{buildroot}%{_docdir}/%{name}/alsa-lib # install alsa-info.sh to sbindir -install -c -m 0755 %{SOURCE33} $RPM_BUILD_ROOT%{_sbindir} +install -c -m 0755 %{SOURCE33} %{buildroot}%{_sbindir} %post -%if %suse_version > 1310 +%if 0%{?suse_version} > 1310 %{fillup_only -n sound} %else %{fillup_and_insserv -ny sound alsasound} @@ -266,7 +305,8 @@ install -c -m 0755 %{SOURCE33} $RPM_BUILD_ROOT%{_sbindir} %endif exit 0 -%if %suse_version <= 1310 +%if 0%{?suse_version} <= 1310 + %preun %stop_on_removal alsasound joystick exit 0 @@ -284,18 +324,18 @@ exit 0 %files %defattr(-, root, root) %doc %{_docdir}/%{name} -%if %suse_version <= 1310 -/etc/init.d/* +%if 0%{?suse_version} <= 1310 +%{_initddir}/* %endif -%if %suse_version > 1220 -/etc/modprobe.d +%if 0%{?suse_version} > 1220 +%{_sysconfdir}/modprobe.d /sbin/* %endif %{_sbindir}/* %{_bindir}/* -/usr/lib/all_notes_off.* +%{_prefix}/lib/all_notes_off.* %{_datadir}/sounds/alsa -/var/adm/fillup-templates/* +%{_localstatedir}/adm/fillup-templates/* %{_udevdir}/rules.d/* %files devel