]> rtime.felk.cvut.cz Git - coffee/buildroot.git/blob - package/alsa-lib/0002-dlmisc.patch
24b7230cae3b86d076b9434ae8ab9b74a7cba313
[coffee/buildroot.git] / package / alsa-lib / 0002-dlmisc.patch
1 alsa-lib: provide dummy definitions of RTLD_* if necessary
2
3 The FLAT GNU toolchain (e.g. blackfin) doesn't include the dlfcn.h header
4 file, so we need to guard that include. Additionally, provide dummy
5 definitions for parameters RTLD_GLOBAL / RTLD_NOW which are normally
6 provided by dlfcn.h.
7
8 Signed-off-by: Sonic Zhang <sonic.zhang@analog.com>
9 [Thomas: don't add separate dlmisc.h, move dummy defs to global.h]
10 Signed-off-by: Thomas De Schampheleire <thomas.de.schampheleire@gmail.com>
11
12 diff --git a/include/global.h b/include/global.h
13 --- a/include/global.h
14 +++ b/include/global.h
15 @@ -97,6 +97,16 @@ extern struct snd_dlsym_link *snd_dlsym_
16  /** \brief Returns the version of a dynamic symbol as a string. */
17  #define SND_DLSYM_VERSION(version) __STRING(version)
18  
19 +/* RTLD_NOW and RTLD_GLOBAL (used for 'mode' in snd_dlopen) are not defined
20 + * on all arches (e.g. blackfin), so provide a dummy definition here. */
21 +#ifndef RTLD_NOW
22 +#define RTLD_NOW 0
23 +#endif
24 +
25 +#ifndef RTLD_GLOBAL
26 +#define RTLD_GLOBAL 0
27 +#endif
28 +
29  void *snd_dlopen(const char *file, int mode);
30  void *snd_dlsym(void *handle, const char *name, const char *version);
31  int snd_dlclose(void *handle);
32 diff --git a/modules/mixer/simple/sbasedl.c b/modules/mixer/simple/sbasedl.c
33 --- a/modules/mixer/simple/sbasedl.c
34 +++ b/modules/mixer/simple/sbasedl.c
35 @@ -27,7 +27,9 @@
36  #include <fcntl.h>
37  #include <sys/ioctl.h>
38  #include <math.h>
39 +#include "config.h"
40 +#ifdef HAVE_DLFCN
41  #include <dlfcn.h>
42 +#endif
43 -#include "config.h"
44  #include "asoundlib.h"
45  #include "mixer_abst.h"
46 diff --git a/src/mixer/simple_abst.c b/src/mixer/simple_abst.c
47 --- a/src/mixer/simple_abst.c
48 +++ b/src/mixer/simple_abst.c
49 @@ -34,7 +34,9 @@
50  #include <fcntl.h>
51  #include <sys/ioctl.h>
52  #include <math.h>
53 +#include "config.h"
54 +#ifdef HAVE_DLFCN
55  #include <dlfcn.h>
56 +#endif
57 -#include "config.h"
58  #include "asoundlib.h"
59  #include "mixer_simple.h"