From ea562ee977d4b48500a9b117e543e9c4ae0eb05e Mon Sep 17 00:00:00 2001 From: Joel Sherrill Date: Thu, 12 Aug 1999 18:22:17 +0000 Subject: Patch from Ralf Corsepius : After upgrading my linux box to the brand new SuSE 6.2 release, which is glibc-2.1 based, I came across a bug in RTEMS - IIRC, I even warned you about it about 1/2 a year ago, but nothing has been done since then :-. The *.m4 macros to check for SYSV/IPC are broken for linux/glibc2.1, because they assume that linux always defines union semun, which isn't true anymore for glibc2.1 (the manpage for semctl states _X_OPEN specifies it this way). Therefore I have tried to implement a more general approach for handling SYSV for unix/posix which checks for presence of struct semun, instead of trying to evaluate OS specific preprocessor symbols. This approach is a bit adventureous, because I only tested it with linux/glibc2.1 and linux/libc5, but not under other Unix variants RTEMS supports. I am quite confident it will work on other hosts, too, but who knows :-. [FYI: I think this might also is the cause of some problems with RedHat 6.X / Mandrake linux recently reported on the rtems list -- rtems-4.0.0 can not be build for posix on any glibc2.1 based host] Furthermore the patch below contains a couple of minor fixes and configuration cleanups, which IMO should be applied before releasing a new snapshot. To apply this patch: cd patch -p1 < rtems-rc-19990709-8.diff ./autogen --- aclocal/sysv-ipc.m4 | 31 +++++++++++++++++++++++++------ 1 file changed, 25 insertions(+), 6 deletions(-) (limited to 'aclocal/sysv-ipc.m4') diff --git a/aclocal/sysv-ipc.m4 b/aclocal/sysv-ipc.m4 index 59a5f5b50c..883921e2c8 100644 --- a/aclocal/sysv-ipc.m4 +++ b/aclocal/sysv-ipc.m4 @@ -16,26 +16,44 @@ 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 +#include +#include ], +[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([ +AC_TRY_RUN( +[ #include #include #include -int main () { -#if !defined(sun) - union semun arg ; -#else +#if !HAS_UNION_SEMUN union semun { int val; struct semid_ds *buf; ushort *array; - } arg; + } ; #endif +int main () { + union semun arg ; + int id=semget(IPC_PRIVATE,1,IPC_CREAT|0400); if (id == -1) exit(1); @@ -98,6 +116,7 @@ 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]) -- cgit v1.2.3