subprojects/spp: use meson configuration

This commit is contained in:
Anton Kochkov 2024-03-27 19:20:26 +08:00 committed by Anton Kochkov
parent 01f125fdc9
commit 89f37e3881
2 changed files with 26 additions and 17 deletions

View file

@ -1,16 +1,10 @@
#ifndef HAVE_FORK
#define HAVE_FORK 1
#endif
#ifndef SPP_CONFIG_H
#define SPP_CONFIG_H
#if HAVE_FORK
# if TARGET_OS_IPHONE || APPLE_SDK_IPHONEOS || APPLE_SDK_IPHONESIMULATOR
# define HAVE_SYSTEM 0
# else
# define HAVE_SYSTEM 1
# endif
#else
# define HAVE_SYSTEM 0
#endif
// clang-format off
#define HAVE_SYSTEM @HAVE_SYSTEM@
#define HAVE_FORK @HAVE_FORK@
// clang-format on
#if HAVE_SYSTEM
#include "p/sh.h"
@ -34,4 +28,4 @@ struct Proc *procs[] = {
DEFAULT_PROC(spp)
#define DEBUG 0
#endif

View file

@ -1,10 +1,6 @@
project('rzspp', 'c')
spp_version = '1.2.0'
configure_file(input: 'config.def.h',
output: 'config.h',
copy: true)
spp_files = [
'spp.c',
]
@ -19,6 +15,25 @@ librzspp = static_library('rzspp', spp_files,
implicit_include_directories: false
)
cc = meson.get_compiler('c')
userconf = configuration_data()
foreach item : [
['system', '#include <stdlib.h>', []],
['fork', '#include <unistd.h>', []],
]
func = item[0]
ok = cc.has_function(func, prefix: item[1], dependencies: item[2])
userconf.set10('HAVE_@0@'.format(func.to_upper()), ok)
endforeach
userconf_h_in = files('config.h.in')
userconf_h = configure_file(
input: userconf_h_in,
output: 'config.h',
configuration: userconf,
)
spp_static_dep = declare_dependency(
link_whole: librzspp,
include_directories: spp_inc,