From 1a0961609e5ba71b0b6bd8b43da4c05771b310f3 Mon Sep 17 00:00:00 2001
From: Ludovico de Nittis <ludovico.denittis@collabora.com>
Date: Tue, 6 Aug 2019 12:13:17 +0200
Subject: [PATCH] Add C argument `-D_GNU_SOURCE` for the whole project

`-D_GNU_SOURCE` was required by a lot of components, so it's easier to
set it by default for the entire project.

Signed-off-by: Ludovico de Nittis <ludovico.denittis@collabora.com>
---
 examples/meson.build            | 3 ---
 helpers/check-gl.c              | 3 ---
 helpers/check-gles.c            | 3 ---
 helpers/meson.build             | 3 ---
 meson.build                     | 2 ++
 steam-runtime-tools/meson.build | 1 -
 6 files changed, 2 insertions(+), 13 deletions(-)

diff --git a/examples/meson.build b/examples/meson.build
index 605fb8d83..83af1519d 100644
--- a/examples/meson.build
+++ b/examples/meson.build
@@ -25,9 +25,6 @@ executable(
   'steam-runtime-system-info',
   'system-info.c',
   dependencies : [glib, libsteamrt_dep, json_glib],
-  c_args : [
-      '-D_GNU_SOURCE',
-  ],
   install : true,
 )
 
diff --git a/helpers/check-gl.c b/helpers/check-gl.c
index 3d81ad9d4..b2ac307f9 100644
--- a/helpers/check-gl.c
+++ b/helpers/check-gl.c
@@ -69,9 +69,6 @@
  * [3] http://git.compiz.org/fusion/misc/compiz-manager/tree/compiz-manager
  */
 
-/* for strcasestr */
-#define _GNU_SOURCE
-
 #include <ctype.h>
 #include <locale.h>
 #include <stdio.h>
diff --git a/helpers/check-gles.c b/helpers/check-gles.c
index e8571470d..39192c8d2 100644
--- a/helpers/check-gles.c
+++ b/helpers/check-gles.c
@@ -23,9 +23,6 @@
  *   Cosimo Cecchi <cosimo@endlessm.com>
  */
 
-/* for strcasestr */
-#define _GNU_SOURCE
-
 #include <locale.h>
 #include <stdlib.h>
 #include <string.h>
diff --git a/helpers/meson.build b/helpers/meson.build
index dc993675d..1e9428586 100644
--- a/helpers/meson.build
+++ b/helpers/meson.build
@@ -35,9 +35,6 @@ executable(
   multiarch + '-inspect-library',
   'inspect-library.c',
   dependencies : [libdl],
-  c_args : [
-      '-D_GNU_SOURCE',
-    ],
   install : true,
   install_dir : join_paths(
     get_option('libexecdir'),
diff --git a/meson.build b/meson.build
index dc8c9e606..1a2c000cd 100644
--- a/meson.build
+++ b/meson.build
@@ -91,6 +91,8 @@ endforeach
 
 add_project_arguments(['-std=c99'], language : 'c')
 
+add_project_arguments(['-D_GNU_SOURCE'], language : 'c')
+
 glib = dependency(
   'glib-2.0',
   version : '>= 2.32',
diff --git a/steam-runtime-tools/meson.build b/steam-runtime-tools/meson.build
index 1211aebc9..5d3d0a0dc 100644
--- a/steam-runtime-tools/meson.build
+++ b/steam-runtime-tools/meson.build
@@ -56,7 +56,6 @@ libsteamrt = library(
   c_args : [
     '-DG_LOG_DOMAIN="' + meson.project_name() + '"',
     '-D_SRT_COMPILATION',
-    '-D_GNU_SOURCE',
     '-D_SRT_SONAME="libsteam-runtime-tools-' + api_major + '.so.' + abi_major + '"',
     '-D_SRT_MULTIARCH="' + multiarch + '"',
     '-D_SRT_API_MAJOR="' + api_major + '"',
-- 
GitLab