Changes for static build.

This commit is contained in:
Jaroslav Kysela 2001-10-24 14:14:11 +00:00
parent caa8d5372e
commit 27472b56a6
44 changed files with 362 additions and 158 deletions

View file

@ -2,7 +2,7 @@ EXTRA_LTLIBRARIES = libcontrol.la
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

View file

@ -33,8 +33,8 @@
#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"
@ -475,6 +475,9 @@ static int snd_ctl_open_conf(snd_ctl_t **ctlp, const char *name,
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)
@ -529,21 +532,19 @@ static int snd_ctl_open_conf(snd_ctl_t **ctlp, const char *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:

View file

@ -29,6 +29,11 @@
#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
@ -336,7 +341,6 @@ int snd_ctl_hw_open(snd_ctl_t **handle, const char *name, int card, int mode)
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;
@ -368,4 +372,4 @@ int _snd_ctl_hw_open(snd_ctl_t **handlep, char *name, snd_config_t *root ATTRIBU
return -EINVAL;
return snd_ctl_hw_open(handlep, name, card, 0);
}
SND_DLSYM_BUILD_VERSION(_snd_ctl_hw_open, SND_CONTROL_DLSYM_VERSION);

View file

@ -35,6 +35,11 @@
#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;
@ -553,7 +558,6 @@ int snd_ctl_shm_open(snd_ctl_t **handlep, const char *name, const char *sockname
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;
@ -668,3 +672,4 @@ int _snd_ctl_shm_open(snd_ctl_t **handlep, char *name, snd_config_t *root, snd_c
snd_config_delete(sconfig);
return err;
}
SND_DLSYM_BUILD_VERSION(_snd_ctl_shm_open, SND_CONTROL_DLSYM_VERSION);