build: add configure check for having memfd_create() API

This commit is contained in:
Thomas Haller
2018-09-11 16:06:25 +02:00
parent ec37e18c64
commit 50e092a967
3 changed files with 11 additions and 0 deletions

View File

@@ -19,6 +19,10 @@
/* Gettext package */
#mesondefine GETTEXT_PACKAGE
/* Define to 1 if you have the declaration of `memfd_create', and to 0 if you
don't. */
#mesondefine HAVE_DECL_MEMFD_CREATE
/* Define to 1 if you have the declaration of `reallocarray', and to 0 if
you don't. */
#mesondefine HAVE_DECL_REALLOCARRAY

View File

@@ -81,6 +81,12 @@ AC_CHECK_DECLS([
#include <malloc.h>
]])
AC_CHECK_DECLS([
memfd_create],
[], [], [[
#include <sys/mman.h>
]])
AC_CHECK_HEADERS(sys/auxv.h)
AC_CHECK_DECLS([getrandom],

View File

@@ -115,6 +115,7 @@ config_h.set('HAVE_SECURE_GETENV', cc.has_function('secure_getenv'))
config_h.set('HAVE___SECURE_GETENV', cc.has_function('__secure_getenv'))
config_h.set10('HAVE_DECL_REALLOCARRAY', cc.has_function('reallocarray', prefix: '#include <malloc.h>'))
config_h.set10('HAVE_DECL_EXPLICIT_BZERO', cc.has_function('explicit_bzero', prefix: '#include <string.h>'))
config_h.set10('HAVE_DECL_MEMFD_CREATE', cc.has_function('memfd_create', prefix: '#include <sys/mman.h>'))
# types
config_h.set('SIZEOF_DEV_T', cc.sizeof('dev_t', prefix: '#include <sys/types.h>'))