[cairo-commit] 4 commits - boilerplate/cairo-boilerplate.h boilerplate/cairo-boilerplate-system.c boilerplate/meson.build meson.build perf/cairo-analyse-trace.c perf/cairo-perf-micro.c perf/cairo-perf-print.c perf/cairo-perf-report.c perf/cairo-perf-trace.c src/cairo-atomic-private.h src/cairo-compiler-private.h src/cairoint.h src/cairo-misc.c src/cairo-mutex-impl-private.h src/cairo-quartz-surface.c src/cairo-wideint-type-private.h src/meson.build test/any2ppm.c test/api-special-cases.c test/buffer-diff.c test/cairo-test.c test/cairo-test-trace.c test/error-setters.c test/fallback-resolution.c test/imagediff.c test/invalid-matrix.c test/meson.build test/pdiff test/ps-eps.c test/solid-pattern-cache-stress.c test/toy-font-face.c util/cairo-fdr util/cairo-gobject util/cairo-missing util/cairo-script util/cairo-sphinx util/cairo-trace util/show-contour.c util/show-edges.c util/show-events.c util/show-polygon.c util/show-traps.c util/trace-to-xml.c

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Sun May 2 05:48:28 UTC 2021


 boilerplate/cairo-boilerplate-system.c     |    2 --
 boilerplate/cairo-boilerplate.h            |    2 --
 boilerplate/meson.build                    |    2 --
 meson.build                                |    3 +++
 perf/cairo-analyse-trace.c                 |    2 +-
 perf/cairo-perf-micro.c                    |    2 +-
 perf/cairo-perf-print.c                    |    2 --
 perf/cairo-perf-report.c                   |    6 ++----
 perf/cairo-perf-trace.c                    |    2 +-
 src/cairo-atomic-private.h                 |    4 +---
 src/cairo-compiler-private.h               |    2 --
 src/cairo-misc.c                           |    2 --
 src/cairo-mutex-impl-private.h             |    2 --
 src/cairo-quartz-surface.c                 |    1 -
 src/cairo-wideint-type-private.h           |    2 --
 src/cairoint.h                             |    2 --
 src/meson.build                            |    4 ++--
 test/any2ppm.c                             |    2 --
 test/api-special-cases.c                   |    2 --
 test/buffer-diff.c                         |    2 --
 test/cairo-test-trace.c                    |    2 --
 test/cairo-test.c                          |    4 ----
 test/error-setters.c                       |    2 --
 test/fallback-resolution.c                 |    2 --
 test/imagediff.c                           |    2 --
 test/invalid-matrix.c                      |    2 +-
 test/meson.build                           |    4 +---
 test/pdiff/meson.build                     |    2 --
 test/pdiff/pdiff.c                         |    4 ----
 test/ps-eps.c                              |    2 --
 test/solid-pattern-cache-stress.c          |    2 --
 test/toy-font-face.c                       |    2 --
 util/cairo-fdr/fdr.c                       |    4 ----
 util/cairo-fdr/meson.build                 |    1 -
 util/cairo-gobject/cairo-gobject-enums.c   |    2 --
 util/cairo-gobject/cairo-gobject-structs.c |    2 --
 util/cairo-gobject/meson.build             |    1 -
 util/cairo-missing/meson.build             |    1 -
 util/cairo-script/cairo-script-private.h   |    2 --
 util/cairo-script/meson.build              |    4 ----
 util/cairo-sphinx/fdr.c                    |    4 ----
 util/cairo-sphinx/meson.build              |    3 +--
 util/cairo-sphinx/sphinx.c                 |    2 --
 util/cairo-trace/lookup-symbol.c           |    4 ----
 util/cairo-trace/meson.build               |    2 +-
 util/cairo-trace/trace.c                   |    4 ----
 util/show-contour.c                        |    3 ++-
 util/show-edges.c                          |    3 ++-
 util/show-events.c                         |    3 ++-
 util/show-polygon.c                        |    3 ++-
 util/show-traps.c                          |    3 ++-
 util/trace-to-xml.c                        |    2 --
 52 files changed, 25 insertions(+), 106 deletions(-)

New commits:
commit aa02315243a5b3ea3dd1bacb61d4ad69fec2e5e2
Merge: 8f6cfe417 bd1384125
Author: Uli Schlachter <psychon at znc.in>
Date:   Sun May 2 05:48:26 2021 +0000

    Merge branch 'ebassi/config-define' into 'master'
    
    meson: Define HAVE_CONFIG_H as a project flag
    
    See merge request cairo/cairo!172

