We should not mock stat64() when building on Apple Silicon,
because the declaration is not present in the header file.
Detect this situation and handle it gracefully.
https://gitlab.com/libvirt/libvirt/-/issues/121
Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
*
* On macOS stat() and lstat() are resolved to _stat$INODE64 and
* _lstat$INODE64, respectively. stat(2) man page also declares that
- * stat64(), lstat64() and fstat64() are deprecated.
+ * stat64(), lstat64() and fstat64() are deprecated, and when
+ * building on Apple Silicon (aarch64) those functions are missing
+ * from the header altogether and should not be mocked.
*
* With all this in mind the list of functions we have to mock will depend
* on several factors
# endif /* WITH___LXSTAT_DECL */
#else /* __APPLE__ */
# define MOCK_STAT
-# define MOCK_STAT64
+# if defined(WITH_STAT64_DECL)
+# define MOCK_STAT64
+# endif
# define MOCK_LSTAT
-# define MOCK_LSTAT64
+# if defined(WITH_LSTAT64_DECL)
+# define MOCK_LSTAT64
+# endif
#endif
#ifdef MOCK_STAT