OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [rtos/] [rtems/] [aclocal/] [sysv-ipc.m4] - Blame information for rev 567

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 30 unneback
dnl
2
dnl $Id: sysv-ipc.m4,v 1.2 2001-09-27 11:59:11 chris Exp $
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_UNION_SEMUN,
20
[
21
AC_CACHE_CHECK([whether $RTEMS_HOST defines union semun],
22
  rtems_cv_HAS_UNION_SEMUN,
23
  [AC_TRY_COMPILE([
24
#include <sys/types.h>
25
#include <sys/ipc.h>
26
#include <sys/sem.h>],
27
[union semun arg ;],
28
[rtems_cv_HAS_UNION_SEMUN="yes"],
29
[rtems_cv_HAS_UNION_SEMUN="no"])
30
 
31
if test "$rtems_cv_HAS_UNION_SEMUN" = "yes"; then
32
    AC_DEFINE(HAS_UNION_SEMUN)
33
fi])
34
])
35
 
36
AC_DEFUN(RTEMS_SYSV_SEM,
37
[AC_REQUIRE([AC_PROG_CC])
38
AC_REQUIRE([RTEMS_CANONICAL_HOST])
39
AC_CACHE_CHECK(whether $RTEMS_HOST supports System V semaphores,
40
rtems_cv_sysv_sem,
41
[
42
AC_TRY_RUN(
43
[
44
#include <sys/types.h>
45
#include <sys/ipc.h>
46
#include <sys/sem.h>
47
#if !HAS_UNION_SEMUN
48
  union semun {
49
    int val;
50
    struct semid_ds *buf;
51
    ushort *array;
52
  } ;
53
#endif
54
int main () {
55
  union semun arg ;
56
 
57
  int id=semget(IPC_PRIVATE,1,IPC_CREAT|0400);
58
  if (id == -1)
59
    exit(1);
60
  arg.val = 0; /* avoid implicit type cast to union */
61
  if (semctl(id, 0, IPC_RMID, arg) == -1)
62
    exit(1);
63
  exit(0);
64
}
65
],
66
rtems_cv_sysv_sem="yes", rtems_cv_sysv_sem="no", :)
67
])
68
])
69
 
70
AC_DEFUN(RTEMS_SYSV_SHM,
71
[AC_REQUIRE([AC_PROG_CC])
72
AC_REQUIRE([RTEMS_CANONICAL_HOST])
73
AC_CACHE_CHECK(whether $RTEMS_HOST supports System V shared memory,
74
rtems_cv_sysv_shm,
75
[
76
AC_TRY_RUN([
77
#include <sys/types.h>
78
#include <sys/ipc.h>
79
#include <sys/shm.h>
80
int main () {
81
  int id=shmget(IPC_PRIVATE,1,IPC_CREAT|0400);
82
  if (id == -1)
83
    exit(1);
84
  if (shmctl(id, IPC_RMID, 0) == -1)
85
    exit(1);
86
  exit(0);
87
}
88
],
89
rtems_cv_sysv_shm="yes", rtems_cv_sysv_shm="no", :)
90
])
91
])
92
 
93
AC_DEFUN(RTEMS_SYSV_MSG,
94
[AC_REQUIRE([AC_PROG_CC])
95
AC_REQUIRE([RTEMS_CANONICAL_HOST])
96
AC_CACHE_CHECK(whether $RTEMS_HOST supports System V messages,
97
rtems_cv_sysv_msg,
98
[
99
AC_TRY_RUN([
100
#include <sys/types.h>
101
#include <sys/ipc.h>
102
#include <sys/msg.h>
103
int main () {
104
  int id=msgget(IPC_PRIVATE,IPC_CREAT|0400);
105
  if (id == -1)
106
    exit(1);
107
  if (msgctl(id, IPC_RMID, 0) == -1)
108
    exit(1);
109
  exit(0);
110
}
111
],
112
rtems_cv_sysv_msg="yes", rtems_cv_sysv_msg="no", :)
113
])
114
])
115
 
116
AC_DEFUN(RTEMS_CHECK_SYSV_UNIX,
117
[AC_REQUIRE([RTEMS_CANONICAL_HOST])
118
if test "$RTEMS_CPU" = "unix" ; then
119
  RTEMS_UNION_SEMUN
120
  RTEMS_SYSV_SEM
121
  if test "$rtems_cv_sysv_sem" != "yes" ; then
122
    AC_MSG_ERROR([System V semaphores don't work, required by simulator])
123
  fi
124
  RTEMS_SYSV_SHM
125
  if test "$rtems_cv_sysv_shm" != "yes" ; then
126
    AC_MSG_ERROR([System V shared memory doesn't work, required by simulator])
127
  fi
128
  RTEMS_SYSV_MSG
129
  if test "$rtems_cv_sysv_msg" != "yes" ; then
130
    AC_MSG_ERROR([System V messages don't work, required by simulator])
131
  fi
132
fi
133
])

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.