/**
 * @file config.h
 * @author Radek Krejci <rkrejci@cesnet.cz>
 * @brief Various variables provided by cmake and compile time options.
 *
 * Copyright (c) 2021 CESNET, z.s.p.o.
 *
 * This source code is licensed under BSD 3-Clause License (the "License").
 * You may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     https://opensource.org/licenses/BSD-3-Clause
 */

#ifndef LY_CONFIG_H_
#define LY_CONFIG_H_

/** size of fixed_mem in lyd_value, minimum is 8 (B) */
#define LYD_VALUE_FIXED_MEM_SIZE @LYD_VALUE_SIZE@

/** plugins */
#define LYPLG_SUFFIX "@CMAKE_SHARED_MODULE_SUFFIX@"
#define LYPLG_SUFFIX_LEN (sizeof LYPLG_SUFFIX - 1)
#define LYPLG_TYPE_DIR "@PLUGINS_DIR_EXTENSIONS@"
#define LYPLG_EXT_DIR "@PLUGINS_DIR_TYPES@"

/** atomic compiler operations, to be able to use uint32_t */
#define LY_ATOMIC_INC_BARRIER(var) __sync_fetch_and_add(&(var), 1)
#define LY_ATOMIC_DEC_BARRIER(var) __sync_fetch_and_sub(&(var), 1)

/** printf compiler attribute */
#if (@CMAKE_C_COMPILER_ID@ == GNU) || (@CMAKE_C_COMPILER_ID@ == Clang)
# define _FORMAT_PRINTF(FORM, ARGS) __attribute__((format (printf, FORM, ARGS)))
#else
# define _FORMAT_PRINTF(FORM, ARGS)
#endif

#endif /* LY_CONFIG_H_ */
