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

@ -7,7 +7,7 @@ libpcm_la_SOURCES = atomic.c mask.c interval.c \
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

View file

@ -38,12 +38,12 @@
#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"
/**
@ -1027,6 +1027,9 @@ static int snd_pcm_open_conf(snd_pcm_t **pcmp, const char *name,
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)
@ -1081,21 +1084,19 @@ static int snd_pcm_open_conf(snd_pcm_t **pcmp, const char *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:
@ -1139,7 +1140,6 @@ int snd_pcm_open(snd_pcm_t **pcmp, const char *name,
}
#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)
{

View file

@ -51,6 +51,11 @@ IMA compatability project proceedings, Vol 2, Issue 2, May 1992.
#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,
@ -541,7 +546,6 @@ int snd_pcm_adpcm_open(snd_pcm_t **pcmp, const char *name, snd_pcm_format_t sfor
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)
@ -586,5 +590,4 @@ int _snd_pcm_adpcm_open(snd_pcm_t **pcmp, const char *name,
snd_pcm_close(spcm);
return err;
}
SND_DLSYM_BUILD_VERSION(_snd_pcm_adpcm_open, SND_PCM_DLSYM_VERSION);

View file

@ -23,6 +23,11 @@
#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,
@ -414,7 +419,6 @@ int snd_pcm_alaw_open(snd_pcm_t **pcmp, const char *name, snd_pcm_format_t sform
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)
@ -459,5 +463,4 @@ int _snd_pcm_alaw_open(snd_pcm_t **pcmp, const char *name,
snd_pcm_close(spcm);
return err;
}
SND_DLSYM_BUILD_VERSION(_snd_pcm_alaw_open, SND_PCM_DLSYM_VERSION);

View file

@ -23,6 +23,11 @@
#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;
@ -184,7 +189,6 @@ int snd_pcm_copy_open(snd_pcm_t **pcmp, const char *name, snd_pcm_t *slave, int
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)
@ -221,4 +225,4 @@ int _snd_pcm_copy_open(snd_pcm_t **pcmp, const char *name,
snd_pcm_close(spcm);
return err;
}
SND_DLSYM_BUILD_VERSION(_snd_pcm_copy_open, SND_PCM_DLSYM_VERSION);

View file

@ -23,6 +23,11 @@
#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;
@ -456,7 +461,6 @@ int snd_pcm_file_open(snd_pcm_t **pcmp, const char *name, const char *fname, int
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)
@ -520,3 +524,4 @@ int _snd_pcm_file_open(snd_pcm_t **pcmp, const char *name,
snd_pcm_close(spcm);
return err;
}
SND_DLSYM_BUILD_VERSION(_snd_pcm_file_open, SND_PCM_DLSYM_VERSION);

View file

@ -22,6 +22,11 @@
#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;
@ -430,7 +435,6 @@ static int snd_pcm_hook_add_conf(snd_pcm_t *pcm, snd_config_t *root, snd_config_
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)
@ -499,6 +503,7 @@ int _snd_pcm_hooks_open(snd_pcm_t **pcmp, const char *name,
*pcmp = rpcm;
return 0;
}
SND_DLSYM_BUILD_VERSION(_snd_pcm_hooks_open, SND_PCM_DLSYM_VERSION);
#endif

View file

@ -31,6 +31,11 @@
#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
@ -654,7 +659,6 @@ int snd_pcm_hw_open(snd_pcm_t **pcmp, const char *name, int card, int device, in
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)
@ -709,4 +713,4 @@ int _snd_pcm_hw_open(snd_pcm_t **pcmp, const char *name,
}
return snd_pcm_hw_open(pcmp, name, card, device, subdevice, stream, mode);
}
SND_DLSYM_BUILD_VERSION(_snd_pcm_hw_open, SND_PCM_DLSYM_VERSION);

View file

@ -23,6 +23,11 @@
#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;
@ -319,7 +324,6 @@ int snd_pcm_linear_open(snd_pcm_t **pcmp, const char *name, snd_pcm_format_t sfo
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)
@ -363,5 +367,4 @@ int _snd_pcm_linear_open(snd_pcm_t **pcmp, const char *name,
snd_pcm_close(spcm);
return err;
}
SND_DLSYM_BUILD_VERSION(_snd_pcm_linear_open, SND_PCM_DLSYM_VERSION);

View file

@ -34,6 +34,11 @@
#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
@ -728,8 +733,6 @@ static int snd_pcm_meter_add_scope_conf(snd_pcm_t *pcm, const char *name,
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)
@ -807,6 +810,7 @@ int _snd_pcm_meter_open(snd_pcm_t **pcmp, const char *name,
}
return 0;
}
SND_DLSYM_BUILD_VERSION(_snd_pcm_meter_open, SND_PCM_DLSYM_VERSION);
#endif

View file

@ -23,6 +23,11 @@
#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,
@ -429,7 +434,6 @@ int snd_pcm_mulaw_open(snd_pcm_t **pcmp, const char *name, snd_pcm_format_t sfor
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)
@ -474,5 +478,4 @@ int _snd_pcm_mulaw_open(snd_pcm_t **pcmp, const char *name,
snd_pcm_close(spcm);
return err;
}
SND_DLSYM_BUILD_VERSION(_snd_pcm_mulaw_open, SND_PCM_DLSYM_VERSION);

View file

@ -26,6 +26,11 @@
#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;
@ -659,7 +664,6 @@ int snd_pcm_multi_open(snd_pcm_t **pcmp, const char *name,
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)
@ -863,4 +867,4 @@ _free:
free(channels_schannel);
return err;
}
SND_DLSYM_BUILD_VERSION(_snd_pcm_multi_open, SND_PCM_DLSYM_VERSION);

View file

@ -25,6 +25,11 @@
#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;
@ -364,7 +369,6 @@ int snd_pcm_null_open(snd_pcm_t **pcmp, const char *name, snd_pcm_stream_t strea
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)
@ -380,3 +384,4 @@ int _snd_pcm_null_open(snd_pcm_t **pcmp, const char *name,
}
return snd_pcm_null_open(pcmp, name, stream, mode);
}
SND_DLSYM_BUILD_VERSION(_snd_pcm_null_open, SND_PCM_DLSYM_VERSION);

View file

@ -22,6 +22,11 @@
#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,
@ -788,7 +793,6 @@ int snd_pcm_plug_open(snd_pcm_t **pcmp,
#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)
@ -872,4 +876,4 @@ int _snd_pcm_plug_open(snd_pcm_t **pcmp, const char *name,
snd_pcm_close(spcm);
return err;
}
SND_DLSYM_BUILD_VERSION(_snd_pcm_plug_open, SND_PCM_DLSYM_VERSION);

View file

@ -24,6 +24,11 @@
#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 {
@ -528,7 +533,6 @@ int snd_pcm_rate_open(snd_pcm_t **pcmp, const char *name, snd_pcm_format_t sform
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)
@ -576,5 +580,4 @@ int _snd_pcm_rate_open(snd_pcm_t **pcmp, const char *name,
snd_pcm_close(spcm);
return err;
}
SND_DLSYM_BUILD_VERSION(_snd_pcm_rate_open, SND_PCM_DLSYM_VERSION);

View file

@ -24,6 +24,11 @@
#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
@ -833,7 +838,6 @@ int snd_pcm_route_load_ttable(snd_config_t *tt, snd_pcm_route_ttable_entry_t *tt
#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)
@ -906,5 +910,4 @@ int _snd_pcm_route_open(snd_pcm_t **pcmp, const char *name,
snd_pcm_close(spcm);
return err;
}
SND_DLSYM_BUILD_VERSION(_snd_pcm_route_open, SND_PCM_DLSYM_VERSION);

View file

@ -32,6 +32,10 @@
#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;
@ -1365,7 +1369,6 @@ int snd_pcm_share_open(snd_pcm_t **pcmp, const char *name, const char *sname,
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)
@ -1478,3 +1481,4 @@ _free:
free(channels_map);
return err;
}
SND_DLSYM_BUILD_VERSION(_snd_pcm_share_open, SND_PCM_DLSYM_VERSION);

View file

@ -38,6 +38,11 @@
#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;
@ -719,7 +724,6 @@ int is_local(struct hostent *hent)
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)
@ -833,4 +837,4 @@ int _snd_pcm_shm_open(snd_pcm_t **pcmp, const char *name,
snd_config_delete(sconfig);
return err;
}
SND_DLSYM_BUILD_VERSION(_snd_pcm_shm_open, SND_PCM_DLSYM_VERSION);