meson: check if secure_getenv() is present
Not all libc make secure_getenv() available, this could lead to build failure on certain build systems. Check if secure_getenv() is available and emit #define HAVE_SECURE_GETENV to config.h Include config.h to every c/c++ file during building by adding `-include config.h` to project arguments for both c and c++. Signed-off-by: Giulio Benetti <giulio.benetti@micronovasrl.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> [Kieran: Drop unnessecary meson message Update commit message] Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
This commit is contained in:
parent
a10fbfcaaa
commit
46bfc32157
1 changed files with 9 additions and 0 deletions
|
@ -13,8 +13,17 @@ project('libcamera', 'c', 'cpp',
|
||||||
# generated from this too.
|
# generated from this too.
|
||||||
api_version = '0.1'
|
api_version = '0.1'
|
||||||
|
|
||||||
|
cc = meson.get_compiler('c')
|
||||||
|
config_h = configuration_data()
|
||||||
|
|
||||||
|
if cc.has_header_symbol('stdlib.h', 'secure_getenv', prefix: '#define _GNU_SOURCE')
|
||||||
|
config_h.set('HAVE_SECURE_GETENV', 1)
|
||||||
|
endif
|
||||||
|
configure_file(output: 'config.h', configuration: config_h)
|
||||||
|
|
||||||
common_arguments = [
|
common_arguments = [
|
||||||
'-Wno-unused-parameter',
|
'-Wno-unused-parameter',
|
||||||
|
'-include', 'config.h',
|
||||||
]
|
]
|
||||||
|
|
||||||
c_arguments = common_arguments
|
c_arguments = common_arguments
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue