build-sys: check for union semun instead of using _SEM_SEMUN_UNDEFINED

Older versions of glibc used to declare ‘union semun’ in <sys/sem.h>,
but POSIX.1-2001 requires the caller to declare it instead. Later
versions of glibc started defining _SEM_SEMUN_UNDEFINED to note that
the union was not being declared, but conforming systems are not
required to define that macro (e.g. FreeBSD). As a side effect we get
rid of some obsolete __GNU_LIBRARY__ macro usage.

[kzak@redhat.com: - use #ifndef]

Signed-off-by: Guillem Jover <guillem@hadrons.org>
Signed-off-by: Karel Zak <kzak@redhat.com>
This commit is contained in:
Guillem Jover 2009-10-08 13:40:11 +02:00 committed by Karel Zak
parent eb35c25174
commit 869829e457
3 changed files with 7 additions and 6 deletions

View File

@ -469,6 +469,11 @@ printf(__progname);
])
AC_CHECK_TYPES([union semun], [], [], [[
#include <sys/sem.h>
]])
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
#include <wchar.h>
#include <wctype.h>

View File

@ -26,9 +26,7 @@
/* for tolower and isupper */
#include <ctype.h>
#if defined (__GNU_LIBRARY__) && !defined(_SEM_SEMUN_UNDEFINED)
/* union semun is defined by including <sys/sem.h> */
#else
#ifndef HAVE_UNION_SEMUN
/* according to X/OPEN we have to define it ourselves */
union semun {
int val;

View File

@ -77,9 +77,7 @@ struct shm_info {
/* The last arg of semctl is a union semun, but where is it defined?
X/OPEN tells us to define it ourselves, but until recently
Linux include files would also define it. */
#if defined (__GNU_LIBRARY__) && !defined(_SEM_SEMUN_UNDEFINED)
/* union semun is defined by including <sys/sem.h> */
#else
#ifndef HAVE_UNION_SEMUN
/* according to X/OPEN we have to define it ourselves */
union semun {
int val;