commit bd138412579e9a7c251ea8f2f1bb2cdb3d0bf95b
Author: Emmanuele Bassi <ebassi at gnome.org>
Date:   Sat May 1 17:05:29 2021 +0100

    Drop the conditional inclusion of config.h
    
    We *always* generate this file, and we depend on its existence.
    
    The idea behind HAVE_CONFIG_H was being able to include random files
    from different projects, back in a time where "libraries" were literally
    just random files instead of actual shared objects.
    
    Since we're not in the '80s any more, and our build system(s) define
    HAVE_CONFIG_H *and* generate the config.h header file, we don't need a
    conditional guard around its inclusion.

diff --git a/boilerplate/cairo-boilerplate.h b/boilerplate/cairo-boilerplate.h
index 515bb03bc..544d38816 100644
--- a/boilerplate/cairo-boilerplate.h
+++ b/boilerplate/cairo-boilerplate.h
@@ -26,9 +26,7 @@
 #ifndef _CAIRO_BOILERPLATE_H_
 #define _CAIRO_BOILERPLATE_H_
 
-#if HAVE_CONFIG_H
 #include "config.h"
-#endif
 
 #include <stdio.h>
 #include <stdlib.h>
diff --git a/perf/cairo-perf-print.c b/perf/cairo-perf-print.c
index d7ae1311e..ab1440f55 100644
--- a/perf/cairo-perf-print.c
+++ b/perf/cairo-perf-print.c
@@ -27,9 +27,7 @@
  *	    Chris Wilson <chris at chris-wilson.co.uk>
  */
 
-#if HAVE_CONFIG_H
 #include "config.h"
-#endif
 
 #include "cairo-perf.h"
 #include "cairo-stats.h"
diff --git a/src/cairo-atomic-private.h b/src/cairo-atomic-private.h
index 70d4b79d6..d23192b41 100644
--- a/src/cairo-atomic-private.h
+++ b/src/cairo-atomic-private.h
@@ -39,11 +39,9 @@
 #ifndef CAIRO_ATOMIC_PRIVATE_H
 #define CAIRO_ATOMIC_PRIVATE_H
 
-# include "cairo-compiler-private.h"
+#include "cairo-compiler-private.h"
 
-#if HAVE_CONFIG_H
 #include "config.h"
-#endif
 
 #include <assert.h>
 
diff --git a/src/cairo-compiler-private.h b/src/cairo-compiler-private.h
index 4562bea66..00703c584 100644
--- a/src/cairo-compiler-private.h
+++ b/src/cairo-compiler-private.h
@@ -40,9 +40,7 @@
 
 #include "cairo.h"
 
-#if HAVE_CONFIG_H
 #include "config.h"
-#endif
 
 /* Size in bytes of buffer to use off the stack per functions.
  * Mostly used by text functions.  For larger allocations, they'll
diff --git a/src/cairo-mutex-impl-private.h b/src/cairo-mutex-impl-private.h
index 25223f3ea..a31e1e0d9 100644
--- a/src/cairo-mutex-impl-private.h
+++ b/src/cairo-mutex-impl-private.h
@@ -43,9 +43,7 @@
 
 #include "cairo.h"
 
-#if HAVE_CONFIG_H
 #include "config.h"
-#endif
 
 #if HAVE_LOCKDEP
 #include <lockdep.h>
diff --git a/src/cairo-wideint-type-private.h b/src/cairo-wideint-type-private.h
index 84a3cbab0..a1a2269f8 100644
--- a/src/cairo-wideint-type-private.h
+++ b/src/cairo-wideint-type-private.h
@@ -39,9 +39,7 @@
 
 #include "cairo.h"
 
-#if HAVE_CONFIG_H
 #include "config.h"
-#endif
 
 #if   HAVE_STDINT_H
 # include <stdint.h>
diff --git a/src/cairoint.h b/src/cairoint.h
index c97ad57fa..03ca09c10 100644
--- a/src/cairoint.h
+++ b/src/cairoint.h
@@ -46,9 +46,7 @@
 #ifndef _CAIROINT_H_
 #define _CAIROINT_H_
 
-#if HAVE_CONFIG_H
 #include "config.h"
-#endif
 
 #ifdef _MSC_VER
 #define cairo_public __declspec(dllexport)
diff --git a/test/any2ppm.c b/test/any2ppm.c
index b3f1308ea..d2d5fc5e2 100644
--- a/test/any2ppm.c
+++ b/test/any2ppm.c
@@ -50,9 +50,7 @@
  * Author: Kristian Høgsberg <krh at redhat.com>
  */
 
-#if HAVE_CONFIG_H
 #include "config.h"
-#endif
 
 #if HAVE_UNISTD_H
 #include <unistd.h>
diff --git a/test/api-special-cases.c b/test/api-special-cases.c
index aa615f804..ae87d0e5d 100644
--- a/test/api-special-cases.c
+++ b/test/api-special-cases.c
@@ -56,9 +56,7 @@
  * enough to just add a new check to the function it complained about.
  */
 
-#ifdef HAVE_CONFIG_H
 #include "config.h"
-#endif
 
 #include <assert.h>
 #include <limits.h>
