src: Use jemalloc if available

This commit is contained in:
Tatsuhiro Tsujikawa 2014-03-05 21:38:33 +09:00
parent 27e161dc31
commit 7f18eced0b
2 changed files with 24 additions and 0 deletions

View File

@ -88,6 +88,11 @@ AC_ARG_WITH([libxml2],
[Use libxml2 [default=check]])],
[request_libxml2=$withval], [request_libxml2=check])
AC_ARG_WITH([jemalloc],
[AS_HELP_STRING([--with-jemalloc],
[Use jemalloc [default=check]])],
[request_jemalloc=$withval], [request_jemalloc=check])
AC_ARG_WITH([cython],
[AS_HELP_STRING([--with-cython=PATH],
[Use cython in given PATH])],
@ -249,6 +254,23 @@ fi
AM_CONDITIONAL([HAVE_LIBXML2], [ test "x${have_libxml2}" = "xyes" ])
# jemalloc
have_jemalloc=no
if test "x${request_jemalloc}" != "xno"; then
LIBS_OLD=$LIBS
AC_SEARCH_LIBS([malloc_stats_print], [jemalloc], [have_jemalloc=yes])
LIBS=$LIBS_OLD
if test "x${have_jemalloc}" = "xyes"; then
JEMALLOC_LIBS="-ljemalloc"
AC_SUBST([JEMALLOC_LIBS])
fi
fi
if test "x${request_jemalloc}" = "xyes" &&
test "x${have_jemalloc}" != "xyes"; then
AC_MSG_ERROR([jemalloc was requested (--with-jemalloc) but not found])
fi
# spdylay (for src/nghttpx)
PKG_CHECK_MODULES([LIBSPDYLAY], [libspdylay >= 1.2.3],
[have_spdylay=yes], [have_spdylay=no])
@ -450,6 +472,7 @@ AC_MSG_NOTICE([summary of build options:
Libevent(SSL): ${have_libevent_openssl}
Spdylay: ${have_spdylay}
Jansson: ${have_jansson}
Jemalloc: ${have_jemalloc}
Applications: ${enable_app}
HPACK tools: ${enable_hpack_tools}
Examples: ${enable_examples}

View File

@ -43,6 +43,7 @@ AM_LDFLAGS = \
@LIBEVENT_OPENSSL_LIBS@ \
@OPENSSL_LIBS@ \
@JANSSON_LIBS@ \
@JEMALLOC_LIBS@ \
@SRC_LIBS@
LDADD = \