diff options
author | Joel Sherrill <joel.sherrill@OARcorp.com> | 2000-10-18 13:14:49 +0000 |
---|---|---|
committer | Joel Sherrill <joel.sherrill@OARcorp.com> | 2000-10-18 13:14:49 +0000 |
commit | aac7fdd28cf1ffbce75e88a1174e75bf5dfa0f30 (patch) | |
tree | c738bfae54c1916b7637adb784317dc20e3d32b7 /macros/sysv-ipc.m4 | |
parent | 2000-10-18 Joel Sherrill <joel@OARcorp.com> (diff) | |
download | rtems-aac7fdd28cf1ffbce75e88a1174e75bf5dfa0f30.tar.bz2 |
2000-09-14 Ralf Corsepius <corsepiu@faw.uni-ulm.de>
* 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.
Diffstat (limited to '')
-rw-r--r-- | macros/sysv-ipc.m4 | 133 |
1 files changed, 133 insertions, 0 deletions
diff --git a/macros/sysv-ipc.m4 b/macros/sysv-ipc.m4 new file mode 100644 index 0000000000..883921e2c8 --- /dev/null +++ b/macros/sysv-ipc.m4 @@ -0,0 +1,133 @@ +dnl +dnl $Id$ +dnl +dnl Check for System V IPC calls used by Unix simulators +dnl +dnl 98/07/17 Dario Alcocer alcocer@netcom.com +dnl Ralf Corsepius corsepiu@faw.uni-ulm.de +dnl +dnl Note: $host_os should probably *not* ever be used here to +dnl determine if host supports System V IPC calls, since some +dnl (e.g. FreeBSD 2.x) are configured by default to include only +dnl a subset of the System V IPC calls. Therefore, to make sure +dnl all of the required calls are found, test for each call explicitly. +dnl +dnl All of the calls use IPC_PRIVATE, so tests will not unintentionally +dnl modify any existing key sets. See the man pages for semget, shmget, +dnl msgget, semctl, shmctl and msgctl for details. + +AC_DEFUN(RTEMS_UNION_SEMUN, +[ +AC_CACHE_CHECK([whether $RTEMS_HOST defines union semun], + rtems_cv_HAS_UNION_SEMUN, + [AC_TRY_COMPILE([ +#include <sys/types.h> +#include <sys/ipc.h> +#include <sys/sem.h>], +[union semun arg ;], +[rtems_cv_HAS_UNION_SEMUN="yes"], +[rtems_cv_HAS_UNION_SEMUN="no"]) + +if test "$rtems_cv_HAS_UNION_SEMUN" = "yes"; then + AC_DEFINE(HAS_UNION_SEMUN) +fi]) +]) + +AC_DEFUN(RTEMS_SYSV_SEM, +[AC_REQUIRE([AC_PROG_CC]) +AC_REQUIRE([RTEMS_CANONICAL_HOST]) +AC_CACHE_CHECK(whether $RTEMS_HOST supports System V semaphores, +rtems_cv_sysv_sem, +[ +AC_TRY_RUN( +[ +#include <sys/types.h> +#include <sys/ipc.h> +#include <sys/sem.h> +#if !HAS_UNION_SEMUN + union semun { + int val; + struct semid_ds *buf; + ushort *array; + } ; +#endif +int main () { + union semun arg ; + + int id=semget(IPC_PRIVATE,1,IPC_CREAT|0400); + if (id == -1) + exit(1); + arg.val = 0; /* avoid implicit type cast to union */ + if (semctl(id, 0, IPC_RMID, arg) == -1) + exit(1); + exit(0); +} +], +rtems_cv_sysv_sem="yes", rtems_cv_sysv_sem="no", :) +]) +]) + +AC_DEFUN(RTEMS_SYSV_SHM, +[AC_REQUIRE([AC_PROG_CC]) +AC_REQUIRE([RTEMS_CANONICAL_HOST]) +AC_CACHE_CHECK(whether $RTEMS_HOST supports System V shared memory, +rtems_cv_sysv_shm, +[ +AC_TRY_RUN([ +#include <sys/types.h> +#include <sys/ipc.h> +#include <sys/shm.h> +int main () { + int id=shmget(IPC_PRIVATE,1,IPC_CREAT|0400); + if (id == -1) + exit(1); + if (shmctl(id, IPC_RMID, 0) == -1) + exit(1); + exit(0); +} +], +rtems_cv_sysv_shm="yes", rtems_cv_sysv_shm="no", :) +]) +]) + +AC_DEFUN(RTEMS_SYSV_MSG, +[AC_REQUIRE([AC_PROG_CC]) +AC_REQUIRE([RTEMS_CANONICAL_HOST]) +AC_CACHE_CHECK(whether $RTEMS_HOST supports System V messages, +rtems_cv_sysv_msg, +[ +AC_TRY_RUN([ +#include <sys/types.h> +#include <sys/ipc.h> +#include <sys/msg.h> +int main () { + int id=msgget(IPC_PRIVATE,IPC_CREAT|0400); + if (id == -1) + exit(1); + if (msgctl(id, IPC_RMID, 0) == -1) + exit(1); + exit(0); +} +], +rtems_cv_sysv_msg="yes", rtems_cv_sysv_msg="no", :) +]) +]) + +AC_DEFUN(RTEMS_CHECK_SYSV_UNIX, +[AC_REQUIRE([RTEMS_CANONICAL_HOST]) +if test "$RTEMS_CPU" = "unix" ; then + RTEMS_UNION_SEMUN + RTEMS_SYSV_SEM + if test "$rtems_cv_sysv_sem" != "yes" ; then + AC_MSG_ERROR([System V semaphores don't work, required by simulator]) + fi + RTEMS_SYSV_SHM + if test "$rtems_cv_sysv_shm" != "yes" ; then + AC_MSG_ERROR([System V shared memory doesn't work, required by simulator]) + fi + RTEMS_SYSV_MSG + if test "$rtems_cv_sysv_msg" != "yes" ; then + AC_MSG_ERROR([System V messages don't work, required by simulator]) + fi +fi +]) |