meson >=0.46.0 fails to configure when cc.has_header and/or cc.has_function called more than once with the same argument
hi
actually, not sure whether this is a problem with glib or meson, so cross posting.
meson >=0.46.0 is failing the configuration step of (at least) glib-2.56.1 and 2.57.1 (the ones that I have tested).
The reason seems to be calling cc.has_header and/or cc.has_function more than once with the same argument in meson.build [1].
termios.h occurs twice in the definition of the "headers" variable (this definitely looks like a typo in glib's meson.build) and this crashes the meson run upon the second "cc.has_header(termios.h)" call in the following "foreach h : headers" loop.
Same thing for gmtime_r which occurs twice in the "functions" variable definition (another typo?) and crashes the meson run in the following "foreach f : functions" loop upon the second cc.has_function(gmtime_r)" call
Similarly, cc.has_header('alloca.h') is called twice: a first time in the "foreach h : headers" loop and a second time at line 1350 (of 2.57.1's meson.build [1]); same for cc.has_header('sys/types.h'), called the first time in the "foreach h : headers" loop and the second time at line 1354 (of 2.57.1's meson.build [1]).
Note that meson 0.45.1 gives no errors (everything else unchanged).
To better explain what I mean, the following hack fixes things for me for both glib-2.56.1 and glib-2.57.1 (patch shown for 2.57.1's meson.build [1]):
diff -c ./meson.build.MESON_0_46_FIX ./meson.build
*** ./meson.build.MESON_0_46_FIX 2018-05-23 18:04:02.934965026 +0200
--- ./meson.build 2018-05-23 18:04:02.954965106 +0200
***************
*** 207,213 ****
'string.h',
'strings.h',
'memory.h',
- 'alloca.h',
'locale.h',
'xlocale.h',
'float.h',
--- 207,212 ----
***************
*** 235,248 ****
'sys/mntctl.h',
'fstab.h',
'linux/magic.h',
- 'termios.h',
'dirent.h', # MSC does not come with this by default
'sys/time.h', # MSC does not come with this by default
'sys/times.h',
'sys/wait.h',
'unistd.h',
'values.h',
- 'sys/types.h',
'sys/uio.h',
'sys/mkdev.h',
'sys/mount.h',
--- 234,245 ----
***************
*** 399,405 ****
'getvfsstat',
'fallocate',
'localtime_r',
- 'gmtime_r',
'getpwuid_r',
'getgrgid_r',
'prlimit',
--- 396,401 ----
[1] https://github.com/GNOME/glib/blob/master/meson.build
ciao gabriele