[gvfs] build: Fix statfs check on FreeBSD
- From: Ondrej Holy <oholy src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gvfs] build: Fix statfs check on FreeBSD
- Date: Tue, 2 Jan 2018 10:09:26 +0000 (UTC)
commit 623ccee4bd9779ca8d86787d2c2f90667fe6fce6
Author: Ting-Wei Lan <lantw src gnome org>
Date: Sun Dec 24 21:37:59 2017 +0800
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
meson.build | 40 ++++++++++++++++++++++------------------
1 files changed, 22 insertions(+), 18 deletions(-)
---
diff --git a/meson.build b/meson.build
index 085a6a0..7d1cebd 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'],
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]