configure.ac 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438
  1. ## Process this file with autoconf to produce configure.
  2. ## In general, the safest way to proceed is to run ./autogen.sh
  3. # make sure we're interpreted by some minimal autoconf
  4. AC_PREREQ([2.68])
  5. AC_INIT([gperftools],[2.1],[[email protected]])
  6. # Update this value for every release! (A:B:C will map to foo.so.(A-C).C.B)
  7. # http://www.gnu.org/software/libtool/manual/html_node/Updating-version-info.html
  8. TCMALLOC_SO_VERSION=5:2:1
  9. PROFILER_SO_VERSION=3:2:3
  10. AC_SUBST(TCMALLOC_SO_VERSION)
  11. AC_SUBST(PROFILER_SO_VERSION)
  12. # The argument here is just something that should be in the current directory
  13. # (for sanity checking)
  14. AC_CONFIG_SRCDIR(README)
  15. AC_CONFIG_MACRO_DIR([m4])
  16. AC_CANONICAL_HOST
  17. AM_INIT_AUTOMAKE([dist-zip])
  18. AC_CONFIG_HEADERS([src/config.h])
  19. # Export the version information (for tc_version and friends)
  20. TC_VERSION_MAJOR=`expr "$PACKAGE_VERSION" : '\([[0-9]]*\)'`
  21. TC_VERSION_MINOR=`expr "$PACKAGE_VERSION" : '[[0-9]]*\.\([[0-9]]*\)'`
  22. TC_VERSION_PATCH=`expr "$PACKAGE_VERSION" : '[[0-9]]*\.[[0-9]]*\(.*\)$'`
  23. AC_SUBST(TC_VERSION_MAJOR)
  24. AC_SUBST(TC_VERSION_MINOR)
  25. AC_SUBST(TC_VERSION_PATCH)
  26. AC_SUBST(PACKAGE_STRING)
  27. # The user can choose not to compile in the heap-profiler, the
  28. # heap-checker, or the cpu-profiler. There's also the possibility
  29. # for a 'fully minimal' compile, which leaves out the stacktrace
  30. # code as well. By default, we include all of these that the
  31. # target system supports.
  32. default_enable_cpu_profiler=yes
  33. default_enable_heap_profiler=yes
  34. default_enable_heap_checker=yes
  35. default_enable_debugalloc=yes
  36. default_enable_minimal=no
  37. need_nanosleep=yes # Used later, to decide if to run ACX_NANOSLEEP
  38. case "$host" in
  39. *-mingw*) default_enable_minimal=yes; default_enable_debugalloc=no;
  40. need_nanosleep=no;;
  41. *-cygwin*) default_enable_heap_checker=no; default_enable_cpu_profiler=no;;
  42. *-freebsd*) default_enable_heap_checker=no;;
  43. *-darwin*) default_enable_heap_checker=no;;
  44. esac
  45. AC_ARG_ENABLE([cpu-profiler],
  46. [AS_HELP_STRING([--disable-cpu-profiler],
  47. [do not build the cpu profiler])],
  48. [],
  49. [enable_cpu_profiler="$default_enable_cpu_profiler"])
  50. AC_ARG_ENABLE([heap-profiler],
  51. [AS_HELP_STRING([--disable-heap-profiler],
  52. [do not build the heap profiler])],
  53. [],
  54. [enable_heap_profiler="$default_enable_heap_profiler"])
  55. AC_ARG_ENABLE([heap-checker],
  56. [AS_HELP_STRING([--disable-heap-checker],
  57. [do not build the heap checker])],
  58. [],
  59. [enable_heap_checker="$default_enable_heap_checker"])
  60. AC_ARG_ENABLE([debugalloc],
  61. [AS_HELP_STRING([--disable-debugalloc],
  62. [do not build versions of libs with debugalloc])],
  63. [],
  64. [enable_debugalloc="$default_enable_debugalloc"])
  65. AC_ARG_ENABLE([minimal],
  66. [AS_HELP_STRING([--enable-minimal],
  67. [build only tcmalloc-minimal (and maybe tcmalloc-minimal-debug)])],
  68. [],
  69. [enable_minimal="$default_enable_minimal"])
  70. if test "$enable_minimal" = yes; then
  71. enable_cpu_profiler=no
  72. enable_heap_profiler=no
  73. enable_heap_checker=no
  74. fi
  75. # Checks for programs.
  76. AC_PROG_CXX
  77. AC_PROG_CC
  78. AC_PROG_CPP
  79. AM_CONDITIONAL(GCC, test "$GCC" = yes) # let the Makefile know if we're gcc
  80. AM_PROG_CC_C_O # shrug: autogen.sh suddenly needs this for some reason
  81. # Check if we have an objcopy installed that supports -W
  82. AC_CHECK_TOOL([OBJCOPY], [objcopy], [])
  83. AS_IF([test -n "$OBJCOPY"], [dnl
  84. AC_CACHE_CHECK([if $OBJCOPY supports -W], gpt_cv_objcopy_weaken, [dnl
  85. AC_LINK_IFELSE([AC_LANG_PROGRAM([void foo() {} int main() {return 0;}])], [dnl
  86. AS_IF(["$OBJCOPY" -W foo conftest$ac_exeext /dev/null],
  87. [gpt_cv_objcopy_weaken=yes], [gpt_cv_objcopy_weaken=no])],
  88. [gpt_cv_objcopy_weaken=no])])],
  89. [gpt_cv_objcopy_weaken=no])
  90. AM_CONDITIONAL(HAVE_OBJCOPY_WEAKEN, test $gpt_cv_objcopy_weaken = yes)
  91. LT_INIT([])
  92. AC_C_INLINE
  93. AX_C___ATTRIBUTE__
  94. # Check whether some low-level functions/files are available
  95. AC_HEADER_STDC
  96. # TODO(csilvers): we could remove a lot when WITH_CPU_PROFILER etc is "no".
  97. AC_CHECK_TYPES([__int64]) # defined in some windows platforms
  98. AC_CHECK_TYPES([struct mallinfo],,, [#include <malloc.h>])
  99. AC_CHECK_TYPES([Elf32_Versym],,, [#include <elf.h>]) # for vdso_support.h
  100. AC_CHECK_FUNCS(sbrk) # for tcmalloc to get memory
  101. AC_CHECK_FUNCS(geteuid) # for turning off services when run as root
  102. AC_CHECK_FUNCS(fork) # for the pthread_atfork setup
  103. AC_CHECK_HEADERS(features.h) # for vdso_support.h
  104. AC_CHECK_HEADERS(malloc.h) # some systems define stuff there, others not
  105. AC_CHECK_HEADERS(sys/malloc.h) # where some versions of OS X put malloc.h
  106. AC_CHECK_HEADERS(malloc/malloc.h) # another place OS X puts malloc.h (?)
  107. AC_CHECK_HEADERS(glob.h) # for heap-profile-table (cleaning up profiles)
  108. AC_CHECK_HEADERS(execinfo.h) # for stacktrace? and heapchecker_unittest
  109. AC_CHECK_HEADERS(libunwind.h) # for stacktrace
  110. AC_CHECK_HEADERS(unwind.h) # for stacktrace
  111. AC_CHECK_HEADERS(sched.h) # for being nice in our spinlock code
  112. AC_CHECK_HEADERS(conflict-signal.h) # defined on some windows platforms?
  113. AC_CHECK_HEADERS(sys/prctl.h) # for thread_lister (needed by leak-checker)
  114. AC_CHECK_HEADERS(linux/ptrace.h)# also needed by leak-checker
  115. AC_CHECK_HEADERS(sys/syscall.h)
  116. AC_CHECK_HEADERS(sys/socket.h) # optional; for forking out to symbolizer
  117. AC_CHECK_HEADERS(sys/wait.h) # optional; for forking out to symbolizer
  118. AC_CHECK_HEADERS(poll.h) # optional; for forking out to symbolizer
  119. AC_CHECK_HEADERS(fcntl.h) # for tcmalloc_unittest
  120. AC_CHECK_HEADERS(grp.h) # for heapchecker_unittest
  121. AC_CHECK_HEADERS(pwd.h) # for heapchecker_unittest
  122. AC_CHECK_HEADERS(sys/resource.h) # for memalign_unittest.cc
  123. AC_CHECK_HEADERS(valgrind.h) # we have a local copy if this isn't found
  124. AC_CHECK_HEADERS(sys/cdefs.h) # Where glibc defines __THROW
  125. AC_CHECK_HEADERS(features.h) # Where __GLIBC__ is defined
  126. # We also need <ucontext.h>/<sys/ucontext.h>, but we get those from
  127. # AC_PC_FROM_UCONTEXT, below.
  128. # We override a lot of memory allocation routines, not all of which are
  129. # standard. For those the system doesn't declare, we'll declare ourselves.
  130. AC_CHECK_DECLS([cfree,
  131. posix_memalign,
  132. memalign,
  133. valloc,
  134. pvalloc],,,
  135. [#define _XOPEN_SOURCE 600
  136. #include <stdlib.h>
  137. #include <malloc.h>])
  138. if test "$ac_cv_type_struct_mallinfo" = yes; then
  139. AC_SUBST(ac_cv_have_struct_mallinfo, 1) # gperftools/tcmalloc.h needs this
  140. else
  141. AC_SUBST(ac_cv_have_struct_mallinfo, 0)
  142. fi
  143. # We need to check for mmap. cygwin supports mmap, but the autoconf
  144. # test doesn't work on cygwin:
  145. # http://www.cygwin.com/ml/cygwin/2002-04/msg00412.html
  146. # This workaround comes from
  147. # http://cygwin.com/ml/cygwin/2004-11/msg00138.html
  148. case "$host" in
  149. *-*-mingw*)
  150. dnl mingw doesn't have mmap, not worth
  151. dnl checking. Especially given that mingw can be a
  152. dnl cross-compiler
  153. ;;
  154. *-*-cygwin*)
  155. ac_cv_func_mmap_fixed_mapped=yes
  156. AC_DEFINE(HAVE_MMAP, 1,
  157. [Define to 1 if you have a working `mmap' system call.])
  158. ;;
  159. *) if test "$cross_compiling" = yes; then
  160. ac_cv_func_mmap_fixed_mapped=yes
  161. AC_DEFINE(HAVE_MMAP, 1,
  162. [Define to 1 if you have a working `mmap' system call.])
  163. else
  164. AC_FUNC_MMAP
  165. fi
  166. ;;
  167. esac
  168. # If AtomicWord != Atomic32, we need to define two versions of all the
  169. # atomicops functions. If they're the same, we want to define only one.
  170. AC_MSG_CHECKING([if int32_t is the same type as intptr_t])
  171. AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <stdint.h>]], [[int32_t v1 = 0; intptr_t v2 = 0; return (&v1 - &v2)]])],[AC_DEFINE(INT32_EQUALS_INTPTR, 1,
  172. Define to 1 if int32_t is equivalent to intptr_t)
  173. AC_MSG_RESULT([yes])],[AC_MSG_RESULT([no])])
  174. # We want to access the "PC" (Program Counter) register from a struct
  175. # ucontext. Every system has its own way of doing that. We try all the
  176. # possibilities we know about. Note REG_PC should come first (REG_RIP
  177. # is also defined on solaris, but does the wrong thing). But don't
  178. # bother if we're not doing cpu-profiling.
  179. # [*] means that we've not actually tested one of these systems
  180. if test "$enable_cpu_profiler" = yes; then
  181. AC_PC_FROM_UCONTEXT(AC_MSG_WARN(Could not find the PC. Will not try to compile libprofiler...);
  182. enable_cpu_profiler=no)
  183. fi
  184. # Some tests test the behavior of .so files, and only make sense for dynamic.
  185. AM_CONDITIONAL(ENABLE_STATIC, test "$enable_static" = yes)
  186. # We want to link in libunwind if it exists
  187. AC_CHECK_LIB(unwind, backtrace, UNWIND_LIBS=-lunwind, UNWIND_LIBS=)
  188. AC_SUBST(UNWIND_LIBS)
  189. # On x86_64, instead of libunwind, we can choose to compile with frame-pointers.
  190. AC_ARG_ENABLE(frame_pointers,
  191. AS_HELP_STRING([--enable-frame-pointers],
  192. [On x86_64 systems, compile with -fno-omit-frame-pointer (see INSTALL)]),
  193. , enable_frame_pointers=no)
  194. AM_CONDITIONAL(ENABLE_FRAME_POINTERS, test "$enable_frame_pointers" = yes)
  195. # Some x86_64 systems do not insert frame pointers by default.
  196. # We want to see if the current system is one of those.
  197. AC_COMPILE_IFELSE([AC_LANG_PROGRAM(, [return __x86_64__ == 1 ? 0 : 1])],
  198. [is_x86_64=yes], [is_x86_64=no])
  199. OLD_CFLAGS="$CFLAGS"
  200. CFLAGS="$CFLAGS -S -O2 -o fp.s"
  201. # This test will always fail because we don't name our output file properly.
  202. # We do our own determination of success/failure in the grep, below.
  203. AC_COMPILE_IFELSE([AC_LANG_PROGRAM([int f(int x) {return x;}], [return f(0);])],
  204. [:], [:])
  205. AM_CONDITIONAL(X86_64_AND_NO_FP_BY_DEFAULT,
  206. test "$is_x86_64" = yes && ! grep 'mov.*rsp.*rbp' fp.s >/dev/null 2>&1)
  207. rm fp.s
  208. CFLAGS="$OLD_CFLAGS"
  209. # We need to know if we're i386 so we can turn on -mmms, which is not
  210. # on by default for i386 (it is for x86_64).
  211. AC_COMPILE_IFELSE([AC_LANG_PROGRAM(, [return __i386__ == 1 ? 0 : 1])],
  212. [is_i386=yes], [is_i386=no])
  213. AM_CONDITIONAL(I386, test "$is_i386" = yes)
  214. # See if the compiler supports -Wno-unused-result.
  215. # Newer ubuntu's turn on -D_FORTIFY_SOURCE=2, enabling
  216. # __attribute__((warn_unused_result)) for things like write(),
  217. # which we don't care about.
  218. AC_CACHE_CHECK([if the compiler supports -Wno-unused-result],
  219. perftools_cv_w_no_unused_result,
  220. [OLD_CFLAGS="$CFLAGS"
  221. CFLAGS="$CFLAGS -Wno-error -Wno-unused-result"
  222. # gcc doesn't warn about unknown flags unless it's
  223. # also warning for some other purpose, hence the
  224. # divide-by-0. (We use -Wno-error to make sure the
  225. # divide-by-0 doesn't cause this test to fail!)
  226. AC_COMPILE_IFELSE([AC_LANG_PROGRAM(, return 1/0)],
  227. perftools_cv_w_no_unused_result=yes,
  228. perftools_cv_w_no_unused_result=no)
  229. CFLAGS="$OLD_CFLAGS"])
  230. AM_CONDITIONAL(HAVE_W_NO_UNUSED_RESULT,
  231. test "$perftools_cv_w_no_unused_result" = yes)
  232. # Defines PRIuS
  233. AC_COMPILER_CHARACTERISTICS
  234. # Also make sure we get standard PRI... definitions, even with glibc.
  235. # We have to use AH_VERBATIM because we need the #ifdef guard (gcc buglet)
  236. AH_VERBATIM([__STDC_FORMAT_MACROS],
  237. [/* C99 says: define this to get the PRI... macros from stdint.h */
  238. #ifndef __STDC_FORMAT_MACROS
  239. # define __STDC_FORMAT_MACROS 1
  240. #endif])
  241. # Check if __builtin_stack_pointer() is available (for elfcore.h)
  242. AC_MSG_CHECKING([for __builtin_stack_pointer()])
  243. AC_LINK_IFELSE([AC_LANG_PROGRAM(, [void *sp = __builtin_stack_pointer()])],
  244. [AC_DEFINE(HAVE_BUILTIN_STACK_POINTER, 1,
  245. Define to 1 if compiler supports __builtin_stack_pointer)
  246. AC_MSG_RESULT([yes])],
  247. [AC_MSG_RESULT([no])])
  248. # Check for __builtin_expect()
  249. AC_MSG_CHECKING([for __builtin_expect()])
  250. AC_LINK_IFELSE([AC_LANG_PROGRAM(, return __builtin_expect(main != 0, 1))],
  251. [AC_DEFINE(HAVE_BUILTIN_EXPECT, 1,
  252. Define to 1 if compiler supports __builtin_expect)
  253. AC_MSG_RESULT([yes])],
  254. [AC_MSG_RESULT([no])])
  255. # Check if __environ is available (for GetenvBeforeMain)
  256. AC_MSG_CHECKING([for __environ])
  257. AC_LINK_IFELSE([AC_LANG_PROGRAM([#include <unistd.h>],
  258. [char **env = __environ])],
  259. [AC_DEFINE(HAVE___ENVIRON, 1,
  260. [Define to 1 if compiler supports __environ])
  261. AC_MSG_RESULT([yes])],
  262. [AC_MSG_RESULT([no])])
  263. # If we support __thread, that can speed up tcmalloc a bit.
  264. # Note, however, that our code tickles a bug in gcc < 4.1.2
  265. # involving TLS and -fPIC (which our libraries will use) on x86:
  266. # http://gcc.gnu.org/ml/gcc-bugs/2006-09/msg02275.html
  267. #
  268. # And mingw also does compile __thread but resultant code actually
  269. # fails to work correctly at least in some not so ancient version:
  270. # http://mingw-users.1079350.n2.nabble.com/gcc-4-4-multi-threaded-exception-handling-amp-thread-specifier-not-working-td3440749.html
  271. AC_MSG_CHECKING([for __thread])
  272. AC_LINK_IFELSE([AC_LANG_PROGRAM([#if defined(__GNUC__) && (defined(__i386__) || defined(__x86_64__)) && ((__GNUC__ < 4) || (__GNUC__ == 4 && __GNUC_MINOR__ < 1) || (__GNUC__ == 4 && __GNUC_MINOR__ == 1 && __GNUC_PATCHLEVEL__ < 2))
  273. #error gcc has this bug: http://gcc.gnu.org/ml/gcc-bugs/2006-09/msg02275.html
  274. #endif
  275. #if defined(__MINGW32__)
  276. #error mingw doesn't really support tls
  277. #endif
  278. ], [static __thread int p = 0])],
  279. [AC_DEFINE(HAVE_TLS, 1,
  280. Define to 1 if compiler supports __thread)
  281. AC_MSG_RESULT([yes])],
  282. [AC_MSG_RESULT([no])])
  283. # glibc's __malloc_hook/etc were declared volatile starting in glibc 2.14
  284. AC_MSG_CHECKING([if __malloc_hook is declared volatile])
  285. AC_COMPILE_IFELSE([AC_LANG_PROGRAM([#include <malloc.h>
  286. void* (* volatile __malloc_hook)(size_t, const void*) = 0;],)],
  287. [AC_DEFINE(MALLOC_HOOK_MAYBE_VOLATILE, volatile,
  288. Define to 'volatile' if __malloc_hook is declared volatile)
  289. AC_MSG_RESULT([yes])],
  290. [AC_DEFINE(MALLOC_HOOK_MAYBE_VOLATILE, )
  291. AC_MSG_RESULT([no])])
  292. # Nanosleep requires extra libraries on some architectures (solaris).
  293. # This sets NANOSLEEP_LIBS. nanosleep doesn't exist on mingw, which
  294. # is fine for us because we don't compile libspinlock, which uses it.
  295. if test "$need_nanosleep" = yes; then
  296. ACX_NANOSLEEP
  297. AC_SUBST(NANOSLEEP_LIBS)
  298. fi
  299. # Solaris 10 6/06 has a bug where /usr/sfw/lib/libstdc++.la is empty.
  300. # If so, we replace it with our own version.
  301. LIBSTDCXX_LA_LINKER_FLAG=
  302. if test -f /usr/sfw/lib/libstdc++.la && ! test -s /usr/sfw/lib/libstdc++.la
  303. then
  304. LIBSTDCXX_LA_LINKER_FLAG='-L$(top_srcdir)/src/solaris'
  305. fi
  306. AC_SUBST(LIBSTDCXX_LA_LINKER_FLAG)
  307. # We also need to check if the kernel supports __thread, which requires uname()
  308. AC_CHECK_DECLS(uname,,, [#include <sys/utsname.h>])
  309. # In fact, a lot of the code in this directory depends on pthreads
  310. ACX_PTHREAD
  311. # Find out what namespace 'normal' STL code lives in
  312. AC_CXX_STL_NAMESPACE
  313. # Figure out where libc has program_invocation_name
  314. AC_PROGRAM_INVOCATION_NAME
  315. # Make the install prefix available, to figure out where to look for pprof
  316. AC_INSTALL_PREFIX
  317. dnl only very recent mingw has sleep and nanosleep
  318. case "$host" in
  319. *-mingw*)
  320. AC_CHECK_DECLS([sleep], [], [], [#include <unistd.h>])
  321. AC_CHECK_DECLS([nanosleep], [], [], [#include <time.h>])
  322. ;;
  323. esac
  324. # For windows, this has a non-trivial value (__declspec(export)), but any
  325. # system that uses configure wants this to be the empty string.
  326. AC_DEFINE(PERFTOOLS_DLL_DECL,,
  327. [Always the empty-string on non-windows systems.
  328. On windows, should be "__declspec(dllexport)".
  329. This way, when we compile the dll, we export our functions/classes.
  330. It's safe to define this here because config.h is only used
  331. internally, to compile the DLL, and every DLL source file
  332. #includes "config.h" before anything else.])
  333. # In theory, config.h files shouldn't need a header guard, but we do,
  334. # because we (maybe) #include windows/mingw.h from within config.h,
  335. # and it #includes other .h files. These all have header guards, so
  336. # the end result is if config.h is #included twice, its #undefs get
  337. # evaluated twice, but all the ones in mingw.h/etc only get evaluated
  338. # once, potentially causing trouble. c.f.
  339. # http://code.google.com/p/gperftools/issues/detail?id=246
  340. AH_TOP([
  341. #ifndef GPERFTOOLS_CONFIG_H_
  342. #define GPERFTOOLS_CONFIG_H_
  343. ])
  344. AH_VERBATIM([PTHREADS_CRASHES_IF_RUN_TOO_EARLY],
  345. [/* Mark the systems where we know it's bad if pthreads runs too
  346. early before main (before threads are initialized, presumably). */
  347. #ifdef __FreeBSD__
  348. #define PTHREADS_CRASHES_IF_RUN_TOO_EARLY 1
  349. #endif])
  350. # MinGW uses autoconf, but also needs the windows shim routines
  351. # (since it doesn't have its own support for, say, pthreads).
  352. # This requires us to #include a special header file, and also to
  353. # link in some windows versions of .o's instead of the unix versions.
  354. #
  355. # Also, manually mark systems where we have to be careful how early
  356. # we run pthreads. TODO(csilvers): turn this into an autoconf check.
  357. AH_BOTTOM([
  358. #ifdef __MINGW32__
  359. #include "windows/mingw.h"
  360. #endif
  361. #endif /* #ifndef GPERFTOOLS_CONFIG_H_ */
  362. ])
  363. AM_CONDITIONAL(MINGW, expr $host : '.*-mingw' >/dev/null 2>&1)
  364. AM_CONDITIONAL(OSX, expr $host : '.*-apple-darwin.*' >/dev/null 2>&1)
  365. # Redhat 7 (and below?) has sys/ucontext.h, but if you try to #include
  366. # it directly, the compiler gets upset. So we pretend we don't have
  367. # it.
  368. if cat /etc/redhat-release 2>/dev/null | grep "Red Hat Linux release 7" >/dev/null 2>&1; then
  369. AC_DEFINE(HAVE_SYS_UCONTEXT_H, 0, [<sys/ucontext.h> is broken on redhat 7])
  370. fi
  371. # Export the --enable flags we set above. We do this at the end so
  372. # other configure rules can enable or disable targets based on what
  373. # they find.
  374. AM_CONDITIONAL(WITH_CPU_PROFILER, test "$enable_cpu_profiler" = yes)
  375. AM_CONDITIONAL(WITH_HEAP_PROFILER, test "$enable_heap_profiler" = yes)
  376. AM_CONDITIONAL(WITH_HEAP_CHECKER, test "$enable_heap_checker" = yes)
  377. AM_CONDITIONAL(WITH_DEBUGALLOC, test "$enable_debugalloc" = yes)
  378. # We make tcmalloc.so if either heap-profiler or heap-checker is asked for.
  379. AM_CONDITIONAL(WITH_HEAP_PROFILER_OR_CHECKER,
  380. test "$enable_heap_profiler" = yes -o \
  381. "$enable_heap_checker" = yes)
  382. # If we don't use any profilers, we don't need stack traces (or pprof)
  383. AM_CONDITIONAL(WITH_STACK_TRACE, test "$enable_cpu_profiler" = yes -o \
  384. "$enable_heap_profiler" = yes -o \
  385. "$enable_heap_checker" = yes)
  386. # Write generated configuration file
  387. AC_CONFIG_FILES([Makefile
  388. src/gperftools/tcmalloc.h src/windows/gperftools/tcmalloc.h])
  389. AC_OUTPUT