diff --git a/test/buffer-diff.c b/test/buffer-diff.c
index 087ac459b..6d2a6bf8a 100644
--- a/test/buffer-diff.c
+++ b/test/buffer-diff.c
@@ -23,9 +23,7 @@
  *
  * Author: Richard D. Worth <richard at theworths.org> */
 
-#if HAVE_CONFIG_H
 #include "config.h"
-#endif
 
 #include <stdio.h>
 #include <stdlib.h>
diff --git a/test/cairo-test.c b/test/cairo-test.c
index 853e7d260..3d241d814 100644
--- a/test/cairo-test.c
+++ b/test/cairo-test.c
@@ -25,9 +25,7 @@
  *         Chris Wilson <chris at chris-wilson.co.uk>
  */
 
-#if HAVE_CONFIG_H
 #include "config.h"
-#endif
 
 #include <stdio.h>
 #include <stdlib.h>
diff --git a/test/error-setters.c b/test/error-setters.c
index ff65ad4f2..8ad823def 100644
--- a/test/error-setters.c
+++ b/test/error-setters.c
@@ -23,9 +23,7 @@
  * Author: Benjamin Otte <otte at redhat.com>
  */
 
-#ifdef HAVE_CONFIG_H
 #include "config.h"
-#endif
 
 #include <limits.h>
 
diff --git a/test/fallback-resolution.c b/test/fallback-resolution.c
index 306a57013..83020fc37 100644
--- a/test/fallback-resolution.c
+++ b/test/fallback-resolution.c
@@ -25,9 +25,7 @@
  *         Chris Wilson <chris at chris-wilson.co.uk>
  */
 
-#ifdef HAVE_CONFIG_H
 #include "config.h"
-#endif
 
 #include <stdio.h>
 #include <stdlib.h>
diff --git a/test/imagediff.c b/test/imagediff.c
index 6ebbcfca7..c091e7627 100644
--- a/test/imagediff.c
+++ b/test/imagediff.c
@@ -23,9 +23,7 @@
  *
  * Author: Richard D. Worth <richard at theworths.org> */
 
-#ifdef HAVE_CONFIG_H
 #include "config.h"
-#endif
 
 #include <stdio.h>
 #include <stdlib.h>
diff --git a/test/pdiff/pdiff.c b/test/pdiff/pdiff.c
index e982cdcc2..6e05552d6 100644
--- a/test/pdiff/pdiff.c
+++ b/test/pdiff/pdiff.c
@@ -14,9 +14,7 @@
   if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Suite 500, Boston, MA 02110-1335, USA
 */
 
-#if HAVE_CONFIG_H
 #include "config.h"
-#endif
 
 #include "lpyramid.h"
 #include <math.h>
diff --git a/test/ps-eps.c b/test/ps-eps.c
index de1248d81..60203a1cb 100644
--- a/test/ps-eps.c
+++ b/test/ps-eps.c
@@ -27,9 +27,7 @@
  *         Chris Wilson <chris at chris-wilson.co.uk>
  */
 
-#ifdef HAVE_CONFIG_H
 #include "config.h"
-#endif
 
 #include <stdio.h>
 #include <stdlib.h>
diff --git a/test/solid-pattern-cache-stress.c b/test/solid-pattern-cache-stress.c
index c2a1c1526..56972bfaf 100644
--- a/test/solid-pattern-cache-stress.c
+++ b/test/solid-pattern-cache-stress.c
@@ -23,9 +23,7 @@
  * Author: Chris Wilson <chris at chris-wilson.co.uk>
  */
 
-#if HAVE_CONFIG_H
 #include "config.h"
-#endif
 
 #include "cairo-test.h"
 #include <stdlib.h> /* drand48() */
diff --git a/test/toy-font-face.c b/test/toy-font-face.c
index cbebf840a..95d2c01eb 100644
--- a/test/toy-font-face.c
+++ b/test/toy-font-face.c
@@ -24,9 +24,7 @@
  *         Behdad Esfahbod <behdad at behdad.org>
  */
 
-#ifdef HAVE_CONFIG_H
 #include "config.h"
-#endif
 
 #include "cairo-test.h"
 
diff --git a/util/cairo-fdr/fdr.c b/util/cairo-fdr/fdr.c
index fa64254b1..edbd53a5b 100644
--- a/util/cairo-fdr/fdr.c
+++ b/util/cairo-fdr/fdr.c
@@ -16,9 +16,7 @@
  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
-#ifdef HAVE_CONFIG_H
 #include "config.h"
-#endif
 
 #include <cairo.h>
 #include <cairo-script.h>
diff --git a/util/cairo-gobject/cairo-gobject-enums.c b/util/cairo-gobject/cairo-gobject-enums.c
index 0c5069406..ce7d70c60 100644
--- a/util/cairo-gobject/cairo-gobject-enums.c
+++ b/util/cairo-gobject/cairo-gobject-enums.c
@@ -1,9 +1,7 @@
 
 /* Generated data (by glib-mkenums) */
 
