From 2bd3cbc5c68bb9b097c382108ae1aed793e08062 Mon Sep 17 00:00:00 2001 From: Antony Dovgal Date: Thu, 13 Oct 2011 09:33:33 +0400 Subject: [PATCH] add autogenerated jemalloc.sh wrapper script --- .gitignore | 1 + Makefile.in | 2 +- bin/jemalloc.sh.in | 9 +++++++++ configure.ac | 20 +++++++++++++++++++- 4 files changed, 30 insertions(+), 2 deletions(-) create mode 100644 bin/jemalloc.sh.in diff --git a/.gitignore b/.gitignore index 32b4c424..1a9bb068 100644 --- a/.gitignore +++ b/.gitignore @@ -21,3 +21,4 @@ !test/*.c !test/*.exp /VERSION +/bin/jemalloc.sh diff --git a/Makefile.in b/Makefile.in index de7492f9..6f66e4d2 100644 --- a/Makefile.in +++ b/Makefile.in @@ -42,7 +42,7 @@ TEST_LIBRARY_PATH := endif # Lists of files. -BINS := @srcroot@bin/pprof +BINS := @srcroot@bin/pprof @objroot@bin/jemalloc.sh CHDRS := @objroot@include/jemalloc/jemalloc@install_suffix@.h \ @objroot@include/jemalloc/jemalloc_defs@install_suffix@.h CSRCS := @srcroot@src/jemalloc.c @srcroot@src/arena.c @srcroot@src/atomic.c \ diff --git a/bin/jemalloc.sh.in b/bin/jemalloc.sh.in new file mode 100644 index 00000000..4d13cc6c --- /dev/null +++ b/bin/jemalloc.sh.in @@ -0,0 +1,9 @@ +#!/bin/sh + +prefix=@prefix@ +exec_prefix=@exec_prefix@ +libdir=@libdir@ + +@LD_PRELOAD_VAR@=${libdir}/libjemalloc.@SHLIB_SUFFIX_NAME@.1 +export @LD_PRELOAD_VAR@ +exec "$@" diff --git a/configure.ac b/configure.ac index b58aa520..688e0c83 100644 --- a/configure.ac +++ b/configure.ac @@ -167,6 +167,9 @@ case "${host_cpu}" in esac AC_DEFINE_UNQUOTED([CPU_SPINWAIT], [$CPU_SPINWAIT]) +LD_PRELOAD_VAR="LD_PRELOAD" +SHLIB_SUFFIX_NAME="so" + dnl Platform-specific settings. abi and RPATH can probably be determined dnl programmatically, but doing so is error-prone, which makes it generally dnl not worth the trouble. @@ -180,6 +183,8 @@ case "${host}" in abi="macho" AC_DEFINE([JEMALLOC_PURGE_MADVISE_FREE]) RPATH="" + LD_PRELOAD_VAR="DYLD_INSERT_LIBRARIES" + SHLIB_SUFFIX_NAME="dylib" ;; *-*-freebsd*) CFLAGS="$CFLAGS" @@ -217,6 +222,17 @@ case "${host}" in CPPFLAGS="$CPPFLAGS -D_POSIX_PTHREAD_SEMANTICS" LIBS="$LIBS -lposix4 -lsocket -lnsl" ;; + *-ibm-aix*) + if "$LG_SIZEOF_PTR" = "8"; then + dnl 64bit AIX + LD_PRELOAD_VAR="LDR_PRELOAD64" + else + dnl 32bit AIX + LD_PRELOAD_VAR="LDR_PRELOAD" + fi + abi="xcoff" + RPATH="-Wl,-rpath," + ;; *) AC_MSG_RESULT([Unsupported operating system: ${host}]) abi="elf" @@ -225,6 +241,8 @@ case "${host}" in esac AC_SUBST([abi]) AC_SUBST([RPATH]) +AC_SUBST([LD_PRELOAD_VAR]) +AC_SUBST([SHLIB_SUFFIX_NAME]) JE_COMPILABLE([__attribute__ syntax], [static __attribute__((unused)) void foo(void){}], @@ -881,7 +899,7 @@ AC_CONFIG_HEADERS([$cfghdrs_tup]) dnl ============================================================================ dnl Generate outputs. -AC_CONFIG_FILES([$cfgoutputs_tup config.stamp]) +AC_CONFIG_FILES([$cfgoutputs_tup config.stamp bin/jemalloc.sh]) AC_SUBST([cfgoutputs_in]) AC_SUBST([cfgoutputs_out]) AC_OUTPUT