diff options
author | Ting-Wei Lan <lantw@src.gnome.org> | 2017-12-24 21:37:59 +0800 |
---|---|---|
committer | Ondrej Holy <oholy@redhat.com> | 2018-01-02 11:08:04 +0100 |
commit | 623ccee4bd9779ca8d86787d2c2f90667fe6fce6 (patch) | |
tree | 23e04f0e26b3278161c63162842f024e78b0ce8b | |
parent | b2b1805e11c72696a639eb9fd8fd6db410868862 (diff) | |
download | gvfs-623ccee4bd9779ca8d86787d2c2f90667fe6fce6.tar.gz |
build: Fix statfs check on FreeBSD
To include a header without the possibility of causing 'no such file or
directory' error, we have to check for it before including it.
https://bugzilla.gnome.org/show_bug.cgi?id=786149
-rw-r--r-- | meson.build | 40 |
1 files changed, 22 insertions, 18 deletions
diff --git a/meson.build b/meson.build index 085a6a03..7d1cebd4 100644 --- a/meson.build +++ b/meson.build @@ -89,10 +89,29 @@ config_h.set('HAVE_OPENPTY', have_openpty, config_h.set('HAVE_LOGIN_TTY', util_dep.found() and cc.has_function('login_tty', dependencies: util_dep), description: 'Whether login_tty is available') +# headers +check_headers = [ + # fs + pty + ['HAVE_SYS_PARAM_H', 'sys/param.h'], + # fs + ['HAVE_SYS_MOUNT_H', 'sys/mount.h'], + ['HAVE_SYS_STATFS_H', 'sys/statfs.h'], + ['HAVE_SYS_STATVFS_H', 'sys/statvfs.h'], + ['HAVE_SYS_VFS_H', 'sys/vfs.h'] +] + +statfs_includes = '' + +foreach header: check_headers + has_header = cc.has_header(header[1]) + config_h.set10(header[0], has_header) + if has_header + statfs_includes += '#include <@0@>\n'.format(header[1]) + endif +endforeach + # if statfs() takes 2 arguments (Posix) or 4 (Solaris) -statfs_code = ''' - #include <sys/statfs.h> - #include <sys/vfs.h> +statfs_code = statfs_includes + ''' int main() { struct statfs st; @0@; @@ -107,21 +126,6 @@ else error('unable to determine number of arguments to statfs()') endif -# headers -check_headers = [ - # fs + pty - ['HAVE_SYS_PARAM_H', 'sys/param.h'], - # fs - ['HAVE_SYS_MOUNT_H', 'sys/mount.h'], - ['HAVE_SYS_STATFS_H', 'sys/statfs.h'], - ['HAVE_SYS_STATVFS_H', 'sys/statvfs.h'], - ['HAVE_SYS_VFS_H', 'sys/vfs.h'] -] - -foreach header: check_headers - config_h.set10(header[0], cc.has_header(header[1])) -endforeach - # pty check_headers = [ ['HAVE_STROPTS_H', 'stropts.h'], |