1 dnl Copyright (C) 2010 Vincent Torri <vtorri at univ-evry dot fr>
2 dnl That code is public domain and can be freely used or copied.
4 dnl Macro that check if shm_open function is available or not.
6 dnl Usage: EFL_CHECK_SHM_OPEN([, ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]])
7 dnl Call AC_SUBST(EFL_SHM_OPEN_LIBS)
8 dnl Define HAVE_SHM_OPEN to 1if shm_open is available
10 AC_DEFUN([EFL_CHECK_SHM_OPEN],
12 _efl_have_shm_open="no"
14 dnl Check is shm_open is in libc
16 AC_MSG_CHECKING([for shm_open in libc])
21 #include <sys/stat.h> /* For mode constants */
22 #include <fcntl.h> /* For O_* constants */
27 fd = shm_open("/dev/null", O_RDONLY, S_IRWXU | S_IRWXG | S_IRWXO);
29 [_efl_have_shm_open="yes"],
30 [_efl_have_shm_open="no"])
32 AC_MSG_RESULT([${_efl_have_shm_open}])
34 if test "x$_efl_have_shm_open" = "xno" ; then
35 AC_MSG_CHECKING([for shm_open in librt])
43 #include <sys/stat.h> /* For mode constants */
44 #include <fcntl.h> /* For O_* constants */
49 fd = shm_open("/dev/null", O_RDONLY, S_IRWXU | S_IRWXG | S_IRWXO);
52 EFL_SHM_OPEN_LIBS="-lrt"
53 _efl_have_shm_open="yes"],
54 [_efl_have_shm_open="no"])
58 AC_MSG_RESULT([${_efl_have_shm_open}])
61 AC_SUBST([EFL_SHM_OPEN_LIBS])
63 if test "x$_efl_have_shm_open" = "xyes" ; then
64 AC_DEFINE([HAVE_SHM_OPEN], [1], [Define to 1 if you have the `shm_open' function.])
67 AS_IF([test "x$_efl_have_shm_open" = "xyes"], [$1], [$2])