[vlc-devel] [PATCH] configure.ac: check validity of sys/shm.h

Alexandre Janniaux ajanni at videolabs.io
Wed May 20 20:34:16 CEST 2020


Some version of Android < 26 have sys/shm.h but it doesn't contain the
functions that shall be exposed. So as to avoid misconfiguration, only
define HAVE_SYS_SHM_H if the header exists AND that it exposes the
required functions.
---
 configure.ac | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/configure.ac b/configure.ac
index ea50387801e..c0d14a8a6c2 100644
--- a/configure.ac
+++ b/configure.ac
@@ -941,7 +941,14 @@ dnl Check for headers
 dnl
 
 dnl  POSIX
-AC_CHECK_HEADERS([arpa/inet.h pthread.h search.h sys/shm.h sys/socket.h sys/uio.h])
+
+dnl Android may have incomplete sys/shm.h header so
+dnl we check that the header is correct.
+AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
+  [[#include <sys/shm.h>]], [[shmat; shmctl; shmdt; shmget;]])],
+  [AC_DEFINE([HAVE_SYS_SHM_H], [1], [Define to 1 if sys/shm.h is available])])
+
+AC_CHECK_HEADERS([arpa/inet.h pthread.h search.h sys/socket.h sys/uio.h])
 AC_CHECK_HEADERS([net/if.h], [], [],
 [
 #include <sys/types.h>
-- 
2.26.2



More information about the vlc-devel mailing list