summaryrefslogtreecommitdiff
path: root/legacy/evas/m4
diff options
context:
space:
mode:
authorVincent Torri <vincent.torri@gmail.com>2012-03-25 16:39:04 +0000
committerVincent Torri <vincent.torri@gmail.com>2012-03-25 16:39:04 +0000
commit5422bf5b852770e06e75d57af0c731053df9a650 (patch)
treede98560aa8348487314886408eb8bbe61ed436f0 /legacy/evas/m4
parentd1ba8d603519db252467c39cff8906d8ec11ee65 (diff)
Evas: fix shm_open() check (can be in libc or librt)
This works in linux and windows, and should fix shm_detection on BSD (including Mac) BSD, Mac and solaris users : please check that it compiles and shm_open is detected SVN revision: 69612
Diffstat (limited to 'legacy/evas/m4')
-rw-r--r--legacy/evas/m4/efl_shm_open.m470
1 files changed, 70 insertions, 0 deletions
diff --git a/legacy/evas/m4/efl_shm_open.m4 b/legacy/evas/m4/efl_shm_open.m4
new file mode 100644
index 0000000..ce3bcf8
--- /dev/null
+++ b/legacy/evas/m4/efl_shm_open.m4
@@ -0,0 +1,70 @@
1dnl Copyright (C) 2010 Vincent Torri <vtorri at univ-evry dot fr>
2dnl That code is public domain and can be freely used or copied.
3
4dnl Macro that check if shm_open function is available or not.
5
6dnl Usage: EFL_CHECK_SHM_OPEN([, ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]])
7dnl Call AC_SUBST(EFL_SHM_OPEN_LIBS)
8dnl Define HAVE_SHM_OPEN to 1if shm_open is available
9
10AC_DEFUN([EFL_CHECK_SHM_OPEN],
11[
12_efl_have_shm_open="no"
13
14dnl Check is shm_open is in libc
15
16AC_MSG_CHECKING([for shm_open in libc])
17AC_LINK_IFELSE(
18 [AC_LANG_PROGRAM(
19 [[
20#include <sys/mman.h>
21#include <sys/stat.h> /* For mode constants */
22#include <fcntl.h> /* For O_* constants */
23 ]],
24 [[
25int fd;
26
27fd = shm_open("/dev/null", O_RDONLY, S_IRWXU | S_IRWXG | S_IRWXO);
28 ]])],
29 [_efl_have_shm_open="yes"],
30 [_efl_have_shm_open="no"])
31
32AC_MSG_RESULT([${_efl_have_shm_open}])
33
34if test "x${_efl_have_shm_open}" = "xno" ; then
35 AC_MSG_CHECKING([for shm_open in librt])
36
37 LIBS_save="${LIBS}"
38 LIBS="${LIBS} -lrt"
39 AC_LINK_IFELSE(
40 [AC_LANG_PROGRAM(
41 [[
42#include <sys/mman.h>
43#include <sys/stat.h> /* For mode constants */
44#include <fcntl.h> /* For O_* constants */
45 ]],
46 [[
47int fd;
48
49fd = shm_open("/dev/null", O_RDONLY, S_IRWXU | S_IRWXG | S_IRWXO);
50 ]])],
51 [
52 EFL_SHM_OPEN_LIBS="-lrt"
53 _efl_have_shm_open="yes"
54 ],
55 [_efl_have_shm_open="no"])
56
57 LIBS="${LIBS_save}"
58
59 AC_MSG_RESULT([${_efl_have_shm_open}])
60fi
61
62AC_SUBST([EFL_SHM_OPEN_LIBS])
63
64if test "x${_efl_have_shm_open}" = "xyes" ; then
65 AC_DEFINE([HAVE_SHM_OPEN], [1], [Define to 1 if you have the `shm_open' function.])
66fi
67
68AS_IF([test "x${_efl_have_shm_open}" = "xyes"], [$1], [$2])
69
70])