adapt build to latest GNUnet without gnunet/platform.h

This commit is contained in:
Christian Grothoff 2022-12-05 12:55:15 +01:00
parent 461dc8e36c
commit 597c9950a3
No known key found for this signature in database
GPG Key ID: 939E6BE1E29FC3CC
7 changed files with 214 additions and 65 deletions

View File

@ -63,6 +63,13 @@ AS_IF([test "x$doc_only" != xyes],[
# Force some CFLAGS
CFLAGS="-Wall -Wno-address-of-packed-member $CFLAGS"
TALER_LIB_LDFLAGS="-export-dynamic -no-undefined"
TALER_PLUGIN_LDFLAGS="-export-dynamic -avoid-version -module -no-undefined"
AC_SUBST(TALER_LIB_LDFLAGS)
AC_SUBST(TALER_PLUGIN_LDFLAGS)
# Checks for header files.
AC_CHECK_HEADERS([stdint.h stdlib.h string.h unistd.h sys/socket.h sys/un.h netinet/in.h netinet/ip.h])
@ -76,6 +83,7 @@ AC_DEFINE_UNQUOTED([NEED_LIBGCRYPT_VERSION], ["$need_libgcrypt_version"],
AM_PATH_LIBGCRYPT([$need_libgcrypt_version])
# should expensive tests be run?
AC_MSG_CHECKING(whether to run expensive tests)
AC_ARG_ENABLE([expensivetests],
@ -133,20 +141,12 @@ AS_CASE([$with_gnunet],
[no], [AC_MSG_ERROR([--with-gnunet is required])],
[LDFLAGS="-L$with_gnunet/lib $LDFLAGS"
CPPFLAGS="-I$with_gnunet/include $CPPFLAGS"])
AC_CHECK_HEADERS([gnunet/platform.h gnunet/gnunet_util_lib.h],
[AC_CHECK_LIB([gnunetutil], [GNUNET_SCHEDULER_run], libgnunetutil=1)],
[], [#ifdef HAVE_GNUNET_PLATFORM_H
#include <gnunet/platform.h>
#endif
#include <gnunet/gnunet_common.h>
#if GNUNET_UTIL_VERSION < 0x00A0104
#fail libgnunetutil is too old
#endif])
AC_CHECK_HEADERS([gnunet/gnunet_util_lib.h],
[AC_CHECK_LIB([gnunetutil], [GNUNET_SCHEDULER_run], libgnunetutil=1)])
AS_IF([test $libgnunetutil != 1],
[AC_MSG_ERROR([[
***
*** You need libgnunetutil > 0.14.0 to build this program.
*** (Yes, ">", libgnunetutil 0.14.0 is NOT enough.)
*** You need libgnunetutil >= 0.19.0 to build this program.
*** This library is part of GNUnet, available at
*** https://gnunet.org
*** ]])])
@ -165,11 +165,8 @@ AS_CASE([$with_gnunet],
[no], [AC_MSG_ERROR([--with-gnunet is required])],
[LDFLAGS="-L$with_gnunet/lib $LDFLAGS"
CPPFLAGS="-I$with_gnunet/include $CPPFLAGS"])
AC_CHECK_HEADERS([gnunet/platform.h gnunet/gnunet_json_lib.h],
[AC_CHECK_LIB([gnunetjson], [GNUNET_JSON_parse], libgnunetjson=1)],
[], [#ifdef HAVE_GNUNET_PLATFORM_H
#include <gnunet/platform.h>
#endif])
AC_CHECK_HEADERS([gnunet/gnunet_json_lib.h],
[AC_CHECK_LIB([gnunetjson], [GNUNET_JSON_parse], libgnunetjson=1)])
AS_IF([test $libgnunetjson != 1],
[AC_MSG_ERROR([[
***
@ -231,11 +228,8 @@ AS_CASE([$with_gnunet],
[no], [AC_MSG_ERROR([--with-gnunet is required])],
[LDFLAGS="-L$with_gnunet/lib $LDFLAGS"
CPPFLAGS="-I$with_gnunet/include $CPPFLAGS"])
AC_CHECK_HEADERS([gnunet/platform.h gnunet/gnunet_curl_lib.h],
[AC_CHECK_LIB([gnunetcurl], [GNUNET_CURL_get_select_info], libgnunetcurl=1)],
[], [#ifdef HAVE_GNUNET_PLATFORM_H
#include <gnunet/platform.h>
#endif])
AC_CHECK_HEADERS([gnunet/gnunet_curl_lib.h],
[AC_CHECK_LIB([gnunetcurl], [GNUNET_CURL_get_select_info], libgnunetcurl=1)])
AS_IF([test $libgnunetcurl != 1],
[AC_MSG_ERROR([[
***
@ -250,6 +244,12 @@ CFLAGS=$CFLAGS_SAVE
LDFLAGS=$LDFLAGS_SAVE
LIBS=$LIBS_SAVE
# test for postgres
AX_LIB_POSTGRESQL([13.0])
AS_IF([test "x$found_postgresql" = "xyes"],[postgres=true])
AM_CONDITIONAL(HAVE_POSTGRESQL, test x$postgres = xtrue)
# Check for GNUnet's libgnunetpq.
libgnunetpq=0
AC_MSG_CHECKING([for libgnunetpq])
@ -262,12 +262,9 @@ AS_CASE([$with_gnunet],
[yes], [],
[no], [AC_MSG_ERROR([--with-gnunet is required])],
[LDFLAGS="-L$with_gnunet/lib $LDFLAGS"
CPPFLAGS="-I$with_gnunet/include $CPPFLAGS"])
AC_CHECK_HEADERS([gnunet/platform.h gnunet/gnunet_pq_lib.h],
[AC_CHECK_LIB([gnunetpq], [GNUNET_PQ_result_spec_string], libgnunetpq=1)],
[], [#ifdef HAVE_GNUNET_PLATFORM_H
#include <gnunet/platform.h>
#endif])
CPPFLAGS="-I$with_gnunet/include ${CPPFLAGS} ${POSTGRESQL_CPPFLAGS}"])
AC_CHECK_HEADERS([gnunet/gnunet_pq_lib.h],
[AC_CHECK_LIB([gnunetpq], [GNUNET_PQ_result_spec_string], libgnunetpq=1)])
AS_IF([test $libgnunetpq != 1],
[AC_MSG_ERROR([[
***
@ -277,15 +274,15 @@ AS_IF([test $libgnunetpq != 1],
*** is recent!)
*** ]])])
CFLAGS_SAVE=$CFLAGS
LDFLAGS_SAVE=$LDFLAGS
LIBS_SAVE="$LIBS"
# Check for GNUnet's libgnunetsq
libgnunetsq=0
AC_MSG_CHECKING([for libgnunetsq])
AC_CHECK_HEADERS([gnunet/gnunet_sq_lib.h],
[AC_CHECK_LIB([gnunetsq], [GNUNET_SQ_result_spec_string], libgnunetsq=1)],
[], [#ifdef HAVE_GNUNET_PLATFORM_H
#include <gnunet/platform.h>
#endif])
[AC_CHECK_LIB([gnunetsq], [GNUNET_SQ_result_spec_string], libgnunetsq=1)])
# check for libmicrohttpd
@ -324,22 +321,6 @@ AS_IF([test $jansson = 0],
*** ]])])
# test for postgres
AX_LIB_POSTGRESQL([13.0])
AS_IF([test "x$found_postgresql" = "xyes"],[postgres=true])
TALER_LIB_LDFLAGS="-export-dynamic -no-undefined"
TALER_PLUGIN_LDFLAGS="-export-dynamic -avoid-version -module -no-undefined"
AC_SUBST(TALER_LIB_LDFLAGS)
AC_SUBST(TALER_PLUGIN_LDFLAGS)
CFLAGS_SAVE=$CFLAGS
LDFLAGS_SAVE=$LDFLAGS
LIBS_SAVE="$LIBS"
AM_CONDITIONAL(HAVE_POSTGRESQL, test x$postgres = xtrue)
CFLAGS=$CFLAGS_SAVE
LDFLAGS=$LDFLAGS_SAVE
@ -389,10 +370,7 @@ AS_CASE([$with_twister],
CPPFLAGS="-I$with_twister/include $CPPFLAGS"])
AC_CHECK_HEADERS([taler/taler_twister_service.h],
[AC_CHECK_LIB([talertwister], [TALER_TWISTER_connect], talertwister=1)],
[], [#ifdef HAVE_GNUNET_PLATFORM_H
#include <gnunet/platform.h>
#endif])
[AC_CHECK_LIB([talertwister], [TALER_TWISTER_connect], talertwister=1)])
AM_CONDITIONAL(HAVE_TWISTER, test x$talertwister = x1)
# should developer logic be compiled (not-for-production code)?

@ -1 +1 @@
Subproject commit 212ee0a78adc43cb5c04d6ea96ccc2fe74fed62b
Subproject commit 20f8eb7a72e2160409f0f78264ec5198e9caa193

View File

@ -21,7 +21,7 @@
#include "platform.h"
#include "taler_util.h"
#include <gnunet/gnunet_json_lib.h>
#include <gnunet/gnunet_crypto_lib.h>
#include <gnunet/gnunet_util_lib.h>
#include "taler_error_codes.h"
#include "taler_json_lib.h"
#include "taler_signatures.h"

View File

@ -20,17 +20,17 @@
* rest of the modules
* @author Sree Harsha Totakura <sreeharsha@totakura.in>
*/
#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 <gnunet/platform.h>
/* Do not use shortcuts for gcrypt mpi */
#define GCRYPT_NO_MPI_MACROS 1
@ -67,6 +64,171 @@
#define ENABLE_SANITY_CHECKS 1
#include <netdb.h>
#include <sys/socket.h>
#include <sys/un.h>
#if HAVE_NETINET_IN_H
#include <netinet/in.h>
#endif
#if HAVE_NETINET_IN_SYSTM_H
#include <netinet/in_systm.h>
#endif
#if HAVE_NETINET_IP_H
#include <netinet/ip.h> /* superset of previous */
#endif
#include <arpa/inet.h>
#include <netinet/tcp.h>
#include <pwd.h>
#include <sys/ioctl.h>
#include <sys/wait.h>
#include <grp.h>
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include <stdarg.h>
#include <stdbool.h>
#include <errno.h>
#include <signal.h>
#include <libgen.h>
#ifdef HAVE_MALLOC_H
#include <malloc.h> /* for mallinfo on GNU */
#endif
#include <unistd.h> /* KLB_FIX */
#include <sys/stat.h>
#include <sys/types.h>
#include <dirent.h> /* KLB_FIX */
#include <fcntl.h>
#include <math.h>
#if HAVE_SYS_PARAM_H
#include <sys/param.h>
#endif
#if HAVE_SYS_TIME_H
#include <sys/time.h>
#endif
#include <time.h>
#ifdef BSD
#include <net/if.h>
#endif
#if defined(BSD) && defined(__FreeBSD__) && defined(__FreeBSD_kernel__)
#include <semaphore.h>
#endif
#ifdef DARWIN
#include <dlfcn.h>
#include <semaphore.h>
#include <net/if.h>
#endif
#if defined(__linux__) || defined(GNU)
#include <net/if.h>
#endif
#ifdef SOLARIS
#include <sys/sockio.h>
#include <sys/filio.h>
#include <sys/loadavg.h>
#include <semaphore.h>
#endif
#if HAVE_UCRED_H
#include <ucred.h>
#endif
#if HAVE_SYS_UCRED_H
#include <sys/ucred.h>
#endif
#if HAVE_IFADDRS_H
#include <ifaddrs.h>
#endif
#include <errno.h>
#include <limits.h>
#if HAVE_VFORK_H
#include <vfork.h>
#endif
#include <ctype.h>
#if HAVE_SYS_RESOURCE_H
#include <sys/resource.h>
#endif
#if HAVE_ENDIAN_H
#include <endian.h>
#endif
#if HAVE_SYS_ENDIAN_H
#include <sys/endian.h>
#endif
#define DIR_SEPARATOR '/'
#define DIR_SEPARATOR_STR "/"
#define PATH_SEPARATOR ':'
#define PATH_SEPARATOR_STR ":"
#define NEWLINE "\n"
#include <locale.h>
#include "gettext.h"
/**
* GNU gettext support macro.
*/
#define _(String) dgettext (PACKAGE, String)
#include <sys/mman.h>
/* 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_ */

View File

@ -827,7 +827,7 @@ TALER_TESTING_setup (TALER_TESTING_Main main_cb,
sigpipe = GNUNET_DISK_pipe (GNUNET_DISK_PF_NONE);
GNUNET_assert (NULL != sigpipe);
shc_chld = GNUNET_SIGNAL_handler_install (
GNUNET_SIGCHLD,
SIGCHLD,
&sighandler_child_death);
is.ctx = GNUNET_CURL_init (
&GNUNET_CURL_gnunet_scheduler_reschedule,

View File

@ -553,7 +553,7 @@ const char *
TALER_amount2s (const struct TALER_Amount *amount)
{
/* 24 is sufficient for a uint64_t value in decimal; 3 is for ":.\0" */
static GNUNET_THREAD_LOCAL char result[TALER_AMOUNT_FRAC_LEN
static TALER_THREAD_LOCAL char result[TALER_AMOUNT_FRAC_LEN
+ TALER_CURRENCY_LEN + 3 + 24];
struct TALER_Amount norm;

View File

@ -28,7 +28,7 @@ const char *
TALER_b2s (const void *buf,
size_t buf_size)
{
static GNUNET_THREAD_LOCAL char ret[9];
static TALER_THREAD_LOCAL char ret[9];
struct GNUNET_HashCode hc;
char *tmp;