From c8a537f3a8cd8cdf8d6491cc7ba3b7127fe850e6 Mon Sep 17 00:00:00 2001 From: "Carsten Haitzler (Rasterman)" Date: Sun, 27 Aug 2023 14:48:15 +0100 Subject: [PATCH] detect nsec struct stat systems fixes #2 --- meson.build | 14 ++++++++++++++ src/shared/common/sha.c | 2 ++ src/shared/common/sha.h | 4 ++-- 3 files changed, 18 insertions(+), 2 deletions(-) diff --git a/meson.build b/meson.build index 518db99..74b96fc 100644 --- a/meson.build +++ b/meson.build @@ -11,6 +11,15 @@ deps = [ dependency('emotion', version: '>= 1.26.0'), m_dep ] + +bsd = ['bsd', 'freebsd', 'dragonfly', 'netbsd', 'openbsd'] +linux = ['linux'] +sun = ['sunos'] + +sys_linux = linux.contains(host_machine.system()) +sys_bsd = bsd.contains(host_machine.system()) +sys_sun = sun.contains(host_machine.system()) + dir_prefix = get_option('prefix') dir_bin = join_paths(dir_prefix, get_option('bindir')) dir_lib = join_paths(dir_prefix, get_option('libdir')) @@ -32,6 +41,11 @@ cfg.set ('_POSIX_PTHREAD_SEMANTICS', 1) cfg.set ('_ALL_SOURCE' , 1) cfg.set ('_POSIX_SOURCE' , 1) cfg.set ('_POSIX_1_SOURCE' , 1) + +if sys_linux or sys_bsd or sys_sun + cfg.set('STAT_NSEC', '1') +endif + configure_file(output: 'efm_config.h', configuration: cfg) subdir('src') subdir('data') diff --git a/src/shared/common/sha.c b/src/shared/common/sha.c index 248e8fd..6e999b7 100644 --- a/src/shared/common/sha.c +++ b/src/shared/common/sha.c @@ -1,8 +1,10 @@ #include "sha.h" +#include "efm_config.h" #include #include #include #include +#include void sha1_stat(const struct stat *st, unsigned char dst[20]) diff --git a/src/shared/common/sha.h b/src/shared/common/sha.h index f343131..39ba784 100644 --- a/src/shared/common/sha.h +++ b/src/shared/common/sha.h @@ -1,8 +1,8 @@ #ifndef SHA_H # define SHA_H 1 -// get nsec in stat -#define STAT_NSEC 1 +# include "efm_config.h" + #include void sha1_stat(const struct stat *st, unsigned char dst[20]);