summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJulian Andres Klode <jak@debian.org>2016-08-23 14:40:46 +0200
committerJulian Andres Klode <jak@debian.org>2016-08-26 15:49:14 +0200
commit2c391d850fb405e03bca362caa5c90262c66fe33 (patch)
tree5d670974fcc946cbd232a5f682b93172a185a314
parentc799c3efe43d7fde53ea4a3c5f976375607a2805 (diff)
CMake/private-download: Fix statfs includes on FreeBSD
On FreeBSD, we have to include sys/params.h and sys/mount.h, not sys/vfs.h. Gbp-Dch: ignore
-rw-r--r--CMakeLists.txt11
-rw-r--r--apt-private/private-download.cc7
2 files changed, 13 insertions, 5 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 4f4c8b37e..b2e5bfe9c 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -89,14 +89,15 @@ if (LZ4_FOUND)
endif()
# Mount()ing and stat()ing and friends
+check_symbol_exists(statfs sys/vfs.h HAVE_VFS_H)
+check_include_files(sys/params.h HAVE_PARAMS_H)
+check_symbol_exists(statfs sys/mount.h HAVE_MOUNT_H)
+if (NOT HAVE_VFS_H AND NOT HAVE_MOUNT_H)
+ message(FATAL_ERROR "Can find neither statvfs() nor statfs()")
+endif()
check_function_exists(statvfs HAVE_STATVFS)
if (NOT HAVE_STATVFS)
- check_symbol_exists(statfs sys/vfs.h HAVE_VFS_H)
- check_symbol_exists(statfs sys/mount.h HAVE_MOUNT_H)
- if (NOT HAVE_VFS_H AND NOT HAVE_MOUNT_H)
- message(FATAL_ERROR "Can find neither statvfs() nor statfs()")
- endif()
configure_file(CMake/statvfs.h.in ${PROJECT_BINARY_DIR}/include/statvfs.h COPYONLY)
endif()
diff --git a/apt-private/private-download.cc b/apt-private/private-download.cc
index c85a49727..d0cbbcf50 100644
--- a/apt-private/private-download.cc
+++ b/apt-private/private-download.cc
@@ -25,7 +25,14 @@
#include <sys/types.h>
#include <pwd.h>
#include <fcntl.h>
+#ifdef HAVE_VFS_H
#include <sys/vfs.h>
+#else
+#ifdef HAVE_PARAMS_H
+#include <sys/params.h>
+#endif
+#include <sys/mount.h>
+#endif
#include <sys/statvfs.h>
#include <sys/stat.h>
#include <errno.h>