1 | dnl |
---|
2 | dnl $Id$ |
---|
3 | dnl |
---|
4 | dnl Check for System V IPC calls used by Unix simulators |
---|
5 | dnl |
---|
6 | dnl 98/07/17 Dario Alcocer alcocer@netcom.com |
---|
7 | dnl Ralf Corsepius corsepiu@faw.uni-ulm.de |
---|
8 | dnl |
---|
9 | dnl Note: $host_os should probably *not* ever be used here to |
---|
10 | dnl determine if host supports System V IPC calls, since some |
---|
11 | dnl (e.g. FreeBSD 2.x) are configured by default to include only |
---|
12 | dnl a subset of the System V IPC calls. Therefore, to make sure |
---|
13 | dnl all of the required calls are found, test for each call explicitly. |
---|
14 | dnl |
---|
15 | dnl All of the calls use IPC_PRIVATE, so tests will not unintentionally |
---|
16 | dnl modify any existing key sets. See the man pages for semget, shmget, |
---|
17 | dnl msgget, semctl, shmctl and msgctl for details. |
---|
18 | |
---|
19 | AC_DEFUN(RTEMS_SYSV_SEM, |
---|
20 | [AC_REQUIRE([RTEMS_PROG_CC]) |
---|
21 | AC_REQUIRE([AC_CANONICAL_HOST]) |
---|
22 | AC_CACHE_CHECK(whether $RTEMS_HOST supports System V semaphores, |
---|
23 | rtems_cv_sysv_sem, |
---|
24 | [ |
---|
25 | AC_TRY_RUN([ |
---|
26 | #include <sys/types.h> |
---|
27 | #include <sys/ipc.h> |
---|
28 | #include <sys/sem.h> |
---|
29 | int main () { |
---|
30 | union semun arg ; |
---|
31 | int id=semget(IPC_PRIVATE,1,IPC_CREAT|0400); |
---|
32 | if (id == -1) |
---|
33 | exit(1); |
---|
34 | arg.val = 0; /* avoid implicit type cast to union */ |
---|
35 | if (semctl(id, 0, IPC_RMID, arg) == -1) |
---|
36 | exit(1); |
---|
37 | exit(0); |
---|
38 | } |
---|
39 | ], |
---|
40 | rtems_cv_sysv_sem="yes", rtems_cv_sysv_sem="no", :) |
---|
41 | ]) |
---|
42 | ]) |
---|
43 | |
---|
44 | AC_DEFUN(RTEMS_SYSV_SHM, |
---|
45 | [AC_REQUIRE([RTEMS_PROG_CC]) |
---|
46 | AC_REQUIRE([AC_CANONICAL_HOST]) |
---|
47 | AC_CACHE_CHECK(whether $RTEMS_HOST supports System V shared memory, |
---|
48 | rtems_cv_sysv_shm, |
---|
49 | [ |
---|
50 | AC_TRY_RUN([ |
---|
51 | #include <sys/types.h> |
---|
52 | #include <sys/ipc.h> |
---|
53 | #include <sys/shm.h> |
---|
54 | int main () { |
---|
55 | int id=shmget(IPC_PRIVATE,1,IPC_CREAT|0400); |
---|
56 | if (id == -1) |
---|
57 | exit(1); |
---|
58 | if (shmctl(id, IPC_RMID, 0) == -1) |
---|
59 | exit(1); |
---|
60 | exit(0); |
---|
61 | } |
---|
62 | ], |
---|
63 | rtems_cv_sysv_shm="yes", rtems_cv_sysv_shm="no", :) |
---|
64 | ]) |
---|
65 | ]) |
---|
66 | |
---|
67 | AC_DEFUN(RTEMS_SYSV_MSG, |
---|
68 | [AC_REQUIRE([RTEMS_PROG_CC]) |
---|
69 | AC_REQUIRE([AC_CANONICAL_HOST]) |
---|
70 | AC_CACHE_CHECK(whether $RTEMS_HOST supports System V messages, |
---|
71 | rtems_cv_sysv_msg, |
---|
72 | [ |
---|
73 | AC_TRY_RUN([ |
---|
74 | #include <sys/types.h> |
---|
75 | #include <sys/ipc.h> |
---|
76 | #include <sys/msg.h> |
---|
77 | int main () { |
---|
78 | int id=msgget(IPC_PRIVATE,IPC_CREAT|0400); |
---|
79 | if (id == -1) |
---|
80 | exit(1); |
---|
81 | if (msgctl(id, IPC_RMID, 0) == -1) |
---|
82 | exit(1); |
---|
83 | exit(0); |
---|
84 | } |
---|
85 | ], |
---|
86 | rtems_cv_sysv_msg="yes", rtems_cv_sysv_msg="no", :) |
---|
87 | ]) |
---|
88 | ]) |
---|