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

4.104.114.84.95
Last change on this file since 5b2e199 was 1f64ebf, checked in by Ralf Corsepius <ralf.corsepius@…>, on 11/19/02 at 17:10:36

2002-11-19 Ralf Corsepius <corsepiu@…>

  • aclocal/sysv-ipc.m4: Adaptation to autoconf-2.5x.
  • aclocal/check-newlib.m4: Sync with ../aclocal/check-newlib.m4.
  • 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])
35# AC_REQUIRE([RTEMS_CANONICAL_HOST])
36AC_CACHE_CHECK(whether $host supports System V semaphores,
37rtems_cv_sysv_sem,
38[
39AC_RUN_IFELSE([AC_LANG_SOURCE([[
40#include <sys/types.h>
41#include <sys/ipc.h>
42#include <sys/sem.h>
43#if !HAS_UNION_SEMUN
44  union semun {
45    int val;
46    struct semid_ds *buf;
47    ushort *array;
48  } ;
49#endif
50int main () {
51  union semun arg ;
52
53  int id=semget(IPC_PRIVATE,1,IPC_CREAT|0400);
54  if (id == -1)
55    exit(1);
56  arg.val = 0; /* avoid implicit type cast to union */
57  if (semctl(id, 0, IPC_RMID, arg) == -1)
58    exit(1);
59  exit(0);
60}
61]])],[rtems_cv_sysv_sem="yes"],[rtems_cv_sysv_sem="no"],[:])
62])
63])
64
65AC_DEFUN(RTEMS_SYSV_SHM,
66[AC_REQUIRE([AC_PROG_CC])
67# AC_REQUIRE([RTEMS_CANONICAL_HOST])
68AC_CACHE_CHECK(whether $host supports System V shared memory,
69rtems_cv_sysv_shm,
70[
71AC_RUN_IFELSE([AC_LANG_SOURCE([[
72#include <sys/types.h>
73#include <sys/ipc.h>
74#include <sys/shm.h>
75int main () {
76  int id=shmget(IPC_PRIVATE,1,IPC_CREAT|0400);
77  if (id == -1)
78    exit(1);
79  if (shmctl(id, IPC_RMID, 0) == -1)
80    exit(1);
81  exit(0);
82}
83]])],[rtems_cv_sysv_shm="yes"],[rtems_cv_sysv_shm="no"],[:])
84])
85])
86
87AC_DEFUN(RTEMS_SYSV_MSG,
88[AC_REQUIRE([AC_PROG_CC])
89# AC_REQUIRE([RTEMS_CANONICAL_HOST])
90AC_CACHE_CHECK(whether $host supports System V messages,
91rtems_cv_sysv_msg,
92[
93AC_RUN_IFELSE([AC_LANG_SOURCE([[
94#include <sys/types.h>
95#include <sys/ipc.h>
96#include <sys/msg.h>
97int main () {
98  int id=msgget(IPC_PRIVATE,IPC_CREAT|0400);
99  if (id == -1)
100    exit(1);
101  if (msgctl(id, IPC_RMID, 0) == -1)
102    exit(1);
103  exit(0);
104}
105]])],[rtems_cv_sysv_msg="yes"],[rtems_cv_sysv_msg="no"],[:])
106])
107])
108
109AC_DEFUN(RTEMS_CHECK_SYSV_UNIX,
110[# AC_REQUIRE([RTEMS_CANONICAL_HOST])
111if test "$RTEMS_CPU" = "unix" ; then
112  RTEMS_UNION_SEMUN
113  RTEMS_SYSV_SEM
114  if test "$rtems_cv_sysv_sem" != "yes" ; then
115    AC_MSG_ERROR([System V semaphores don't work, required by simulator])
116  fi
117  RTEMS_SYSV_SHM
118  if test "$rtems_cv_sysv_shm" != "yes" ; then
119    AC_MSG_ERROR([System V shared memory doesn't work, required by simulator])
120  fi
121  RTEMS_SYSV_MSG
122  if test "$rtems_cv_sysv_msg" != "yes" ; then
123    AC_MSG_ERROR([System V messages don't work, required by simulator])
124  fi
125fi
126])
Note: See TracBrowser for help on using the repository browser.