[glib/wip/3v1n0/more-unix-oses: 4/7] meson: Define G_OS_LINUX when host system is Linux
- From: Marco Trevisan <marcotrevi src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glib/wip/3v1n0/more-unix-oses: 4/7] meson: Define G_OS_LINUX when host system is Linux
- Date: Wed, 19 Oct 2022 15:13:18 +0000 (UTC)
commit 7270b9063b08e5f9dbc582cb1d567a12b3d90340
Author: Marco Trevisan (TreviƱo) <mail 3v1n0 net>
Date: Wed Oct 19 15:33:42 2022 +0200
meson: Define G_OS_LINUX when host system is Linux
We happen to have some linux-only code also in generic unix
code, so expose it as an OS macro and unix-subtype.
docs/reference/glib/glib-overrides.txt | 5 +++++
docs/reference/glib/glib-sections.txt.in | 1 +
glib/docs.c | 11 +++++++++++
meson.build | 4 +++-
4 files changed, 20 insertions(+), 1 deletion(-)
---
diff --git a/docs/reference/glib/glib-overrides.txt b/docs/reference/glib/glib-overrides.txt
index 8f29a48d4b..ea53ea1b7b 100644
--- a/docs/reference/glib/glib-overrides.txt
+++ b/docs/reference/glib/glib-overrides.txt
@@ -201,6 +201,11 @@ GCond *cond
#define G_OS_DARWIN
</MACRO>
+<MACRO>
+<NAME>G_OS_LINUX</NAME>
+#define G_OS_LINUX
+</MACRO>
+
<MACRO>
<NAME>G_OS_UNIX</NAME>
#define G_OS_UNIX
diff --git a/docs/reference/glib/glib-sections.txt.in b/docs/reference/glib/glib-sections.txt.in
index 90b0f32585..5478c47951 100644
--- a/docs/reference/glib/glib-sections.txt.in
+++ b/docs/reference/glib/glib-sections.txt.in
@@ -141,6 +141,7 @@ GLIB_VERSION_PREV_STABLE
<FILE>macros</FILE>
<SUBSECTION>
G_OS_DARWIN
+G_OS_LINUX
G_OS_WIN32
G_OS_UNIX
diff --git a/glib/docs.c b/glib/docs.c
index e2d164625b..0a671bb9ed 100644
--- a/glib/docs.c
+++ b/glib/docs.c
@@ -1658,6 +1658,17 @@
* Since: 2.76
*/
+/**
+ * G_OS_LINUX:
+ *
+ * This macro is defined only on Linux operating systems. So you can bracket
+ * Linux-specific code in `\#ifdef G_OS_LINUX`.
+ *
+ * Note that %G_OS_UNIX is also set.
+ *
+ * Since: 2.76
+ */
+
/**
* G_OS_WIN32:
*
diff --git a/meson.build b/meson.build
index cd9c88e4a4..d4f2610bff 100644
--- a/meson.build
+++ b/meson.build
@@ -237,7 +237,9 @@ if host_system == 'windows'
else
glib_os = ['G_OS_UNIX']
- if host_system == 'cygwin'
+ if host_system == 'linux'
+ glib_os += 'G_OS_LINUX'
+ elif host_system == 'cygwin'
glib_os += 'G_WITH_CYGWIN'
elif host_system == 'darwin'
glib_os += 'G_OS_DARWIN'
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]