-#ifdef HAVE_CONFIG_H
 #include "config.h"
-#endif
 
 #include "cairo-gobject.h"
 
diff --git a/util/cairo-gobject/cairo-gobject-structs.c b/util/cairo-gobject/cairo-gobject-structs.c
index 9171abeb8..c8f59d7e7 100644
--- a/util/cairo-gobject/cairo-gobject-structs.c
+++ b/util/cairo-gobject/cairo-gobject-structs.c
@@ -34,9 +34,7 @@
  *	Benjamin Otte <otte at redhat.com>
  */
 
-#ifdef HAVE_CONFIG_H
 #include "config.h"
-#endif
 
 #include "cairo-gobject.h"
 
diff --git a/util/cairo-script/cairo-script-private.h b/util/cairo-script/cairo-script-private.h
index ac633c950..7ae8be925 100644
--- a/util/cairo-script/cairo-script-private.h
+++ b/util/cairo-script/cairo-script-private.h
@@ -35,9 +35,7 @@
 #ifndef CAIRO_SCRIPT_PRIVATE_H
 #define CAIRO_SCRIPT_PRIVATE_H
 
-#ifdef HAVE_CONFIG_H
 #include "config.h"
-#endif
 
 #include "cairo-script-interpreter.h"
 
diff --git a/util/cairo-sphinx/fdr.c b/util/cairo-sphinx/fdr.c
index 5c08953b5..a28251650 100644
--- a/util/cairo-sphinx/fdr.c
+++ b/util/cairo-sphinx/fdr.c
@@ -16,9 +16,7 @@
  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
-#ifdef HAVE_CONFIG_H
 #include "config.h"
-#endif
 
 #include <cairo.h>
 #include <cairo-script.h>
diff --git a/util/cairo-sphinx/sphinx.c b/util/cairo-sphinx/sphinx.c
index 5c5fcee77..9e248aff1 100644
--- a/util/cairo-sphinx/sphinx.c
+++ b/util/cairo-sphinx/sphinx.c
@@ -6,9 +6,7 @@
  * delta-debugging to reduce that down to a minimal trace.)
  */
 
-#ifdef HAVE_CONFIG_H
 #include "config.h"
-#endif
 
 #include <stdio.h>
 #include <stdlib.h>
diff --git a/util/cairo-trace/lookup-symbol.c b/util/cairo-trace/lookup-symbol.c
index a670f4556..4bc1fac1a 100644
--- a/util/cairo-trace/lookup-symbol.c
+++ b/util/cairo-trace/lookup-symbol.c
@@ -45,9 +45,7 @@
    This file was part of GNU Binutils.
    */
 
-#ifdef HAVE_CONFIG_H
 #include "config.h"
-#endif
 
 #define true 1
 #define false 0
diff --git a/util/cairo-trace/trace.c b/util/cairo-trace/trace.c
index 931e775f8..babcc06fa 100644
--- a/util/cairo-trace/trace.c
+++ b/util/cairo-trace/trace.c
@@ -16,9 +16,7 @@
  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
-#ifdef HAVE_CONFIG_H
 #include "config.h"
-#endif
 
 /* The autoconf on OpenBSD 4.5 produces the malformed constant name
  * SIZEOF_VOID__ rather than SIZEOF_VOID_P.  Work around that here. */
diff --git a/util/trace-to-xml.c b/util/trace-to-xml.c
index a0f03ccff..b4295fbdd 100644
--- a/util/trace-to-xml.c
+++ b/util/trace-to-xml.c
@@ -1,6 +1,4 @@
-#ifdef HAVE_CONFIG_H
 #include "config.h"
-#endif
 
 #include <cairo-xml.h>
 #include <cairo-script-interpreter.h>
commit bfd1602db9fd0d23074ef4d1628de66d70241c3b
Author: Emmanuele Bassi <ebassi at gnome.org>
Date:   Sat May 1 16:58:15 2021 +0100

    Remove stray _GNU_SOURCE definitions
    
    We define _GNU_SOURCE globally in both the Autotools build, through the
    use of the AC_USE_SYSTEM_EXTENSIONS macro; and in the Meson build, with
    add_project_arguments().

diff --git a/boilerplate/cairo-boilerplate-system.c b/boilerplate/cairo-boilerplate-system.c
index ec23341a4..e9bcd78c5 100644
--- a/boilerplate/cairo-boilerplate-system.c
+++ b/boilerplate/cairo-boilerplate-system.c
@@ -23,8 +23,6 @@
  * Author: Carl D. Worth <cworth at cworth.org>
  */
 
-#define _GNU_SOURCE 1 /* for vasprintf */
-
 #include "cairo-boilerplate.h"
 #include "cairo-boilerplate-system.h"
 
