make
Note: Some automake packages have missing aclocal program. Use newer version
- in this case.
+ in the case.
+
+Compilation of static library
+-----------------------------
+
+If you would like to use the static ALSA library, you need to use these
+options for the configure script:
+
+ ./configure --enable-shared=no --enable-static=yes
+
+Unfortunately, due to bug in the libtool script, the shared and static
+library cannot be built together.
JAVADOC_AUTOBRIEF = NO
INHERIT_DOCS = YES
ENABLED_SECTIONS = ""
-PREDEFINED = "DOC_HIDDEN"
+PREDEFINED = PIC "DOC_HIDDEN"
OPTIMIZE_OUTPUT_FOR_C = YES # doxygen 1.2.6 option
#define ATTRIBUTE_UNUSED __attribute__ ((__unused__)) /**< don't print warning when attribute is not used */
#endif
-/** helper macro for SND_DLSYM_BUILD_VERSION */
+#ifdef PIC /* dynamic build */
+
+/** helper macro for SND_DLSYM_BUILD_VERSION \hideinitializer */
#define __SND_DLSYM_VERSION(name, version) _ ## name ## version
-/** build version for versioned dynamic symbol */
-#define SND_DLSYM_BUILD_VERSION(name, version) char __SND_DLSYM_VERSION(name, version)
+/** build version for versioned dynamic symbol \hideinitializer */
+#define SND_DLSYM_BUILD_VERSION(name, version) char __SND_DLSYM_VERSION(name, version);
+
+#else /* static build */
+
+struct snd_dlsym_link {
+ struct snd_dlsym_link *next;
+ const char *dlsym_name;
+ const void *dlsym_ptr;
+};
+
+extern struct snd_dlsym_link *snd_dlsym_start;
+
+/** helper macro for SND_DLSYM_BUILD_VERSION \hideinitializer */
+#define __SND_DLSYM_VERSION(prefix, name, version) _ ## prefix ## name ## version
+/** build version for versioned dynamic symbol \hideinitializer */
+#define SND_DLSYM_BUILD_VERSION(name, version) \
+ static struct snd_dlsym_link __SND_DLSYM_VERSION(snd_dlsym_, name, version); \
+ void __SND_DLSYM_VERSION(snd_dlsym_constructor_, name, version) (void) __attribute__ ((constructor)); \
+ void __SND_DLSYM_VERSION(snd_dlsym_constructor_, name, version) (void) { \
+ __SND_DLSYM_VERSION(snd_dlsym_, name, version).next = snd_dlsym_start; \
+ __SND_DLSYM_VERSION(snd_dlsym_, name, version).dlsym_name = # name; \
+ __SND_DLSYM_VERSION(snd_dlsym_, name, version).dlsym_ptr = (void *)&name; \
+ snd_dlsym_start = &__SND_DLSYM_VERSION(snd_dlsym_, name, version); \
+ }
+
+#endif
+
/** get version of dynamic symbol as string */
#define SND_DLSYM_VERSION(version) __STRING(version)
-int snd_dlsym_verify(void *handle, const char *name, const char *version);
+void *snd_dlopen(const char *file, int mode);
+void *snd_dlsym(void *handle, const char *name, const char *version);
+int snd_dlclose(void *handle);
+
/** Async notification client handler */
typedef struct _snd_async_handler snd_async_handler_t;
#include <stdarg.h>
#include <wordexp.h>
-#include <sys/stat.h>
#include <dlfcn.h>
+#include <sys/stat.h>
#include "local.h"
#ifndef DOC_HIDDEN
buf[len-1] = '\0';
func_name = buf;
}
- h = dlopen(lib, RTLD_NOW);
- if ((err = snd_dlsym_verify(h, func_name, SND_DLSYM_VERSION(SND_CONFIG_DLSYM_VERSION_HOOK))) < 0)
- goto _err;
- func = h ? dlsym(h, func_name) : NULL;
+ h = snd_dlopen(lib, RTLD_NOW);
+ func = h ? snd_dlsym(h, func_name, SND_DLSYM_VERSION(SND_CONFIG_DLSYM_VERSION_HOOK)) : NULL;
err = 0;
if (!h) {
SNDERR("Cannot open shared library %s", lib);
err = -ENOENT;
} else if (!func) {
SNDERR("symbol %s is not defined inside %s", func_name, lib);
- dlclose(h);
+ snd_dlclose(h);
err = -ENXIO;
}
_err:
err = func(root, config, &nroot, private_data);
if (err < 0)
SNDERR("function %s returned error: %s", func_name, snd_strerror(err));
- dlclose(h);
+ snd_dlclose(h);
if (err >= 0 && nroot)
snd_config_substitute(root, nroot);
}
return err;
}
-#ifndef DOC_HIDDEN
-SND_DLSYM_BUILD_VERSION(snd_config_hook_load, SND_CONFIG_DLSYM_VERSION_HOOK);
-#endif
/**
* \brief Load configuration from specified files
* \param root Configuration root node
snd_config_delete(n);
return err;
}
-
#ifndef DOC_HIDDEN
-int snd_determine_driver(int card, char **driver);
+SND_DLSYM_BUILD_VERSION(snd_config_hook_load, SND_CONFIG_DLSYM_VERSION_HOOK);
#endif
#ifndef DOC_HIDDEN
-SND_DLSYM_BUILD_VERSION(snd_config_hook_load_for_all_cards, SND_CONFIG_DLSYM_VERSION_HOOK);
+int snd_determine_driver(int card, char **driver);
#endif
+
/**
* \brief Load configuration for all present cards
* \param root Configuration root node
*dst = NULL;
return 0;
}
+#ifndef DOC_HIDDEN
+SND_DLSYM_BUILD_VERSION(snd_config_hook_load_for_all_cards, SND_CONFIG_DLSYM_VERSION_HOOK);
+#endif
/**
* \brief Update #snd_config rereading (if needed) files specified in
buf[len-1] = '\0';
func_name = buf;
}
- h = dlopen(lib, RTLD_NOW);
- if (h) {
- if ((err = snd_dlsym_verify(h, func_name, SND_DLSYM_VERSION(SND_CONFIG_DLSYM_VERSION_EVALUATE))) < 0)
- goto _err;
- func = dlsym(h, func_name);
- }
+ h = snd_dlopen(lib, RTLD_NOW);
+ if (h)
+ func = snd_dlsym(h, func_name, SND_DLSYM_VERSION(SND_CONFIG_DLSYM_VERSION_EVALUATE));
err = 0;
if (!h) {
SNDERR("Cannot open shared library %s", lib);
return -ENOENT;
} else if (!func) {
SNDERR("symbol %s is not defined inside %s", func_name, lib);
- dlclose(h);
+ snd_dlclose(h);
return -ENXIO;
}
_err:
err = func(&eval, root, src, private_data);
if (err < 0)
SNDERR("function %s returned error: %s", func_name, snd_strerror(err));
- dlclose(h);
+ snd_dlclose(h);
if (err >= 0 && eval)
snd_config_substitute(src, eval);
}
* Helper functions for the configuration file
*/
-SND_DLSYM_BUILD_VERSION(snd_func_getenv, SND_CONFIG_DLSYM_VERSION_EVALUATE);
int snd_func_getenv(snd_config_t **dst, snd_config_t *root, snd_config_t *src, void *private_data)
{
snd_config_t *n, *d;
free(def);
return err;
}
+SND_DLSYM_BUILD_VERSION(snd_func_getenv, SND_CONFIG_DLSYM_VERSION_EVALUATE);
-SND_DLSYM_BUILD_VERSION(snd_func_igetenv, SND_CONFIG_DLSYM_VERSION_EVALUATE);
int snd_func_igetenv(snd_config_t **dst, snd_config_t *root, snd_config_t *src, void *private_data)
{
snd_config_t *d;
_end:
return err;
}
+SND_DLSYM_BUILD_VERSION(snd_func_igetenv, SND_CONFIG_DLSYM_VERSION_EVALUATE);
-SND_DLSYM_BUILD_VERSION(snd_func_concat, SND_CONFIG_DLSYM_VERSION_EVALUATE);
int snd_func_concat(snd_config_t **dst, snd_config_t *root, snd_config_t *src, void *private_data)
{
snd_config_t *n;
__error:
return err;
}
+SND_DLSYM_BUILD_VERSION(snd_func_concat, SND_CONFIG_DLSYM_VERSION_EVALUATE);
-SND_DLSYM_BUILD_VERSION(snd_func_datadir, SND_CONFIG_DLSYM_VERSION_EVALUATE);
int snd_func_datadir(snd_config_t **dst, snd_config_t *root ATTRIBUTE_UNUSED,
snd_config_t *src, void *private_data ATTRIBUTE_UNUSED)
{
err = snd_config_set_string(*dst, DATADIR "/alsa");
return 0;
}
+SND_DLSYM_BUILD_VERSION(snd_func_datadir, SND_CONFIG_DLSYM_VERSION_EVALUATE);
static int open_ctl(long card, snd_ctl_t **ctl)
{
}
#endif
-SND_DLSYM_BUILD_VERSION(snd_func_private_string, SND_CONFIG_DLSYM_VERSION_EVALUATE);
int snd_func_private_string(snd_config_t **dst, snd_config_t *root ATTRIBUTE_UNUSED, snd_config_t *src, void *private_data)
{
int err;
err = snd_config_set_string(*dst, (char *)private_data);
return err;
}
+SND_DLSYM_BUILD_VERSION(snd_func_private_string, SND_CONFIG_DLSYM_VERSION_EVALUATE);
int snd_determine_driver(int card, char **driver)
{
return err;
}
-SND_DLSYM_BUILD_VERSION(snd_func_private_card_strtype, SND_CONFIG_DLSYM_VERSION_EVALUATE);
int snd_func_private_card_strtype(snd_config_t **dst, snd_config_t *root ATTRIBUTE_UNUSED, snd_config_t *src, void *private_data)
{
char *driver;
free(driver);
return err;
}
+SND_DLSYM_BUILD_VERSION(snd_func_private_card_strtype, SND_CONFIG_DLSYM_VERSION_EVALUATE);
-SND_DLSYM_BUILD_VERSION(snd_func_card_strtype, SND_CONFIG_DLSYM_VERSION_EVALUATE);
int snd_func_card_strtype(snd_config_t **dst, snd_config_t *root, snd_config_t *src, void *private_data)
{
snd_config_t *n;
free(str);
return snd_func_private_card_strtype(dst, root, src, (void *)v);
}
+SND_DLSYM_BUILD_VERSION(snd_func_card_strtype, SND_CONFIG_DLSYM_VERSION_EVALUATE);
-SND_DLSYM_BUILD_VERSION(snd_func_card_id, SND_CONFIG_DLSYM_VERSION_EVALUATE);
int snd_func_card_id(snd_config_t **dst, snd_config_t *root, snd_config_t *src, void *private_data)
{
snd_config_t *n;
snd_ctl_close(ctl);
return err;
}
+SND_DLSYM_BUILD_VERSION(snd_func_card_id, SND_CONFIG_DLSYM_VERSION_EVALUATE);
-SND_DLSYM_BUILD_VERSION(snd_func_pcm_id, SND_CONFIG_DLSYM_VERSION_EVALUATE);
int snd_func_pcm_id(snd_config_t **dst, snd_config_t *root, snd_config_t *src, void *private_data)
{
snd_config_t *n;
snd_ctl_close(ctl);
return err;
}
+SND_DLSYM_BUILD_VERSION(snd_func_pcm_id, SND_CONFIG_DLSYM_VERSION_EVALUATE);
-SND_DLSYM_BUILD_VERSION(snd_func_private_pcm_subdevice, SND_CONFIG_DLSYM_VERSION_EVALUATE);
int snd_func_private_pcm_subdevice(snd_config_t **dst, snd_config_t *root ATTRIBUTE_UNUSED, snd_config_t *src, void *private_data)
{
char *res = NULL;
free(res);
return err;
}
+SND_DLSYM_BUILD_VERSION(snd_func_private_pcm_subdevice, SND_CONFIG_DLSYM_VERSION_EVALUATE);
-SND_DLSYM_BUILD_VERSION(snd_func_refer, SND_CONFIG_DLSYM_VERSION_EVALUATE);
int snd_func_refer(snd_config_t **dst, snd_config_t *root, snd_config_t *src, void *private_data)
{
snd_config_t *n;
_end:
return err;
}
+SND_DLSYM_BUILD_VERSION(snd_func_refer, SND_CONFIG_DLSYM_VERSION_EVALUATE);
libcontrol_la_SOURCES = cards.c hcontrol.c \
control.c control_hw.c control_shm.c \
- setup.c
+ setup.c control_symbols.c
noinst_HEADERS = control_local.h
#include <unistd.h>
#include <string.h>
#include <fcntl.h>
-#include <dlfcn.h>
#include <signal.h>
+#include <dlfcn.h>
#include <sys/poll.h>
#include "control_local.h"
snd_config_iterator_t i, next;
const char *lib = NULL, *open_name = NULL;
int (*open_func)(snd_ctl_t **, const char *, snd_config_t *, snd_config_t *, int) = NULL;
+#ifndef PIC
+ extern void *snd_control_open_symbols(void);
+#endif
void *h;
if (snd_config_get_type(ctl_conf) != SND_CONFIG_TYPE_COMPOUND) {
if (name)
open_name = buf;
snprintf(buf, sizeof(buf), "_snd_ctl_%s_open", str);
}
- h = dlopen(lib, RTLD_NOW);
- if (h) {
- if ((err = snd_dlsym_verify(h, open_name, SND_DLSYM_VERSION(SND_CONTROL_DLSYM_VERSION))) < 0) {
- dlclose(h);
- goto _err;
- }
- open_func = dlsym(h, open_name);
- }
+#ifndef PIC
+ snd_control_open_symbols();
+#endif
+ h = snd_dlopen(lib, RTLD_NOW);
+ if (h)
+ open_func = snd_dlsym(h, open_name, SND_DLSYM_VERSION(SND_CONTROL_DLSYM_VERSION));
err = 0;
if (!h) {
SNDERR("Cannot open shared library %s", lib);
err = -ENOENT;
} if (!open_func) {
SNDERR("symbol %s is not defined inside %s", open_name, lib);
- dlclose(h);
+ snd_dlclose(h);
err = -ENXIO;
}
_err:
#include <sys/ioctl.h>
#include "control_local.h"
+#ifndef PIC
+/* entry for static linking */
+const char *_snd_module_control_hw = "";
+#endif
+
#ifndef F_SETSIG
#define F_SETSIG 10
#endif
return 0;
}
-SND_DLSYM_BUILD_VERSION(_snd_ctl_hw_open, SND_CONTROL_DLSYM_VERSION);
int _snd_ctl_hw_open(snd_ctl_t **handlep, char *name, snd_config_t *root ATTRIBUTE_UNUSED, snd_config_t *conf)
{
snd_config_iterator_t i, next;
return -EINVAL;
return snd_ctl_hw_open(handlep, name, card, 0);
}
-
+SND_DLSYM_BUILD_VERSION(_snd_ctl_hw_open, SND_CONTROL_DLSYM_VERSION);
#include <netdb.h>
#include "aserver.h"
+#ifndef PIC
+/* entry for static linking */
+const char *_snd_module_control_shm = "";
+#endif
+
typedef struct {
int socket;
volatile snd_ctl_shm_ctrl_t *ctrl;
return result;
}
-SND_DLSYM_BUILD_VERSION(_snd_ctl_shm_open, SND_CONTROL_DLSYM_VERSION);
int _snd_ctl_shm_open(snd_ctl_t **handlep, char *name, snd_config_t *root, snd_config_t *conf, int mode)
{
snd_config_iterator_t i, next;
snd_config_delete(sconfig);
return err;
}
+SND_DLSYM_BUILD_VERSION(_snd_ctl_shm_open, SND_CONTROL_DLSYM_VERSION);
#include <dlfcn.h>
#include "local.h"
+#ifndef DOC_HIDDEN
+#ifndef PIC
+struct snd_dlsym_link *snd_dlsym_start = NULL;
+#endif
+#endif
+
+/**
+ * \brief Open the dynamic library, with ALSA extension
+ * \param name name, similar to dlopen
+ * \param mode mode, similar to dlopen
+ * \return pointer to handle
+ */
+void *snd_dlopen(const char *name, int mode)
+{
+#ifndef PIC
+ if (name == NULL)
+ return &snd_dlsym_start;
+#endif
+ return dlopen(name, mode);
+}
+
+/**
+ * \brief Close the dynamic library, with ALSA extension
+ * \param handle handle, similar to dlclose
+ * \return zero if success, otherwise an error code
+ */
+int snd_dlclose(void *handle)
+{
+#ifndef PIC
+ if (handle == &snd_dlsym_start)
+ return 0;
+#endif
+ return dlclose(handle);
+}
+
/**
* \brief Verify dynamically loaded symbol
* \param handle dlopen handle
* \param version version of symbol
* \return zero is success, otherwise a negative error code
*/
-int snd_dlsym_verify(void *handle, const char *name, const char *version)
+static int snd_dlsym_verify(void *handle, const char *name, const char *version)
{
int res;
char *vname;
SNDERR("unable to verify version for symbol %s", name);
return res;
}
+/**
+ * \brief Resolve the symbol, with ALSA extension
+ * \param handle handle, similar to dlsym
+ * \param name symbol name
+ * \param version symbol version
+ */
+void *snd_dlsym(void *handle, const char *name, const char *version)
+{
+ int err;
+
+#ifndef PIC
+ if (handle == &snd_dlsym_start) {
+ /* it's the funny part, we are looking for a symbol */
+ /* in a static library */
+ struct snd_dlsym_link *link = snd_dlsym_start;
+ while (link) {
+ if (!strcmp(name, link->dlsym_name))
+ return (void *)link->dlsym_ptr;
+ link = link->next;
+ }
+ return NULL;
+ }
+#endif
+ err = snd_dlsym_verify(handle, name, version);
+ if (err < 0)
+ return NULL;
+ return dlsym(handle, name);
+}
EXTRA_LTLIBRARIES=libhwdep.la
-libhwdep_la_SOURCES = hwdep.c hwdep_hw.c
+libhwdep_la_SOURCES = hwdep.c hwdep_hw.c hwdep_symbols.c
noinst_HEADERS = hwdep_local.h
all: libhwdep.la
snd_config_iterator_t i, next;
const char *lib = NULL, *open_name = NULL;
int (*open_func)(snd_hwdep_t **, const char *, snd_config_t *, snd_config_t *, int) = NULL;
+#ifndef PIC
+ extern void *snd_hwdep_open_symbols(void);
+#endif
void *h;
if (snd_config_get_type(hwdep_conf) != SND_CONFIG_TYPE_COMPOUND) {
if (name)
open_name = buf;
snprintf(buf, sizeof(buf), "_snd_hwdep_%s_open", str);
}
- h = dlopen(lib, RTLD_NOW);
- if (h) {
- if ((err = snd_dlsym_verify(h, open_name, SND_DLSYM_VERSION(SND_HWDEP_DLSYM_VERSION))) < 0) {
- dlclose(h);
- goto _err;
- }
- open_func = dlsym(h, open_name);
- }
+#ifndef PIC
+ snd_hwdep_open_symbols();
+#endif
+ h = snd_dlopen(lib, RTLD_NOW);
+ if (h)
+ open_func = snd_dlsym(h, open_name, SND_DLSYM_VERSION(SND_HWDEP_DLSYM_VERSION));
if (!h) {
SNDERR("Cannot open shared library %s", lib);
err = -ENOENT;
} else if (!open_func) {
SNDERR("symbol %s is not defined inside %s", open_name, lib);
- dlclose(h);
+ snd_dlclose(h);
err = -ENXIO;
}
_err:
#include <sys/ioctl.h>
#include "hwdep_local.h"
+#ifndef PIC
+/* entry for static linking */
+const char *_snd_module_hwdep_hw = "";
+#endif
+
#define SNDRV_FILE_HWDEP "/dev/snd/hwC%iD%i"
#define SNDRV_HWDEP_VERSION_MAX SNDRV_PROTOCOL_VERSION(1, 0, 0)
return 0;
}
-SND_DLSYM_BUILD_VERSION(_snd_hwdep_hw_open, SND_HWDEP_DLSYM_VERSION);
int _snd_hwdep_hw_open(snd_hwdep_t **hwdep, char *name,
snd_config_t *root ATTRIBUTE_UNUSED,
snd_config_t *conf, int mode)
return -EINVAL;
return snd_hwdep_hw_open(hwdep, name, card, device, mode);
}
+SND_DLSYM_BUILD_VERSION(_snd_hwdep_hw_open, SND_HWDEP_DLSYM_VERSION);
pcm_route.c pcm_mulaw.c pcm_alaw.c pcm_adpcm.c \
pcm_rate.c pcm_plug.c pcm_misc.c pcm_mmap.c pcm_multi.c \
pcm_shm.c pcm_file.c pcm_null.c pcm_share.c \
- pcm_meter.c pcm_hooks.c
+ pcm_meter.c pcm_hooks.c pcm_symbols.c
noinst_HEADERS = atomic.h pcm_local.h pcm_plugin.h mask.h mask_inline.h \
interval.h interval_inline.h plugin_ops.h
#include <malloc.h>
#include <stdarg.h>
#include <signal.h>
+#include <dlfcn.h>
#include <sys/ioctl.h>
#include <sys/poll.h>
#include <sys/shm.h>
#include <sys/mman.h>
#include <limits.h>
-#include <dlfcn.h>
#include "pcm_local.h"
/**
int (*open_func)(snd_pcm_t **, const char *,
snd_config_t *, snd_config_t *,
snd_pcm_stream_t, int) = NULL;
+#ifndef PIC
+ extern void *snd_pcm_open_symbols(void);
+#endif
void *h;
if (snd_config_get_type(pcm_conf) != SND_CONFIG_TYPE_COMPOUND) {
if (name)
open_name = buf;
snprintf(buf, sizeof(buf), "_snd_pcm_%s_open", str);
}
- h = dlopen(lib, RTLD_NOW);
- if (h) {
- if ((err = snd_dlsym_verify(h, open_name, SND_DLSYM_VERSION(SND_PCM_DLSYM_VERSION))) < 0) {
- dlclose(h);
- goto _err;
- }
- open_func = dlsym(h, open_name);
- }
+#ifndef PIC
+ snd_pcm_open_symbols(); /* this call is for static linking only */
+#endif
+ h = snd_dlopen(lib, RTLD_NOW);
+ if (h)
+ open_func = snd_dlsym(h, open_name, SND_DLSYM_VERSION(SND_PCM_DLSYM_VERSION));
err = 0;
if (!h) {
SNDERR("Cannot open shared library %s", lib);
err = -ENOENT;
} else if (!open_func) {
SNDERR("symbol %s is not defined inside %s", open_name, lib);
- dlclose(h);
+ snd_dlclose(h);
err = -ENXIO;
}
_err:
}
#ifndef DOC_HIDDEN
-
int snd_pcm_new(snd_pcm_t **pcmp, snd_pcm_type_t type, const char *name,
snd_pcm_stream_t stream, int mode)
{
#include "pcm_local.h"
#include "pcm_plugin.h"
+#ifndef PIC
+/* entry for static linking */
+const char *_snd_module_pcm_adpcm = "";
+#endif
+
typedef void (*adpcm_f)(const snd_pcm_channel_area_t *dst_areas,
snd_pcm_uframes_t dst_offset,
const snd_pcm_channel_area_t *src_areas,
return 0;
}
-SND_DLSYM_BUILD_VERSION(_snd_pcm_adpcm_open, SND_PCM_DLSYM_VERSION);
int _snd_pcm_adpcm_open(snd_pcm_t **pcmp, const char *name,
snd_config_t *root, snd_config_t *conf,
snd_pcm_stream_t stream, int mode)
snd_pcm_close(spcm);
return err;
}
-
-
+SND_DLSYM_BUILD_VERSION(_snd_pcm_adpcm_open, SND_PCM_DLSYM_VERSION);
#include "pcm_local.h"
#include "pcm_plugin.h"
+#ifndef PIC
+/* entry for static linking */
+const char *_snd_module_pcm_alaw = "";
+#endif
+
typedef void (*alaw_f)(const snd_pcm_channel_area_t *dst_areas,
snd_pcm_uframes_t dst_offset,
const snd_pcm_channel_area_t *src_areas,
return 0;
}
-SND_DLSYM_BUILD_VERSION(_snd_pcm_alaw_open, SND_PCM_DLSYM_VERSION);
int _snd_pcm_alaw_open(snd_pcm_t **pcmp, const char *name,
snd_config_t *root, snd_config_t *conf,
snd_pcm_stream_t stream, int mode)
snd_pcm_close(spcm);
return err;
}
-
-
+SND_DLSYM_BUILD_VERSION(_snd_pcm_alaw_open, SND_PCM_DLSYM_VERSION);
#include "pcm_local.h"
#include "pcm_plugin.h"
+#ifndef PIC
+/* entry for static linking */
+const char *_snd_module_pcm_copy = "";
+#endif
+
typedef struct {
/* This field need to be the first */
snd_pcm_plugin_t plug;
return 0;
}
-SND_DLSYM_BUILD_VERSION(_snd_pcm_copy_open, SND_PCM_DLSYM_VERSION);
int _snd_pcm_copy_open(snd_pcm_t **pcmp, const char *name,
snd_config_t *root, snd_config_t *conf,
snd_pcm_stream_t stream, int mode)
snd_pcm_close(spcm);
return err;
}
-
+SND_DLSYM_BUILD_VERSION(_snd_pcm_copy_open, SND_PCM_DLSYM_VERSION);
#include "pcm_local.h"
#include "pcm_plugin.h"
+#ifndef PIC
+/* entry for static linking */
+const char *_snd_module_pcm_file = "";
+#endif
+
typedef enum _snd_pcm_file_format {
SND_PCM_FILE_FORMAT_RAW
} snd_pcm_file_format_t;
return 0;
}
-SND_DLSYM_BUILD_VERSION(_snd_pcm_file_open, SND_PCM_DLSYM_VERSION);
int _snd_pcm_file_open(snd_pcm_t **pcmp, const char *name,
snd_config_t *root, snd_config_t *conf,
snd_pcm_stream_t stream, int mode)
snd_pcm_close(spcm);
return err;
}
+SND_DLSYM_BUILD_VERSION(_snd_pcm_file_open, SND_PCM_DLSYM_VERSION);
#include <dlfcn.h>
#include "pcm_local.h"
+#ifndef PIC
+/* entry for static linking */
+const char *_snd_module_pcm_hooks = "";
+#endif
+
#ifndef DOC_HIDDEN
struct _snd_pcm_hook {
snd_pcm_t *pcm;
return 0;
}
-SND_DLSYM_BUILD_VERSION(_snd_pcm_hooks_open, SND_PCM_DLSYM_VERSION);
int _snd_pcm_hooks_open(snd_pcm_t **pcmp, const char *name,
snd_config_t *root, snd_config_t *conf,
snd_pcm_stream_t stream, int mode)
*pcmp = rpcm;
return 0;
}
+SND_DLSYM_BUILD_VERSION(_snd_pcm_hooks_open, SND_PCM_DLSYM_VERSION);
#endif
#include "pcm_local.h"
#include "../control/control_local.h"
+#ifndef PIC
+/* entry for static linking */
+const char *_snd_module_pcm_hw = "";
+#endif
+
#ifndef F_SETSIG
#define F_SETSIG 10
#endif
return ret;
}
-SND_DLSYM_BUILD_VERSION(_snd_pcm_hw_open, SND_PCM_DLSYM_VERSION);
int _snd_pcm_hw_open(snd_pcm_t **pcmp, const char *name,
snd_config_t *root ATTRIBUTE_UNUSED, snd_config_t *conf,
snd_pcm_stream_t stream, int mode)
}
return snd_pcm_hw_open(pcmp, name, card, device, subdevice, stream, mode);
}
-
+SND_DLSYM_BUILD_VERSION(_snd_pcm_hw_open, SND_PCM_DLSYM_VERSION);
#include "pcm_local.h"
#include "pcm_plugin.h"
+#ifndef PIC
+/* entry for static linking */
+const char *_snd_module_pcm_linear = "";
+#endif
+
typedef struct {
/* This field need to be the first */
snd_pcm_plugin_t plug;
return 0;
}
-SND_DLSYM_BUILD_VERSION(_snd_pcm_linear_open, SND_PCM_DLSYM_VERSION);
int _snd_pcm_linear_open(snd_pcm_t **pcmp, const char *name,
snd_config_t *root, snd_config_t *conf,
snd_pcm_stream_t stream, int mode)
snd_pcm_close(spcm);
return err;
}
-
-
+SND_DLSYM_BUILD_VERSION(_snd_pcm_linear_open, SND_PCM_DLSYM_VERSION);
#include "pcm_local.h"
#include "pcm_plugin.h"
+#ifndef PIC
+/* entry for static linking */
+const char *_snd_module_pcm_meter = "";
+#endif
+
#if defined(__sparc__) || defined(__ia64__) || defined(__mips__)
/* asm/atomic.h is unavailable on sparc and ia64 */
#define atomic_t int
return err >= 0 ? open_func(pcm, name, root, conf) : err;
}
-
-SND_DLSYM_BUILD_VERSION(_snd_pcm_meter_open, SND_PCM_DLSYM_VERSION);
int _snd_pcm_meter_open(snd_pcm_t **pcmp, const char *name,
snd_config_t *root, snd_config_t *conf,
snd_pcm_stream_t stream, int mode)
}
return 0;
}
+SND_DLSYM_BUILD_VERSION(_snd_pcm_meter_open, SND_PCM_DLSYM_VERSION);
#endif
#include "pcm_local.h"
#include "pcm_plugin.h"
+#ifndef PIC
+/* entry for static linking */
+const char *_snd_module_pcm_mulaw = "";
+#endif
+
typedef void (*mulaw_f)(const snd_pcm_channel_area_t *src_areas,
snd_pcm_uframes_t src_offset,
const snd_pcm_channel_area_t *dst_areas,
return 0;
}
-SND_DLSYM_BUILD_VERSION(_snd_pcm_mulaw_open, SND_PCM_DLSYM_VERSION);
int _snd_pcm_mulaw_open(snd_pcm_t **pcmp, const char *name,
snd_config_t *root, snd_config_t *conf,
snd_pcm_stream_t stream, int mode)
snd_pcm_close(spcm);
return err;
}
-
-
+SND_DLSYM_BUILD_VERSION(_snd_pcm_mulaw_open, SND_PCM_DLSYM_VERSION);
#include <math.h>
#include "pcm_local.h"
+#ifndef PIC
+/* entry for static linking */
+const char *_snd_module_pcm_multi = "";
+#endif
+
typedef struct {
snd_pcm_t *pcm;
unsigned int channels_count;
return 0;
}
-SND_DLSYM_BUILD_VERSION(_snd_pcm_multi_open, SND_PCM_DLSYM_VERSION);
int _snd_pcm_multi_open(snd_pcm_t **pcmp, const char *name,
snd_config_t *root, snd_config_t *conf,
snd_pcm_stream_t stream, int mode)
free(channels_schannel);
return err;
}
-
+SND_DLSYM_BUILD_VERSION(_snd_pcm_multi_open, SND_PCM_DLSYM_VERSION);
#include "pcm_local.h"
#include "pcm_plugin.h"
+#ifndef PIC
+/* entry for static linking */
+const char *_snd_module_pcm_null = "";
+#endif
+
typedef struct {
snd_timestamp_t trigger_tstamp;
snd_pcm_state_t state;
return 0;
}
-SND_DLSYM_BUILD_VERSION(_snd_pcm_null_open, SND_PCM_DLSYM_VERSION);
int _snd_pcm_null_open(snd_pcm_t **pcmp, const char *name,
snd_config_t *conf,
snd_pcm_stream_t stream, int mode)
}
return snd_pcm_null_open(pcmp, name, stream, mode);
}
+SND_DLSYM_BUILD_VERSION(_snd_pcm_null_open, SND_PCM_DLSYM_VERSION);
#include "pcm_local.h"
#include "pcm_plugin.h"
+#ifndef PIC
+/* entry for static linking */
+const char *_snd_module_pcm_plug = "";
+#endif
+
enum snd_pcm_plug_route_policy {
PLUG_ROUTE_POLICY_NONE,
PLUG_ROUTE_POLICY_DEFAULT,
#define MAX_CHANNELS 64
-SND_DLSYM_BUILD_VERSION(_snd_pcm_plug_open, SND_PCM_DLSYM_VERSION);
int _snd_pcm_plug_open(snd_pcm_t **pcmp, const char *name,
snd_config_t *root, snd_config_t *conf,
snd_pcm_stream_t stream, int mode)
snd_pcm_close(spcm);
return err;
}
-
+SND_DLSYM_BUILD_VERSION(_snd_pcm_plug_open, SND_PCM_DLSYM_VERSION);
#include "pcm_local.h"
#include "pcm_plugin.h"
+#ifndef PIC
+/* entry for static linking */
+const char *_snd_module_pcm_rate = "";
+#endif
+
#define DIV (1<<16)
typedef struct {
return 0;
}
-SND_DLSYM_BUILD_VERSION(_snd_pcm_rate_open, SND_PCM_DLSYM_VERSION);
int _snd_pcm_rate_open(snd_pcm_t **pcmp, const char *name,
snd_config_t *root, snd_config_t *conf,
snd_pcm_stream_t stream, int mode)
snd_pcm_close(spcm);
return err;
}
-
-
+SND_DLSYM_BUILD_VERSION(_snd_pcm_rate_open, SND_PCM_DLSYM_VERSION);
#include "pcm_local.h"
#include "pcm_plugin.h"
+#ifndef PIC
+/* entry for static linking */
+const char *_snd_module_pcm_route = "";
+#endif
+
/* The best possible hack to support missing optimization in gcc 2.7.2.3 */
#if ROUTE_PLUGIN_RESOLUTION & (ROUTE_PLUGIN_RESOLUTION - 1) != 0
#define div(a) a /= ROUTE_PLUGIN_RESOLUTION
#define MAX_CHANNELS 32
-SND_DLSYM_BUILD_VERSION(_snd_pcm_route_open, SND_PCM_DLSYM_VERSION);
int _snd_pcm_route_open(snd_pcm_t **pcmp, const char *name,
snd_config_t *root, snd_config_t *conf,
snd_pcm_stream_t stream, int mode)
snd_pcm_close(spcm);
return err;
}
-
-
+SND_DLSYM_BUILD_VERSION(_snd_pcm_route_open, SND_PCM_DLSYM_VERSION);
#include <pthread.h>
#include "pcm_local.h"
+#ifndef PIC
+/* entry for static linking */
+const char *_snd_module_pcm_share = "";
+#endif
static LIST_HEAD(snd_pcm_share_slaves);
static pthread_mutex_t snd_pcm_share_slaves_mutex = PTHREAD_MUTEX_INITIALIZER;
return 0;
}
-SND_DLSYM_BUILD_VERSION(_snd_pcm_share_open, SND_PCM_DLSYM_VERSION);
int _snd_pcm_share_open(snd_pcm_t **pcmp, const char *name,
snd_config_t *root, snd_config_t *conf,
snd_pcm_stream_t stream, int mode)
free(channels_map);
return err;
}
+SND_DLSYM_BUILD_VERSION(_snd_pcm_share_open, SND_PCM_DLSYM_VERSION);
#include <netdb.h>
#include "aserver.h"
+#ifndef PIC
+/* entry for static linking */
+const char *_snd_module_pcm_shm = "";
+#endif
+
typedef struct {
int socket;
volatile snd_pcm_shm_ctrl_t *ctrl;
return i < numreqs;
}
-SND_DLSYM_BUILD_VERSION(_snd_pcm_shm_open, SND_PCM_DLSYM_VERSION);
int _snd_pcm_shm_open(snd_pcm_t **pcmp, const char *name,
snd_config_t *root, snd_config_t *conf,
snd_pcm_stream_t stream, int mode)
snd_config_delete(sconfig);
return err;
}
-
+SND_DLSYM_BUILD_VERSION(_snd_pcm_shm_open, SND_PCM_DLSYM_VERSION);
EXTRA_LTLIBRARIES=librawmidi.la
-librawmidi_la_SOURCES = rawmidi.c rawmidi_hw.c
+librawmidi_la_SOURCES = rawmidi.c rawmidi_hw.c rawmidi_symbols.c
noinst_HEADERS = rawmidi_local.h
all: librawmidi.la
const char *lib = NULL, *open_name = NULL;
int (*open_func)(snd_rawmidi_t **, snd_rawmidi_t **,
const char *, snd_config_t *, snd_config_t *, int) = NULL;
+#ifndef PIC
+ extern void *snd_rawmidi_open_symbols(void);
+#endif
void *h;
if (snd_config_get_type(rawmidi_conf) != SND_CONFIG_TYPE_COMPOUND) {
if (name)
open_name = buf;
snprintf(buf, sizeof(buf), "_snd_rawmidi_%s_open", str);
}
- h = dlopen(lib, RTLD_NOW);
- if (h) {
- if ((err = snd_dlsym_verify(h, open_name, SND_DLSYM_VERSION(SND_RAWMIDI_DLSYM_VERSION))) < 0) {
- dlclose(h);
- goto _err;
- }
- open_func = dlsym(h, open_name);
- }
+#ifndef PIC
+ snd_rawmidi_open_symbols();
+#endif
+ h = snd_dlopen(lib, RTLD_NOW);
+ if (h)
+ open_func = snd_dlsym(h, open_name, SND_DLSYM_VERSION(SND_RAWMIDI_DLSYM_VERSION));
+ err = 0;
if (!h) {
SNDERR("Cannot open shared library %s", lib);
err = -ENOENT;
} else if (!open_func) {
SNDERR("symbol %s is not defined inside %s", open_name, lib);
- dlclose(h);
+ snd_dlclose(h);
err = -ENXIO;
}
_err:
#include "../control/control_local.h"
#include "rawmidi_local.h"
-#define SNDRV_FILE_RAWMIDI "/dev/snd/midiC%iD%i"
+#ifndef PIC
+/* entry for static linking */
+const char *_snd_module_rawmidi_hw = "";
+#endif
+
+#define SNDRV_FILE_RAWMIDI "/dev/snd/midiC%iD%i"
#define SNDRV_RAWMIDI_VERSION_MAX SNDRV_PROTOCOL_VERSION(2, 0, 0)
typedef struct {
return -ENOMEM;
}
-SND_DLSYM_BUILD_VERSION(_snd_rawmidi_hw_open, SND_RAWMIDI_DLSYM_VERSION);
int _snd_rawmidi_hw_open(snd_rawmidi_t **inputp, snd_rawmidi_t **outputp,
char *name, snd_config_t *root ATTRIBUTE_UNUSED,
snd_config_t *conf, int mode)
return -EINVAL;
return snd_rawmidi_hw_open(inputp, outputp, name, card, device, subdevice, mode);
}
-
+SND_DLSYM_BUILD_VERSION(_snd_rawmidi_hw_open, SND_RAWMIDI_DLSYM_VERSION);
EXTRA_LTLIBRARIES=libseq.la
-libseq_la_SOURCES = seq_hw.c seq.c seq_event.c seqmid.c seq_midi_event.c
+libseq_la_SOURCES = seq_hw.c seq.c seq_event.c seqmid.c seq_midi_event.c \
+ seq_symbols.c
noinst_HEADERS = seq_local.h
all: libseq.la
*
*/
-#include <sys/poll.h>
#include <dlfcn.h>
+#include <sys/poll.h>
#include "seq_local.h"
/****************************************************************************
int (*open_func)(snd_seq_t **, const char *,
snd_config_t *, snd_config_t *,
int, int) = NULL;
+#ifndef PIC
+ extern void *snd_seq_open_symbols(void);
+#endif
void *h;
if (snd_config_get_type(seq_conf) != SND_CONFIG_TYPE_COMPOUND) {
if (name)
open_name = buf;
snprintf(buf, sizeof(buf), "_snd_seq_%s_open", str);
}
- h = dlopen(lib, RTLD_NOW);
- if (h) {
- if ((err = snd_dlsym_verify(h, open_name, SND_DLSYM_VERSION(SND_SEQ_DLSYM_VERSION))) < 0) {
- dlclose(h);
- goto _err;
- }
- open_func = dlsym(h, open_name);
- }
+#ifndef PIC
+ snd_seq_open_symbols();
+#endif
+ h = snd_dlopen(lib, RTLD_NOW);
+ if (h)
+ open_func = snd_dlsym(h, open_name, SND_DLSYM_VERSION(SND_SEQ_DLSYM_VERSION));
err = 0;
if (!h) {
SNDERR("Cannot open shared library %s", lib);
err = -ENOENT;
} else if (!open_func) {
SNDERR("symbol %s is not defined inside %s", open_name, lib);
- dlclose(h);
+ snd_dlclose(h);
err = -ENXIO;
}
_err:
#include <sys/ioctl.h>
#include "seq_local.h"
+#ifndef PIC
+/* entry for static linking */
+const char *_snd_module_seq_hw = "";
+#endif
+
#define SNDRV_FILE_SEQ "/dev/snd/seq"
#define SNDRV_FILE_ALOADSEQ "/dev/aloadSEQ"
#define SNDRV_SEQ_VERSION_MAX SNDRV_PROTOCOL_VERSION(1, 0, 0)
return 0;
}
-SND_DLSYM_BUILD_VERSION(_snd_seq_hw_open, SND_SEQ_DLSYM_VERSION);
int _snd_seq_hw_open(snd_seq_t **handlep, char *name,
snd_config_t *root ATTRIBUTE_UNUSED, snd_config_t *conf,
int streams, int mode)
}
return snd_seq_hw_open(handlep, name, streams, mode);
}
-
+SND_DLSYM_BUILD_VERSION(_snd_seq_hw_open, SND_SEQ_DLSYM_VERSION);
EXTRA_LTLIBRARIES=libtimer.la
-libtimer_la_SOURCES = timer.c timer_hw.c timer_query.c timer_query_hw.c
+libtimer_la_SOURCES = timer.c timer_hw.c timer_query.c timer_query_hw.c \
+ timer_symbols.c
noinst_HEADERS = timer_local.h
all: libtimer.la
snd_config_iterator_t i, next;
const char *lib = NULL, *open_name = NULL;
int (*open_func)(snd_timer_t **, const char *, snd_config_t *, snd_config_t *, int) = NULL;
+#ifndef PIC
+ extern void *snd_timer_open_symbols(void);
+#endif
void *h;
if (snd_config_get_type(timer_conf) != SND_CONFIG_TYPE_COMPOUND) {
if (name)
open_name = buf;
snprintf(buf, sizeof(buf), "_snd_timer_%s_open", str);
}
- h = dlopen(lib, RTLD_NOW);
- if (h) {
- if ((err = snd_dlsym_verify(h, open_name, SND_DLSYM_VERSION(SND_TIMER_DLSYM_VERSION))) < 0) {
- dlclose(h);
- goto _err;
- }
- open_func = dlsym(h, open_name);
- }
+#ifndef PIC
+ snd_timer_open_symbols();
+#endif
+ h = snd_dlopen(lib, RTLD_NOW);
+ if (h)
+ open_func = snd_dlsym(h, open_name, SND_DLSYM_VERSION(SND_TIMER_DLSYM_VERSION));
+ err = 0;
if (!h) {
SNDERR("Cannot open shared library %s", lib);
err = -ENOENT;
} else if (!open_func) {
SNDERR("symbol %s is not defined inside %s", open_name, lib);
- dlclose(h);
+ snd_dlclose(h);
err = -ENXIO;
}
_err:
#include <sys/ioctl.h>
#include "timer_local.h"
+#ifndef PIC
+/* entry for static linking */
+const char *_snd_module_timer_hw = "";
+#endif
+
#define SNDRV_FILE_TIMER "/dev/snd/timer"
#define SNDRV_TIMER_VERSION_MAX SNDRV_PROTOCOL_VERSION(2, 0, 0)
return 0;
}
-SND_DLSYM_BUILD_VERSION(_snd_timer_hw_open, SND_TIMER_DLSYM_VERSION);
int _snd_timer_hw_open(snd_timer_t **timer, char *name,
snd_config_t *root ATTRIBUTE_UNUSED,
snd_config_t *conf, int mode)
return -EINVAL;
return snd_timer_hw_open(timer, name, dev_class, dev_sclass, card, device, subdevice, mode);
}
+SND_DLSYM_BUILD_VERSION(_snd_timer_hw_open, SND_TIMER_DLSYM_VERSION);
snd_config_iterator_t i, next;
const char *lib = NULL, *open_name = NULL;
int (*open_func)(snd_timer_query_t **, const char *, snd_config_t *, snd_config_t *, int) = NULL;
+#ifndef PIC
+ extern void *snd_timer_query_open_symbols(void);
+#endif
void *h;
if (snd_config_get_type(timer_conf) != SND_CONFIG_TYPE_COMPOUND) {
if (name)
open_name = buf;
snprintf(buf, sizeof(buf), "_snd_timer_query_%s_open", str);
}
- h = dlopen(lib, RTLD_NOW);
- if (h) {
- if ((err = snd_dlsym_verify(h, open_name, SND_DLSYM_VERSION(SND_TIMER_QUERY_DLSYM_VERSION))) < 0) {
- dlclose(h);
- goto _err;
- }
- open_func = dlsym(h, open_name);
- }
+#ifndef PIC
+ snd_timer_query_open_symbols();
+#endif
+ h = snd_dlopen(lib, RTLD_NOW);
+ if (h)
+ open_func = snd_dlsym(h, open_name, SND_DLSYM_VERSION(SND_TIMER_QUERY_DLSYM_VERSION));
if (!h) {
SNDERR("Cannot open shared library %s", lib);
err = -ENOENT;
} else if (!open_func) {
SNDERR("symbol %s is not defined inside %s", open_name, lib);
- dlclose(h);
+ snd_dlclose(h);
err = -ENXIO;
}
_err:
#include <sys/ioctl.h>
#include "timer_local.h"
+#ifndef PIC
+/* entry for static linking */
+const char *_snd_module_timer_query_hw = "";
+#endif
+
#define SNDRV_FILE_TIMER "/dev/snd/timer"
#define SNDRV_TIMER_VERSION_MAX SNDRV_PROTOCOL_VERSION(2, 0, 0)
return 0;
}
-SND_DLSYM_BUILD_VERSION(_snd_timer_query_hw_open, SND_TIMER_QUERY_DLSYM_VERSION);
int _snd_timer_query_hw_open(snd_timer_query_t **timer, char *name,
snd_config_t *root ATTRIBUTE_UNUSED,
snd_config_t *conf, int mode)
}
return snd_timer_query_hw_open(timer, name, mode);
}
+SND_DLSYM_BUILD_VERSION(_snd_timer_query_hw_open, SND_TIMER_QUERY_DLSYM_VERSION);
midiloop_LDADD=../src/libasound.la
INCLUDES=-I$(top_srcdir)/include
-CFLAGS=-Wall -pipe -g
+CFLAGS=-static -Wall -pipe -g
EXTRA_DIST=seq-decoder.c seq-sender.c midifile.h midifile.c midifile.3
#include <stdlib.h>
#include <stdio.h>
#include <ctype.h>
+#include <sys/time.h>
#include "../include/asoundlib.h"
#include <string.h>
#include <signal.h>