From 597c9950a34801ed80f3cdcb030c20950cb55e9b Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Mon, 5 Dec 2022 12:55:15 +0100 Subject: adapt build to latest GNUnet without gnunet/platform.h --- src/include/platform.h | 187 ++++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 179 insertions(+), 8 deletions(-) (limited to 'src/include/platform.h') diff --git a/src/include/platform.h b/src/include/platform.h index b2c286b74..d4d2c80e7 100644 --- a/src/include/platform.h +++ b/src/include/platform.h @@ -20,17 +20,17 @@ * rest of the modules * @author Sree Harsha Totakura */ - #ifndef PLATFORM_H_ #define PLATFORM_H_ /* Include our configuration header */ #ifndef HAVE_USED_CONFIG_H -# define HAVE_USED_CONFIG_H -# ifdef HAVE_CONFIG_H -# include "taler_config.h" -# endif +#define HAVE_USED_CONFIG_H +#ifdef HAVE_CONFIG_H +#include "taler_config.h" +#endif #endif + /* For the exchange build, we do NOT want gettext, even if it is available! */ #undef ENABLE_NLS @@ -45,9 +45,6 @@ /* Include the features available for GNU source */ #define _GNU_SOURCE -/* Include GNUnet's platform file */ -#include - /* Do not use shortcuts for gcrypt mpi */ #define GCRYPT_NO_MPI_MACROS 1 @@ -67,6 +64,171 @@ #define ENABLE_SANITY_CHECKS 1 +#include +#include +#include +#if HAVE_NETINET_IN_H +#include +#endif +#if HAVE_NETINET_IN_SYSTM_H +#include +#endif +#if HAVE_NETINET_IP_H +#include /* superset of previous */ +#endif +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#ifdef HAVE_MALLOC_H +#include /* for mallinfo on GNU */ +#endif +#include /* KLB_FIX */ +#include +#include +#include /* KLB_FIX */ +#include +#include +#if HAVE_SYS_PARAM_H +#include +#endif +#if HAVE_SYS_TIME_H +#include +#endif +#include +#ifdef BSD +#include +#endif +#if defined(BSD) && defined(__FreeBSD__) && defined(__FreeBSD_kernel__) +#include +#endif +#ifdef DARWIN +#include +#include +#include +#endif +#if defined(__linux__) || defined(GNU) +#include +#endif +#ifdef SOLARIS +#include +#include +#include +#include +#endif +#if HAVE_UCRED_H +#include +#endif +#if HAVE_SYS_UCRED_H +#include +#endif +#if HAVE_IFADDRS_H +#include +#endif +#include +#include + +#if HAVE_VFORK_H +#include +#endif + +#include +#if HAVE_SYS_RESOURCE_H +#include +#endif + +#if HAVE_ENDIAN_H +#include +#endif +#if HAVE_SYS_ENDIAN_H +#include +#endif + +#define DIR_SEPARATOR '/' +#define DIR_SEPARATOR_STR "/" +#define PATH_SEPARATOR ':' +#define PATH_SEPARATOR_STR ":" +#define NEWLINE "\n" + + +#include +#include "gettext.h" +/** + * GNU gettext support macro. + */ +#define _(String) dgettext (PACKAGE, String) + + +#include + +/* FreeBSD_kernel is not defined on the now discontinued kFreeBSD */ +#if defined(BSD) && defined(__FreeBSD__) && defined(__FreeBSD_kernel__) +#define __BYTE_ORDER BYTE_ORDER +#define __BIG_ENDIAN BIG_ENDIAN +#endif + +#ifdef DARWIN +#define __BYTE_ORDER BYTE_ORDER +#define __BIG_ENDIAN BIG_ENDIAN +/* not available on darwin, override configure */ +#undef HAVE_STAT64 +#undef HAVE_MREMAP +#endif + +#if ! HAVE_ATOLL +long long +atoll (const char *nptr); + +#endif + +#if ENABLE_NLS +#include "langinfo.h" +#endif + +#ifndef SIZE_MAX +#define SIZE_MAX ((size_t) (-1)) +#endif + +#ifndef O_LARGEFILE +#define O_LARGEFILE 0 +#endif + + +#if defined(__sparc__) +#define MAKE_UNALIGNED(val) ({ __typeof__((val)) __tmp; memmove (&__tmp, &(val), \ + sizeof((val))); \ + __tmp; }) +#else +#define MAKE_UNALIGNED(val) val +#endif + + +#ifndef PATH_MAX +/** + * Assumed maximum path length. + */ +#define PATH_MAX 4096 +#endif + +#if HAVE_THREAD_LOCAL_GCC +#define TALER_THREAD_LOCAL __thread +#else +#define TALER_THREAD_LOCAL +#endif + + /* LSB-style exit status codes */ #ifndef EXIT_INVALIDARGUMENT #define EXIT_INVALIDARGUMENT 2 @@ -92,6 +254,15 @@ #define EXIT_NOTRUNNING 7 #endif +/** + * clang et al do not have such an attribute + */ +#if __has_attribute (__nonstring__) +# define __nonstring __attribute__((__nonstring__)) +#else +# define __nonstring +#endif + #endif /* PLATFORM_H_ */ -- cgit v1.2.3