Use configure checks to detect whether we need to define either KERNEL or
2006-04-04 Julio M. Merino Vidal <jmmv@NetBSD.org> * libgtop-sysdeps.m4: * sysdeps/freebsd/msg_limits.c: Use configure checks to detect whether we need to define either KERNEL or _KERNEL to get the definition of 'struct msginfo' in a BSD system. This replaces the previous checks in the code that relied on __FreeBSD__ and similar macros. Before this change, the explicit definition of _KERNEL in the msg_limits.c file broke the build in NetBSD because it made the system headers pull in stuff unavailable to userland. Fixes bug #337207.
This commit is contained in:
committed by
Benoît Dejean
parent
9e6115f322
commit
3c21c70b64
16
ChangeLog
16
ChangeLog
@@ -1,3 +1,19 @@
|
|||||||
|
2006-04-04 Julio M. Merino Vidal <jmmv@NetBSD.org>
|
||||||
|
|
||||||
|
* libgtop-sysdeps.m4:
|
||||||
|
* sysdeps/freebsd/msg_limits.c:
|
||||||
|
|
||||||
|
Use configure checks to detect whether we need to define either
|
||||||
|
KERNEL or _KERNEL to get the definition of 'struct msginfo' in a
|
||||||
|
BSD system. This replaces the previous checks in the code that
|
||||||
|
relied on __FreeBSD__ and similar macros.
|
||||||
|
|
||||||
|
Before this change, the explicit definition of _KERNEL in the
|
||||||
|
msg_limits.c file broke the build in NetBSD because it made the
|
||||||
|
system headers pull in stuff unavailable to userland.
|
||||||
|
|
||||||
|
Fixes bug #337207.
|
||||||
|
|
||||||
2006-04-04 Julio M. Merino Vidal <jmmv@NetBSD.org>
|
2006-04-04 Julio M. Merino Vidal <jmmv@NetBSD.org>
|
||||||
|
|
||||||
* libgtop-sysdeps.m4:
|
* libgtop-sysdeps.m4:
|
||||||
|
@@ -192,6 +192,41 @@ AC_DEFUN([GNOME_LIBGTOP_SYSDEPS],[
|
|||||||
*** to see how to enable it.])
|
*** to see how to enable it.])
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
AC_MSG_CHECKING(what we need to define to get struct msginfo)
|
||||||
|
AC_CACHE_VAL(msginfo_needs,
|
||||||
|
msginfo_needs=
|
||||||
|
for def in nothing KERNEL _KERNEL; do
|
||||||
|
AC_COMPILE_IFELSE([#define $def
|
||||||
|
#include <sys/ipc.h>
|
||||||
|
#include <sys/msg.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
|
int
|
||||||
|
main (void)
|
||||||
|
{
|
||||||
|
struct msginfo mi;
|
||||||
|
mi.msgmax = 0;
|
||||||
|
return 0;
|
||||||
|
}],
|
||||||
|
[
|
||||||
|
msginfo_needs=$def
|
||||||
|
if test ${msginfo_needs} = KERNEL; then
|
||||||
|
AC_DEFINE(STRUCT_MSGINFO_NEEDS_KERNEL, 1,
|
||||||
|
[Define to 1 if we need to define KERNEL to get 'struct msginfo'])
|
||||||
|
elif test ${msginfo_needs} = _KERNEL; then
|
||||||
|
AC_DEFINE(STRUCT_MSGINFO_NEEDS__KERNEL, 1,
|
||||||
|
[Define to 1 if we need to define _KERNEL to get 'struct msginfo'])
|
||||||
|
fi
|
||||||
|
]
|
||||||
|
)
|
||||||
|
test -n "${msginfo_needs}" && break
|
||||||
|
done
|
||||||
|
)
|
||||||
|
AC_MSG_RESULT($msginfo_needs)
|
||||||
|
if test -z "${msginfo_needs}"; then
|
||||||
|
AC_MSG_ERROR([Could not find the definition of 'struct msginfo'])
|
||||||
|
fi
|
||||||
;;
|
;;
|
||||||
linux*)
|
linux*)
|
||||||
os_major_version=`uname -r | sed 's/-pre[[0-9]]*//' | \
|
os_major_version=`uname -r | sed 's/-pre[[0-9]]*//' | \
|
||||||
|
@@ -45,11 +45,11 @@ glibtop_get_msg_limits_p (glibtop *server, glibtop_msg_limits *buf)
|
|||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
/* #define KERNEL to get declaration of `struct msginfo'. */
|
/* Define the appropriate macro (if any) to get declaration of `struct
|
||||||
|
* msginfo'. Needed on, at least, FreeBSD. */
|
||||||
#if (defined(__FreeBSD__) && (__FreeBSD_version < 410000)) || (defined __bsdi__)
|
#if defined (STRUCT_MSGINFO_NEEDS_KERNEL)
|
||||||
#define KERNEL 1
|
#define KERNEL 1
|
||||||
#else
|
#elif defined (STRUCT_MSGINFO_NEEDS__KERNEL)
|
||||||
#define _KERNEL 1
|
#define _KERNEL 1
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user