1# SPDX-License-Identifier: Apache-2.0
2
3zephyr_library()
4zephyr_library_sources(libc-hooks.c)
5
6# define __LINUX_ERRNO_EXTENSIONS__ so we get errno defines like -ESHUTDOWN
7# used by the network stack
8zephyr_compile_definitions(__LINUX_ERRNO_EXTENSIONS__)
9
10if(NOT CONFIG_PICOLIBC_USE_MODULE)
11
12  # Use picolibc provided with the toolchain
13
14  zephyr_compile_options(--specs=picolibc.specs)
15  zephyr_compile_definitions(_POSIX_C_SOURCE=200809)
16  zephyr_libc_link_libraries(--specs=picolibc.specs c -lgcc)
17  if(CONFIG_PICOLIBC_IO_FLOAT)
18    zephyr_compile_definitions(PICOLIBC_DOUBLE_PRINTF_SCANF)
19    zephyr_link_libraries(-DPICOLIBC_DOUBLE_PRINTF_SCANF)
20  else()
21    zephyr_compile_definitions(PICOLIBC_INTEGER_PRINTF_SCANF)
22    zephyr_link_libraries(-DPICOLIBC_INTEGER_PRINTF_SCANF)
23  endif()
24
25endif()
26