#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
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)