1# 2# SPDX-License-Identifier: BSD-3-Clause 3# 4# Copyright © 2019 Keith Packard 5# 6# Redistribution and use in source and binary forms, with or without 7# modification, are permitted provided that the following conditions 8# are met: 9# 10# 1. Redistributions of source code must retain the above copyright 11# notice, this list of conditions and the following disclaimer. 12# 13# 2. Redistributions in binary form must reproduce the above 14# copyright notice, this list of conditions and the following 15# disclaimer in the documentation and/or other materials provided 16# with the distribution. 17# 18# 3. Neither the name of the copyright holder nor the names of its 19# contributors may be used to endorse or promote products derived 20# from this software without specific prior written permission. 21# 22# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 23# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 24# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 25# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 26# COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 27# INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 28# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 29# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 30# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 31# STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 32# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 33# OF THE POSSIBILITY OF SUCH DAMAGE. 34# 35option('fast-strcmp', type: 'boolean', value: true, 36 description: 'Always optimize strcmp for performance') 37 38option('have-alias-attribute', type: 'combo', choices: ['true', 'false', 'auto'], value: 'auto', 39 description: 'Compiler supports __alias__ attribute') 40 41option('have-format-attribute', type: 'combo', choices: ['true', 'false', 'auto'], value: 'auto', 42 description: 'Compiler supports __format__ attribute') 43 44option('have-weak-attribute', type: 'combo', choices: ['true', 'false', 'auto'], value: 'auto', 45 description: 'Compiler supports __weak__ attribute') 46 47option('multilib', type: 'boolean', value: true, 48 description: 'Enable multilib compile') 49 50option('multilib-list', type: 'array', value: [], 51 description: 'List of multilib configurations to build for') 52 53option('multilib-exclude', type: 'array', value: [], 54 description: 'Multilib configurations containing any of these strings will not be built') 55 56option('build-type-subdir', type: 'string', 57 description: 'Build-type subdir. Also skips installing .specs file') 58 59option('picolib', type: 'boolean', value: true, 60 description: 'Include pico lib bits') 61 62option('picocrt', type: 'boolean', value: true, 63 description: 'Include pico crt bits') 64 65option('picocrt-lib', type: 'boolean', value: true, 66 description: 'Include pico crt bits in lib form') 67 68option('semihost', type: 'boolean', value: true, 69 description: 'Include semihost bits') 70 71option('specsdir', type: 'string', 72 description: 'Installation directory for .specs file') 73 74option('sysroot-install', type: 'boolean', value: false, 75 description: 'Install in gcc sysroot') 76 77option('sysroot-install-skip-checks', type: 'boolean', value: false, 78 description: 'Skip sysroot path checks during config') 79 80option('system-libc', type: 'boolean', value: false, 81 description: 'Install as system C library') 82 83option('picoexit', type: 'boolean', value: true, 84 description: 'Smaller exit/atexit/onexit code') 85 86option('sanitize-bounds', type: 'boolean', value: false, 87 description: 'Build the library with -fsanitize=bounds') 88 89option('sanitize-trap-on-error', type: 'boolean', value: false, 90 description: 'Build the library with -fsanitize-undefined-trap-on-error') 91 92option('use-stdlib', type: 'boolean', value: false, 93 description: 'Do not bypass the standard system library with -nostdlib (useful for native testing)') 94 95option('profile', type: 'boolean', value: false, 96 description: 'Enable profiling by adding -pg -no-pie to compile flags') 97 98option('freestanding', type: 'boolean', value: false, 99 description: 'Build the library with -ffreestanding (useful for Zephyr testing)') 100 101option('analyzer', type: 'boolean', value: false, 102 description: 'Enable the analyzer while compiling with -fanalyzer') 103 104option('assert-verbose', type: 'boolean', value: true, 105 description: 'Assert provides verbose information') 106 107# 108# Testing options 109# 110option('native-tests', type: 'boolean', value: false, 111 description: 'Run math tests against native libc too') 112option('tests', type: 'boolean', value: false, 113 description: 'Enable tests') 114option('tests-enable-stack-protector', type: 'boolean', value: true, 115 description: 'tests enable stack protector') 116option('tests-enable-full-malloc-stress', type: 'boolean', value: false, 117 description: 'tests enable stress test for full malloc') 118option('tests-enable-posix-io', type: 'boolean', value: true, 119 description: 'tests enable posix-io when available') 120option('test-long-double', type: 'boolean', value: true, 121 description: 'Enable long double tests on targets with long double type') 122option('split-large-tests', type: 'boolean', value: false, 123 description: 'Split large tests into pieces for smaller targets') 124option('test-stdin', type: 'boolean', value: false, 125 description: 'Enable tests that use stdin. This only works on a few targets') 126option('fortify-source', type: 'combo', choices: ['none', '1', '2'], value: '2', 127 description: 'Set _FORTIFY_SOURCE=<value> when building tests') 128 129option('tinystdio', type: 'boolean', value: true, 130 description: 'Use tiny stdio from avr libc') 131 132# 133# Options applying to both legacy stdio and tinystdio 134# 135option('io-c99-formats', type: 'boolean', value: true, 136 description: 'enable C99 support in IO functions like printf/scanf') 137option('newlib-io-c99-formats', type: 'combo', choices: ['true', 'false', 'auto'], value: 'auto', 138 description: 'enable C99 support in IO functions like printf/scanf') 139option('io-long-long', type: 'boolean', value: false, 140 description: 'enable long long type support in IO functions like printf/scanf') 141option('newlib-io-long-long', type: 'combo', choices: ['true', 'false', 'auto'], value: 'auto', 142 description: 'enable long long type support in IO functions like printf/scanf') 143option('io-pos-args', type: 'boolean', value: false, 144 description: 'enable printf-family positional arg support (always enabled for tinystdio float)') 145option('newlib-io-pos-args', type: 'combo', choices: ['true', 'false', 'auto'], value: 'auto', 146 description: 'enable printf-family positional arg support (always enabled for tinystdio float)') 147option('io-long-double', type: 'boolean', value: false, 148 description: 'enable long double type support in IO functions printf/scanf') 149option('newlib-io-long-double', type: 'boolean', value: false, 150 description: 'enable long double type support in IO functions printf/scanf') 151option('fast-bufio', type: 'boolean', value: false, 152 description: 'enable some faster buffered i/o operations') 153 154# 155# Options applying only to tinystdio 156# 157option('io-float-exact', type: 'boolean', value: true, 158 description: 'use float/string code which supports round-tripping') 159option('atomic-ungetc', type: 'boolean', value: true, 160 description: 'use atomics in fgetc/ungetc to make them re-entrant') 161option('posix-io', type: 'boolean', value: true, 162 description: 'Provide fopen/fdopen using POSIX I/O (open, close, read, write, lseek)') 163option('posix-console', type: 'boolean', value: false, 164 description: 'Use POSIX I/O for stdin/stdout/stderr') 165option('format-default', type: 'combo', choices: ['double', 'float', 'long-long', 'integer', 'minimal'], value: 'double', 166 description: 'which printf/scanf versions should be the default') 167option('printf-aliases', type: 'boolean', value: true, 168 description: 'Allow link-time printf aliases') 169option('io-percent-b', type: 'boolean', value: false, 170 description: 'enable proposed %b/%B format in printf and scanf in tinystdio (default: false)') 171option('printf-small-ultoa', type: 'boolean', value: true, 172 description: 'Avoid softare division in decimal conversions') 173option('minimal-io-long-long', type: 'boolean', value: false, 174 description: 'enable long long type support in minimal printf/scanf') 175 176# 177# Options applying to only legacy stdio 178# 179option('newlib-elix-level', type: 'integer', value: 4, 180 description: 'desired elix library level (0-4)') 181option('newlib-fseek-optimization', type: 'boolean', value: false, 182 description: 'enable fseek optimization') 183option('newlib-fvwrite-in-streamio', type: 'boolean', value: false, 184 description: 'disable iov in streamio') 185option('newlib-global-stdio-streams', type: 'boolean', value: false, 186 description: 'enable global stdio streams') 187option('newlib-io-float', type: 'boolean', value: false, 188 description: 'enable printf/scanf family float support') 189option('newlib-nano-formatted-io', type: 'boolean', value: false, 190 description: 'Use nano version formatted IO') 191option('newlib-reent-small', type: 'boolean', value: false, 192 description: 'enable small reentrant struct support') 193option('newlib-stdio64', type: 'boolean', value: true, 194 description: 'Include stdio64 with newlib stdio') 195option('newlib-unbuf-stream-opt', type: 'boolean', value: false, 196 description: 'enable unbuffered stream optimization in streamio') 197option('newlib-wide-orient', type: 'boolean', value: false, 198 description: 'Turn off wide orientation in streamio') 199option('newlib-have-fcntl', type: 'boolean', value: false, 200 description: 'System has fcntl function') 201 202# 203# Internationalization options 204# 205 206option('newlib-iconv-encodings', type: 'array', 207 description: 'enable specific comma-separated list of bidirectional iconv encodings to be built-in') 208option('newlib-iconv-from-encodings', type: 'array', 209 description: 'enable specific comma-separated list of "from" iconv encodings to be built-in') 210option('newlib-iconv-to-encodings', type: 'array', 211 description: 'enable specific comma-separated list of "to" iconv encodings to be built-in') 212option('newlib-iconv-external-ccs', type: 'boolean', value:false, 213 description: 'Load iconv CCS tables from files rather than having them built-in') 214option('newlib-iconv-dir', type: 'string', 215 description: 'Installation directory for iconv CCS files') 216option('newlib-iconv-runtime-dir', type: 'string', 217 description: 'Path used at runtime to locate iconv CCS files') 218option('newlib-iconv-encodings-exclude', type: 'array', 219 description: 'enable specific comma-separated list of bidirectional iconv encodings to be excluded') 220 221option('newlib-locale-info', type: 'boolean', value: false, 222 description: 'locale support') 223option('newlib-locale-info-extended', type: 'boolean', value: false, 224 description: 'extended locale support') 225option('newlib-mb', type: 'boolean', value: false, 226 description: 'enable multibyte support') 227 228# 229# Startup/shutdown options 230# 231option('lite-exit', type: 'boolean', value: true, 232 description: 'enable light weight exit') 233option('newlib-atexit-dynamic-alloc', type: 'boolean', value: false, 234 description: 'enable dynamic allocation of atexit entries') 235option('newlib-global-atexit', type: 'boolean', value: false, 236 description: 'enable atexit data structure as global') 237option('newlib-initfini', type: 'boolean', value: true, 238 description: 'Supports _init() and _fini()') 239option('newlib-initfini-array', type: 'boolean', value: true, 240 description: 'compiler supports INIT_ARRAY section types') 241option('newlib-register-fini', type: 'boolean', value: false, 242 description: 'enable finalization function registration using atexit') 243option('fake-semihost', type: 'boolean', value: false, 244 description: 'create fake semihost library to link tests') 245option('crt-runtime-size', type: 'boolean', value: false, 246 description: 'compute crt memory space sizes at runtime') 247option('atomic-signal', type: 'boolean', value: true, 248 description: 'use atomics in signal/raise to make them re-entrant') 249 250# 251# Malloc option 252# 253option('newlib-nano-malloc', type: 'boolean', value: true, 254 description: 'use small-footprint nano-malloc implementation') 255 256# 257# Locking support 258# 259option('newlib-multithread', type: 'boolean', value: true, 260 description: 'enable support for multiple threads') 261option('newlib-retargetable-locking', type: 'boolean', value: true, 262 description: 'Allow locking routines to be retargeted at link time') 263 264# 265# Thread-local storage support 266# 267option('thread-local-storage', type: 'combo', choices: ['true', 'false', 'auto', 'picolibc'], value: 'picolibc', 268 description: 'use thread local storage for static data ("picolibc": picolibc and toolchain support) ("auto": toolchain supports) (default: "picolibc")') 269option('tls-model', type: 'combo', choices: ['global-dynamic', 'local-dynamic', 'initial-exec', 'local-exec'], value: 'local-exec', 270 description: 'Set TLS model. No-op when thread-local-storage is false') 271option('newlib-global-errno', type: 'boolean', value: false, 272 description: 'use global errno variable') 273option('errno-function', type: 'string', 274 value: 'false', 275 description: 'Use this function to compute errno address (default false, auto means autodetect, zephyr means use z_errno_wrap if !tls)') 276 277# 278# Math options 279# 280# Use "obsolete" math code, which use 'float' for 'float' functions 281# instead of the newer code which uses 'double' instead. 282# 283option('newlib-obsolete-math', type: 'combo', choices: ['true', 'false', 'auto'], 284 value: 'auto', 285 description: 'Use float type for float valued math routines (default: automatic based on platform)') 286option('newlib-obsolete-math-float', type: 'combo', choices: ['true', 'false', 'auto'], 287 value: 'auto', 288 description: 'Use old math code that uses float type for float valued math routines (default: automatic based on platform)') 289option('newlib-obsolete-math-double', type: 'combo', choices: ['true', 'false', 'auto'], 290 value: 'auto', 291 description: 'Use old math code for double valued math routines (default: automatic based on platform)') 292option('want-math-errno', type: 'boolean', value: false, 293 description: 'Set errno in math functions according to stdc (default: false)') 294 295# 296# Obsolete newlib options 297# 298option('newlib-long-time_t', type: 'boolean', value: false, 299 description: 'define time_t to long instead of a 64-bit type') 300option('newlib-missing-syscall-names', type: 'boolean', value: false, 301 description: 'system only provides regular syscall API') 302option('newlib-reentrant-syscalls-provided', type: 'boolean', value: false, 303 description: 'system provides reentrant syscall API') 304option('newlib-supplied-syscalls', type: 'boolean', value: false, 305 description: 'newlib supplies system call functions') 306