diff --git a/perf/cairo-analyse-trace.c b/perf/cairo-analyse-trace.c
index 95b7e6664..6dbe7cf4b 100644
--- a/perf/cairo-analyse-trace.c
+++ b/perf/cairo-analyse-trace.c
@@ -29,7 +29,7 @@
  *	    Chris Wilson <chris at chris-wilson.co.uk>
  */
 
-#define _GNU_SOURCE 1	/* for sched_getaffinity() and getline() */
+#include "config.h"
 
 #include "cairo-perf.h"
 #include "cairo-stats.h"
diff --git a/perf/cairo-perf-micro.c b/perf/cairo-perf-micro.c
index d8745c205..618272ec5 100644
--- a/perf/cairo-perf-micro.c
+++ b/perf/cairo-perf-micro.c
@@ -26,7 +26,7 @@
  *	    Carl Worth <cworth at cworth.org>
  */
 
-#define _GNU_SOURCE 1	/* for sched_getaffinity() */
+#include "config.h"
 
 #include "cairo-perf.h"
 #include "cairo-stats.h"
diff --git a/perf/cairo-perf-report.c b/perf/cairo-perf-report.c
index 2325f4793..5a1e25441 100644
--- a/perf/cairo-perf-report.c
+++ b/perf/cairo-perf-report.c
@@ -25,16 +25,14 @@
  * Authors: Carl Worth <cworth at cworth.org>
  */
 
+#include "config.h"
+
 #define _GETDELIM 1/* for getline() on AIX */
 
 #include "cairo-perf.h"
 #include "cairo-missing.h"
 #include "cairo-stats.h"
 
-/* We use _GNU_SOURCE for getline and strndup if available. */
-#ifndef _GNU_SOURCE
-# define _GNU_SOURCE
-#endif
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
diff --git a/perf/cairo-perf-trace.c b/perf/cairo-perf-trace.c
index 7823089ae..cfabcaad0 100644
--- a/perf/cairo-perf-trace.c
+++ b/perf/cairo-perf-trace.c
@@ -28,7 +28,7 @@
  *	    Chris Wilson <chris at chris-wilson.co.uk>
  */
 
-#define _GNU_SOURCE 1	/* for sched_getaffinity() and getline() */
+#include "config.h"
 
 #include "cairo-missing.h"
 #include "cairo-perf.h"
diff --git a/src/cairo-misc.c b/src/cairo-misc.c
index d7af82147..e683198e7 100644
--- a/src/cairo-misc.c
+++ b/src/cairo-misc.c
@@ -38,8 +38,6 @@
  *      Adrian Johnson <ajohnson at redneon.com>
  */
 
-#define _GNU_SOURCE 1	/* strtod_l() */
-
 #include "cairoint.h"
 #include "cairo-error-private.h"
 
diff --git a/src/cairo-quartz-surface.c b/src/cairo-quartz-surface.c
index 7a9f52401..c8c28d4a7 100644
--- a/src/cairo-quartz-surface.c
+++ b/src/cairo-quartz-surface.c
@@ -34,7 +34,6 @@
  *	Vladimir Vukicevic <vladimir at mozilla.com>
  */
 
-#define _GNU_SOURCE /* required for RTLD_DEFAULT */
 #include "cairoint.h"
 
 #include "cairo-quartz-private.h"
diff --git a/test/cairo-test-trace.c b/test/cairo-test-trace.c
index 7ada3e75a..35db4c033 100644
--- a/test/cairo-test-trace.c
+++ b/test/cairo-test-trace.c
@@ -52,8 +52,6 @@
  *     scope of this test.
  */
 
-#define _GNU_SOURCE 1	/* getline() */
-
 #include "cairo-test.h"
 #include "buffer-diff.h"
 
diff --git a/test/cairo-test.c b/test/cairo-test.c
index b5650ffce..853e7d260 100644
--- a/test/cairo-test.c
+++ b/test/cairo-test.c
@@ -25,8 +25,6 @@
  *         Chris Wilson <chris at chris-wilson.co.uk>
  */
 
-#define _GNU_SOURCE 1	/* for feenableexcept() et al */
-
 #if HAVE_CONFIG_H
 #include "config.h"
 #endif
diff --git a/test/invalid-matrix.c b/test/invalid-matrix.c
index 9bb26be0b..df0dff0f1 100644
--- a/test/invalid-matrix.c
+++ b/test/invalid-matrix.c
@@ -25,8 +25,8 @@
  */
 
 #define _ISOC99_SOURCE	/* for INFINITY */
-#define _GNU_SOURCE 1	/* for fedisableeexcept() et al */
 
+#include "config.h"
 #include "cairo-test.h"
 
 #if !defined(INFINITY)
