From: Guillem Jover Date: Thu, 8 Oct 2009 11:40:11 +0000 (+0200) Subject: build-sys: check for union semun instead of using _SEM_SEMUN_UNDEFINED X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=869829e457cf7ca79c7f3f997088af8cb70aff77;p=util-linux build-sys: check for union semun instead of using _SEM_SEMUN_UNDEFINED Older versions of glibc used to declare ‘union semun’ in , 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 Signed-off-by: Karel Zak --- diff --git a/configure.ac b/configure.ac index ed3c3b07..7b11ab1f 100644 --- a/configure.ac +++ b/configure.ac @@ -469,6 +469,11 @@ printf(__progname); ]) +AC_CHECK_TYPES([union semun], [], [], [[ +#include +]]) + + AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include #include diff --git a/sys-utils/ipcrm.c b/sys-utils/ipcrm.c index 11a5af2c..f07eac82 100644 --- a/sys-utils/ipcrm.c +++ b/sys-utils/ipcrm.c @@ -26,9 +26,7 @@ /* for tolower and isupper */ #include -#if defined (__GNU_LIBRARY__) && !defined(_SEM_SEMUN_UNDEFINED) -/* union semun is defined by including */ -#else +#ifndef HAVE_UNION_SEMUN /* according to X/OPEN we have to define it ourselves */ union semun { int val; diff --git a/sys-utils/ipcs.c b/sys-utils/ipcs.c index 55d5c80f..0e645d13 100644 --- a/sys-utils/ipcs.c +++ b/sys-utils/ipcs.c @@ -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 */ -#else +#ifndef HAVE_UNION_SEMUN /* according to X/OPEN we have to define it ourselves */ union semun { int val;