Allow LD_PRELOAD libs to be configured at build time

Signed-off-by: Ikey Doherty <ikey@solus-project.com>
This commit is contained in:
Ikey Doherty
2016-05-27 04:03:48 +01:00
parent 6e43036cd8
commit 23bfc418bd
2 changed files with 15 additions and 1 deletions
+8
View File
@@ -57,6 +57,13 @@ AC_SUBST(STEAMBIN)
AC_DEFINE_UNQUOTED(STEAM_BINARY, "$STEAMBIN",
[The location of the real Steam binary])
# The LD_PRELOAD list required to integrate gracefully with the official Steam Runtime
AC_ARG_WITH([preload-libs], AS_HELP_STRING([--with-preload-libs],
[the preload libs to use with Steams own runtime]), [preloadlibs="${withval}"],
[preloadlibs="/usr/\$LIB/libX11.so.6:/usr/\$LIB/libstdc++.so.6"])
AC_DEFINE_UNQUOTED([LSI_PRELOAD_LIBS], "$preloadlibs",
[Libraries to preload with Steams runtime])
m4_define([gtk_required_version], [3.4.0])
@@ -88,6 +95,7 @@ AC_MSG_RESULT([
New C++ ABI: ${use_new_abi}
Real Steam binary: ${STEAMBIN}
GTK+ Frontend: ${have_frontend}
preload-libs: ${preloadlibs}
compiler: ${CC}
cflags: ${CFLAGS}
+7 -1
View File
@@ -19,6 +19,8 @@
#include <sys/stat.h>
#include <unistd.h>
#include "config.h"
/* Mark a variable/argument as unused to skip warnings */
#define __lsi_unused__ __attribute__((unused))
@@ -86,7 +88,11 @@ __lsi_inline__ static inline bool lsi_system_requires_preload(void)
*/
__lsi_inline__ static inline const char *lsi_preload_list(void)
{
return "/usr/$LIB/libX11.so.6:/usr/$LIB/libstdc++.so.6";
/* Respect existing LD_PRELOAD in environment */
if (getenv("LD_PRELOAD")) {
return "$LD_PRELOAD:" LSI_PRELOAD_LIBS;
}
return LSI_PRELOAD_LIBS;
}
/**