05dc70ee7ea269fd83fa173a31beb9b78f9aba3e
[packages/trusty/cirros-testvm.git] / cirros-testvm / src-cirros / buildroot-2015.05 / package / alsa-lib / 0003-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 +#ifdef HAVE_LIBDL
40  #include <dlfcn.h>
41 +#endif
42  #include "config.h"
43  #include "asoundlib.h"
44  #include "mixer_abst.h"
45 diff --git a/src/mixer/simple_abst.c b/src/mixer/simple_abst.c
46 --- a/src/mixer/simple_abst.c
47 +++ b/src/mixer/simple_abst.c
48 @@ -34,7 +34,9 @@
49  #include <fcntl.h>
50  #include <sys/ioctl.h>
51  #include <math.h>
52 +#ifdef HAVE_LIBDL
53  #include <dlfcn.h>
54 +#endif
55  #include "config.h"
56  #include "asoundlib.h"
57  #include "mixer_simple.h"