Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/snaipe/meson-check

A meson module to conveniently check for features
https://github.com/snaipe/meson-check

Last synced: about 1 month ago
JSON representation

A meson module to conveniently check for features

Awesome Lists containing this project

README

        

# meson-check

A [meson][meson] module to convenienty check for features.

## What

Meson already provides means to check for features through compiler objects, but
I've found myself still writing a lot of boilerplate code for what pretty much
amounts to "setup-thing, check-thing, set-config".

`meson-check` addresses this through convention over configuration, by wrapping
all of that boilerplate up into convenient functions.

For the moment, the module is very C-centric, with existing (but limited) C++ support.
Patches are welcome.

## Install

```
pip install meson-check
```

## Usage

```meson
config = configuration_data()

check = import('check')

# Optionally, set some things up
check.setup(args: '-D_GNU_SOURCE', config: config)

# Check for a symbol in the standard library
check.symbol('clock_gettime')

# Check for a symbol in select libraries
check.symbol('shm_open', libraries: ['c', 'rt'])

# Check for a header declaration
check.declaration('unistd.h', 'environ')

# Check for a specific prototype declaration
check.declaration('sys/mman.h', 'int mincore(void *, size_t, unsigned char *)')

# Check for a header file
check.header('link.h')
```

All functions return a boolean representing whether the check was successful or not.

[meson]: https://github.com/mesonbuild/meson