Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 30 additions & 0 deletions meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -26,5 +26,35 @@ endif

glib_dep = dependency('glib-2.0', version: glib_req, required: false)

thread_dep = dependency('threads', required: false)

# Check if functions exist

config = configuration_data()

functions = {
'fseeko': 'stdio.h',
'realpath': 'stdlib.h',
}

foreach function, include_file : functions
exists = cc.has_function(
function,
args: '-D_GNU_SOURCE',
prefix: '#include <@0@>'.format(include_file),
)
config.set('HAVE_' + function.to_upper(), exists)
endforeach

# Generate config.h

config.set('FST_WRITER_PARALLEL', thread_dep.found())
config.set('HAVE_LIBPTHREAD', thread_dep.found())

configure_file(output: 'config.h', configuration: config)
config_inc = include_directories('.')

add_project_arguments('-DFST_INCLUDE_CONFIG', language: 'c')

subdir('src')
subdir('tests')
30 changes: 9 additions & 21 deletions src/fstapi.c
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,9 @@
*
*/

// #ifndef FST_CONFIG_INCLUDE
// # define FST_CONFIG_INCLUDE <config.h>
// #endif
// #include FST_CONFIG_INCLUDE
#ifdef FST_INCLUDE_CONFIG
#include <config.h>
#endif

#include "fstapi.h"
#include "fastlz.h"
Expand All @@ -60,21 +59,6 @@
#include <windows.h>
#endif

#ifdef HAVE_ALLOCA_H
#include <alloca.h>
#elif defined(__GNUC__)
#ifndef __MINGW32__
#ifndef alloca
#define alloca __builtin_alloca
#endif
#else
#include <malloc.h>
#endif
#elif defined(_MSC_VER)
#include <malloc.h>
#define alloca _alloca
#endif

#ifndef PATH_MAX
#define PATH_MAX (4096)
#endif
Expand Down Expand Up @@ -1748,8 +1732,9 @@ static void fstWriterFlushContextPrivate(fstWriterContext *xc)
}

#ifdef FST_WRITER_PARALLEL
static void *fstWriterFlushContextPrivate1(fstWriterContext *xc)
static void *fstWriterFlushContextPrivate1(void *ctx)
{
struct fstWriterContext *xc = (struct fstWriterContext *)ctx;
struct fstWriterContext *xc_parent;

pthread_mutex_lock(&(xc->xc_parent->mutex));
Expand Down Expand Up @@ -5964,7 +5949,10 @@ static char *fstExtractRvatDataFromFrame(fstReaderContext *xc, fstHandle facidx,
return (buf);
}

char *fstReaderGetValueFromHandleAtTime(fstReaderContext *xc, uint64_t tim, fstHandle facidx, char *buf)
char *fstReaderGetValueFromHandleAtTime(fstReaderContext *xc,
uint64_t tim,
fstHandle facidx,
char *buf)
{
fst_off_t blkpos = 0, prev_blkpos;
uint64_t beg_tim, end_tim, beg_tim2, end_tim2;
Expand Down
3 changes: 2 additions & 1 deletion src/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ libfst_headers = [
libfst_dependencies = [
zlib_dep,
bzip2_dep,
# thread_dep,
thread_dep,
]

libfst = library(
Expand All @@ -20,6 +20,7 @@ libfst = library(
dependencies: libfst_dependencies,
version: meson.project_version(),
install: true,
include_directories: config_inc,
)

libfst_dep = declare_dependency(
Expand Down
Loading