Skip to content

Commit 769fba8

Browse files
committed
Fix statfs check
1 parent 9346e3b commit 769fba8

File tree

1 file changed

+15
-6
lines changed

1 file changed

+15
-6
lines changed

cmake/cmake/ConfigureChecks.cmake

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -304,12 +304,21 @@ check_symbol_exists(setenv "stdlib.h" HAVE_SETENV)
304304
check_symbol_exists(shutdown "sys/socket.h" HAVE_SHUTDOWN)
305305
check_symbol_exists(sigprocmask "signal.h" HAVE_SIGPROCMASK)
306306

307-
# BSD-based systems have statfs in sys/mount.h.
308-
if(HAVE_SYS_MOUNT_H)
309-
check_symbol_exists(statfs "sys/mount.h" HAVE_STATFS)
310-
else()
311-
check_symbol_exists(statfs "sys/statfs.h" HAVE_STATFS)
312-
endif()
307+
# Check for statfs().
308+
block()
309+
set(headers "")
310+
311+
# BSD-based systems have statfs in sys/mount.h.
312+
if(HAVE_SYS_MOUNT_H)
313+
list(APPEND headers "sys/mount.h")
314+
endif()
315+
316+
if(HAVE_SYS_STATFS_H)
317+
list(APPEND headers "sys/statfs.h")
318+
endif()
319+
320+
check_symbol_exists(statfs "${headers}" HAVE_STATFS)
321+
endblock()
313322

314323
check_symbol_exists(statvfs "sys/statvfs.h" HAVE_STATVFS)
315324
check_symbol_exists(std_syslog "sys/syslog.h" HAVE_STD_SYSLOG)

0 commit comments

Comments
 (0)