diff --git a/test/pdiff/pdiff.c b/test/pdiff/pdiff.c
index eb5f15682..e982cdcc2 100644
--- a/test/pdiff/pdiff.c
+++ b/test/pdiff/pdiff.c
@@ -14,8 +14,6 @@
   if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Suite 500, Boston, MA 02110-1335, USA
 */
 
-#define _GNU_SOURCE
-
 #if HAVE_CONFIG_H
 #include "config.h"
 #endif
diff --git a/util/cairo-fdr/fdr.c b/util/cairo-fdr/fdr.c
index 08d9c0113..fa64254b1 100644
--- a/util/cairo-fdr/fdr.c
+++ b/util/cairo-fdr/fdr.c
@@ -16,8 +16,6 @@
  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
-#define _GNU_SOURCE
-
 #ifdef HAVE_CONFIG_H
 #include "config.h"
 #endif
diff --git a/util/cairo-sphinx/fdr.c b/util/cairo-sphinx/fdr.c
index aeda89bcd..5c08953b5 100644
--- a/util/cairo-sphinx/fdr.c
+++ b/util/cairo-sphinx/fdr.c
@@ -16,8 +16,6 @@
  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
-#define _GNU_SOURCE
-
 #ifdef HAVE_CONFIG_H
 #include "config.h"
 #endif
diff --git a/util/cairo-trace/lookup-symbol.c b/util/cairo-trace/lookup-symbol.c
index 9af0b5944..a670f4556 100644
--- a/util/cairo-trace/lookup-symbol.c
+++ b/util/cairo-trace/lookup-symbol.c
@@ -45,8 +45,6 @@
    This file was part of GNU Binutils.
    */
 
-#define _GNU_SOURCE
-
 #ifdef HAVE_CONFIG_H
 #include "config.h"
 #endif
diff --git a/util/cairo-trace/trace.c b/util/cairo-trace/trace.c
index 26ed2e506..931e775f8 100644
--- a/util/cairo-trace/trace.c
+++ b/util/cairo-trace/trace.c
@@ -16,8 +16,6 @@
  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
-#define _GNU_SOURCE
-
 #ifdef HAVE_CONFIG_H
 #include "config.h"
 #endif
diff --git a/util/show-contour.c b/util/show-contour.c
index f3fa1babf..e09f6315f 100644
--- a/util/show-contour.c
+++ b/util/show-contour.c
@@ -1,4 +1,5 @@
-#define _GNU_SOURCE
+#include "config.h"
+
 #include <gtk/gtk.h>
 #include <stdlib.h>
 #include <stdio.h>
diff --git a/util/show-edges.c b/util/show-edges.c
index a85ad5f7e..c27900333 100644
--- a/util/show-edges.c
+++ b/util/show-edges.c
@@ -1,4 +1,5 @@
-#define _GNU_SOURCE
+#include "config.h"
+
 #include <gtk/gtk.h>
 #include <stdlib.h>
 #include <stdio.h>
diff --git a/util/show-events.c b/util/show-events.c
index 8bff3efc4..da824dd9d 100644
--- a/util/show-events.c
+++ b/util/show-events.c
@@ -1,4 +1,5 @@
-#define _GNU_SOURCE
+#include "config.h"
+
 #include <gtk/gtk.h>
 #include <stdlib.h>
 #include <stdio.h>
diff --git a/util/show-polygon.c b/util/show-polygon.c
index 35c0014d1..1157427f7 100644
--- a/util/show-polygon.c
+++ b/util/show-polygon.c
@@ -1,4 +1,5 @@
-#define _GNU_SOURCE
+#include "config.h"
+
 #include <gtk/gtk.h>
 #include <stdlib.h>
 #include <stdio.h>
diff --git a/util/show-traps.c b/util/show-traps.c
index f46c8b009..dc1093060 100644
--- a/util/show-traps.c
+++ b/util/show-traps.c
@@ -1,4 +1,5 @@
-#define _GNU_SOURCE
+#include "config.h"
+
 #include <gtk/gtk.h>
 #include <stdlib.h>
 #include <stdio.h>
commit 833630979404faae2bd99c59e4e5739e675917f0
Author: Emmanuele Bassi <ebassi at gnome.org>
Date:   Sat May 1 16:55:38 2021 +0100

    meson: Define HAVE_CONFIG_H as a project flag
    
    Precisely what Autotools does, instead of adding it as per-target C
    argument.
    
    Once we remove HAVE_CONFIG_H checks in every source file, we'll be able
    to drop it.

