diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-28 09:55:11 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-28 09:55:11 +0000 |
commit | cd07912073c951b4bbb871ed2653af1be2cfc714 (patch) | |
tree | 1073c2308492e6aea4c66cb7436ee92db2abfd42 /src/config.h.in | |
parent | Initial commit. (diff) | |
download | libyang2-519edde05ce4e4d0afbfc705ff24e78c997c3542.tar.xz libyang2-519edde05ce4e4d0afbfc705ff24e78c997c3542.zip |
Adding upstream version 2.1.30.upstream/2.1.30upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/config.h.in')
-rw-r--r-- | src/config.h.in | 74 |
1 files changed, 74 insertions, 0 deletions
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 <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_ + +#ifdef _WIN32 +/* headers are broken on Windows, which means that some of them simply *have* to come first */ +# include <winsock2.h> +# include <ws2tcpip.h> +#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 <windows.h> +# 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_ */ |