From 85ab0307d7923128aebb069200791c01c7892c2e Mon Sep 17 00:00:00 2001 From: morganamilo Date: Fri, 25 Aug 2023 07:01:46 +0200 Subject: [PATCH] Fix compile on some platforms Controlling the type of getmntinfo's param was decided by whether or not we had the statvfs type avaliable. But getmntinfo uses statfs regardless of this except on netbsd where it uses statvfs. Add a check to detect which type our version of the function uses. --- meson.build | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/meson.build b/meson.build index dbc599ea..43705338 100644 --- a/meson.build +++ b/meson.build @@ -182,7 +182,22 @@ foreach type : [ endif endforeach -if conf.has('HAVE_STRUCT_STATVFS_F_FLAG') + +if conf.has('HAVE_GETMNTINFO') + if cc.compiles(''' + #include + #include + + void func() { + struct statvfs *buf; + getmntinfo(&buf, 0); + } + ''') + conf.set('FSSTATSTYPE', 'struct statvfs') + else + conf.set('FSSTATSTYPE', 'struct statfs') + endif +elif conf.has('HAVE_STRUCT_STATVFS_F_FLAG') conf.set('FSSTATSTYPE', 'struct statvfs') elif conf.has('HAVE_STRUCT_STATFS_F_FLAGS') conf.set('FSSTATSTYPE', 'struct statfs')