From cd07912073c951b4bbb871ed2653af1be2cfc714 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sun, 28 Apr 2024 11:55:11 +0200 Subject: Adding upstream version 2.1.30. Signed-off-by: Daniel Baumann --- src/config.h.in | 74 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 74 insertions(+) create mode 100644 src/config.h.in (limited to 'src/config.h.in') diff --git a/src/config.h.in b/src/config.h.in new file mode 100644 index 0000000..af3d1f0 --- /dev/null +++ b/src/config.h.in @@ -0,0 +1,74 @@ +/** + * @file config.h + * @author Radek Krejci + * @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_ + +#ifdef _WIN32 +/* headers are broken on Windows, which means that some of them simply *have* to come first */ +# include +# include +#endif + +/** 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_TYPES@" +#define LYPLG_EXT_DIR "@PLUGINS_DIR_EXTENSIONS@" + +/** atomic compiler operations, to be able to use uint32_t */ +#ifndef _WIN32 +# define LY_ATOMIC_INC_BARRIER(var) __sync_fetch_and_add(&(var), 1) +# define LY_ATOMIC_DEC_BARRIER(var) __sync_fetch_and_sub(&(var), 1) +#else +# include +# define LY_ATOMIC_INC_BARRIER(var) InterlockedExchangeAdd(&(var), 1) +# define LY_ATOMIC_DEC_BARRIER(var) InterlockedExchangeAdd(&(var), -1) +#endif + +/** printf compiler attribute */ +#ifdef __GNUC__ +# define _FORMAT_PRINTF(FORM, ARGS) __attribute__((format (printf, FORM, ARGS))) +#else +# define _FORMAT_PRINTF(FORM, ARGS) +#endif + +/** Exporting symbols to a shared library and importing back afterwards + * + * - use LIBYANG_API_DECL to mark a declaration in the public header + * - use LIBYANG_API_DEF to mark a definition (in the source code for the actual implementaiton) + * */ +#ifdef _MSC_VER +# ifndef STATIC +# define LIBYANG_API_DEF __declspec(dllexport) +# ifdef LIBYANG_BUILD +# define LIBYANG_API_DECL __declspec(dllexport) +# else +# define LIBYANG_API_DECL __declspec(dllimport) +# endif +# endif +#else +/* + * If the compiler supports attribute to mark objects as hidden, mark all + * objects as hidden and export only objects explicitly marked to be part of + * the public API. + */ +# define LIBYANG_API_DEF __attribute__((visibility("default"))) +# define LIBYANG_API_DECL +#endif + +#endif /* LY_CONFIG_H_ */ -- cgit v1.2.3