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.
This commit is contained in:
morganamilo 2023-08-25 07:01:46 +02:00
parent ffde12cebd
commit 85ab0307d7
No known key found for this signature in database
GPG key ID: E48D0A8326DE47C5

View file

@ -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 <sys/types.h>
#include <sys/statvfs.h>
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')