Message ID | 20190424110044.12608-2-giulio.benetti@micronovasrl.com |
---|---|
State | Superseded |
Headers | show |
Series |
|
Related | show |
Hi Giulio, Thank you for the patch, On 24/04/2019 13:00, Giulio Benetti wrote: > Not all libc make secure_getenv() available, this could lead to build > failure on certain build systems. > > Check if secure_getenv() 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++. Thank you, I think this is a better approach to resolving the issue. > Signed-off-by: Giulio Benetti <giulio.benetti@micronovasrl.com> > --- > meson.build | 12 ++++++++++++ > 1 file changed, 12 insertions(+) > > diff --git a/meson.build b/meson.build > index 6e68c3e..ee9f5bf 100644 > --- a/meson.build > +++ b/meson.build > @@ -25,6 +25,18 @@ add_project_arguments(cpp_arguments, language: 'cpp') > > libcamera_includes = include_directories('include') > > +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) > +else > + message('C library does not support secure_getenv, using getenv instead') > +endif > +configure_file(output: 'config.h', configuration: config_h) > +add_project_arguments('-include', 'config.h', language: 'c') > +add_project_arguments('-include', 'config.h', language: 'cpp') I wonder if we should put this earlier in the file, and/or simply add '-include', 'config.h' to the common_arguments variable which already gets added to both 'c' and 'cpp' languages.... It's not critical though. Does anyone else have an opinion here? > + > subdir('include') > subdir('src') > subdir('utils') >
Hi Kieran, All, Il 26/04/2019 08:56, Kieran Bingham ha scritto: > Hi Giulio, > > Thank you for the patch, > > On 24/04/2019 13:00, Giulio Benetti wrote: >> Not all libc make secure_getenv() available, this could lead to build >> failure on certain build systems. >> >> Check if secure_getenv() 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++. > > Thank you, I think this is a better approach to resolving the issue. > >> Signed-off-by: Giulio Benetti <giulio.benetti@micronovasrl.com> >> --- >> meson.build | 12 ++++++++++++ >> 1 file changed, 12 insertions(+) >> >> diff --git a/meson.build b/meson.build >> index 6e68c3e..ee9f5bf 100644 >> --- a/meson.build >> +++ b/meson.build >> @@ -25,6 +25,18 @@ add_project_arguments(cpp_arguments, language: 'cpp') >> >> libcamera_includes = include_directories('include') >> >> +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) >> +else >> + message('C library does not support secure_getenv, using getenv instead') >> +endif >> +configure_file(output: 'config.h', configuration: config_h) >> +add_project_arguments('-include', 'config.h', language: 'c') >> +add_project_arguments('-include', 'config.h', language: 'cpp') > > I wonder if we should put this earlier in the file, and/or simply add > '-include', 'config.h' to the common_arguments variable which already > gets added to both 'c' and 'cpp' languages.... Yes, you're totally right, it's cleaner. I didn't notice common_arguments at all. > It's not critical though. > > Does anyone else have an opinion here? > >> + >> subdir('include') >> subdir('src') >> subdir('utils') >> >
diff --git a/meson.build b/meson.build index 6e68c3e..ee9f5bf 100644 --- a/meson.build +++ b/meson.build @@ -25,6 +25,18 @@ add_project_arguments(cpp_arguments, language: 'cpp') libcamera_includes = include_directories('include') +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) +else + message('C library does not support secure_getenv, using getenv instead') +endif +configure_file(output: 'config.h', configuration: config_h) +add_project_arguments('-include', 'config.h', language: 'c') +add_project_arguments('-include', 'config.h', language: 'cpp') + subdir('include') subdir('src') subdir('utils')
Not all libc make secure_getenv() available, this could lead to build failure on certain build systems. Check if secure_getenv() 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> --- meson.build | 12 ++++++++++++ 1 file changed, 12 insertions(+)