[glib: 4/6] build: Define MAJOR_IN_TYPES when major is defined in sys/types.h
- From: Philip Withnall <pwithnall src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glib: 4/6] build: Define MAJOR_IN_TYPES when major is defined in sys/types.h
- Date: Mon, 11 Jun 2018 10:54:25 +0000 (UTC)
commit c61f01f0ff9889c393304e8ffa7ee099ba5ed8f6
Author: Ting-Wei Lan <lantw src gnome org>
Date: Sun Jun 3 02:17:51 2018 +0800
build: Define MAJOR_IN_TYPES when major is defined in sys/types.h
Autoconf macro AC_HEADER_MAJOR doesn't define a macro in config.h when
major is defined in sys/types.h. This was not a problem because major
is assumed to be always available. However, commit aefffa3fbc3901
changes this assumption in order to fix build on systems without major,
which causes code using major to be disabled on systems putting major
in sys/types.h.
This commit defines a new macro MAJOR_IN_TYPES for both autotools and
meson builds to make major useful on these systems again.
configure.ac | 2 ++
gio/gdbusmessage.c | 2 ++
meson.build | 2 ++
3 files changed, 6 insertions(+)
---
diff --git a/configure.ac b/configure.ac
index 9ccedcdfc..43a33473b 100644
--- a/configure.ac
+++ b/configure.ac
@@ -665,6 +665,8 @@ AC_CHECK_HEADERS([sys/mount.h sys/sysctl.h], [], [],
AC_CHECK_FUNCS(sysctlbyname)
AC_HEADER_MAJOR
+AS_IF([test "$ac_cv_header_sys_types_h_makedev" = "yes"],
+ [AC_DEFINE([MAJOR_IN_TYPES], [1], [Define to 1 if `major', `minor', and `makedev' are declared in
<sys/types.h>.])])
AC_CHECK_HEADERS([xlocale.h])
# check for structure fields
diff --git a/gio/gdbusmessage.c b/gio/gdbusmessage.c
index be001ae55..68122387b 100644
--- a/gio/gdbusmessage.c
+++ b/gio/gdbusmessage.c
@@ -32,6 +32,8 @@
#include <sys/mkdev.h>
#elif MAJOR_IN_SYSMACROS
#include <sys/sysmacros.h>
+#elif MAJOR_IN_TYPES
+#include <sys/types.h>
#else
#define MAJOR_MINOR_NOT_FOUND 1
#endif
diff --git a/meson.build b/meson.build
index 7e60e9c19..4a12c1f65 100644
--- a/meson.build
+++ b/meson.build
@@ -542,6 +542,8 @@ if cc.has_header_symbol('sys/sysmacros.h', 'major')
glib_conf.set('MAJOR_IN_SYSMACROS', 1)
elif cc.has_header_symbol('sys/mkdev.h', 'major')
glib_conf.set('MAJOR_IN_MKDEV', 1)
+elif cc.has_header_symbol('sys/types.h', 'major')
+ glib_conf.set('MAJOR_IN_TYPES', 1)
endif
if cc.has_header_symbol('dlfcn.h', 'RTLD_LAZY')
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]