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('build-type-subdir', type: 'string', 54 description: 'Build-type subdir. Also skips installing .specs file') 55 56option('picolib', type: 'boolean', value: true, 57 description: 'Include pico lib bits') 58 59option('picocrt', type: 'boolean', value: true, 60 description: 'Include pico crt bits') 61 62option('picocrt-lib', type: 'boolean', value: true, 63 description: 'Include pico crt bits in lib form') 64 65option('semihost', type: 'boolean', value: true, 66 description: 'Include semihost bits') 67 68option('specsdir', type: 'string', 69 description: 'Installation directory for .specs file') 70 71option('sysroot-install', type: 'boolean', value: false, 72 description: 'Install in gcc sysroot') 73 74option('sysroot-install-skip-checks', type: 'boolean', value: false, 75 description: 'Skip sysroot path checks during config') 76 77option('system-libc', type: 'boolean', value: false, 78 description: 'Install as system C library') 79 80option('picoexit', type: 'boolean', value: true, 81 description: 'Smaller exit/atexit/onexit code') 82 83option('fortify-source', type: 'combo', choices: ['none', '1', '2'], value: 'none', 84 description: 'Set _FORTIFY_SOURCE=<value>') 85 86option('use-stdlib', type: 'boolean', value: false, 87 description: 'Do not bypass the standard system library with -nostdlib (useful for native testing)') 88 89option('profile', type: 'boolean', value: false, 90 description: 'Enable profiling by adding -pg -no-pie to compile flags') 91 92option('freestanding', type: 'boolean', value: false, 93 description: 'Build the library with -ffreestanding (useful for Zephyr testing)') 94 95# 96# Testing options 97# 98option('native-tests', type: 'boolean', value: false, 99 description: 'Run math tests against native libc too') 100option('tests', type: 'boolean', value: false, 101 description: 'Enable tests') 102option('tests-enable-stack-protector', type: 'boolean', value: true, 103 description: 'tests enable stack protector') 104option('tests-enable-full-malloc-stress', type: 'boolean', value: false, 105 description: 'tests enable stress test for full malloc') 106option('tests-enable-posix-io', type: 'boolean', value: true, 107 description: 'tests enable posix-io when available') 108 109option('tinystdio', type: 'boolean', value: true, 110 description: 'Use tiny stdio from avr libc') 111 112# 113# Options applying to both legacy stdio and tinystdio 114# 115option('io-c99-formats', type: 'boolean', value: true, 116 description: 'enable C99 support in IO functions like printf/scanf') 117option('newlib-io-c99-formats', type: 'combo', choices: ['true', 'false', 'auto'], value: 'auto', 118 description: 'enable C99 support in IO functions like printf/scanf') 119option('io-long-long', type: 'boolean', value: false, 120 description: 'enable long long type support in IO functions like printf/scanf') 121option('newlib-io-long-long', type: 'combo', choices: ['true', 'false', 'auto'], value: 'auto', 122 description: 'enable long long type support in IO functions like printf/scanf') 123option('io-pos-args', type: 'boolean', value: false, 124 description: 'enable printf-family positional arg support (always enabled for tinystdio float)') 125option('newlib-io-pos-args', type: 'combo', choices: ['true', 'false', 'auto'], value: 'auto', 126 description: 'enable printf-family positional arg support (always enabled for tinystdio float)') 127option('io-percent-b', type: 'boolean', value: false, 128 description: 'enable proposed %b/%B format in printf and scanf in tinystdio (default: false)') 129option('io-long-double', type: 'boolean', value: false, 130 description: 'enable long double type support in IO functions printf/scanf') 131option('newlib-io-long-double', type: 'boolean', value: false, 132 description: 'enable long double type support in IO functions printf/scanf') 133 134# 135# Options applying only to tinystdio 136# 137option('io-float-exact', type: 'boolean', value: true, 138 description: 'use float/string code which supports round-tripping') 139option('atomic-ungetc', type: 'boolean', value: true, 140 description: 'use atomics in fgetc/ungetc to make them re-entrant') 141option('posix-io', type: 'boolean', value: true, 142 description: 'Provide fopen/fdopen using POSIX I/O (open, close, read, write, lseek)') 143option('posix-console', type: 'boolean', value: false, 144 description: 'Use POSIX I/O for stdin/stdout/stderr') 145option('format-default', type: 'combo', choices: ['double', 'float', 'integer'], value: 'double', 146 description: 'which printf/scanf versions should be the default') 147option('printf-aliases', type: 'boolean', value: true, 148 description: 'Allow link-time printf aliases') 149 150# 151# Options applying to only legacy stdio 152# 153option('newlib-elix-level', type: 'integer', value: 4, 154 description: 'desired elix library level (0-4)') 155option('newlib-fseek-optimization', type: 'boolean', value: false, 156 description: 'enable fseek optimization') 157option('newlib-fvwrite-in-streamio', type: 'boolean', value: false, 158 description: 'disable iov in streamio') 159option('newlib-global-stdio-streams', type: 'boolean', value: false, 160 description: 'enable global stdio streams') 161option('newlib-io-float', type: 'boolean', value: false, 162 description: 'enable printf/scanf family float support') 163option('newlib-nano-formatted-io', type: 'boolean', value: false, 164 description: 'Use nano version formatted IO') 165option('newlib-reent-small', type: 'boolean', value: false, 166 description: 'enable small reentrant struct support') 167option('newlib-stdio64', type: 'boolean', value: true, 168 description: 'Include stdio64 with newlib stdio') 169option('newlib-unbuf-stream-opt', type: 'boolean', value: false, 170 description: 'enable unbuffered stream optimization in streamio') 171option('newlib-wide-orient', type: 'boolean', value: false, 172 description: 'Turn off wide orientation in streamio') 173option('newlib-have-fcntl', type: 'boolean', value: false, 174 description: 'System has fcntl function') 175 176# 177# Internationalization options 178# 179 180option('newlib-iconv-encodings', type: 'array', 181 description: 'enable specific comma-separated list of bidirectional iconv encodings to be built-in') 182option('newlib-iconv-from-encodings', type: 'array', 183 description: 'enable specific comma-separated list of "from" iconv encodings to be built-in') 184option('newlib-iconv-to-encodings', type: 'array', 185 description: 'enable specific comma-separated list of "to" iconv encodings to be built-in') 186option('newlib-iconv-external-ccs', type: 'boolean', value:false, 187 description: 'Load iconv CCS tables from files rather than having them built-in') 188option('newlib-iconv-dir', type: 'string', 189 description: 'Installation directory for iconv CCS files') 190option('newlib-iconv-runtime-dir', type: 'string', 191 description: 'Path used at runtime to locate iconv CCS files') 192option('newlib-iconv-encodings-exclude', type: 'array', 193 description: 'enable specific comma-separated list of bidirectional iconv encodings to be excluded') 194 195option('newlib-locale-info', type: 'boolean', value: false, 196 description: 'locale support') 197option('newlib-locale-info-extended', type: 'boolean', value: false, 198 description: 'extended locale support') 199option('newlib-mb', type: 'boolean', value: false, 200 description: 'enable multibyte support') 201 202# 203# Startup/shutdown options 204# 205option('lite-exit', type: 'boolean', value: true, 206 description: 'enable light weight exit') 207option('newlib-atexit-dynamic-alloc', type: 'boolean', value: false, 208 description: 'enable dynamic allocation of atexit entries') 209option('newlib-global-atexit', type: 'boolean', value: false, 210 description: 'enable atexit data structure as global') 211option('newlib-initfini', type: 'boolean', value: true, 212 description: 'Supports _init() and _fini()') 213option('newlib-initfini-array', type: 'boolean', value: true, 214 description: 'compiler supports INIT_ARRAY section types') 215option('newlib-register-fini', type: 'boolean', value: false, 216 description: 'enable finalization function registration using atexit') 217option('fake-semihost', type: 'boolean', value: false, 218 description: 'create fake semihost library to link tests') 219option('crt-runtime-size', type: 'boolean', value: false, 220 description: 'compute crt memory space sizes at runtime') 221option('atomic-signal', type: 'boolean', value: true, 222 description: 'use atomics in signal/raise to make them re-entrant') 223 224# 225# Malloc option 226# 227option('newlib-nano-malloc', type: 'boolean', value: true, 228 description: 'use small-footprint nano-malloc implementation') 229 230# 231# Locking support 232# 233option('newlib-multithread', type: 'boolean', value: true, 234 description: 'enable support for multiple threads') 235option('newlib-retargetable-locking', type: 'boolean', value: true, 236 description: 'Allow locking routines to be retargeted at link time') 237 238# 239# Thread-local storage support 240# 241option('thread-local-storage', type: 'combo', choices: ['true', 'false', 'auto', 'picolibc'], value: 'picolibc', 242 description: 'use thread local storage for static data ("picolibc": picolibc and toolchain support) ("auto": toolchain supports) (default: "picolibc")') 243option('tls-model', type: 'combo', choices: ['global-dynamic', 'local-dynamic', 'initial-exec', 'local-exec'], value: 'local-exec', 244 description: 'Set TLS model. No-op when thread-local-storage is false') 245option('newlib-global-errno', type: 'boolean', value: false, 246 description: 'use global errno variable') 247option('errno-function', type: 'string', 248 value: 'false', 249 description: 'Use this function to compute errno address (default false, auto means autodetect, zephyr means use z_errno_wrap if !tls)') 250 251# 252# Math options 253# 254# Use "obsolete" math code, which use 'float' for 'float' functions 255# instead of the newer code which uses 'double' instead. 256# 257option('newlib-obsolete-math', type: 'combo', choices: ['true', 'false', 'auto'], 258 value: 'auto', 259 description: 'Use float type for float valued math routines (default: automatic based on platform)') 260option('newlib-obsolete-math-float', type: 'combo', choices: ['true', 'false', 'auto'], 261 value: 'auto', 262 description: 'Use old math code that uses float type for float valued math routines (default: automatic based on platform)') 263option('newlib-obsolete-math-double', type: 'combo', choices: ['true', 'false', 'auto'], 264 value: 'auto', 265 description: 'Use old math code for double valued math routines (default: automatic based on platform)') 266option('want-math-errno', type: 'boolean', value: false, 267 description: 'Set errno in math functions according to stdc (default: false)') 268 269# 270# Obsolete newlib options 271# 272option('newlib-long-time_t', type: 'boolean', value: false, 273 description: 'define time_t to long instead of a 64-bit type') 274option('newlib-missing-syscall-names', type: 'boolean', value: false, 275 description: 'system only provides regular syscall API') 276option('newlib-reentrant-syscalls-provided', type: 'boolean', value: false, 277 description: 'system provides reentrant syscall API') 278option('newlib-supplied-syscalls', type: 'boolean', value: false, 279 description: 'newlib supplies system call functions') 280