1*1208bc7eSAndroid Build Coastguard WorkerBuilding and installing a packaged release of jemalloc can be as simple as 2*1208bc7eSAndroid Build Coastguard Workertyping the following while in the root directory of the source tree: 3*1208bc7eSAndroid Build Coastguard Worker 4*1208bc7eSAndroid Build Coastguard Worker ./configure 5*1208bc7eSAndroid Build Coastguard Worker make 6*1208bc7eSAndroid Build Coastguard Worker make install 7*1208bc7eSAndroid Build Coastguard Worker 8*1208bc7eSAndroid Build Coastguard WorkerIf building from unpackaged developer sources, the simplest command sequence 9*1208bc7eSAndroid Build Coastguard Workerthat might work is: 10*1208bc7eSAndroid Build Coastguard Worker 11*1208bc7eSAndroid Build Coastguard Worker ./autogen.sh 12*1208bc7eSAndroid Build Coastguard Worker make dist 13*1208bc7eSAndroid Build Coastguard Worker make 14*1208bc7eSAndroid Build Coastguard Worker make install 15*1208bc7eSAndroid Build Coastguard Worker 16*1208bc7eSAndroid Build Coastguard WorkerNote that documentation is not built by the default target because doing so 17*1208bc7eSAndroid Build Coastguard Workerwould create a dependency on xsltproc in packaged releases, hence the 18*1208bc7eSAndroid Build Coastguard Workerrequirement to either run 'make dist' or avoid installing docs via the various 19*1208bc7eSAndroid Build Coastguard Workerinstall_* targets documented below. 20*1208bc7eSAndroid Build Coastguard Worker 21*1208bc7eSAndroid Build Coastguard Worker 22*1208bc7eSAndroid Build Coastguard Worker## Advanced configuration 23*1208bc7eSAndroid Build Coastguard Worker 24*1208bc7eSAndroid Build Coastguard WorkerThe 'configure' script supports numerous options that allow control of which 25*1208bc7eSAndroid Build Coastguard Workerfunctionality is enabled, where jemalloc is installed, etc. Optionally, pass 26*1208bc7eSAndroid Build Coastguard Workerany of the following arguments (not a definitive list) to 'configure': 27*1208bc7eSAndroid Build Coastguard Worker 28*1208bc7eSAndroid Build Coastguard Worker* `--help` 29*1208bc7eSAndroid Build Coastguard Worker 30*1208bc7eSAndroid Build Coastguard Worker Print a definitive list of options. 31*1208bc7eSAndroid Build Coastguard Worker 32*1208bc7eSAndroid Build Coastguard Worker* `--prefix=<install-root-dir>` 33*1208bc7eSAndroid Build Coastguard Worker 34*1208bc7eSAndroid Build Coastguard Worker Set the base directory in which to install. For example: 35*1208bc7eSAndroid Build Coastguard Worker 36*1208bc7eSAndroid Build Coastguard Worker ./configure --prefix=/usr/local 37*1208bc7eSAndroid Build Coastguard Worker 38*1208bc7eSAndroid Build Coastguard Worker will cause files to be installed into /usr/local/include, /usr/local/lib, 39*1208bc7eSAndroid Build Coastguard Worker and /usr/local/man. 40*1208bc7eSAndroid Build Coastguard Worker 41*1208bc7eSAndroid Build Coastguard Worker* `--with-version=(<major>.<minor>.<bugfix>-<nrev>-g<gid>|VERSION)` 42*1208bc7eSAndroid Build Coastguard Worker 43*1208bc7eSAndroid Build Coastguard Worker The VERSION file is mandatory for successful configuration, and the 44*1208bc7eSAndroid Build Coastguard Worker following steps are taken to assure its presence: 45*1208bc7eSAndroid Build Coastguard Worker 1) If --with-version=<major>.<minor>.<bugfix>-<nrev>-g<gid> is specified, 46*1208bc7eSAndroid Build Coastguard Worker generate VERSION using the specified value. 47*1208bc7eSAndroid Build Coastguard Worker 2) If --with-version is not specified in either form and the source 48*1208bc7eSAndroid Build Coastguard Worker directory is inside a git repository, try to generate VERSION via 'git 49*1208bc7eSAndroid Build Coastguard Worker describe' invocations that pattern-match release tags. 50*1208bc7eSAndroid Build Coastguard Worker 3) If VERSION is missing, generate it with a bogus version: 51*1208bc7eSAndroid Build Coastguard Worker 0.0.0-0-g0000000000000000000000000000000000000000 52*1208bc7eSAndroid Build Coastguard Worker 53*1208bc7eSAndroid Build Coastguard Worker Note that --with-version=VERSION bypasses (1) and (2), which simplifies 54*1208bc7eSAndroid Build Coastguard Worker VERSION configuration when embedding a jemalloc release into another 55*1208bc7eSAndroid Build Coastguard Worker project's git repository. 56*1208bc7eSAndroid Build Coastguard Worker 57*1208bc7eSAndroid Build Coastguard Worker* `--with-rpath=<colon-separated-rpath>` 58*1208bc7eSAndroid Build Coastguard Worker 59*1208bc7eSAndroid Build Coastguard Worker Embed one or more library paths, so that libjemalloc can find the libraries 60*1208bc7eSAndroid Build Coastguard Worker it is linked to. This works only on ELF-based systems. 61*1208bc7eSAndroid Build Coastguard Worker 62*1208bc7eSAndroid Build Coastguard Worker* `--with-mangling=<map>` 63*1208bc7eSAndroid Build Coastguard Worker 64*1208bc7eSAndroid Build Coastguard Worker Mangle public symbols specified in <map> which is a comma-separated list of 65*1208bc7eSAndroid Build Coastguard Worker name:mangled pairs. 66*1208bc7eSAndroid Build Coastguard Worker 67*1208bc7eSAndroid Build Coastguard Worker For example, to use ld's --wrap option as an alternative method for 68*1208bc7eSAndroid Build Coastguard Worker overriding libc's malloc implementation, specify something like: 69*1208bc7eSAndroid Build Coastguard Worker 70*1208bc7eSAndroid Build Coastguard Worker --with-mangling=malloc:__wrap_malloc,free:__wrap_free[...] 71*1208bc7eSAndroid Build Coastguard Worker 72*1208bc7eSAndroid Build Coastguard Worker Note that mangling happens prior to application of the prefix specified by 73*1208bc7eSAndroid Build Coastguard Worker --with-jemalloc-prefix, and mangled symbols are then ignored when applying 74*1208bc7eSAndroid Build Coastguard Worker the prefix. 75*1208bc7eSAndroid Build Coastguard Worker 76*1208bc7eSAndroid Build Coastguard Worker* `--with-jemalloc-prefix=<prefix>` 77*1208bc7eSAndroid Build Coastguard Worker 78*1208bc7eSAndroid Build Coastguard Worker Prefix all public APIs with <prefix>. For example, if <prefix> is 79*1208bc7eSAndroid Build Coastguard Worker "prefix_", API changes like the following occur: 80*1208bc7eSAndroid Build Coastguard Worker 81*1208bc7eSAndroid Build Coastguard Worker malloc() --> prefix_malloc() 82*1208bc7eSAndroid Build Coastguard Worker malloc_conf --> prefix_malloc_conf 83*1208bc7eSAndroid Build Coastguard Worker /etc/malloc.conf --> /etc/prefix_malloc.conf 84*1208bc7eSAndroid Build Coastguard Worker MALLOC_CONF --> PREFIX_MALLOC_CONF 85*1208bc7eSAndroid Build Coastguard Worker 86*1208bc7eSAndroid Build Coastguard Worker This makes it possible to use jemalloc at the same time as the system 87*1208bc7eSAndroid Build Coastguard Worker allocator, or even to use multiple copies of jemalloc simultaneously. 88*1208bc7eSAndroid Build Coastguard Worker 89*1208bc7eSAndroid Build Coastguard Worker By default, the prefix is "", except on OS X, where it is "je_". On OS X, 90*1208bc7eSAndroid Build Coastguard Worker jemalloc overlays the default malloc zone, but makes no attempt to actually 91*1208bc7eSAndroid Build Coastguard Worker replace the "malloc", "calloc", etc. symbols. 92*1208bc7eSAndroid Build Coastguard Worker 93*1208bc7eSAndroid Build Coastguard Worker* `--without-export` 94*1208bc7eSAndroid Build Coastguard Worker 95*1208bc7eSAndroid Build Coastguard Worker Don't export public APIs. This can be useful when building jemalloc as a 96*1208bc7eSAndroid Build Coastguard Worker static library, or to avoid exporting public APIs when using the zone 97*1208bc7eSAndroid Build Coastguard Worker allocator on OSX. 98*1208bc7eSAndroid Build Coastguard Worker 99*1208bc7eSAndroid Build Coastguard Worker* `--with-private-namespace=<prefix>` 100*1208bc7eSAndroid Build Coastguard Worker 101*1208bc7eSAndroid Build Coastguard Worker Prefix all library-private APIs with <prefix>je_. For shared libraries, 102*1208bc7eSAndroid Build Coastguard Worker symbol visibility mechanisms prevent these symbols from being exported, but 103*1208bc7eSAndroid Build Coastguard Worker for static libraries, naming collisions are a real possibility. By 104*1208bc7eSAndroid Build Coastguard Worker default, <prefix> is empty, which results in a symbol prefix of je_ . 105*1208bc7eSAndroid Build Coastguard Worker 106*1208bc7eSAndroid Build Coastguard Worker* `--with-install-suffix=<suffix>` 107*1208bc7eSAndroid Build Coastguard Worker 108*1208bc7eSAndroid Build Coastguard Worker Append <suffix> to the base name of all installed files, such that multiple 109*1208bc7eSAndroid Build Coastguard Worker versions of jemalloc can coexist in the same installation directory. For 110*1208bc7eSAndroid Build Coastguard Worker example, libjemalloc.so.0 becomes libjemalloc<suffix>.so.0. 111*1208bc7eSAndroid Build Coastguard Worker 112*1208bc7eSAndroid Build Coastguard Worker* `--with-malloc-conf=<malloc_conf>` 113*1208bc7eSAndroid Build Coastguard Worker 114*1208bc7eSAndroid Build Coastguard Worker Embed `<malloc_conf>` as a run-time options string that is processed prior to 115*1208bc7eSAndroid Build Coastguard Worker the malloc_conf global variable, the /etc/malloc.conf symlink, and the 116*1208bc7eSAndroid Build Coastguard Worker MALLOC_CONF environment variable. For example, to change the default decay 117*1208bc7eSAndroid Build Coastguard Worker time to 30 seconds: 118*1208bc7eSAndroid Build Coastguard Worker 119*1208bc7eSAndroid Build Coastguard Worker --with-malloc-conf=decay_ms:30000 120*1208bc7eSAndroid Build Coastguard Worker 121*1208bc7eSAndroid Build Coastguard Worker* `--enable-debug` 122*1208bc7eSAndroid Build Coastguard Worker 123*1208bc7eSAndroid Build Coastguard Worker Enable assertions and validation code. This incurs a substantial 124*1208bc7eSAndroid Build Coastguard Worker performance hit, but is very useful during application development. 125*1208bc7eSAndroid Build Coastguard Worker 126*1208bc7eSAndroid Build Coastguard Worker* `--disable-stats` 127*1208bc7eSAndroid Build Coastguard Worker 128*1208bc7eSAndroid Build Coastguard Worker Disable statistics gathering functionality. See the "opt.stats_print" 129*1208bc7eSAndroid Build Coastguard Worker option documentation for usage details. 130*1208bc7eSAndroid Build Coastguard Worker 131*1208bc7eSAndroid Build Coastguard Worker* `--enable-prof` 132*1208bc7eSAndroid Build Coastguard Worker 133*1208bc7eSAndroid Build Coastguard Worker Enable heap profiling and leak detection functionality. See the "opt.prof" 134*1208bc7eSAndroid Build Coastguard Worker option documentation for usage details. When enabled, there are several 135*1208bc7eSAndroid Build Coastguard Worker approaches to backtracing, and the configure script chooses the first one 136*1208bc7eSAndroid Build Coastguard Worker in the following list that appears to function correctly: 137*1208bc7eSAndroid Build Coastguard Worker 138*1208bc7eSAndroid Build Coastguard Worker + libunwind (requires --enable-prof-libunwind) 139*1208bc7eSAndroid Build Coastguard Worker + libgcc (unless --disable-prof-libgcc) 140*1208bc7eSAndroid Build Coastguard Worker + gcc intrinsics (unless --disable-prof-gcc) 141*1208bc7eSAndroid Build Coastguard Worker 142*1208bc7eSAndroid Build Coastguard Worker* `--enable-prof-libunwind` 143*1208bc7eSAndroid Build Coastguard Worker 144*1208bc7eSAndroid Build Coastguard Worker Use the libunwind library (http://www.nongnu.org/libunwind/) for stack 145*1208bc7eSAndroid Build Coastguard Worker backtracing. 146*1208bc7eSAndroid Build Coastguard Worker 147*1208bc7eSAndroid Build Coastguard Worker* `--disable-prof-libgcc` 148*1208bc7eSAndroid Build Coastguard Worker 149*1208bc7eSAndroid Build Coastguard Worker Disable the use of libgcc's backtracing functionality. 150*1208bc7eSAndroid Build Coastguard Worker 151*1208bc7eSAndroid Build Coastguard Worker* `--disable-prof-gcc` 152*1208bc7eSAndroid Build Coastguard Worker 153*1208bc7eSAndroid Build Coastguard Worker Disable the use of gcc intrinsics for backtracing. 154*1208bc7eSAndroid Build Coastguard Worker 155*1208bc7eSAndroid Build Coastguard Worker* `--with-static-libunwind=<libunwind.a>` 156*1208bc7eSAndroid Build Coastguard Worker 157*1208bc7eSAndroid Build Coastguard Worker Statically link against the specified libunwind.a rather than dynamically 158*1208bc7eSAndroid Build Coastguard Worker linking with -lunwind. 159*1208bc7eSAndroid Build Coastguard Worker 160*1208bc7eSAndroid Build Coastguard Worker* `--disable-fill` 161*1208bc7eSAndroid Build Coastguard Worker 162*1208bc7eSAndroid Build Coastguard Worker Disable support for junk/zero filling of memory. See the "opt.junk" and 163*1208bc7eSAndroid Build Coastguard Worker "opt.zero" option documentation for usage details. 164*1208bc7eSAndroid Build Coastguard Worker 165*1208bc7eSAndroid Build Coastguard Worker* `--disable-zone-allocator` 166*1208bc7eSAndroid Build Coastguard Worker 167*1208bc7eSAndroid Build Coastguard Worker Disable zone allocator for Darwin. This means jemalloc won't be hooked as 168*1208bc7eSAndroid Build Coastguard Worker the default allocator on OSX/iOS. 169*1208bc7eSAndroid Build Coastguard Worker 170*1208bc7eSAndroid Build Coastguard Worker* `--enable-utrace` 171*1208bc7eSAndroid Build Coastguard Worker 172*1208bc7eSAndroid Build Coastguard Worker Enable utrace(2)-based allocation tracing. This feature is not broadly 173*1208bc7eSAndroid Build Coastguard Worker portable (FreeBSD has it, but Linux and OS X do not). 174*1208bc7eSAndroid Build Coastguard Worker 175*1208bc7eSAndroid Build Coastguard Worker* `--enable-xmalloc` 176*1208bc7eSAndroid Build Coastguard Worker 177*1208bc7eSAndroid Build Coastguard Worker Enable support for optional immediate termination due to out-of-memory 178*1208bc7eSAndroid Build Coastguard Worker errors, as is commonly implemented by "xmalloc" wrapper function for malloc. 179*1208bc7eSAndroid Build Coastguard Worker See the "opt.xmalloc" option documentation for usage details. 180*1208bc7eSAndroid Build Coastguard Worker 181*1208bc7eSAndroid Build Coastguard Worker* `--enable-lazy-lock` 182*1208bc7eSAndroid Build Coastguard Worker 183*1208bc7eSAndroid Build Coastguard Worker Enable code that wraps pthread_create() to detect when an application 184*1208bc7eSAndroid Build Coastguard Worker switches from single-threaded to multi-threaded mode, so that it can avoid 185*1208bc7eSAndroid Build Coastguard Worker mutex locking/unlocking operations while in single-threaded mode. In 186*1208bc7eSAndroid Build Coastguard Worker practice, this feature usually has little impact on performance unless 187*1208bc7eSAndroid Build Coastguard Worker thread-specific caching is disabled. 188*1208bc7eSAndroid Build Coastguard Worker 189*1208bc7eSAndroid Build Coastguard Worker* `--disable-cache-oblivious` 190*1208bc7eSAndroid Build Coastguard Worker 191*1208bc7eSAndroid Build Coastguard Worker Disable cache-oblivious large allocation alignment for large allocation 192*1208bc7eSAndroid Build Coastguard Worker requests with no alignment constraints. If this feature is disabled, all 193*1208bc7eSAndroid Build Coastguard Worker large allocations are page-aligned as an implementation artifact, which can 194*1208bc7eSAndroid Build Coastguard Worker severely harm CPU cache utilization. However, the cache-oblivious layout 195*1208bc7eSAndroid Build Coastguard Worker comes at the cost of one extra page per large allocation, which in the 196*1208bc7eSAndroid Build Coastguard Worker most extreme case increases physical memory usage for the 16 KiB size class 197*1208bc7eSAndroid Build Coastguard Worker to 20 KiB. 198*1208bc7eSAndroid Build Coastguard Worker 199*1208bc7eSAndroid Build Coastguard Worker* `--disable-syscall` 200*1208bc7eSAndroid Build Coastguard Worker 201*1208bc7eSAndroid Build Coastguard Worker Disable use of syscall(2) rather than {open,read,write,close}(2). This is 202*1208bc7eSAndroid Build Coastguard Worker intended as a workaround for systems that place security limitations on 203*1208bc7eSAndroid Build Coastguard Worker syscall(2). 204*1208bc7eSAndroid Build Coastguard Worker 205*1208bc7eSAndroid Build Coastguard Worker* `--disable-cxx` 206*1208bc7eSAndroid Build Coastguard Worker 207*1208bc7eSAndroid Build Coastguard Worker Disable C++ integration. This will cause new and delete operator 208*1208bc7eSAndroid Build Coastguard Worker implementations to be omitted. 209*1208bc7eSAndroid Build Coastguard Worker 210*1208bc7eSAndroid Build Coastguard Worker* `--with-xslroot=<path>` 211*1208bc7eSAndroid Build Coastguard Worker 212*1208bc7eSAndroid Build Coastguard Worker Specify where to find DocBook XSL stylesheets when building the 213*1208bc7eSAndroid Build Coastguard Worker documentation. 214*1208bc7eSAndroid Build Coastguard Worker 215*1208bc7eSAndroid Build Coastguard Worker* `--with-lg-page=<lg-page>` 216*1208bc7eSAndroid Build Coastguard Worker 217*1208bc7eSAndroid Build Coastguard Worker Specify the base 2 log of the allocator page size, which must in turn be at 218*1208bc7eSAndroid Build Coastguard Worker least as large as the system page size. By default the configure script 219*1208bc7eSAndroid Build Coastguard Worker determines the host's page size and sets the allocator page size equal to 220*1208bc7eSAndroid Build Coastguard Worker the system page size, so this option need not be specified unless the 221*1208bc7eSAndroid Build Coastguard Worker system page size may change between configuration and execution, e.g. when 222*1208bc7eSAndroid Build Coastguard Worker cross compiling. 223*1208bc7eSAndroid Build Coastguard Worker 224*1208bc7eSAndroid Build Coastguard Worker* `--with-lg-page-sizes=<lg-page-sizes>` 225*1208bc7eSAndroid Build Coastguard Worker 226*1208bc7eSAndroid Build Coastguard Worker Specify the comma-separated base 2 logs of the page sizes to support. This 227*1208bc7eSAndroid Build Coastguard Worker option may be useful when cross compiling in combination with 228*1208bc7eSAndroid Build Coastguard Worker `--with-lg-page`, but its primary use case is for integration with FreeBSD's 229*1208bc7eSAndroid Build Coastguard Worker libc, wherein jemalloc is embedded. 230*1208bc7eSAndroid Build Coastguard Worker 231*1208bc7eSAndroid Build Coastguard Worker* `--with-lg-hugepage=<lg-hugepage>` 232*1208bc7eSAndroid Build Coastguard Worker 233*1208bc7eSAndroid Build Coastguard Worker Specify the base 2 log of the system huge page size. This option is useful 234*1208bc7eSAndroid Build Coastguard Worker when cross compiling, or when overriding the default for systems that do 235*1208bc7eSAndroid Build Coastguard Worker not explicitly support huge pages. 236*1208bc7eSAndroid Build Coastguard Worker 237*1208bc7eSAndroid Build Coastguard Worker* `--with-lg-quantum=<lg-quantum>` 238*1208bc7eSAndroid Build Coastguard Worker 239*1208bc7eSAndroid Build Coastguard Worker Specify the base 2 log of the minimum allocation alignment. jemalloc needs 240*1208bc7eSAndroid Build Coastguard Worker to know the minimum alignment that meets the following C standard 241*1208bc7eSAndroid Build Coastguard Worker requirement (quoted from the April 12, 2011 draft of the C11 standard): 242*1208bc7eSAndroid Build Coastguard Worker 243*1208bc7eSAndroid Build Coastguard Worker > The pointer returned if the allocation succeeds is suitably aligned so 244*1208bc7eSAndroid Build Coastguard Worker that it may be assigned to a pointer to any type of object with a 245*1208bc7eSAndroid Build Coastguard Worker fundamental alignment requirement and then used to access such an object 246*1208bc7eSAndroid Build Coastguard Worker or an array of such objects in the space allocated [...] 247*1208bc7eSAndroid Build Coastguard Worker 248*1208bc7eSAndroid Build Coastguard Worker This setting is architecture-specific, and although jemalloc includes known 249*1208bc7eSAndroid Build Coastguard Worker safe values for the most commonly used modern architectures, there is a 250*1208bc7eSAndroid Build Coastguard Worker wrinkle related to GNU libc (glibc) that may impact your choice of 251*1208bc7eSAndroid Build Coastguard Worker <lg-quantum>. On most modern architectures, this mandates 16-byte 252*1208bc7eSAndroid Build Coastguard Worker alignment (<lg-quantum>=4), but the glibc developers chose not to meet this 253*1208bc7eSAndroid Build Coastguard Worker requirement for performance reasons. An old discussion can be found at 254*1208bc7eSAndroid Build Coastguard Worker <https://sourceware.org/bugzilla/show_bug.cgi?id=206> . Unlike glibc, 255*1208bc7eSAndroid Build Coastguard Worker jemalloc does follow the C standard by default (caveat: jemalloc 256*1208bc7eSAndroid Build Coastguard Worker technically cheats for size classes smaller than the quantum), but the fact 257*1208bc7eSAndroid Build Coastguard Worker that Linux systems already work around this allocator noncompliance means 258*1208bc7eSAndroid Build Coastguard Worker that it is generally safe in practice to let jemalloc's minimum alignment 259*1208bc7eSAndroid Build Coastguard Worker follow glibc's lead. If you specify `--with-lg-quantum=3` during 260*1208bc7eSAndroid Build Coastguard Worker configuration, jemalloc will provide additional size classes that are not 261*1208bc7eSAndroid Build Coastguard Worker 16-byte-aligned (24, 40, and 56). 262*1208bc7eSAndroid Build Coastguard Worker 263*1208bc7eSAndroid Build Coastguard Worker* `--with-lg-vaddr=<lg-vaddr>` 264*1208bc7eSAndroid Build Coastguard Worker 265*1208bc7eSAndroid Build Coastguard Worker Specify the number of significant virtual address bits. By default, the 266*1208bc7eSAndroid Build Coastguard Worker configure script attempts to detect virtual address size on those platforms 267*1208bc7eSAndroid Build Coastguard Worker where it knows how, and picks a default otherwise. This option may be 268*1208bc7eSAndroid Build Coastguard Worker useful when cross-compiling. 269*1208bc7eSAndroid Build Coastguard Worker 270*1208bc7eSAndroid Build Coastguard Worker* `--disable-initial-exec-tls` 271*1208bc7eSAndroid Build Coastguard Worker 272*1208bc7eSAndroid Build Coastguard Worker Disable the initial-exec TLS model for jemalloc's internal thread-local 273*1208bc7eSAndroid Build Coastguard Worker storage (on those platforms that support explicit settings). This can allow 274*1208bc7eSAndroid Build Coastguard Worker jemalloc to be dynamically loaded after program startup (e.g. using dlopen). 275*1208bc7eSAndroid Build Coastguard Worker Note that in this case, there will be two malloc implementations operating 276*1208bc7eSAndroid Build Coastguard Worker in the same process, which will almost certainly result in confusing runtime 277*1208bc7eSAndroid Build Coastguard Worker crashes if pointers leak from one implementation to the other. 278*1208bc7eSAndroid Build Coastguard Worker 279*1208bc7eSAndroid Build Coastguard WorkerThe following environment variables (not a definitive list) impact configure's 280*1208bc7eSAndroid Build Coastguard Workerbehavior: 281*1208bc7eSAndroid Build Coastguard Worker 282*1208bc7eSAndroid Build Coastguard Worker* `CFLAGS="?"` 283*1208bc7eSAndroid Build Coastguard Worker* `CXXFLAGS="?"` 284*1208bc7eSAndroid Build Coastguard Worker 285*1208bc7eSAndroid Build Coastguard Worker Pass these flags to the C/C++ compiler. Any flags set by the configure 286*1208bc7eSAndroid Build Coastguard Worker script are prepended, which means explicitly set flags generally take 287*1208bc7eSAndroid Build Coastguard Worker precedence. Take care when specifying flags such as -Werror, because 288*1208bc7eSAndroid Build Coastguard Worker configure tests may be affected in undesirable ways. 289*1208bc7eSAndroid Build Coastguard Worker 290*1208bc7eSAndroid Build Coastguard Worker* `EXTRA_CFLAGS="?"` 291*1208bc7eSAndroid Build Coastguard Worker* `EXTRA_CXXFLAGS="?"` 292*1208bc7eSAndroid Build Coastguard Worker 293*1208bc7eSAndroid Build Coastguard Worker Append these flags to CFLAGS/CXXFLAGS, without passing them to the 294*1208bc7eSAndroid Build Coastguard Worker compiler(s) during configuration. This makes it possible to add flags such 295*1208bc7eSAndroid Build Coastguard Worker as -Werror, while allowing the configure script to determine what other 296*1208bc7eSAndroid Build Coastguard Worker flags are appropriate for the specified configuration. 297*1208bc7eSAndroid Build Coastguard Worker 298*1208bc7eSAndroid Build Coastguard Worker* `CPPFLAGS="?"` 299*1208bc7eSAndroid Build Coastguard Worker 300*1208bc7eSAndroid Build Coastguard Worker Pass these flags to the C preprocessor. Note that CFLAGS is not passed to 301*1208bc7eSAndroid Build Coastguard Worker 'cpp' when 'configure' is looking for include files, so you must use 302*1208bc7eSAndroid Build Coastguard Worker CPPFLAGS instead if you need to help 'configure' find header files. 303*1208bc7eSAndroid Build Coastguard Worker 304*1208bc7eSAndroid Build Coastguard Worker* `LD_LIBRARY_PATH="?"` 305*1208bc7eSAndroid Build Coastguard Worker 306*1208bc7eSAndroid Build Coastguard Worker 'ld' uses this colon-separated list to find libraries. 307*1208bc7eSAndroid Build Coastguard Worker 308*1208bc7eSAndroid Build Coastguard Worker* `LDFLAGS="?"` 309*1208bc7eSAndroid Build Coastguard Worker 310*1208bc7eSAndroid Build Coastguard Worker Pass these flags when linking. 311*1208bc7eSAndroid Build Coastguard Worker 312*1208bc7eSAndroid Build Coastguard Worker* `PATH="?"` 313*1208bc7eSAndroid Build Coastguard Worker 314*1208bc7eSAndroid Build Coastguard Worker 'configure' uses this to find programs. 315*1208bc7eSAndroid Build Coastguard Worker 316*1208bc7eSAndroid Build Coastguard WorkerIn some cases it may be necessary to work around configuration results that do 317*1208bc7eSAndroid Build Coastguard Workernot match reality. For example, Linux 4.5 added support for the MADV_FREE flag 318*1208bc7eSAndroid Build Coastguard Workerto madvise(2), which can cause problems if building on a host with MADV_FREE 319*1208bc7eSAndroid Build Coastguard Workersupport and deploying to a target without. To work around this, use a cache 320*1208bc7eSAndroid Build Coastguard Workerfile to override the relevant configuration variable defined in configure.ac, 321*1208bc7eSAndroid Build Coastguard Workere.g.: 322*1208bc7eSAndroid Build Coastguard Worker 323*1208bc7eSAndroid Build Coastguard Worker echo "je_cv_madv_free=no" > config.cache && ./configure -C 324*1208bc7eSAndroid Build Coastguard Worker 325*1208bc7eSAndroid Build Coastguard Worker 326*1208bc7eSAndroid Build Coastguard Worker## Advanced compilation 327*1208bc7eSAndroid Build Coastguard Worker 328*1208bc7eSAndroid Build Coastguard WorkerTo build only parts of jemalloc, use the following targets: 329*1208bc7eSAndroid Build Coastguard Worker 330*1208bc7eSAndroid Build Coastguard Worker build_lib_shared 331*1208bc7eSAndroid Build Coastguard Worker build_lib_static 332*1208bc7eSAndroid Build Coastguard Worker build_lib 333*1208bc7eSAndroid Build Coastguard Worker build_doc_html 334*1208bc7eSAndroid Build Coastguard Worker build_doc_man 335*1208bc7eSAndroid Build Coastguard Worker build_doc 336*1208bc7eSAndroid Build Coastguard Worker 337*1208bc7eSAndroid Build Coastguard WorkerTo install only parts of jemalloc, use the following targets: 338*1208bc7eSAndroid Build Coastguard Worker 339*1208bc7eSAndroid Build Coastguard Worker install_bin 340*1208bc7eSAndroid Build Coastguard Worker install_include 341*1208bc7eSAndroid Build Coastguard Worker install_lib_shared 342*1208bc7eSAndroid Build Coastguard Worker install_lib_static 343*1208bc7eSAndroid Build Coastguard Worker install_lib_pc 344*1208bc7eSAndroid Build Coastguard Worker install_lib 345*1208bc7eSAndroid Build Coastguard Worker install_doc_html 346*1208bc7eSAndroid Build Coastguard Worker install_doc_man 347*1208bc7eSAndroid Build Coastguard Worker install_doc 348*1208bc7eSAndroid Build Coastguard Worker 349*1208bc7eSAndroid Build Coastguard WorkerTo clean up build results to varying degrees, use the following make targets: 350*1208bc7eSAndroid Build Coastguard Worker 351*1208bc7eSAndroid Build Coastguard Worker clean 352*1208bc7eSAndroid Build Coastguard Worker distclean 353*1208bc7eSAndroid Build Coastguard Worker relclean 354*1208bc7eSAndroid Build Coastguard Worker 355*1208bc7eSAndroid Build Coastguard Worker 356*1208bc7eSAndroid Build Coastguard Worker## Advanced installation 357*1208bc7eSAndroid Build Coastguard Worker 358*1208bc7eSAndroid Build Coastguard WorkerOptionally, define make variables when invoking make, including (not 359*1208bc7eSAndroid Build Coastguard Workerexclusively): 360*1208bc7eSAndroid Build Coastguard Worker 361*1208bc7eSAndroid Build Coastguard Worker* `INCLUDEDIR="?"` 362*1208bc7eSAndroid Build Coastguard Worker 363*1208bc7eSAndroid Build Coastguard Worker Use this as the installation prefix for header files. 364*1208bc7eSAndroid Build Coastguard Worker 365*1208bc7eSAndroid Build Coastguard Worker* `LIBDIR="?"` 366*1208bc7eSAndroid Build Coastguard Worker 367*1208bc7eSAndroid Build Coastguard Worker Use this as the installation prefix for libraries. 368*1208bc7eSAndroid Build Coastguard Worker 369*1208bc7eSAndroid Build Coastguard Worker* `MANDIR="?"` 370*1208bc7eSAndroid Build Coastguard Worker 371*1208bc7eSAndroid Build Coastguard Worker Use this as the installation prefix for man pages. 372*1208bc7eSAndroid Build Coastguard Worker 373*1208bc7eSAndroid Build Coastguard Worker* `DESTDIR="?"` 374*1208bc7eSAndroid Build Coastguard Worker 375*1208bc7eSAndroid Build Coastguard Worker Prepend DESTDIR to INCLUDEDIR, LIBDIR, DATADIR, and MANDIR. This is useful 376*1208bc7eSAndroid Build Coastguard Worker when installing to a different path than was specified via --prefix. 377*1208bc7eSAndroid Build Coastguard Worker 378*1208bc7eSAndroid Build Coastguard Worker* `CC="?"` 379*1208bc7eSAndroid Build Coastguard Worker 380*1208bc7eSAndroid Build Coastguard Worker Use this to invoke the C compiler. 381*1208bc7eSAndroid Build Coastguard Worker 382*1208bc7eSAndroid Build Coastguard Worker* `CFLAGS="?"` 383*1208bc7eSAndroid Build Coastguard Worker 384*1208bc7eSAndroid Build Coastguard Worker Pass these flags to the compiler. 385*1208bc7eSAndroid Build Coastguard Worker 386*1208bc7eSAndroid Build Coastguard Worker* `CPPFLAGS="?"` 387*1208bc7eSAndroid Build Coastguard Worker 388*1208bc7eSAndroid Build Coastguard Worker Pass these flags to the C preprocessor. 389*1208bc7eSAndroid Build Coastguard Worker 390*1208bc7eSAndroid Build Coastguard Worker* `LDFLAGS="?"` 391*1208bc7eSAndroid Build Coastguard Worker 392*1208bc7eSAndroid Build Coastguard Worker Pass these flags when linking. 393*1208bc7eSAndroid Build Coastguard Worker 394*1208bc7eSAndroid Build Coastguard Worker* `PATH="?"` 395*1208bc7eSAndroid Build Coastguard Worker 396*1208bc7eSAndroid Build Coastguard Worker Use this to search for programs used during configuration and building. 397*1208bc7eSAndroid Build Coastguard Worker 398*1208bc7eSAndroid Build Coastguard Worker 399*1208bc7eSAndroid Build Coastguard Worker## Development 400*1208bc7eSAndroid Build Coastguard Worker 401*1208bc7eSAndroid Build Coastguard WorkerIf you intend to make non-trivial changes to jemalloc, use the 'autogen.sh' 402*1208bc7eSAndroid Build Coastguard Workerscript rather than 'configure'. This re-generates 'configure', enables 403*1208bc7eSAndroid Build Coastguard Workerconfiguration dependency rules, and enables re-generation of automatically 404*1208bc7eSAndroid Build Coastguard Workergenerated source files. 405*1208bc7eSAndroid Build Coastguard Worker 406*1208bc7eSAndroid Build Coastguard WorkerThe build system supports using an object directory separate from the source 407*1208bc7eSAndroid Build Coastguard Workertree. For example, you can create an 'obj' directory, and from within that 408*1208bc7eSAndroid Build Coastguard Workerdirectory, issue configuration and build commands: 409*1208bc7eSAndroid Build Coastguard Worker 410*1208bc7eSAndroid Build Coastguard Worker autoconf 411*1208bc7eSAndroid Build Coastguard Worker mkdir obj 412*1208bc7eSAndroid Build Coastguard Worker cd obj 413*1208bc7eSAndroid Build Coastguard Worker ../configure --enable-autogen 414*1208bc7eSAndroid Build Coastguard Worker make 415*1208bc7eSAndroid Build Coastguard Worker 416*1208bc7eSAndroid Build Coastguard Worker 417*1208bc7eSAndroid Build Coastguard Worker## Documentation 418*1208bc7eSAndroid Build Coastguard Worker 419*1208bc7eSAndroid Build Coastguard WorkerThe manual page is generated in both html and roff formats. Any web browser 420*1208bc7eSAndroid Build Coastguard Workercan be used to view the html manual. The roff manual page can be formatted 421*1208bc7eSAndroid Build Coastguard Workerprior to installation via the following command: 422*1208bc7eSAndroid Build Coastguard Worker 423*1208bc7eSAndroid Build Coastguard Worker nroff -man -t doc/jemalloc.3 424