source: rtems/cpukit/aclocal/sysv-ipc.m4 @ f26145b

4.104.114.84.95
Last change on this file since f26145b was 863fb4f, checked in by Ralf Corsepius <ralf.corsepius@…>, on 11/26/03 at 06:56:28

2003-11-26 Ralf Corsepius <corsepiu@…>

  • aclocal/canonicalize-tools.m4, aclocal/check-itron.m4, aclocal/check-multiprocessing.m4, aclocal/check-newlib.m4, aclocal/check-posix.m4, aclocal/check-rtems-debug.m4, aclocal/check-tool.m4, aclocal/enable-bare.m4, aclocal/enable-inlines.m4, aclocal/enable-itron.m4, aclocal/enable-multiprocessing.m4, aclocal/enable-networking.m4, aclocal/enable-posix.m4, aclocal/enable-rtems-debug.m4, aclocal/env-rtemscpu.m4, aclocal/gcc-isystem.m4, aclocal/gcc-pipe.m4, aclocal/multi.m4, aclocal/multilib.m4, aclocal/prog-cc.m4, aclocal/rtems-top.m4, aclocal/sysv-ipc.m4: Fix underquoting to silence automake-1.8.
  • Property mode set to 100644
File size: 3.3 KB
Line 
1dnl
2dnl $Id$
3dnl
4dnl Check for System V IPC calls used by Unix simulators
5dnl
6dnl 98/07/17 Dario Alcocer     alcocer@netcom.com
7dnl          Ralf Corsepius    corsepiu@faw.uni-ulm.de
8dnl
9dnl Note: $host_os should probably *not* ever be used here to
10dnl determine if host supports System V IPC calls, since some
11dnl (e.g. FreeBSD 2.x) are configured by default to include only
12dnl a subset of the System V IPC calls.  Therefore, to make sure
13dnl all of the required calls are found, test for each call explicitly.
14dnl
15dnl All of the calls use IPC_PRIVATE, so tests will not unintentionally
16dnl modify any existing key sets.  See the man pages for semget, shmget,
17dnl msgget, semctl, shmctl and msgctl for details.
18
19AC_DEFUN([RTEMS_UNION_SEMUN],
20[
21AC_CACHE_CHECK([whether $host defines union semun],
22  rtems_cv_HAS_UNION_SEMUN,
23  [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
24#include <sys/types.h>
25#include <sys/ipc.h>
26#include <sys/sem.h>]], [[union semun arg ;]])],[rtems_cv_HAS_UNION_SEMUN="yes"],[rtems_cv_HAS_UNION_SEMUN="no"])
27])
28if test "$rtems_cv_HAS_UNION_SEMUN" = "yes"; then
29    AC_DEFINE(HAS_UNION_SEMUN,[1],[if having union semum])
30fi
31])
32
33AC_DEFUN([RTEMS_SYSV_SEM],
34[AC_REQUIRE([AC_PROG_CC])
35AC_CACHE_CHECK(whether $host supports System V semaphores,
36rtems_cv_sysv_sem,
37[
38AC_RUN_IFELSE([AC_LANG_SOURCE([[
39#include <sys/types.h>
40#include <sys/ipc.h>
41#include <sys/sem.h>
42#if !HAS_UNION_SEMUN
43  union semun {
44    int val;
45    struct semid_ds *buf;
46    ushort *array;
47  } ;
48#endif
49int main () {
50  union semun arg ;
51
52  int id=semget(IPC_PRIVATE,1,IPC_CREAT|0400);
53  if (id == -1)
54    exit(1);
55  arg.val = 0; /* avoid implicit type cast to union */
56  if (semctl(id, 0, IPC_RMID, arg) == -1)
57    exit(1);
58  exit(0);
59}
60]])],[rtems_cv_sysv_sem="yes"],[rtems_cv_sysv_sem="no"],[:])
61])
62])
63
64AC_DEFUN([RTEMS_SYSV_SHM],
65[AC_REQUIRE([AC_PROG_CC])
66# AC_REQUIRE([RTEMS_CANONICAL_HOST])
67AC_CACHE_CHECK(whether $host supports System V shared memory,
68rtems_cv_sysv_shm,
69[
70AC_RUN_IFELSE([AC_LANG_SOURCE([[
71#include <sys/types.h>
72#include <sys/ipc.h>
73#include <sys/shm.h>
74int main () {
75  int id=shmget(IPC_PRIVATE,1,IPC_CREAT|0400);
76  if (id == -1)
77    exit(1);
78  if (shmctl(id, IPC_RMID, 0) == -1)
79    exit(1);
80  exit(0);
81}
82]])],[rtems_cv_sysv_shm="yes"],[rtems_cv_sysv_shm="no"],[:])
83])
84])
85
86AC_DEFUN([RTEMS_SYSV_MSG],
87[AC_REQUIRE([AC_PROG_CC])
88# AC_REQUIRE([RTEMS_CANONICAL_HOST])
89AC_CACHE_CHECK(whether $host supports System V messages,
90rtems_cv_sysv_msg,
91[
92AC_RUN_IFELSE([AC_LANG_SOURCE([[
93#include <sys/types.h>
94#include <sys/ipc.h>
95#include <sys/msg.h>
96int main () {
97  int id=msgget(IPC_PRIVATE,IPC_CREAT|0400);
98  if (id == -1)
99    exit(1);
100  if (msgctl(id, IPC_RMID, 0) == -1)
101    exit(1);
102  exit(0);
103}
104]])],[rtems_cv_sysv_msg="yes"],[rtems_cv_sysv_msg="no"],[:])
105])
106])
107
108AC_DEFUN([RTEMS_CHECK_SYSV_UNIX],
109[# AC_REQUIRE([RTEMS_CANONICAL_HOST])
110if test "$RTEMS_CPU" = "unix" ; then
111  RTEMS_UNION_SEMUN
112  RTEMS_SYSV_SEM
113  if test "$rtems_cv_sysv_sem" != "yes" ; then
114    AC_MSG_ERROR([System V semaphores don't work, required by simulator])
115  fi
116  RTEMS_SYSV_SHM
117  if test "$rtems_cv_sysv_shm" != "yes" ; then
118    AC_MSG_ERROR([System V shared memory doesn't work, required by simulator])
119  fi
120  RTEMS_SYSV_MSG
121  if test "$rtems_cv_sysv_msg" != "yes" ; then
122    AC_MSG_ERROR([System V messages don't work, required by simulator])
123  fi
124fi
125])
Note: See TracBrowser for help on using the repository browser.