1 dnl -------------------------------------------------------- -*- autoconf -*-
2 dnl Licensed to the Apache Software Foundation (ASF) under one or more
3 dnl contributor license agreements. See the NOTICE file distributed with
4 dnl this work for additional information regarding copyright ownership.
5 dnl The ASF licenses this file to You under the Apache License, Version 2.0
6 dnl (the "License"); you may not use this file except in compliance with
7 dnl the License. You may obtain a copy of the License at
9 dnl http://www.apache.org/licenses/LICENSE-2.0
11 dnl Unless required by applicable law or agreed to in writing, software
12 dnl distributed under the License is distributed on an "AS IS" BASIS,
13 dnl WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 dnl See the License for the specific language governing permissions and
15 dnl limitations under the License.
18 dnl tcmalloc.m4: Trafficserver's tcmalloc autoconf macros
19 dnl modified to skip other TS_ helpers
22 dnl This is kinda fugly, but need a way to both specify a directory and which
23 dnl of the many tcmalloc libraries to use ...
24 AC_DEFUN([TS_CHECK_TCMALLOC], [
25 AC_ARG_WITH([tcmalloc-lib],
26 [AS_HELP_STRING([--with-tcmalloc-lib],[specify the tcmalloc library to use [default=tcmalloc]])],
28 with_tcmalloc_lib="$withval"
30 with_tcmalloc_lib="tcmalloc"
35 AC_ARG_WITH([tcmalloc], [AS_HELP_STRING([--with-tcmalloc=DIR], [use the tcmalloc library])],
37 if test "$withval" != "no"; then
38 if test "x${enable_jemalloc}" = "xyes"; then
39 AC_MSG_ERROR([Cannot compile with both tcmalloc and jemalloc])
42 if test "x$withval" != "xyes" && test "x$withval" != "x"; then
43 tcmalloc_ldflags="$withval/lib"
44 LDFLAGS="${LDFLAGS} -L${tcmalloc_ldflags}"
45 LIBTOOL_LINK_FLAGS="${LIBTOOL_LINK_FLAGS} -rpath ${tcmalloc_ldflags}"
47 AC_CHECK_LIB(${with_tcmalloc_lib}, tc_cfree, [tcmalloc_have_lib=1])
48 if test "$tcmalloc_have_lib" != "0"; then
49 LIBS="${LIBS} -l${with_tcmalloc_lib}"
51 AC_DEFINE(has_tcmalloc, [1], [Link/compile against tcmalloc])
53 AC_MSG_ERROR([Couldn't find a tcmalloc installation])
57 AC_SUBST(has_tcmalloc)