diff --git a/meson.build b/meson.build
index 1902ea2fd3ff..0ef4cdaafd76 100644
--- a/meson.build
+++ b/meson.build
@@ -74,6 +74,10 @@ cc = meson.get_compiler('c')
 cxx = meson.get_compiler('cpp')
 config_h = configuration_data()
 
+if cc.has_header_symbol('fcntl.h', 'F_ADD_SEALS', prefix : '#define _GNU_SOURCE')
+    config_h.set('HAVE_FILE_SEALS', 1)
+endif
+
 if cc.has_header_symbol('unistd.h', 'issetugid')
     config_h.set('HAVE_ISSETUGID', 1)
 endif
diff --git a/src/libcamera/dma_buf_allocator.cpp b/src/libcamera/dma_buf_allocator.cpp
index d7d08e188a62..1c39441a3415 100644
--- a/src/libcamera/dma_buf_allocator.cpp
+++ b/src/libcamera/dma_buf_allocator.cpp
@@ -157,6 +157,11 @@ UniqueFD DmaBufAllocator::allocFromUDmaBuf(const char *name, std::size_t size)
 		return {};
 	}
 
+#if not HAVE_FILE_SEALS
+#define F_ADD_SEALS	1033
+#define F_SEAL_SHRINK	0x0002
+#endif
+
 	/* udmabuf dma-buffers *must* have the F_SEAL_SHRINK seal. */
 	ret = fcntl(memfd.get(), F_ADD_SEALS, F_SEAL_SHRINK);
 	if (ret < 0) {
