]> code.delx.au - pulseaudio/commitdiff
daemon: Fix dlsearchpath while running from build tree
authorArun Raghavan <arun.raghavan@collabora.co.uk>
Sat, 20 Apr 2013 04:20:38 +0000 (09:50 +0530)
committerArun Raghavan <arun.raghavan@collabora.co.uk>
Sat, 20 Apr 2013 04:34:32 +0000 (10:04 +0530)
It appears that, libltdl will find the .la file in the builddir and
figure out where the real .so is.

This also requires .ifexists to be fixed up to correspondingly search in
<dlsearchpath>/.libs.

src/daemon/daemon-conf.c
src/pulsecore/cli-command.c

index 2c43cf9c1546adcee0614c316dc671bf18c0608b..f1e5476a9c429ada7f8bb60ad75f24b4080f66c3 100644 (file)
@@ -156,7 +156,7 @@ pa_daemon_conf *pa_daemon_conf_new(void) {
 #else
     if (pa_run_from_build_tree()) {
         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);
     } else
         c->dl_search_path = pa_xstrdup(PA_DLSEARCHPATH);
 #endif
index 1ec8054118133664015e4a1632736c78e7d8c9a7..f5489d6ea94d19363c7893f45beb40e1073ef543 100644 (file)
@@ -2062,11 +2062,21 @@ int pa_cli_command_execute_line_stateful(pa_core *c, const char *s, pa_strbuf *b
                             char *pathname;
 
                             pathname = pa_sprintf_malloc("%s" PA_PATH_SEP "%s", p, filename);
-                            pa_xfree(p);
 
                             *ifstate = access(pathname, F_OK) == 0 ? IFSTATE_TRUE : IFSTATE_FALSE;
                             pa_log_debug("Checking for existence of '%s': %s", pathname, *ifstate == IFSTATE_TRUE ? "success" : "failure");
 
+                            if (PA_UNLIKELY(pa_run_from_build_tree())) {
+                                /* If run from the build tree, search in <path>/.libs as well */
+                                char *ltpathname = pa_sprintf_malloc("%s" PA_PATH_SEP ".libs" PA_PATH_SEP "%s", p, filename);
+
+                                *ifstate = access(ltpathname, F_OK) == 0 ? IFSTATE_TRUE : IFSTATE_FALSE;
+                                pa_log_debug("Checking for existence of '%s': %s", ltpathname, *ifstate == IFSTATE_TRUE ? "success" : "failure");
+
+                                pa_xfree(ltpathname);
+                            }
+
+                            pa_xfree(p);
                             pa_xfree(pathname);
 
                             if (*ifstate == IFSTATE_TRUE)