source: rtems/macros/sysv-ipc.m4 @ aac7fdd2

4.104.114.84.9
Last change on this file since aac7fdd2 was aac7fdd2, checked in by Joel Sherrill <joel.sherrill@…>, on Oct 18, 2000 at 1:14:49 PM

2000-09-14 Ralf Corsepius <corsepiu@…>

  • macros: New directory.
  • macros/bsp-alias.m4: new file.
  • macros/canonical-host.m4: new file.
  • macros/canonical-target-name.m4: new file.
  • macros/canonicalize-tools.m4: new file.
  • macros/check-bsp-cache.m4: new file.
  • macros/check-bsps.m4: new file.
  • macros/check-cpu.m4: new file.
  • macros/rtems-debug.m4: new file.
  • macros/check-cxx.m4: new file.
  • macros/check-itron.m4: new file.
  • macros/check-multiprocessing.m4: new file.
  • macros/check-networking.m4: new file.
  • macros/check-newlib.m4: new file.
  • macros/check-posix.m4: new file.
  • macros/check-rdbg.m4: new file.
  • macros/enable-bare.m4: new file.
  • macros/enable-cxx.m4: new file.
  • macros/enable-gcc28.m4: new file.
  • macros/enable-inlines.m4: new file.
  • macros/enable-itron.m4: new file.
  • macros/enable-libcdir.m4: new file.
  • macros/enable-multiprocessing.m4: new file.
  • macros/enable-networking.m4: new file.
  • macros/enable-posix.m4: new file.
  • macros/enable-rdbg.m4: new file.
  • macros/enable-rtemsbsp.m4: new file.
  • macros/enable-tests.m4: new file.
  • macros/gcc-pipe.m4: new file.
  • macros/gcc-specs.m4: new file.
  • macros/i386-gas-code16.m4: new file.
  • macros/path-ksh.m4: new file.
  • macros/path-perl.m4: new file.
  • macros/prog-cc.m4: new file.
  • macros/prog-cxx.m4: new file.
  • macros/project-root.m4: new file.
  • macros/rtems-top.m4: new file.
  • macros/sysv-ipc.m4: new file.
  • macros/target.m4: new file.
  • macros/rtems-test-no-pause.m4: new file.
  • macros/multilib.m4: new file.
  • macros/tool-paths.m4: new file.
  • macros/tool-prefix.m4: new file.
  • Property mode set to 100644
File size: 3.2 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 $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
31if test "$rtems_cv_HAS_UNION_SEMUN" = "yes"; then
32    AC_DEFINE(HAS_UNION_SEMUN)
33fi])
34])
35
36AC_DEFUN(RTEMS_SYSV_SEM,
37[AC_REQUIRE([AC_PROG_CC])
38AC_REQUIRE([RTEMS_CANONICAL_HOST])
39AC_CACHE_CHECK(whether $RTEMS_HOST supports System V semaphores,
40rtems_cv_sysv_sem,
41[
42AC_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
54int 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],
66rtems_cv_sysv_sem="yes", rtems_cv_sysv_sem="no", :)
67])
68])
69
70AC_DEFUN(RTEMS_SYSV_SHM,
71[AC_REQUIRE([AC_PROG_CC])
72AC_REQUIRE([RTEMS_CANONICAL_HOST])
73AC_CACHE_CHECK(whether $RTEMS_HOST supports System V shared memory,
74rtems_cv_sysv_shm,
75[
76AC_TRY_RUN([
77#include <sys/types.h>
78#include <sys/ipc.h>
79#include <sys/shm.h>
80int 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],
89rtems_cv_sysv_shm="yes", rtems_cv_sysv_shm="no", :)
90])
91])
92
93AC_DEFUN(RTEMS_SYSV_MSG,
94[AC_REQUIRE([AC_PROG_CC])
95AC_REQUIRE([RTEMS_CANONICAL_HOST])
96AC_CACHE_CHECK(whether $RTEMS_HOST supports System V messages,
97rtems_cv_sysv_msg,
98[
99AC_TRY_RUN([
100#include <sys/types.h>
101#include <sys/ipc.h>
102#include <sys/msg.h>
103int 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],
112rtems_cv_sysv_msg="yes", rtems_cv_sysv_msg="no", :)
113])
114])
115
116AC_DEFUN(RTEMS_CHECK_SYSV_UNIX,
117[AC_REQUIRE([RTEMS_CANONICAL_HOST])
118if 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
132fi
133])
Note: See TracBrowser for help on using the repository browser.