[glib/wip/3v1n0/more-unix-oses: 1/5] meson: Define G_OS_LINUX when host system is Linux




commit 11dc6151ce0d304fe5fda2bda3faf72d882d90a7
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.

 glib/docs.c | 11 +++++++++++
 meson.build |  3 +++
 2 files changed, 14 insertions(+)
---
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 bd30f53d7a..73e61dacd7 100644
--- a/meson.build
+++ b/meson.build
@@ -232,6 +232,9 @@ endif
 if host_system == 'windows'
   glib_os = '''#define G_OS_WIN32
 #define G_PLATFORM_WIN32'''
+elif host_system == 'linux'
+  glib_os = '''#define G_OS_UNIX
+#define G_OS_LINUX'''
 elif host_system == 'cygwin'
   glib_os = '''#define G_OS_UNIX
 #define G_WITH_CYGWIN'''


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]