mirror of
https://gitlab.freedesktop.org/pulseaudio/pulseaudio.git
synced 2026-01-03 11:08:55 -05:00
Move compile-time checks around pa_run_from_build_tree to core-util
To make the code cleaner and have the checks all in one place.
This commit is contained in:
parent
72323bc6bb
commit
93348331bb
4 changed files with 10 additions and 21 deletions
|
|
@ -153,19 +153,10 @@ pa_daemon_conf* pa_daemon_conf_new(void) {
|
||||||
c->dl_search_path = pa_sprintf_malloc("%s" PA_PATH_SEP "lib" PA_PATH_SEP "pulse-%d.%d" PA_PATH_SEP "modules",
|
c->dl_search_path = pa_sprintf_malloc("%s" PA_PATH_SEP "lib" PA_PATH_SEP "pulse-%d.%d" PA_PATH_SEP "modules",
|
||||||
pa_win32_get_toplevel(NULL), PA_MAJOR, PA_MINOR);
|
pa_win32_get_toplevel(NULL), PA_MAJOR, PA_MINOR);
|
||||||
#else
|
#else
|
||||||
#if defined(__linux__) && !defined(__OPTIMIZE__)
|
|
||||||
|
|
||||||
/* We abuse __OPTIMIZE__ as a check whether we are a debug build
|
|
||||||
* or not. If we are and are run from the build tree then we
|
|
||||||
* override the search path to point to our build tree */
|
|
||||||
|
|
||||||
if (pa_run_from_build_tree()) {
|
if (pa_run_from_build_tree()) {
|
||||||
pa_log_notice("Detected that we are run from the build tree, fixing search path.");
|
pa_log_notice("Detected that we are run from the build tree, fixing search path.");
|
||||||
c->dl_search_path = pa_xstrdup(PA_BUILDDIR "/.libs/");
|
c->dl_search_path = pa_xstrdup(PA_BUILDDIR "/.libs/");
|
||||||
|
|
||||||
} else
|
} else
|
||||||
|
|
||||||
#endif
|
|
||||||
c->dl_search_path = pa_xstrdup(PA_DLSEARCHPATH);
|
c->dl_search_path = pa_xstrdup(PA_DLSEARCHPATH);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2229,9 +2229,7 @@ pa_alsa_path* pa_alsa_path_new(const char *fname, pa_alsa_direction_t direction)
|
||||||
items[2].data = &p->name;
|
items[2].data = &p->name;
|
||||||
|
|
||||||
fn = pa_maybe_prefix_path(fname,
|
fn = pa_maybe_prefix_path(fname,
|
||||||
#if defined(__linux__) && !defined(__OPTIMIZE__)
|
|
||||||
pa_run_from_build_tree() ? PA_BUILDDIR "/modules/alsa/mixer/paths/" :
|
pa_run_from_build_tree() ? PA_BUILDDIR "/modules/alsa/mixer/paths/" :
|
||||||
#endif
|
|
||||||
PA_ALSA_PATHS_DIR);
|
PA_ALSA_PATHS_DIR);
|
||||||
|
|
||||||
r = pa_config_parse(fn, NULL, items, p);
|
r = pa_config_parse(fn, NULL, items, p);
|
||||||
|
|
@ -3744,9 +3742,7 @@ pa_alsa_profile_set* pa_alsa_profile_set_new(const char *fname, const pa_channel
|
||||||
fname = "default.conf";
|
fname = "default.conf";
|
||||||
|
|
||||||
fn = pa_maybe_prefix_path(fname,
|
fn = pa_maybe_prefix_path(fname,
|
||||||
#if defined(__linux__) && !defined(__OPTIMIZE__)
|
|
||||||
pa_run_from_build_tree() ? PA_BUILDDIR "/modules/alsa/mixer/profile-sets/" :
|
pa_run_from_build_tree() ? PA_BUILDDIR "/modules/alsa/mixer/profile-sets/" :
|
||||||
#endif
|
|
||||||
PA_ALSA_PROFILE_SETS_DIR);
|
PA_ALSA_PROFILE_SETS_DIR);
|
||||||
|
|
||||||
r = pa_config_parse(fn, NULL, items, ps);
|
r = pa_config_parse(fn, NULL, items, ps);
|
||||||
|
|
|
||||||
|
|
@ -2991,9 +2991,6 @@ pa_bool_t pa_run_from_build_tree(void) {
|
||||||
char *rp;
|
char *rp;
|
||||||
pa_bool_t b = FALSE;
|
pa_bool_t b = FALSE;
|
||||||
|
|
||||||
/* We abuse __OPTIMIZE__ as a check whether we are a debug build
|
|
||||||
* or not. */
|
|
||||||
|
|
||||||
if ((rp = pa_readlink("/proc/self/exe"))) {
|
if ((rp = pa_readlink("/proc/self/exe"))) {
|
||||||
b = pa_startswith(rp, PA_BUILDDIR);
|
b = pa_startswith(rp, PA_BUILDDIR);
|
||||||
pa_xfree(rp);
|
pa_xfree(rp);
|
||||||
|
|
|
||||||
|
|
@ -254,8 +254,13 @@ size_t pa_pipe_buf(int fd);
|
||||||
|
|
||||||
void pa_reset_personality(void);
|
void pa_reset_personality(void);
|
||||||
|
|
||||||
|
/* We abuse __OPTIMIZE__ as a check whether we are a debug build
|
||||||
|
* or not. If we are and are run from the build tree then we
|
||||||
|
* override the search path to point to our build tree */
|
||||||
#if defined(__linux__) && !defined(__OPTIMIZE__)
|
#if defined(__linux__) && !defined(__OPTIMIZE__)
|
||||||
pa_bool_t pa_run_from_build_tree(void);
|
pa_bool_t pa_run_from_build_tree(void);
|
||||||
|
#else
|
||||||
|
static inline pa_bool_t pa_run_from_build_tree(void) {return FALSE;}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
const char *pa_get_temp_dir(void);
|
const char *pa_get_temp_dir(void);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue