1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295
|
/* -*- Mode: C++; c-basic-offset: 2; indent-tabs-mode: nil -*-
* Copyright (c) 2024, gperftools Contributors
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following disclaimer
* in the documentation and/or other materials provided with the
* distribution.
* * Neither the name of Google Inc. nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
// Note, this is somewhat "poor man's" equivalent of config.h that is
// normally produced by autotools. It detects features at compile
// time, so it is easier to integrate with stuff like bazel, but it
// supports fewer platforms. As of this writing it is tested on modern
// GNU/Linux and Windows (MSVC).
#ifndef GPERFTOOLS_CONFIG_H_
#define GPERFTOOLS_CONFIG_H_
/* enable aggressive decommit by default */
/* #undef ENABLE_AGGRESSIVE_DECOMMIT_BY_DEFAULT */
/* Build runtime detection for sized delete */
/* #undef ENABLE_DYNAMIC_SIZED_DELETE */
/* report large allocation */
/* #undef ENABLE_LARGE_ALLOC_REPORT */
/* Build sized deletion operators */
/* #undef ENABLE_SIZED_DELETE */
/* Define to 1 if you have the <asm/ptrace.h> header file. */
#if defined __has_include
# if __has_include(<asm/ptrace.h>)
# define HAVE_ASM_PTRACE_H 1
# endif
#endif
/* Whether <cxxabi.h> contains __cxxabiv1::__cxa_demangle */
#ifdef __GNUC__
#define HAVE_CXA_DEMANGLE 1
#endif
/* Define to 1 if you have the declaration of 'backtrace', and to 0 if you
don't. */
/* #undef HAVE_DECL_BACKTRACE */
/* Define to 1 if you have the declaration of 'backtrace_symbols', and to 0 if
you don't. */
// #undef HAVE_DECL_BACKTRACE_SYMBOLS 1
/* Define to 1 if you have the declaration of 'memalign', and to 0 if you
don't. */
// memalign is legacy API. BSDs have already removed it.
#if __linux__
#define HAVE_DECL_MEMALIGN 1
#endif
/* Define to 1 if you have the declaration of 'nanosleep', and to 0 if you
don't. */
/* #undef HAVE_DECL_NANOSLEEP */
/* Define to 1 if you have the declaration of 'posix_memalign', and to 0 if
you don't. */
// We keep it simple for generic config.h and assume anything
// non-windows is modern enough.
#ifndef _WIN32
#define HAVE_DECL_POSIX_MEMALIGN 1
#endif
/* Define to 1 if you have the declaration of 'pvalloc', and to 0 if you
don't. */
#if __linux__
// same as memalign above.
#define HAVE_DECL_PVALLOC 1
#endif
// Nothing else is using it
#if defined(__MINGW32__)
#define HAVE_DECL_SLEEP 1
#define HAVE_DECL_NANOSLEEP 1
#endif
/* Define to 1 if you have the declaration of 'valloc', and to 0 if you don't.
*/
#if __linux__
// same as memalign above
#define HAVE_DECL_VALLOC 1
#endif
/* Define to 1 if you have the <dlfcn.h> header file. */
#if defined __has_include
# if __has_include(<dlfcn.h>)
# define HAVE_DLFCN_H 1
# endif
#endif
/* Define to 1 if you have the <execinfo.h> header file. */
#if defined __has_include
# if __has_include(<execinfo.h>)
# define HAVE_EXECINFO_H 1
# endif
#endif
/* Define to 1 if you have the <fcntl.h> header file. */
#if defined __has_include
# if __has_include(<fcntl.h>)
# define HAVE_FCNTL_H 1
# endif
#endif
/* Define to 1 if you have the <features.h> header file. */
#if defined __has_include
# if __has_include(<features.h>)
# include <features.h> // for __GLIBC__ define below and elsewhere
# endif
#endif
/* Define to 1 if you have the 'geteuid' function. */
#ifndef _WIN32
#define HAVE_GETEUID 1
#endif
/* Define to 1 if you have the <glob.h> header file. */
#if defined __has_include
# if __has_include(<glob.h>)
# define HAVE_GLOB_H 1
# endif
#endif
/* Define to 1 if you have the <inttypes.h> header file. */
#if defined __has_include
# if __has_include(<inttypes.h>)
# define HAVE_INTTYPES_H 1
# endif
#endif
/* Define to 1 if you have the <libunwind.h> header file. */
#if defined __has_include
# if __has_include(<libunwind.h>)
# define HAVE_LIBUNWIND_H 1
# endif
#endif
/* Define if this is Linux that has SIGEV_THREAD_ID */
#if __linux__
#define HAVE_LINUX_SIGEV_THREAD_ID 1
#endif
/* Define to 1 if you have the <malloc.h> header file. */
#if defined __has_include
# if __has_include(<malloc.h>)
# define HAVE_MALLOC_H 1
# endif
#endif
/* Define to 1 if you have a working `mmap' system call. */
#ifndef _WIN32
#define HAVE_MMAP 1
#endif
/* define if libc has program_invocation_name */
#if __linux__
#define HAVE_PROGRAM_INVOCATION_NAME 1
#endif
/* Define to 1 if you have the 'sbrk' function. */
#if __linux__
// Some BSDs already started removing sbrk. So we keep it simple for
// now.
#define HAVE_SBRK 1
#endif
/* Define to 1 if you have the <sched.h> header file. */
#if defined __has_include
# if __has_include(<sched.h>)
# define HAVE_SCHED_H 1
# endif
#endif
/* Define to 1 if you have the <sys/cdefs.h> header file. */
#if defined __has_include
# if __has_include(<sys/cdefs.h>)
# define HAVE_SYS_CDEFS_H 1
# endif
#endif
/* Define to 1 if you have the <sys/stat.h> header file. */
#if defined __has_include
# if __has_include(<sys/stat.h>)
# define HAVE_SYS_STAT_H 1
# endif
#endif
/* Define to 1 if you have the <sys/syscall.h> header file. */
#if defined __has_include
# if __has_include(<sys/syscall.h>)
# define HAVE_SYS_SYSCALL_H 1
# endif
#endif
/* Define to 1 if you have the <sys/types.h> header file. */
#if defined __has_include
# if __has_include(<sys/types.h>)
# define HAVE_SYS_TYPES_H 1
# endif
#endif
/* Define to 1 if you have the <sys/ucontext.h> header file. */
#if defined __has_include
# if __has_include(<sys/ucontext.h>)
# define HAVE_SYS_UCONTEXT_H 1
# endif
#endif
/* Define to 1 if you have the <ucontext.h> header file. */
#if defined __has_include
# if __has_include(<ucontext.h>)
# define HAVE_UCONTEXT_H 1
# endif
#endif
/* Define to 1 if you have the <unistd.h> header file. */
#if defined __has_include
# if __has_include(<unistd.h>) && !defined(_WIN32)
# define HAVE_UNISTD_H 1
# endif
#endif
/* Whether <unwind.h> contains _Unwind_Backtrace */
// Apparently both clang (even with -stdlib=libc++) and gcc have
// Unwind_Backtrace. But we seem to be avoiding it on OSX and FreeBSD,
// reportedly due to recursing back into malloc (see matching comment
// in configure.ac)
#if defined(__GNUC__) && !defined(__APPLE__) && !defined(__FreeBSD__)
#define HAVE_UNWIND_BACKTRACE 1
#endif
#ifdef __GNUC__
/* define if your compiler has __attribute__ */
#define HAVE___ATTRIBUTE__ 1
/* define if your compiler supports alignment of functions */
#define HAVE___ATTRIBUTE__ALIGNED_FN 1
#endif
/* dllexport or attribute visibility */
#ifndef PERFTOOLS_DLL_DECL
#define PERFTOOLS_DLL_DECL /**/
#endif
/* if libgcc stacktrace method should be default */
/* #undef PREFER_LIBGCC_UNWINDER */
/* Define 8 bytes of allocation alignment for tcmalloc */
/* #undef TCMALLOC_ALIGN_8BYTES */
/* Define internal page size for tcmalloc as number of left bitshift */
/* #undef TCMALLOC_PAGE_SIZE_SHIFT */
/* libunwind.h was found and is working */
//#define USE_LIBUNWIND 1
/* C99 says: define this to get the PRI... macros from stdint.h */
#ifndef __STDC_FORMAT_MACROS
# define __STDC_FORMAT_MACROS 1
#endif
#ifdef _WIN32
// TODO(csilvers): include windows/port.h in every relevant source file instead?
#include "windows/port.h"
#endif
#endif /* #ifndef GPERFTOOLS_CONFIG_H_ */
|