[uClibc]ALSA and uClibc

Olivier Rolland billl at esil.univ-mrs.fr
Tue Jun 24 11:18:56 UTC 2003


Works very well, thank you very much...

On Mon, 23 Jun 2003 12:52:06 -0600
Erik Andersen <andersen at codepoet.org> wrote:

> On Mon Jun 23, 2003 at 05:42:55PM +0200, Olivier Rolland wrote:
> > 
> > Hi !
> > 
> > I want to compile alsa against uClibc but when trying to build
> > alsa-lib it complains about wordexp missing and I've read that
> > wordexp support was removed from uClibc.
> > 
> > How can I get rid of wordexp ?
> 
> You use glob instead.  i.e....
> 
> --- src/pcm/pcm_ladspa.c.orig	2003-06-23 12:25:03.000000000 -0600
> +++ src/pcm/pcm_ladspa.c	2003-06-23 12:50:06.000000000 -0600
> @@ -28,7 +28,11 @@
>    
>  #include <dirent.h>
>  #include <dlfcn.h>
> +#ifdef HAS_WORDEXP
>  #include <wordexp.h>
> +#else
> +#include <glob.h>
> +#endif
>  #include "pcm_local.h"
>  #include "pcm_plugin.h"
>  
> @@ -792,13 +796,18 @@
>  {
>  	const char *c;
>  	size_t l;
> -	wordexp_t we;
> +#ifdef HAS_WORDEXP
> +	wordexp_t           we;
> +#else
> +	glob_t              globbuf;
> +#endif
>  	int err;
>  	
>  	for (c = path; (l = strcspn(c, ": ")) > 0; ) {
>  		char name[l + 1];
>  		memcpy(name, c, l);
>  		name[l] = 0;
> +#ifdef HAS_WORDEXP
>  		err = wordexp(name, &we, WRDE_NOCMD);
>  		switch (err) {
>  		case WRDE_NOSPACE:
> @@ -812,6 +821,22 @@
>  		}
>  		err = snd_pcm_ladspa_check_dir(plugin, we.we_wordv[0], label, ladspa_id);
>  		wordfree(&we);
> +#else
> +		err = glob(name, 0, NULL, &globbuf);
> +		switch (err) {
> +		case GLOB_NOSPACE:
> +			return -ENOMEM;
> +		case 0:
> +			if (globbuf.gl_pathc == 1)
> +				break;
> +			/* Fall through */
> +		default:
> +			return -EINVAL;
> +		}
> +		err = snd_pcm_ladspa_check_dir(plugin, globbuf.gl_pathv[0], label, ladspa_id);
> +		globfree(&globbuf);
> +#endif
> +
>  		if (err < 0)
>  			return err;
>  		if (err > 0)
> --- src/conf.c.orig	2003-06-23 12:41:48.000000000 -0600
> +++ src/conf.c	2003-06-23 12:51:03.000000000 -0600
> @@ -415,7 +415,11 @@
>  
>  
>  #include <stdarg.h>
> +#ifdef HAS_WORDEXP
>  #include <wordexp.h>
> +#else
> +#include <glob.h>
> +#endif
>  #include <dlfcn.h>
>  #include <limits.h>
>  #include <sys/stat.h>
> @@ -2780,7 +2784,8 @@
>  				goto _err;
>  			}
>  			if (i == idx) {
> -				wordexp_t we;
> +#ifdef HAS_WORDEXP
> +				wordexp_t           we;
>  				char *name;
>  				if ((err = snd_config_get_ascii(n, &name)) < 0)
>  					goto _err;
> @@ -2799,6 +2804,27 @@
>  				}
>  				fi[idx].name = strdup(we.we_wordv[0]);
>  				wordfree(&we);
> +#else
> +				glob_t              globbuf;
> +				char *name;
> +				if ((err = snd_config_get_ascii(n, &name)) < 0)
> +					goto _err;
> +				err = glob(name, 0, NULL, &globbuf);
> +				switch (err) {
> +				case GLOB_NOSPACE:
> +					err = -ENOMEM;
> +					goto _err;
> +				case 0:
> +					if (globbuf.gl_pathc == 1)
> +						break;
> +					/* Fall through */
> +				default:
> +					err = -EINVAL;
> +					goto _err;
> +				}
> +				fi[idx].name = strdup(globbuf.gl_pathv[0]);
> +				globfree(&globbuf);
> +#endif
>  				free(name);
>  				if (fi[idx].name == NULL) {
>  					err = -ENOMEM;
> @@ -2924,11 +2950,15 @@
>  	int err;
>  	const char *configs, *c;
>  	unsigned int k;
> -	wordexp_t we;
>  	size_t l;
>  	snd_config_update_t *local;
>  	snd_config_update_t *update;
>  	snd_config_t *top;
> +#ifdef HAS_WORDEXP
> +	wordexp_t           we;
> +#else
> +	glob_t              globbuf;
> +#endif
>  	
>  	assert(_top && _update);
>  	top = *_top;
> @@ -2963,6 +2993,7 @@
>  		char name[l + 1];
>  		memcpy(name, c, l);
>  		name[l] = 0;
> +#ifdef HAS_WORDEXP
>  		err = wordexp(name, &we, WRDE_NOCMD);
>  		switch (err) {
>  		case WRDE_NOSPACE:
> @@ -2978,6 +3009,23 @@
>  		}
>  		local->finfo[k].name = strdup(we.we_wordv[0]);
>  		wordfree(&we);
> +#else
> +		err = glob(name, 0, NULL, &globbuf);
> +		switch (err) {
> +		case GLOB_NOSPACE:
> +			err = -ENOMEM;
> +			goto _end;
> +		case 0:
> +			if (globbuf.gl_pathc == 1)
> +				break;
> +			/* Fall through */
> +		default:
> +			err = -EINVAL;
> +			goto _end;
> +		}
> +		local->finfo[k].name = strdup(globbuf.gl_pathv[0]);
> +		globfree(&globbuf);
> +#endif
>  		if (!local->finfo[k].name) {
>  			err = -ENOMEM;
>  			goto _end;
> 
>  -Erik
> 
> --
> Erik B. Andersen             http://codepoet-consulting.com/
> --This message was written using 73% post-consumer electrons--
> 




More information about the uClibc mailing list