diff --git a/boilerplate/meson.build b/boilerplate/meson.build
index 79d1eeea4..0216b7a6c 100644
--- a/boilerplate/meson.build
+++ b/boilerplate/meson.build
@@ -35,8 +35,6 @@ cairo_boilerplate_constructors = custom_target('cairo-boilerplate-constructors.c
   command: [python3, files('make-cairo-boilerplate-constructors.py')[0], '@OUTPUT@', '@INPUT@'])
 
 libcairoboilerplate = static_library('cairoboilerplate', cairo_boilerplate_sources + [cairo_boilerplate_constructors],
-  c_args: ['-DHAVE_CONFIG_H'],
-  cpp_args: ['-DHAVE_CONFIG_H'],
   include_directories: [incbase, incsrc],
   dependencies: deps,
   link_with: [libcairo],
diff --git a/meson.build b/meson.build
index d4f759224..06df7f9c1 100644
--- a/meson.build
+++ b/meson.build
@@ -45,6 +45,9 @@ endif
 
 add_project_arguments('-D_GNU_SOURCE', language: 'c')
 
+# Autotools compatibility
+add_project_arguments('-DHAVE_CONFIG_H', language: 'c')
+
 # Make sure source directory hasn't been configured with autotools
 if meson.version().version_compare('>= 0.53')
   fs = import('fs')
diff --git a/src/meson.build b/src/meson.build
index f5d741eae..2905fdc8a 100644
--- a/src/meson.build
+++ b/src/meson.build
@@ -296,8 +296,8 @@ incsrc = include_directories('.')
 
 libcairo = library('cairo', cairo_sources,
   dependencies: deps,
-  c_args: cairo_no_warn_c_args + pthread_c_args + ['-DHAVE_CONFIG_H'],
-  cpp_args: cairo_no_warn_c_args + pthread_c_args + ['-DHAVE_CONFIG_H'],
+  c_args: cairo_no_warn_c_args + pthread_c_args,
+  cpp_args: cairo_no_warn_c_args + pthread_c_args,
   link_args: extra_link_args,
   soversion: cairo_version_sonum,
   version: cairo_libversion,
diff --git a/test/meson.build b/test/meson.build
index 0a7bf6d3a..cfe35a7dc 100644
--- a/test/meson.build
+++ b/test/meson.build
@@ -597,7 +597,6 @@ endif
 
 if build_any2ppm
   any2ppm_exe = executable('any2ppm', 'any2ppm.c',
-    c_args: ['-DHAVE_CONFIG_H'],
     include_directories: [incbase, incsrc, inccairoscript],
     link_with: [libcairo, libcairoscript],
     dependencies: deps + test_deps,
@@ -608,7 +607,7 @@ endif
 if have_shm
   cairo_test_trace_exe = executable('cairo-test-trace', cairo_test_trace_sources,
   include_directories: [incbase, incsrc, incboilerplate, incpdiff, inccairoscript, inccairomissing],
-  c_args: ['-DHAVE_CONFIG_H'] + pthread_c_args,
+  c_args: pthread_c_args,
   link_with: [libcairo, libcairoboilerplate, libpdiff, libcairoscript, libcairomissing],
   link_args: extra_link_args,
   dependencies: deps + test_deps + [rt_dep])
@@ -616,7 +615,6 @@ endif
 
 exe = executable('cairo-test-suite', [cairo_test_suite_sources, test_sources, cairo_test_constructors],
   include_directories: [incbase, incsrc, incboilerplate, incpdiff],
-  c_args: ['-DHAVE_CONFIG_H'],
   link_with: [libcairo, libcairoboilerplate, libpdiff],
   link_args: extra_link_args,
   dependencies: deps + test_deps,
diff --git a/test/pdiff/meson.build b/test/pdiff/meson.build
index 6400b95c2..30c6f1b5f 100644
--- a/test/pdiff/meson.build
+++ b/test/pdiff/meson.build
@@ -9,13 +9,11 @@ perceptualdiff_sources = [
 ]
 
 libpdiff = static_library('pdiff', libpdiff_sources,
-  c_args: ['-DHAVE_CONFIG_H'],
   include_directories: [incbase, incsrc],
   dependencies: deps,
   link_with: [libcairo],
 )
 
 perceptualdiff = executable('perceptualdiff', perceptualdiff_sources,
-  c_args: ['-DHAVE_CONFIG_H'],
   include_directories: [incbase, incsrc],
   link_with: [libpdiff])
diff --git a/util/cairo-fdr/meson.build b/util/cairo-fdr/meson.build
index 3cb66c678..001af27bc 100644
--- a/util/cairo-fdr/meson.build
+++ b/util/cairo-fdr/meson.build
@@ -4,7 +4,6 @@ cairo_fdr_sources = [
 
 libcairofdr = library('cairo-fdr', cairo_fdr_sources,
   include_directories: [incbase, incsrc],
-  c_args: ['-DHAVE_CONFIG_H'],
   dependencies: deps,
   install: true,
   install_dir: join_paths(get_option('prefix'), get_option('libdir'), 'cairo'),
diff --git a/util/cairo-gobject/meson.build b/util/cairo-gobject/meson.build
index bf24242a0..e4e3c8302 100644
--- a/util/cairo-gobject/meson.build
+++ b/util/cairo-gobject/meson.build
@@ -8,7 +8,6 @@ cairo_gobject_headers = [
 ]
 
 libcairogobject = library('cairo-gobject', cairo_gobject_sources,
-  c_args: ['-DHAVE_CONFIG_H'],
   include_directories: [incbase, incsrc],
   dependencies: [glib_dep, gobject_dep],
   link_with: [libcairo],
diff --git a/util/cairo-missing/meson.build b/util/cairo-missing/meson.build
index dd1507b59..18c6caf33 100644
--- a/util/cairo-missing/meson.build
+++ b/util/cairo-missing/meson.build
@@ -6,7 +6,6 @@ cairo_missing_sources = [
 inccairomissing = include_directories('.')
 
 libcairomissing = static_library('cairo-missing', cairo_missing_sources,
-  c_args: ['-DHAVE_CONFIG_H'],
   include_directories: [incbase, incsrc],
   install: false,
   build_by_default: false,
diff --git a/util/cairo-script/meson.build b/util/cairo-script/meson.build
index f50a200df..7a6b55818 100644
--- a/util/cairo-script/meson.build
+++ b/util/cairo-script/meson.build
@@ -26,7 +26,6 @@ csi_trace_sources = [
 
 libcairoscript = library('cairo-script-interpreter',
   cairoscript_interpreter_sources,
-  c_args: ['-DHAVE_CONFIG_H'],
   include_directories: [incbase, incsrc],
   dependencies: deps,
   link_with: [libcairo],
@@ -50,14 +49,12 @@ pkgmod.generate(libcairoscript,
 meson.override_dependency('cairo-script-interpreter', libcairoscript_dep)
 
 csi_replay_exe = executable('csi-replay', csi_replay_sources,
-  c_args: ['-DHAVE_CONFIG_H'],
   include_directories: [incbase, incsrc],
   link_with: [libcairo, libcairoscript],
   dependencies: deps,
 )
 
 csi_exec_exe = executable('csi-exec', csi_exec_sources,
-  c_args: ['-DHAVE_CONFIG_H'],
   include_directories: [incbase, incsrc],
   link_with: [libcairo, libcairoscript],
   dependencies: deps,
@@ -65,7 +62,6 @@ csi_exec_exe = executable('csi-exec', csi_exec_sources,
 
 if feature_conf.get('CAIRO_HAS_SCRIPT_SURFACE', 0) == 1 and conf.get('HAVE_LIBGEN_H', 0) == 1
   csi_trace_exe = executable('csi-trace', csi_trace_sources,
-    c_args: ['-DHAVE_CONFIG_H'],
     include_directories: [incbase, incsrc],
     link_with: [libcairo, libcairoscript],
     dependencies: deps,
diff --git a/util/cairo-sphinx/meson.build b/util/cairo-sphinx/meson.build
index cf560aefd..f779744b9 100644
--- a/util/cairo-sphinx/meson.build
+++ b/util/cairo-sphinx/meson.build
@@ -8,7 +8,6 @@ cairo_sphinx_sources = [
 
 libcairosphinx = library('cairo-sphinx', libcairo_sphinx_sources,
   include_directories: [incbase, incsrc],
-  c_args: ['-DHAVE_CONFIG_H'],
   dependencies: deps,
   install: true,
   install_dir: join_paths(get_option('prefix'), get_option('libdir'), 'cairo'),
@@ -18,7 +17,7 @@ libdir = join_paths(get_option('prefix'), get_option('libdir'))
 
 cairosphinx_exe = executable('cairo-sphinx', cairo_sphinx_sources,
   include_directories: [incbase, incsrc, inccairoscript, incboilerplate],
-  c_args: ['-DHAVE_CONFIG_H', '-DLIBDIR="@0@"'.format(libdir)] + pthread_c_args,
+  c_args: ['-DLIBDIR="@0@"'.format(libdir)] + pthread_c_args,
   dependencies: deps + [glib_dep, rt_dep],
   link_with: [libcairo, libcairosphinx, libcairoscript, libcairoboilerplate],
   link_args: extra_link_args,
diff --git a/util/cairo-trace/meson.build b/util/cairo-trace/meson.build
index 7048786eb..c4a504759 100644
--- a/util/cairo-trace/meson.build
+++ b/util/cairo-trace/meson.build
@@ -12,7 +12,7 @@ libcairotrace = library('cairo-trace', cairo_trace_sources,
   include_directories: [incbase, incsrc],
   dependencies: deps,
   link_args: extra_link_args,
-  c_args: ['-DSHARED_LIB_EXT="@0@"'.format(shared_lib_ext), '-DHAVE_CONFIG_H'] + pthread_c_args,
+  c_args: ['-DSHARED_LIB_EXT="@0@"'.format(shared_lib_ext),] + pthread_c_args,
   install: true,
   install_dir: join_paths(get_option('prefix'), get_option('libdir'), 'cairo'),
 )


More information about the cairo-commit mailing list