]> arthur.barton.de Git - netdata.git/blob - m4/tcmalloc.m4
rename chart fields to avoid conflicts with backends; fixes #1962
[netdata.git] / m4 / tcmalloc.m4
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
8 dnl
9 dnl     http://www.apache.org/licenses/LICENSE-2.0
10 dnl
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.
16
17 dnl
18 dnl tcmalloc.m4: Trafficserver's tcmalloc autoconf macros
19 dnl modified to skip other TS_ helpers
20 dnl
21
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]])],
27   [
28   with_tcmalloc_lib="$withval"
29   ],[
30   with_tcmalloc_lib="tcmalloc"
31   ]
32 )
33
34 has_tcmalloc=0
35 AC_ARG_WITH([tcmalloc], [AS_HELP_STRING([--with-tcmalloc=DIR], [use the tcmalloc library])],
36 [
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])
40     fi
41     tcmalloc_have_lib=0
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}"
46     fi
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}"
50       has_tcmalloc=1      
51       AC_DEFINE(has_tcmalloc, [1], [Link/compile against tcmalloc])
52     else
53       AC_MSG_ERROR([Couldn't find a tcmalloc installation])
54     fi
55   fi
56 ])
57 AC_SUBST(has_tcmalloc)
58 ])