blob: 41e1942c5ac575546688db6eb40ff383c01d2afc [file] [log] [blame]
Radek Krejci968d7552021-03-26 20:33:51 +01001/**
2 * @file config.h
3 * @author Radek Krejci <rkrejci@cesnet.cz>
4 * @brief Various variables provided by cmake and compile time options.
5 *
6 * Copyright (c) 2021 CESNET, z.s.p.o.
7 *
8 * This source code is licensed under BSD 3-Clause License (the "License").
9 * You may not use this file except in compliance with the License.
10 * You may obtain a copy of the License at
11 *
12 * https://opensource.org/licenses/BSD-3-Clause
13 */
14
15#ifndef LY_CONFIG_H_
16#define LY_CONFIG_H_
17
Michal Vaskoaa0ee622021-05-11 09:29:25 +020018/** size of fixed_mem in lyd_value, minimum is 8 (B) */
19#define LYD_VALUE_FIXED_MEM_SIZE @LYD_VALUE_SIZE@
20
Michal Vaskobabf0bd2021-08-31 14:55:39 +020021/** plugins */
Radek Krejci968d7552021-03-26 20:33:51 +010022#define LYPLG_SUFFIX "@CMAKE_SHARED_MODULE_SUFFIX@"
23#define LYPLG_SUFFIX_LEN (sizeof LYPLG_SUFFIX - 1)
24#define LYPLG_TYPE_DIR "@PLUGINS_DIR_EXTENSIONS@"
25#define LYPLG_EXT_DIR "@PLUGINS_DIR_TYPES@"
26
Michal Vaskobabf0bd2021-08-31 14:55:39 +020027/** atomic variables type similar to compat.h */
28#cmakedefine HAVE_STDATOMIC
29
30#ifdef HAVE_STDATOMIC
31# include <stdatomic.h>
32# define LY_ATOMIC_T atomic_uint_fast32_t
33#else
34# include <stdint.h>
35# define LY_ATOMIC_T uint32_t
36#endif
37
38/** printf compiler attribute */
aPiecek6d618552021-06-18 10:02:59 +020039#if (@CMAKE_C_COMPILER_ID@ == GNU) || (@CMAKE_C_COMPILER_ID@ == Clang)
40# define _FORMAT_PRINTF(FORM, ARGS) __attribute__((format (printf, FORM, ARGS)))
41#else
42# define _FORMAT_PRINTF(FORM, ARGS)
43#endif
44
Radek Krejci968d7552021-03-26 20:33:51 +010045#endif /* LY_CONFIG_H_ */