Imported Upstream version 3.24.0 upstream/3.24.0
authorDongHun Kwak <dh0128.kwak@samsung.com>
Tue, 30 Oct 2018 01:29:23 +0000 (10:29 +0900)
committerDongHun Kwak <dh0128.kwak@samsung.com>
Tue, 30 Oct 2018 01:29:23 +0000 (10:29 +0900)
36 files changed:
ChangeLog
Makefile.am
Makefile.in
NEWS
PKG-INFO
aclocal.m4
config.guess
config.sub
configure
configure.ac
examples/Makefile.in
examples/cairo-demo.py
examples/properties.py
gi/Makefile.in
gi/_gobject/Makefile.in
gi/_option.py
gi/overrides/GIMarshallingTests.py
gi/overrides/GLib.py
gi/overrides/GObject.py
gi/overrides/Gdk.py
gi/overrides/Gio.py
gi/overrides/Gtk.py
gi/overrides/Makefile.in
gi/overrides/Pango.py
gi/pygi-cache.c
gi/repository/Makefile.in
gi/types.py
pygtkcompat/Makefile.in
pygtkcompat/pygtkcompat.py
tests/Makefile.in
tests/test_generictreemodel.py
tests/test_interface.py
tests/test_iochannel.py
tests/test_overrides_gtk.py
tests/test_properties.py
tests/test_signal.py

index 85e07d4..a76a4fd 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,217 @@
+commit bffbb4b1f823de5035e51e013dc6da5a973045aa
+Author: Christoph Reiter <creiter@src.gnome.org>
+Date:   Mon Mar 20 14:23:59 2017 +0100
+
+    configure.ac: pre-release version bump to 3.24.0
+
+ configure.ac | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+commit 78defd2ab5f1935a6226336eaa08727e7516fb02
+Author: Christoph Reiter <creiter@src.gnome.org>
+Date:   Mon Mar 13 20:14:37 2017 +0100
+
+    release 3.23.92
+
+ NEWS | 10 ++++++++++
+ 1 file changed, 10 insertions(+)
+
+commit 4ccabfec0cececba935339ea8449ec51b4aeef5e
+Author: Christoph Reiter <creiter@src.gnome.org>
+Date:   Mon Mar 13 20:13:13 2017 +0100
+
+    Version bump to 3.23.92
+
+ configure.ac | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+commit ebc245c477c36fa1f65f80d2e75792b82d837611
+Author: Fabian Orccon <cfoch.fabian@gmail.com>
+Date:   Tue Jan 24 00:00:12 2017 -0500
+
+    overrides: Update for Gdk-4.0 and Gtk+-4.0
+
+    Override Gdk.Color and Gdk.RGBA according version.
+    Use properly Gtk.init_check in Gtk+-4.0
+
+    https://bugzilla.gnome.org/show_bug.cgi?id=777680
+
+ gi/overrides/Gdk.py | 74
+ ++++++++++++++++++++++++++++-------------------------
+ gi/overrides/Gtk.py |  7 +++--
+ 2 files changed, 44 insertions(+), 37 deletions(-)
+
+commit d005df9645fd5fb2f19bd09384355f45591f1e58
+Author: Christoph Reiter <creiter@src.gnome.org>
+Date:   Mon Jan 23 21:26:05 2017 +0100
+
+    Disable -Werror=missing-prototypes
+
+    https://bugzilla.gnome.org/show_bug.cgi?id=760056
+    added some code triggering "missing-prototype" which we by default
+    treat as an error. This disables that specific error by default.
+
+    https://bugzilla.gnome.org/show_bug.cgi?id=777534
+
+ configure.ac | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+commit 6695931a0dfb7d9db9ea14a128108342c3d0be89
+Author: Christoph Reiter <creiter@src.gnome.org>
+Date:   Mon Jan 9 20:44:11 2017 +0100
+
+    Fix new PEP8 errors
+
+    Two new errors popped up:
+
+    * E305 expected 2 blank lines after class or function definition
+    * E741 ambiguous variable name
+
+    https://bugzilla.gnome.org/show_bug.cgi?id=776009
+
+ examples/cairo-demo.py             |  1 +
+ examples/properties.py             |  1 +
+ gi/_option.py                      |  1 +
+ gi/overrides/GIMarshallingTests.py |  2 ++
+ gi/overrides/GLib.py               | 19 +++++++++++++++++++
+ gi/overrides/GObject.py            | 12 ++++++++++++
+ gi/overrides/Gdk.py                |  3 +++
+ gi/overrides/Gio.py                |  2 ++
+ gi/overrides/Gtk.py                | 35
+ +++++++++++++++++++++++++++++++++++
+ gi/overrides/Pango.py              |  2 ++
+ gi/types.py                        |  1 +
+ pygtkcompat/pygtkcompat.py         |  1 +
+ tests/test_generictreemodel.py     |  1 +
+ tests/test_interface.py            |  4 ++++
+ tests/test_iochannel.py            |  1 +
+ tests/test_overrides_gtk.py        | 10 +++++-----
+ tests/test_properties.py           | 12 ++++++------
+ tests/test_signal.py               |  1 +
+ 18 files changed, 98 insertions(+), 11 deletions(-)
+
+commit 3f68e0a352abc12e1990e82e3134c48f0be2b3c9
+Author: Christoph Reiter <creiter@src.gnome.org>
+Date:   Wed Mar 23 17:07:53 2016 +0100
+
+    Move pep8/pyflakes tests from 'make check' to 'make check.quality'
+
+    The current behaviour is problematic because new versions of
+    pep8/pyflakes
+    add new warnings or get more picky. This makes testing
+    hard in case newly added code is developed on an older version
+    or when testing old branches/releases.
+
+    This moves the pep8/pyflakes tests to a new "make check.quality"
+    command.
+
+    This also removes the SKIP_PEP8 flag which was added in
+    25d12afd06863ce
+    to speed up make check.
+
+    https://bugzilla.gnome.org/show_bug.cgi?id=764087
+
+ HACKING     |  2 +-
+ Makefile.am | 12 +++++-------
+ 2 files changed, 6 insertions(+), 8 deletions(-)
+
+commit 222f5581c38551bdd5c6c9ca4e895d1f44397ad1
+Author: Christoph Reiter <creiter@src.gnome.org>
+Date:   Fri Oct 21 13:59:54 2016 +0200
+
+    overrides: Update for Gtk-4.0
+
+    Skip things which are gone since 4.0.
+    This only fixes importing and doesn't add any tests for now.
+
+    https://bugzilla.gnome.org/show_bug.cgi?id=773315
+
+ gi/overrides/Gtk.py | 482
+ ++++++++++++++++++++++++++--------------------------
+ 1 file changed, 242 insertions(+), 240 deletions(-)
+
+commit 8694e4dd42565f07b6f9ba1221fb03146be333a0
+Author: Dan Nicholson <nicholson@endlessm.com>
+Date:   Wed Dec 21 12:02:14 2016 -0600
+
+    Handle exception unreffing Variant at exit
+
+    Calling unref will cause gi and gi.repository.GLib to be imported.
+    However, if the program is exiting, then these modules have likely
+    been
+    removed from sys.modules and will raise an exception. Assume
+    that's the
+    case for ImportError and ignore the exception since everything will be
+    cleaned up, anyways.
+
+    This can be triggered with the following trivial program:
+
+    $ python3 -c 'from gi.repository import GLib; v = GLib.Variant("s",
+    "foo")'
+    Exception ignored in:
+
+    Adding some debug code to show the full exception revealed this:
+
+    Traceback (most recent call last):
+      File "/home/dan/src/pygobject/build3/gi/overrides/GLib.py", line
+      265, in __del__
+        self.unref()
+    ImportError: import of 'gi.repository.GLib' halted; None in
+    sys.modules
+
+    https://bugzilla.gnome.org/show_bug.cgi?id=776092
+
+ gi/overrides/GLib.py | 11 ++++++++++-
+ 1 file changed, 10 insertions(+), 1 deletion(-)
+
+commit 54c623ba639654716ca475f75c92cc8ed673d9f5
+Author: Dan Nicholson <nicholson@endlessm.com>
+Date:   Wed Dec 21 11:50:08 2016 -0600
+
+    Handle multiple deinit of callable cache
+
+    In python3, it seems that the callable cache deinit can be called
+    multiple times when the program is exiting. Make that safer by
+    clearing
+    the various pointers in the structure using g_clear_pointer and
+    Py_CLEAR. A subsequent call will skip all the deinit by seeing NULL
+    pointers for the members.
+
+    This was causing a critical warning when destroying the arg name hash
+    table multiple times with the following trivial program:
+
+    $ python3 -c 'from gi.repository import GLib; v = GLib.Variant("s",
+    "foo")'
+
+    (process:32378): GLib-CRITICAL **: g_hash_table_destroy: assertion
+    'hash_table != NULL' failed
+
+    (process:32378): GLib-CRITICAL **: g_hash_table_destroy: assertion
+    'hash_table != NULL' failed
+
+    https://bugzilla.gnome.org/show_bug.cgi?id=776092
+
+ gi/pygi-cache.c | 15 +++++++--------
+ 1 file changed, 7 insertions(+), 8 deletions(-)
+
+commit 94226b8eb63dd985def8501168572ee16e02acad
+Author: Christoph Reiter <creiter@src.gnome.org>
+Date:   Mon Sep 19 15:31:57 2016 +0200
+
+    configure.ac: post-release version bump to 3.23.0
+
+ configure.ac | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+commit fb1b8fa8a67f2c7ea7ad4b53076496a8f2b4afdb
+Author: Christoph Reiter <creiter@src.gnome.org>
+Date:   Mon Sep 19 15:27:35 2016 +0200
+
+    release 3.22.0
+
+ NEWS | 3 +++
+ 1 file changed, 3 insertions(+)
+
 commit b93523fcdb6bc04b42709ecd30b8cd11de80f0c5
 Author: Christoph Reiter <creiter@src.gnome.org>
 Date:   Mon Sep 19 15:24:35 2016 +0200
@@ -21247,14 +21461,14 @@ Date:   Mon Jul 18 10:56:36 2011 -0400
  3 files changed, 1 insertion(+), 1050 deletions(-)
 
 commit 2937cfe5bb7122dd3783c7919294d6a34a3dfc05
-Merge: 519e556 917ea2d
+Merge: 519e556d 917ea2df
 Author: John (J5) Palmieri <johnp@redhat.com>
 Date:   Mon Jul 18 10:45:18 2011 -0400
 
     Merge branch 'master' into invoke-rewrite
 
 commit 519e556dc1e5874e1668bad93043fb9258c7ee79
-Merge: bab7e88 38cca3c
+Merge: bab7e882 38cca3c1
 Author: John (J5) Palmieri <johnp@redhat.com>
 Date:   Mon Jul 18 10:37:20 2011 -0400
 
@@ -21787,14 +22001,14 @@ Date:   Tue Jun 14 16:12:43 2011 -0400
  1 file changed, 16 insertions(+), 8 deletions(-)
 
 commit fbf5382fbc1aed49ed491d2255d616a1643a45fc
-Merge: 499b68d 1491f62
+Merge: 499b68d6 1491f622
 Author: John (J5) Palmieri <johnp@redhat.com>
 Date:   Mon Jun 13 17:28:23 2011 -0400
 
     Merge branch 'master' into invoke-rewrite
 
 commit 499b68d6c9040cffc6e43dc87789d68446564a92
-Merge: 4c9bced 426c710
+Merge: 4c9bcedb 426c7109
 Author: John (J5) Palmieri <johnp@redhat.com>
 Date:   Mon Jun 13 17:26:37 2011 -0400
 
@@ -22697,7 +22911,7 @@ Date:   Tue Mar 22 14:46:29 2011 -0400
  2 files changed, 337 insertions(+), 267 deletions(-)
 
 commit 17cb714cfdaf45b6d7dd627b0189bd24e6578f74
-Merge: 7332a1b 01596a9
+Merge: 7332a1b9 01596a9b
 Author: John (J5) Palmieri <johnp@redhat.com>
 Date:   Tue Mar 22 13:34:36 2011 -0400
 
@@ -24714,7 +24928,7 @@ Date:   Fri Jan 21 09:54:14 2011 +0100
  2 files changed, 43 insertions(+), 1 deletion(-)
 
 commit 71dd03261fc06b8180c14cd31b54d8e4b200be3a
-Merge: bc29600 bd002c7
+Merge: bc29600a bd002c72
 Author: Dieter Verfaillie <dieterv@optionexplicit.be>
 Date:   Fri Jan 21 09:33:16 2011 +0100
 
@@ -25458,7 +25672,7 @@ Date:   Tue Jan 18 07:16:40 2011 -0500
  1 file changed, 24 insertions(+), 18 deletions(-)
 
 commit f56d85a7f39c2088bf9fd50b1b1e5b67c03104d3
-Merge: 84d6142 7d997b6
+Merge: 84d6142c 7d997b6f
 Author: Sebastian Pölsterl <sebp@k-d-w.org>
 Date:   Tue Jan 18 13:14:45 2011 +0100
 
@@ -27497,7 +27711,7 @@ Date:   Thu Nov 4 12:00:14 2010 -0400
  7 files changed, 84 insertions(+), 12 deletions(-)
 
 commit 878b8f630acd2146bee364054acd45cd33eea37a
-Merge: cdacaa9 e317838
+Merge: cdacaa95 e3178381
 Author: John Stowers <john.stowers@gmail.com>
 Date:   Fri Nov 5 11:40:22 2010 +1300
 
@@ -30206,7 +30420,7 @@ Date:   Tue Jun 22 14:45:48 2010 -0400
  1 file changed, 3 insertions(+), 2 deletions(-)
 
 commit fb1ee243493616d7a7e4f6924c574db39f5a423d
-Merge: acf7b43 5f9cb91
+Merge: acf7b43a 5f9cb91c
 Author: Tomeu Vizoso <tomeu.vizoso@collabora.co.uk>
 Date:   Wed Jun 23 12:53:05 2010 +0200
 
@@ -30424,7 +30638,7 @@ Date:   Sun Jun 20 11:09:57 2010 -0300
  39 files changed, 75 insertions(+), 137 deletions(-)
 
 commit 597bd64319d7966045b5b8613ca6fc85668c3f56
-Merge: ec8d148 fa91dfd
+Merge: ec8d148e fa91dfd3
 Author: Johan Dahlin <johan@gnome.org>
 Date:   Sun Jun 20 10:53:46 2010 -0300
 
index 186cfd7..6171e18 100644 (file)
@@ -176,18 +176,16 @@ dist-hook: $(BUILT_EXTRA_DIST)
 
 # pycheck_subdirs = 
 
-check-local:
+check.quality:
        @echo "  CHECK  Pyflakes" $(pycheck_dirs)
        @if type pyflakes >/dev/null 2>&1; then \
                (cd $(abs_top_srcdir) && pyflakes $(pycheck_dirs) ); \
        else echo "skipped, pyflakes not installed"; \
        fi
-       @if test -z "$$SKIP_PEP8"; then \
-               echo "  CHECK  PEP8"; \
-               if type pep8 >/dev/null 2>&1; then \
-                       (cd $(abs_top_srcdir) && pep8 --ignore=E501,E123,E124,E402,E731 --repeat --show-source $(pycheck_dirs) ); \
-               else echo "skipped, pep8 not installed"; \
-               fi; \
+       @echo "  CHECK  PEP8";
+       @if type pep8 >/dev/null 2>&1; then \
+               (cd $(abs_top_srcdir) && pep8 --ignore=E501,E123,E124,E402,E731 --repeat --show-source $(pycheck_dirs) ); \
+       else echo "skipped, pep8 not installed"; \
        fi
 
 check.gdb:
index 9e3a948..94c17bd 100644 (file)
@@ -268,6 +268,7 @@ CODE_COVERAGE_CPPFLAGS = @CODE_COVERAGE_CPPFLAGS@
 CODE_COVERAGE_CXXFLAGS = @CODE_COVERAGE_CXXFLAGS@
 CODE_COVERAGE_ENABLED = @CODE_COVERAGE_ENABLED@
 CODE_COVERAGE_LDFLAGS = @CODE_COVERAGE_LDFLAGS@
+CODE_COVERAGE_LIBS = @CODE_COVERAGE_LIBS@
 CPP = @CPP@
 CPPFLAGS = @CPPFLAGS@
 CYGPATH_W = @CYGPATH_W@
@@ -1197,18 +1198,16 @@ dist-hook: $(BUILT_EXTRA_DIST)
 
 # pycheck_subdirs = 
 
-check-local:
+check.quality:
        @echo "  CHECK  Pyflakes" $(pycheck_dirs)
        @if type pyflakes >/dev/null 2>&1; then \
                (cd $(abs_top_srcdir) && pyflakes $(pycheck_dirs) ); \
        else echo "skipped, pyflakes not installed"; \
        fi
-       @if test -z "$$SKIP_PEP8"; then \
-               echo "  CHECK  PEP8"; \
-               if type pep8 >/dev/null 2>&1; then \
-                       (cd $(abs_top_srcdir) && pep8 --ignore=E501,E123,E124,E402,E731 --repeat --show-source $(pycheck_dirs) ); \
-               else echo "skipped, pep8 not installed"; \
-               fi; \
+       @echo "  CHECK  PEP8";
+       @if type pep8 >/dev/null 2>&1; then \
+               (cd $(abs_top_srcdir) && pep8 --ignore=E501,E123,E124,E402,E731 --repeat --show-source $(pycheck_dirs) ); \
+       else echo "skipped, pep8 not installed"; \
        fi
 
 check.gdb:
diff --git a/NEWS b/NEWS
index 62469cc..4d01190 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -1,3 +1,16 @@
+3.24.0  20-Mar-2017
+        - configure.ac: pre-release version bump to 3.24.0 (Christoph Reiter)
+
+3.23.92 13-Mar-2017
+        - overrides: Update for Gdk-4.0 and Gtk+-4.0 (Fabian Orccon) (#777680)
+        - Disable -Werror=missing-prototypes (Christoph Reiter) (#777534)
+        - Fix new PEP8 errors (Christoph Reiter) (#776009)
+        - Move pep8/pyflakes tests from 'make check' to 'make check.quality' (Christoph Reiter) (#764087)
+        - overrides: Update for Gtk-4.0 (Christoph Reiter) (#773315)
+        - Handle exception unreffing Variant at exit (Dan Nicholson) (#776092)
+        - Handle multiple deinit of callable cache (Dan Nicholson) (#776092)
+        - configure.ac: post-release version bump to 3.23.0 (Christoph Reiter)
+
 3.22.0  19-Sep-2016
         - configure.ac: pre-release version bump to 3.22.0 (Christoph Reiter)
 
index 380475b..4fb47a9 100644 (file)
--- a/PKG-INFO
+++ b/PKG-INFO
@@ -1,6 +1,6 @@
 Metadata-Version: 1.0
 Name: PyGObject
-Version: 3.22.0
+Version: 3.24.0
 Summary: Python bindings for GObject
 Home-page: http://www.pygtk.org/
 Author: James Henstridge
@@ -8,7 +8,7 @@ Author-email: james@daa.com.au
 Maintainer: Simon Feltman
 Maintainer-email: sfeltman@src.gnome.org
 License: GNU LGPL
-Download-url: ftp://ftp.gnome.org/pub/GNOME/sources/pygobject/3.22/pygobject-3.22.0.tar.gz
+Download-url: ftp://ftp.gnome.org/pub/GNOME/sources/pygobject/3.24/pygobject-3.24.0.tar.gz
 Description: Python bindings for GLib and GObject
 Platform: POSIX, Windows
 Classifier: Development Status :: 5 - Production/Stable
index a9612de..110d9bb 100644 (file)
@@ -20,157 +20,445 @@ You have another version of autoconf.  It may work, but is not guaranteed to.
 If you have problems, you may need to regenerate the build system entirely.
 To do so, use the procedure documented by the package, typically 'autoreconf'.])])
 
-# ===========================================================================
-#     http://www.gnu.org/software/autoconf-archive/ax_code_coverage.html
-# ===========================================================================
-#
-# SYNOPSIS
-#
-#   AX_CODE_COVERAGE()
-#
-# DESCRIPTION
-#
-#   Defines CODE_COVERAGE_CPPFLAGS, CODE_COVERAGE_CFLAGS,
-#   CODE_COVERAGE_CXXFLAGS and CODE_COVERAGE_LDFLAGS which should be
-#   included in the CPPFLAGS, CFLAGS CXXFLAGS and LIBS/LDFLAGS variables of
-#   every build target (program or library) which should be built with code
-#   coverage support. Also defines CODE_COVERAGE_RULES which should be
-#   substituted in your Makefile; and $enable_code_coverage which can be
-#   used in subsequent configure output. CODE_COVERAGE_ENABLED is defined
-#   and substituted, and corresponds to the value of the
-#   --enable-code-coverage option, which defaults to being disabled.
-#
-#   Test also for gcov program and create GCOV variable that could be
-#   substituted.
-#
-#   Note that all optimisation flags in CFLAGS must be disabled when code
-#   coverage is enabled.
-#
-#   Usage example:
-#
-#   configure.ac:
-#
-#     AX_CODE_COVERAGE
-#
-#   Makefile.am:
-#
-#     @CODE_COVERAGE_RULES@
-#     my_program_LIBS = ... $(CODE_COVERAGE_LDFLAGS) ...
-#     my_program_CPPFLAGS = ... $(CODE_COVERAGE_CPPFLAGS) ...
-#     my_program_CFLAGS = ... $(CODE_COVERAGE_CFLAGS) ...
-#     my_program_CXXFLAGS = ... $(CODE_COVERAGE_CXXFLAGS) ...
-#
-#   This results in a "check-code-coverage" rule being added to any
-#   Makefile.am which includes "@CODE_COVERAGE_RULES@" (assuming the module
-#   has been configured with --enable-code-coverage). Running `make
-#   check-code-coverage` in that directory will run the module's test suite
-#   (`make check`) and build a code coverage report detailing the code which
-#   was touched, then print the URI for the report.
-#
-#   This code was derived from Makefile.decl in GLib, originally licenced
-#   under LGPLv2.1+.
-#
-# LICENSE
-#
-#   Copyright (c) 2012, 2016 Philip Withnall
-#   Copyright (c) 2012 Xan Lopez
-#   Copyright (c) 2012 Christian Persch
-#   Copyright (c) 2012 Paolo Borelli
-#   Copyright (c) 2012 Dan Winship
-#   Copyright (c) 2015 Bastien ROUCARIES
-#
-#   This library is free software; you can redistribute it and/or modify it
-#   under the terms of the GNU Lesser General Public License as published by
-#   the Free Software Foundation; either version 2.1 of the License, or (at
-#   your option) any later version.
-#
-#   This library is distributed in the hope that it will be useful, but
-#   WITHOUT ANY WARRANTY; without even the implied warranty of
-#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser
-#   General Public License for more details.
-#
-#   You should have received a copy of the GNU Lesser General Public License
-#   along with this program. If not, see <http://www.gnu.org/licenses/>.
+dnl pkg.m4 - Macros to locate and utilise pkg-config.   -*- Autoconf -*-
+dnl serial 11 (pkg-config-0.29)
+dnl
+dnl Copyright Â© 2004 Scott James Remnant <scott@netsplit.com>.
+dnl Copyright Â© 2012-2015 Dan Nicholson <dbn.lists@gmail.com>
+dnl
+dnl This program is free software; you can redistribute it and/or modify
+dnl it under the terms of the GNU General Public License as published by
+dnl the Free Software Foundation; either version 2 of the License, or
+dnl (at your option) any later version.
+dnl
+dnl This program is distributed in the hope that it will be useful, but
+dnl WITHOUT ANY WARRANTY; without even the implied warranty of
+dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+dnl General Public License for more details.
+dnl
+dnl You should have received a copy of the GNU General Public License
+dnl along with this program; if not, write to the Free Software
+dnl Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+dnl 02111-1307, USA.
+dnl
+dnl As a special exception to the GNU General Public License, if you
+dnl distribute this file as part of a program that contains a
+dnl configuration script generated by Autoconf, you may include it under
+dnl the same distribution terms that you use for the rest of that
+dnl program.
 
-#serial 15
+dnl PKG_PREREQ(MIN-VERSION)
+dnl -----------------------
+dnl Since: 0.29
+dnl
+dnl Verify that the version of the pkg-config macros are at least
+dnl MIN-VERSION. Unlike PKG_PROG_PKG_CONFIG, which checks the user's
+dnl installed version of pkg-config, this checks the developer's version
+dnl of pkg.m4 when generating configure.
+dnl
+dnl To ensure that this macro is defined, also add:
+dnl m4_ifndef([PKG_PREREQ],
+dnl     [m4_fatal([must install pkg-config 0.29 or later before running autoconf/autogen])])
+dnl
+dnl See the "Since" comment for each macro you use to see what version
+dnl of the macros you require.
+m4_defun([PKG_PREREQ],
+[m4_define([PKG_MACROS_VERSION], [0.29])
+m4_if(m4_version_compare(PKG_MACROS_VERSION, [$1]), -1,
+    [m4_fatal([pkg.m4 version $1 or higher is required but ]PKG_MACROS_VERSION[ found])])
+])dnl PKG_PREREQ
 
-AC_DEFUN([AX_CODE_COVERAGE],[
-       dnl Check for --enable-code-coverage
-       AC_REQUIRE([AC_PROG_SED])
+dnl PKG_PROG_PKG_CONFIG([MIN-VERSION])
+dnl ----------------------------------
+dnl Since: 0.16
+dnl
+dnl Search for the pkg-config tool and set the PKG_CONFIG variable to
+dnl first found in the path. Checks that the version of pkg-config found
+dnl is at least MIN-VERSION. If MIN-VERSION is not specified, 0.9.0 is
+dnl used since that's the first version where most current features of
+dnl pkg-config existed.
+AC_DEFUN([PKG_PROG_PKG_CONFIG],
+[m4_pattern_forbid([^_?PKG_[A-Z_]+$])
+m4_pattern_allow([^PKG_CONFIG(_(PATH|LIBDIR|SYSROOT_DIR|ALLOW_SYSTEM_(CFLAGS|LIBS)))?$])
+m4_pattern_allow([^PKG_CONFIG_(DISABLE_UNINSTALLED|TOP_BUILD_DIR|DEBUG_SPEW)$])
+AC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility])
+AC_ARG_VAR([PKG_CONFIG_PATH], [directories to add to pkg-config's search path])
+AC_ARG_VAR([PKG_CONFIG_LIBDIR], [path overriding pkg-config's built-in search path])
 
-       # allow to override gcov location
-       AC_ARG_WITH([gcov],
-         [AS_HELP_STRING([--with-gcov[=GCOV]], [use given GCOV for coverage (GCOV=gcov).])],
-         [_AX_CODE_COVERAGE_GCOV_PROG_WITH=$with_gcov],
-         [_AX_CODE_COVERAGE_GCOV_PROG_WITH=gcov])
+if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then
+       AC_PATH_TOOL([PKG_CONFIG], [pkg-config])
+fi
+if test -n "$PKG_CONFIG"; then
+       _pkg_min_version=m4_default([$1], [0.9.0])
+       AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version])
+       if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then
+               AC_MSG_RESULT([yes])
+       else
+               AC_MSG_RESULT([no])
+               PKG_CONFIG=""
+       fi
+fi[]dnl
+])dnl PKG_PROG_PKG_CONFIG
 
-       AC_MSG_CHECKING([whether to build with code coverage support])
-       AC_ARG_ENABLE([code-coverage],
-         AS_HELP_STRING([--enable-code-coverage],
-         [Whether to enable code coverage support]),,
-         enable_code_coverage=no)
+dnl PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
+dnl -------------------------------------------------------------------
+dnl Since: 0.18
+dnl
+dnl Check to see whether a particular set of modules exists. Similar to
+dnl PKG_CHECK_MODULES(), but does not set variables or print errors.
+dnl
+dnl Please remember that m4 expands AC_REQUIRE([PKG_PROG_PKG_CONFIG])
+dnl only at the first occurence in configure.ac, so if the first place
+dnl it's called might be skipped (such as if it is within an "if", you
+dnl have to call PKG_CHECK_EXISTS manually
+AC_DEFUN([PKG_CHECK_EXISTS],
+[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
+if test -n "$PKG_CONFIG" && \
+    AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$1"]); then
+  m4_default([$2], [:])
+m4_ifvaln([$3], [else
+  $3])dnl
+fi])
 
-       AM_CONDITIONAL([CODE_COVERAGE_ENABLED], [test x$enable_code_coverage = xyes])
-       AC_SUBST([CODE_COVERAGE_ENABLED], [$enable_code_coverage])
-       AC_MSG_RESULT($enable_code_coverage)
+dnl _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES])
+dnl ---------------------------------------------
+dnl Internal wrapper calling pkg-config via PKG_CONFIG and setting
+dnl pkg_failed based on the result.
+m4_define([_PKG_CONFIG],
+[if test -n "$$1"; then
+    pkg_cv_[]$1="$$1"
+ elif test -n "$PKG_CONFIG"; then
+    PKG_CHECK_EXISTS([$3],
+                     [pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null`
+                     test "x$?" != "x0" && pkg_failed=yes ],
+                    [pkg_failed=yes])
+ else
+    pkg_failed=untried
+fi[]dnl
+])dnl _PKG_CONFIG
 
-       AS_IF([ test "$enable_code_coverage" = "yes" ], [
-               # check for gcov
-               AC_CHECK_TOOL([GCOV],
-                 [$_AX_CODE_COVERAGE_GCOV_PROG_WITH],
-                 [:])
-               AS_IF([test "X$GCOV" = "X:"],
-                 [AC_MSG_ERROR([gcov is needed to do coverage])])
-               AC_SUBST([GCOV])
+dnl _PKG_SHORT_ERRORS_SUPPORTED
+dnl ---------------------------
+dnl Internal check to see if pkg-config supports short errors.
+AC_DEFUN([_PKG_SHORT_ERRORS_SUPPORTED],
+[AC_REQUIRE([PKG_PROG_PKG_CONFIG])
+if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
+        _pkg_short_errors_supported=yes
+else
+        _pkg_short_errors_supported=no
+fi[]dnl
+])dnl _PKG_SHORT_ERRORS_SUPPORTED
 
-               dnl Check if gcc is being used
-               AS_IF([ test "$GCC" = "no" ], [
-                       AC_MSG_ERROR([not compiling with gcc, which is required for gcov code coverage])
-               ])
 
-               # List of supported lcov versions.
-               lcov_version_list="1.6 1.7 1.8 1.9 1.10 1.11 1.12"
+dnl PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
+dnl   [ACTION-IF-NOT-FOUND])
+dnl --------------------------------------------------------------
+dnl Since: 0.4.0
+dnl
+dnl Note that if there is a possibility the first call to
+dnl PKG_CHECK_MODULES might not happen, you should be sure to include an
+dnl explicit call to PKG_PROG_PKG_CONFIG in your configure.ac
+AC_DEFUN([PKG_CHECK_MODULES],
+[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
+AC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl
+AC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl
 
-               AC_CHECK_PROG([LCOV], [lcov], [lcov])
-               AC_CHECK_PROG([GENHTML], [genhtml], [genhtml])
+pkg_failed=no
+AC_MSG_CHECKING([for $1])
 
-               AS_IF([ test "$LCOV" ], [
-                       AC_CACHE_CHECK([for lcov version], ax_cv_lcov_version, [
-                               ax_cv_lcov_version=invalid
-                               lcov_version=`$LCOV -v 2>/dev/null | $SED -e 's/^.* //'`
-                               for lcov_check_version in $lcov_version_list; do
-                                       if test "$lcov_version" = "$lcov_check_version"; then
-                                               ax_cv_lcov_version="$lcov_check_version (ok)"
-                                       fi
-                               done
-                       ])
-               ], [
-                       lcov_msg="To enable code coverage reporting you must have one of the following lcov versions installed: $lcov_version_list"
-                       AC_MSG_ERROR([$lcov_msg])
-               ])
+_PKG_CONFIG([$1][_CFLAGS], [cflags], [$2])
+_PKG_CONFIG([$1][_LIBS], [libs], [$2])
 
-               case $ax_cv_lcov_version in
-                       ""|invalid[)]
-                               lcov_msg="You must have one of the following versions of lcov: $lcov_version_list (found: $lcov_version)."
-                               AC_MSG_ERROR([$lcov_msg])
-                               LCOV="exit 0;"
-                       ;;
-               esac
+m4_define([_PKG_TEXT], [Alternatively, you may set the environment variables $1[]_CFLAGS
+and $1[]_LIBS to avoid the need to call pkg-config.
+See the pkg-config man page for more details.])
 
-               AS_IF([ test -z "$GENHTML" ], [
-                       AC_MSG_ERROR([Could not find genhtml from the lcov package])
-               ])
+if test $pkg_failed = yes; then
+       AC_MSG_RESULT([no])
+        _PKG_SHORT_ERRORS_SUPPORTED
+        if test $_pkg_short_errors_supported = yes; then
+               $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "$2" 2>&1`
+        else 
+               $1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "$2" 2>&1`
+        fi
+       # Put the nasty error message in config.log where it belongs
+       echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD
 
-               dnl Build the code coverage flags
-               CODE_COVERAGE_CPPFLAGS="-DNDEBUG"
-               CODE_COVERAGE_CFLAGS="-O0 -g -fprofile-arcs -ftest-coverage"
-               CODE_COVERAGE_CXXFLAGS="-O0 -g -fprofile-arcs -ftest-coverage"
-               CODE_COVERAGE_LDFLAGS="-lgcov"
+       m4_default([$4], [AC_MSG_ERROR(
+[Package requirements ($2) were not met:
+
+$$1_PKG_ERRORS
+
+Consider adjusting the PKG_CONFIG_PATH environment variable if you
+installed software in a non-standard prefix.
+
+_PKG_TEXT])[]dnl
+        ])
+elif test $pkg_failed = untried; then
+       AC_MSG_RESULT([no])
+       m4_default([$4], [AC_MSG_FAILURE(
+[The pkg-config script could not be found or is too old.  Make sure it
+is in your PATH or set the PKG_CONFIG environment variable to the full
+path to pkg-config.
+
+_PKG_TEXT
+
+To get pkg-config, see <http://pkg-config.freedesktop.org/>.])[]dnl
+        ])
+else
+       $1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS
+       $1[]_LIBS=$pkg_cv_[]$1[]_LIBS
+        AC_MSG_RESULT([yes])
+       $3
+fi[]dnl
+])dnl PKG_CHECK_MODULES
+
+
+dnl PKG_CHECK_MODULES_STATIC(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
+dnl   [ACTION-IF-NOT-FOUND])
+dnl ---------------------------------------------------------------------
+dnl Since: 0.29
+dnl
+dnl Checks for existence of MODULES and gathers its build flags with
+dnl static libraries enabled. Sets VARIABLE-PREFIX_CFLAGS from --cflags
+dnl and VARIABLE-PREFIX_LIBS from --libs.
+dnl
+dnl Note that if there is a possibility the first call to
+dnl PKG_CHECK_MODULES_STATIC might not happen, you should be sure to
+dnl include an explicit call to PKG_PROG_PKG_CONFIG in your
+dnl configure.ac.
+AC_DEFUN([PKG_CHECK_MODULES_STATIC],
+[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
+_save_PKG_CONFIG=$PKG_CONFIG
+PKG_CONFIG="$PKG_CONFIG --static"
+PKG_CHECK_MODULES($@)
+PKG_CONFIG=$_save_PKG_CONFIG[]dnl
+])dnl PKG_CHECK_MODULES_STATIC
+
+
+dnl PKG_INSTALLDIR([DIRECTORY])
+dnl -------------------------
+dnl Since: 0.27
+dnl
+dnl Substitutes the variable pkgconfigdir as the location where a module
+dnl should install pkg-config .pc files. By default the directory is
+dnl $libdir/pkgconfig, but the default can be changed by passing
+dnl DIRECTORY. The user can override through the --with-pkgconfigdir
+dnl parameter.
+AC_DEFUN([PKG_INSTALLDIR],
+[m4_pushdef([pkg_default], [m4_default([$1], ['${libdir}/pkgconfig'])])
+m4_pushdef([pkg_description],
+    [pkg-config installation directory @<:@]pkg_default[@:>@])
+AC_ARG_WITH([pkgconfigdir],
+    [AS_HELP_STRING([--with-pkgconfigdir], pkg_description)],,
+    [with_pkgconfigdir=]pkg_default)
+AC_SUBST([pkgconfigdir], [$with_pkgconfigdir])
+m4_popdef([pkg_default])
+m4_popdef([pkg_description])
+])dnl PKG_INSTALLDIR
+
+
+dnl PKG_NOARCH_INSTALLDIR([DIRECTORY])
+dnl --------------------------------
+dnl Since: 0.27
+dnl
+dnl Substitutes the variable noarch_pkgconfigdir as the location where a
+dnl module should install arch-independent pkg-config .pc files. By
+dnl default the directory is $datadir/pkgconfig, but the default can be
+dnl changed by passing DIRECTORY. The user can override through the
+dnl --with-noarch-pkgconfigdir parameter.
+AC_DEFUN([PKG_NOARCH_INSTALLDIR],
+[m4_pushdef([pkg_default], [m4_default([$1], ['${datadir}/pkgconfig'])])
+m4_pushdef([pkg_description],
+    [pkg-config arch-independent installation directory @<:@]pkg_default[@:>@])
+AC_ARG_WITH([noarch-pkgconfigdir],
+    [AS_HELP_STRING([--with-noarch-pkgconfigdir], pkg_description)],,
+    [with_noarch_pkgconfigdir=]pkg_default)
+AC_SUBST([noarch_pkgconfigdir], [$with_noarch_pkgconfigdir])
+m4_popdef([pkg_default])
+m4_popdef([pkg_description])
+])dnl PKG_NOARCH_INSTALLDIR
+
+
+dnl PKG_CHECK_VAR(VARIABLE, MODULE, CONFIG-VARIABLE,
+dnl [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
+dnl -------------------------------------------
+dnl Since: 0.28
+dnl
+dnl Retrieves the value of the pkg-config variable for the given module.
+AC_DEFUN([PKG_CHECK_VAR],
+[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
+AC_ARG_VAR([$1], [value of $3 for $2, overriding pkg-config])dnl
+
+_PKG_CONFIG([$1], [variable="][$3]["], [$2])
+AS_VAR_COPY([$1], [pkg_cv_][$1])
+
+AS_VAR_IF([$1], [""], [$5], [$4])dnl
+])dnl PKG_CHECK_VAR
+
+# ===========================================================================
+#     http://www.gnu.org/software/autoconf-archive/ax_code_coverage.html
+# ===========================================================================
+#
+# SYNOPSIS
+#
+#   AX_CODE_COVERAGE()
+#
+# DESCRIPTION
+#
+#   Defines CODE_COVERAGE_CPPFLAGS, CODE_COVERAGE_CFLAGS,
+#   CODE_COVERAGE_CXXFLAGS and CODE_COVERAGE_LIBS which should be included
+#   in the CPPFLAGS, CFLAGS CXXFLAGS and LIBS/LIBADD variables of every
+#   build target (program or library) which should be built with code
+#   coverage support. Also defines CODE_COVERAGE_RULES which should be
+#   substituted in your Makefile; and $enable_code_coverage which can be
+#   used in subsequent configure output. CODE_COVERAGE_ENABLED is defined
+#   and substituted, and corresponds to the value of the
+#   --enable-code-coverage option, which defaults to being disabled.
+#
+#   Test also for gcov program and create GCOV variable that could be
+#   substituted.
+#
+#   Note that all optimisation flags in CFLAGS must be disabled when code
+#   coverage is enabled.
+#
+#   Usage example:
+#
+#   configure.ac:
+#
+#     AX_CODE_COVERAGE
+#
+#   Makefile.am:
+#
+#     @CODE_COVERAGE_RULES@
+#     my_program_LIBS = ... $(CODE_COVERAGE_LIBS) ...
+#     my_program_CPPFLAGS = ... $(CODE_COVERAGE_CPPFLAGS) ...
+#     my_program_CFLAGS = ... $(CODE_COVERAGE_CFLAGS) ...
+#     my_program_CXXFLAGS = ... $(CODE_COVERAGE_CXXFLAGS) ...
+#
+#   This results in a "check-code-coverage" rule being added to any
+#   Makefile.am which includes "@CODE_COVERAGE_RULES@" (assuming the module
+#   has been configured with --enable-code-coverage). Running `make
+#   check-code-coverage` in that directory will run the module's test suite
+#   (`make check`) and build a code coverage report detailing the code which
+#   was touched, then print the URI for the report.
+#
+#   In earlier versions of this macro, CODE_COVERAGE_LDFLAGS was defined
+#   instead of CODE_COVERAGE_LIBS. They are both still defined, but use of
+#   CODE_COVERAGE_LIBS is preferred for clarity; CODE_COVERAGE_LDFLAGS is
+#   deprecated. They have the same value.
+#
+#   This code was derived from Makefile.decl in GLib, originally licenced
+#   under LGPLv2.1+.
+#
+# LICENSE
+#
+#   Copyright (c) 2012, 2016 Philip Withnall
+#   Copyright (c) 2012 Xan Lopez
+#   Copyright (c) 2012 Christian Persch
+#   Copyright (c) 2012 Paolo Borelli
+#   Copyright (c) 2012 Dan Winship
+#   Copyright (c) 2015 Bastien ROUCARIES
+#
+#   This library is free software; you can redistribute it and/or modify it
+#   under the terms of the GNU Lesser General Public License as published by
+#   the Free Software Foundation; either version 2.1 of the License, or (at
+#   your option) any later version.
+#
+#   This library is distributed in the hope that it will be useful, but
+#   WITHOUT ANY WARRANTY; without even the implied warranty of
+#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser
+#   General Public License for more details.
+#
+#   You should have received a copy of the GNU Lesser General Public License
+#   along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+#serial 20
+
+AC_DEFUN([AX_CODE_COVERAGE],[
+       dnl Check for --enable-code-coverage
+       AC_REQUIRE([AC_PROG_SED])
+
+       # allow to override gcov location
+       AC_ARG_WITH([gcov],
+         [AS_HELP_STRING([--with-gcov[=GCOV]], [use given GCOV for coverage (GCOV=gcov).])],
+         [_AX_CODE_COVERAGE_GCOV_PROG_WITH=$with_gcov],
+         [_AX_CODE_COVERAGE_GCOV_PROG_WITH=gcov])
+
+       AC_MSG_CHECKING([whether to build with code coverage support])
+       AC_ARG_ENABLE([code-coverage],
+         AS_HELP_STRING([--enable-code-coverage],
+         [Whether to enable code coverage support]),,
+         enable_code_coverage=no)
+
+       AM_CONDITIONAL([CODE_COVERAGE_ENABLED], [test x$enable_code_coverage = xyes])
+       AC_SUBST([CODE_COVERAGE_ENABLED], [$enable_code_coverage])
+       AC_MSG_RESULT($enable_code_coverage)
+
+       AS_IF([ test "$enable_code_coverage" = "yes" ], [
+               # check for gcov
+               AC_CHECK_TOOL([GCOV],
+                 [$_AX_CODE_COVERAGE_GCOV_PROG_WITH],
+                 [:])
+               AS_IF([test "X$GCOV" = "X:"],
+                 [AC_MSG_ERROR([gcov is needed to do coverage])])
+               AC_SUBST([GCOV])
+
+               dnl Check if gcc is being used
+               AS_IF([ test "$GCC" = "no" ], [
+                       AC_MSG_ERROR([not compiling with gcc, which is required for gcov code coverage])
+               ])
+
+               AC_CHECK_PROG([LCOV], [lcov], [lcov])
+               AC_CHECK_PROG([GENHTML], [genhtml], [genhtml])
+
+               AS_IF([ test -z "$LCOV" ], [
+                       AC_MSG_ERROR([To enable code coverage reporting you must have lcov installed])
+               ])
+
+               AS_IF([ test -z "$GENHTML" ], [
+                       AC_MSG_ERROR([Could not find genhtml from the lcov package])
+               ])
+
+               dnl Build the code coverage flags
+               dnl Define CODE_COVERAGE_LDFLAGS for backwards compatibility
+               CODE_COVERAGE_CPPFLAGS="-DNDEBUG"
+               CODE_COVERAGE_CFLAGS="-O0 -g -fprofile-arcs -ftest-coverage"
+               CODE_COVERAGE_CXXFLAGS="-O0 -g -fprofile-arcs -ftest-coverage"
+               CODE_COVERAGE_LIBS="-lgcov"
+               CODE_COVERAGE_LDFLAGS="$CODE_COVERAGE_LIBS"
 
                AC_SUBST([CODE_COVERAGE_CPPFLAGS])
                AC_SUBST([CODE_COVERAGE_CFLAGS])
                AC_SUBST([CODE_COVERAGE_CXXFLAGS])
+               AC_SUBST([CODE_COVERAGE_LIBS])
                AC_SUBST([CODE_COVERAGE_LDFLAGS])
+
+               [CODE_COVERAGE_RULES_CHECK='
+       -$(A''M_V_at)$(MAKE) $(AM_MAKEFLAGS) -k check
+       $(A''M_V_at)$(MAKE) $(AM_MAKEFLAGS) code-coverage-capture
+']
+               [CODE_COVERAGE_RULES_CAPTURE='
+       $(code_coverage_v_lcov_cap)$(LCOV) $(code_coverage_quiet) $(addprefix --directory ,$(CODE_COVERAGE_DIRECTORY)) --capture --output-file "$(CODE_COVERAGE_OUTPUT_FILE).tmp" --test-name "$(call code_coverage_sanitize,$(PACKAGE_NAME)-$(PACKAGE_VERSION))" --no-checksum --compat-libtool $(CODE_COVERAGE_LCOV_SHOPTS) $(CODE_COVERAGE_LCOV_OPTIONS)
+       $(code_coverage_v_lcov_ign)$(LCOV) $(code_coverage_quiet) $(addprefix --directory ,$(CODE_COVERAGE_DIRECTORY)) --remove "$(CODE_COVERAGE_OUTPUT_FILE).tmp" "/tmp/*" $(CODE_COVERAGE_IGNORE_PATTERN) --output-file "$(CODE_COVERAGE_OUTPUT_FILE)" $(CODE_COVERAGE_LCOV_SHOPTS) $(CODE_COVERAGE_LCOV_RMOPTS)
+       -@rm -f $(CODE_COVERAGE_OUTPUT_FILE).tmp
+       $(code_coverage_v_genhtml)LANG=C $(GENHTML) $(code_coverage_quiet) $(addprefix --prefix ,$(CODE_COVERAGE_DIRECTORY)) --output-directory "$(CODE_COVERAGE_OUTPUT_DIRECTORY)" --title "$(PACKAGE_NAME)-$(PACKAGE_VERSION) Code Coverage" --legend --show-details "$(CODE_COVERAGE_OUTPUT_FILE)" $(CODE_COVERAGE_GENHTML_OPTIONS)
+       @echo "file://$(abs_builddir)/$(CODE_COVERAGE_OUTPUT_DIRECTORY)/index.html"
+']
+               [CODE_COVERAGE_RULES_CLEAN='
+clean: code-coverage-clean
+distclean: code-coverage-clean
+code-coverage-clean:
+       -$(LCOV) --directory $(top_builddir) -z
+       -rm -rf $(CODE_COVERAGE_OUTPUT_FILE) $(CODE_COVERAGE_OUTPUT_FILE).tmp $(CODE_COVERAGE_OUTPUT_DIRECTORY)
+       -find . \( -name "*.gcda" -o -name "*.gcno" -o -name "*.gcov" \) -delete
+']
+       ], [
+               [CODE_COVERAGE_RULES_CHECK='
+       @echo "Need to reconfigure with --enable-code-coverage"
+']
+               CODE_COVERAGE_RULES_CAPTURE="$CODE_COVERAGE_RULES_CHECK"
+               CODE_COVERAGE_RULES_CLEAN=''
        ])
 
 [CODE_COVERAGE_RULES='
@@ -247,767 +535,470 @@ code_coverage_quiet_ = $(code_coverage_quiet_$(AM_DEFAULT_VERBOSITY))
 code_coverage_quiet_0 = --quiet
 
 # sanitizes the test-name: replaces with underscores: dashes and dots
-code_coverage_sanitize = $(subst -,_,$(subst .,_,$(1)))
-
-# Use recursive makes in order to ignore errors during check
-check-code-coverage:
-ifeq ($(CODE_COVERAGE_ENABLED),yes)
-       -$(A''M_V_at)$(MAKE) $(AM_MAKEFLAGS) -k check
-       $(A''M_V_at)$(MAKE) $(AM_MAKEFLAGS) code-coverage-capture
-else
-       @echo "Need to reconfigure with --enable-code-coverage"
-endif
-
-# Capture code coverage data
-code-coverage-capture: code-coverage-capture-hook
-ifeq ($(CODE_COVERAGE_ENABLED),yes)
-       $(code_coverage_v_lcov_cap)$(LCOV) $(code_coverage_quiet) $(addprefix --directory ,$(CODE_COVERAGE_DIRECTORY)) --capture --output-file "$(CODE_COVERAGE_OUTPUT_FILE).tmp" --test-name "$(call code_coverage_sanitize,$(PACKAGE_NAME)-$(PACKAGE_VERSION))" --no-checksum --compat-libtool $(CODE_COVERAGE_LCOV_SHOPTS) $(CODE_COVERAGE_LCOV_OPTIONS)
-       $(code_coverage_v_lcov_ign)$(LCOV) $(code_coverage_quiet) $(addprefix --directory ,$(CODE_COVERAGE_DIRECTORY)) --remove "$(CODE_COVERAGE_OUTPUT_FILE).tmp" "/tmp/*" $(CODE_COVERAGE_IGNORE_PATTERN) --output-file "$(CODE_COVERAGE_OUTPUT_FILE)" $(CODE_COVERAGE_LCOV_SHOPTS) $(CODE_COVERAGE_LCOV_RMOPTS)
-       -@rm -f $(CODE_COVERAGE_OUTPUT_FILE).tmp
-       $(code_coverage_v_genhtml)LANG=C $(GENHTML) $(code_coverage_quiet) $(addprefix --prefix ,$(CODE_COVERAGE_DIRECTORY)) --output-directory "$(CODE_COVERAGE_OUTPUT_DIRECTORY)" --title "$(PACKAGE_NAME)-$(PACKAGE_VERSION) Code Coverage" --legend --show-details "$(CODE_COVERAGE_OUTPUT_FILE)" $(CODE_COVERAGE_GENHTML_OPTIONS)
-       @echo "file://$(abs_builddir)/$(CODE_COVERAGE_OUTPUT_DIRECTORY)/index.html"
-else
-       @echo "Need to reconfigure with --enable-code-coverage"
-endif
-
-# Hook rule executed before code-coverage-capture, overridable by the user
-code-coverage-capture-hook:
-
-ifeq ($(CODE_COVERAGE_ENABLED),yes)
-clean: code-coverage-clean
-code-coverage-clean:
-       -$(LCOV) --directory $(top_builddir) -z
-       -rm -rf $(CODE_COVERAGE_OUTPUT_FILE) $(CODE_COVERAGE_OUTPUT_FILE).tmp $(CODE_COVERAGE_OUTPUT_DIRECTORY)
-       -find . -name "*.gcda" -o -name "*.gcov" -delete
-endif
-
-GITIGNOREFILES ?=
-GITIGNOREFILES += $(CODE_COVERAGE_OUTPUT_FILE) $(CODE_COVERAGE_OUTPUT_DIRECTORY)
-
-A''M_DISTCHECK_CONFIGURE_FLAGS ?=
-A''M_DISTCHECK_CONFIGURE_FLAGS += --disable-code-coverage
-
-.PHONY: check-code-coverage code-coverage-capture code-coverage-capture-hook code-coverage-clean
-']
-
-       AC_SUBST([CODE_COVERAGE_RULES])
-       m4_ifdef([_AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE([CODE_COVERAGE_RULES])])
-])
-
-# Configure paths for GLIB
-# Owen Taylor     1997-2001
-
-dnl AM_PATH_GLIB_2_0([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND [, MODULES]]]])
-dnl Test for GLIB, and define GLIB_CFLAGS and GLIB_LIBS, if gmodule, gobject,
-dnl gthread, or gio is specified in MODULES, pass to pkg-config
-dnl
-AC_DEFUN([AM_PATH_GLIB_2_0],
-[dnl 
-dnl Get the cflags and libraries from pkg-config
-dnl
-AC_ARG_ENABLE(glibtest, [  --disable-glibtest      do not try to compile and run a test GLIB program],
-                   , enable_glibtest=yes)
-
-  pkg_config_args=glib-2.0
-  for module in . $4
-  do
-      case "$module" in
-         gmodule) 
-             pkg_config_args="$pkg_config_args gmodule-2.0"
-         ;;
-         gmodule-no-export) 
-             pkg_config_args="$pkg_config_args gmodule-no-export-2.0"
-         ;;
-         gobject) 
-             pkg_config_args="$pkg_config_args gobject-2.0"
-         ;;
-         gthread) 
-             pkg_config_args="$pkg_config_args gthread-2.0"
-         ;;
-         gio*) 
-             pkg_config_args="$pkg_config_args $module-2.0"
-         ;;
-      esac
-  done
-
-  PKG_PROG_PKG_CONFIG([0.16])
-
-  no_glib=""
-
-  if test "x$PKG_CONFIG" = x ; then
-    no_glib=yes
-    PKG_CONFIG=no
-  fi
-
-  min_glib_version=ifelse([$1], ,2.0.0,$1)
-  AC_MSG_CHECKING(for GLIB - version >= $min_glib_version)
-
-  if test x$PKG_CONFIG != xno ; then
-    ## don't try to run the test against uninstalled libtool libs
-    if $PKG_CONFIG --uninstalled $pkg_config_args; then
-         echo "Will use uninstalled version of GLib found in PKG_CONFIG_PATH"
-         enable_glibtest=no
-    fi
-
-    if $PKG_CONFIG --atleast-version $min_glib_version $pkg_config_args; then
-         :
-    else
-         no_glib=yes
-    fi
-  fi
-
-  if test x"$no_glib" = x ; then
-    GLIB_GENMARSHAL=`$PKG_CONFIG --variable=glib_genmarshal glib-2.0`
-    GOBJECT_QUERY=`$PKG_CONFIG --variable=gobject_query glib-2.0`
-    GLIB_MKENUMS=`$PKG_CONFIG --variable=glib_mkenums glib-2.0`
-    GLIB_COMPILE_RESOURCES=`$PKG_CONFIG --variable=glib_compile_resources gio-2.0`
-
-    GLIB_CFLAGS=`$PKG_CONFIG --cflags $pkg_config_args`
-    GLIB_LIBS=`$PKG_CONFIG --libs $pkg_config_args`
-    glib_config_major_version=`$PKG_CONFIG --modversion glib-2.0 | \
-           sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
-    glib_config_minor_version=`$PKG_CONFIG --modversion glib-2.0 | \
-           sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
-    glib_config_micro_version=`$PKG_CONFIG --modversion glib-2.0 | \
-           sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
-    if test "x$enable_glibtest" = "xyes" ; then
-      ac_save_CFLAGS="$CFLAGS"
-      ac_save_LIBS="$LIBS"
-      CFLAGS="$CFLAGS $GLIB_CFLAGS"
-      LIBS="$GLIB_LIBS $LIBS"
-dnl
-dnl Now check if the installed GLIB is sufficiently new. (Also sanity
-dnl checks the results of pkg-config to some extent)
-dnl
-      rm -f conf.glibtest
-      AC_TRY_RUN([
-#include <glib.h>
-#include <stdio.h>
-#include <stdlib.h>
-
-int 
-main ()
-{
-  unsigned int major, minor, micro;
-
-  fclose (fopen ("conf.glibtest", "w"));
-
-  if (sscanf("$min_glib_version", "%u.%u.%u", &major, &minor, &micro) != 3) {
-     printf("%s, bad version string\n", "$min_glib_version");
-     exit(1);
-   }
-
-  if ((glib_major_version != $glib_config_major_version) ||
-      (glib_minor_version != $glib_config_minor_version) ||
-      (glib_micro_version != $glib_config_micro_version))
-    {
-      printf("\n*** 'pkg-config --modversion glib-2.0' returned %d.%d.%d, but GLIB (%d.%d.%d)\n", 
-             $glib_config_major_version, $glib_config_minor_version, $glib_config_micro_version,
-             glib_major_version, glib_minor_version, glib_micro_version);
-      printf ("*** was found! If pkg-config was correct, then it is best\n");
-      printf ("*** to remove the old version of GLib. You may also be able to fix the error\n");
-      printf("*** by modifying your LD_LIBRARY_PATH enviroment variable, or by editing\n");
-      printf("*** /etc/ld.so.conf. Make sure you have run ldconfig if that is\n");
-      printf("*** required on your system.\n");
-      printf("*** If pkg-config was wrong, set the environment variable PKG_CONFIG_PATH\n");
-      printf("*** to point to the correct configuration files\n");
-    } 
-  else if ((glib_major_version != GLIB_MAJOR_VERSION) ||
-          (glib_minor_version != GLIB_MINOR_VERSION) ||
-           (glib_micro_version != GLIB_MICRO_VERSION))
-    {
-      printf("*** GLIB header files (version %d.%d.%d) do not match\n",
-            GLIB_MAJOR_VERSION, GLIB_MINOR_VERSION, GLIB_MICRO_VERSION);
-      printf("*** library (version %d.%d.%d)\n",
-            glib_major_version, glib_minor_version, glib_micro_version);
-    }
-  else
-    {
-      if ((glib_major_version > major) ||
-        ((glib_major_version == major) && (glib_minor_version > minor)) ||
-        ((glib_major_version == major) && (glib_minor_version == minor) && (glib_micro_version >= micro)))
-      {
-        return 0;
-       }
-     else
-      {
-        printf("\n*** An old version of GLIB (%u.%u.%u) was found.\n",
-               glib_major_version, glib_minor_version, glib_micro_version);
-        printf("*** You need a version of GLIB newer than %u.%u.%u. The latest version of\n",
-              major, minor, micro);
-        printf("*** GLIB is always available from ftp://ftp.gtk.org.\n");
-        printf("***\n");
-        printf("*** If you have already installed a sufficiently new version, this error\n");
-        printf("*** probably means that the wrong copy of the pkg-config shell script is\n");
-        printf("*** being found. The easiest way to fix this is to remove the old version\n");
-        printf("*** of GLIB, but you can also set the PKG_CONFIG environment to point to the\n");
-        printf("*** correct copy of pkg-config. (In this case, you will have to\n");
-        printf("*** modify your LD_LIBRARY_PATH enviroment variable, or edit /etc/ld.so.conf\n");
-        printf("*** so that the correct libraries are found at run-time))\n");
-      }
-    }
-  return 1;
-}
-],, no_glib=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"])
-       CFLAGS="$ac_save_CFLAGS"
-       LIBS="$ac_save_LIBS"
-     fi
-  fi
-  if test "x$no_glib" = x ; then
-     AC_MSG_RESULT(yes (version $glib_config_major_version.$glib_config_minor_version.$glib_config_micro_version))
-     ifelse([$2], , :, [$2])     
-  else
-     AC_MSG_RESULT(no)
-     if test "$PKG_CONFIG" = "no" ; then
-       echo "*** A new enough version of pkg-config was not found."
-       echo "*** See http://www.freedesktop.org/software/pkgconfig/"
-     else
-       if test -f conf.glibtest ; then
-        :
-       else
-          echo "*** Could not run GLIB test program, checking why..."
-          ac_save_CFLAGS="$CFLAGS"
-          ac_save_LIBS="$LIBS"
-          CFLAGS="$CFLAGS $GLIB_CFLAGS"
-          LIBS="$LIBS $GLIB_LIBS"
-          AC_TRY_LINK([
-#include <glib.h>
-#include <stdio.h>
-],      [ return ((glib_major_version) || (glib_minor_version) || (glib_micro_version)); ],
-        [ echo "*** The test program compiled, but did not run. This usually means"
-          echo "*** that the run-time linker is not finding GLIB or finding the wrong"
-          echo "*** version of GLIB. If it is not finding GLIB, you'll need to set your"
-          echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point"
-          echo "*** to the installed location  Also, make sure you have run ldconfig if that"
-          echo "*** is required on your system"
-         echo "***"
-          echo "*** If you have an old version installed, it is best to remove it, although"
-          echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH" ],
-        [ echo "*** The test program failed to compile or link. See the file config.log for the"
-          echo "*** exact error that occured. This usually means GLIB is incorrectly installed."])
-          CFLAGS="$ac_save_CFLAGS"
-          LIBS="$ac_save_LIBS"
-       fi
-     fi
-     GLIB_CFLAGS=""
-     GLIB_LIBS=""
-     GLIB_GENMARSHAL=""
-     GOBJECT_QUERY=""
-     GLIB_MKENUMS=""
-     GLIB_COMPILE_RESOURCES=""
-     ifelse([$3], , :, [$3])
-  fi
-  AC_SUBST(GLIB_CFLAGS)
-  AC_SUBST(GLIB_LIBS)
-  AC_SUBST(GLIB_GENMARSHAL)
-  AC_SUBST(GOBJECT_QUERY)
-  AC_SUBST(GLIB_MKENUMS)
-  AC_SUBST(GLIB_COMPILE_RESOURCES)
-  rm -f conf.glibtest
-])
-
-dnl GNOME_CODE_COVERAGE
-dnl
-dnl Defines CODE_COVERAGE_CFLAGS and CODE_COVERAGE_LDFLAGS which should be
-dnl included in the CFLAGS and LIBS/LDFLAGS variables of every build target
-dnl (program or library) which should be built with code coverage support.
-dnl Also defines GNOME_CODE_COVERAGE_RULES which should be substituted in your
-dnl Makefile; and $enable_code_coverage which can be used in subsequent
-dnl configure output.
-dnl
-dnl Note that all optimisation flags in CFLAGS must be disabled when code
-dnl coverage is enabled.
-dnl
-dnl Derived from Makefile.decl in GLib, originally licenced under LGPLv2.1+.
-dnl This file is licenced under LGPLv2.1+.
-dnl
-dnl Usage example:
-dnl configure.ac:
-dnl    GNOME_CODE_COVERAGE
-dnl
-dnl Makefile.am:
-dnl    @GNOME_CODE_COVERAGE_RULES@
-dnl    my_program_LIBS = â€¦ $(CODE_COVERAGE_LDFLAGS) â€¦
-dnl    my_program_CFLAGS = â€¦ $(CODE_COVERAGE_CFLAGS) â€¦
-dnl
-dnl This results in a â€ścheck-code-coverage” rule being added to any Makefile.am
-dnl which includes â€ś@GNOME_CODE_COVERAGE_RULES@” (assuming the module has been
-dnl configured with --enable-code-coverage). Running `make check-code-coverage`
-dnl in that directory will run the module’s test suite (`make check`) and build
-dnl a code coverage report detailing the code which was touched, then print the
-dnl URI for the report.
-
-AU_DEFUN([GNOME_CODE_COVERAGE],[
-       AX_CODE_COVERAGE
-       GNOME_CODE_COVERAGE_RULES=$CODE_COVERAGE_RULES
-
-       AC_SUBST([GNOME_CODE_COVERAGE_RULES])
-       m4_ifdef([_AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE([GNOME_CODE_COVERAGE_RULES])])
-],
-[[$0: This macro is deprecated. You should use AX_CODE_COVERAGE instead and
-replace uses of GNOME_CODE_COVERAGE_RULES with CODE_COVERAGE_RULES.
-See: http://www.gnu.org/software/autoconf-archive/ax_code_coverage.html#ax_code_coverage]])
-
-# gnome-compiler-flags.m4
-#
-# serial 4
-#
-
-dnl GNOME_COMPILE_WARNINGS
-dnl Turn on many useful compiler warnings and substitute the result into
-dnl WARN_CFLAGS
-dnl For now, only works on GCC
-dnl Pass the default value of the --enable-compile-warnings configure option as
-dnl the first argument to the macro, defaulting to 'yes'.
-dnl Additional warning/error flags can be passed as an optional second argument.
-dnl
-dnl For example: GNOME_COMPILE_WARNINGS([maximum],[-Werror=some-flag -Wfoobar])
-AU_DEFUN([GNOME_COMPILE_WARNINGS],[
-    dnl ******************************
-    dnl More compiler warnings
-    dnl ******************************
-
-    AC_ARG_ENABLE(compile-warnings, 
-                  AS_HELP_STRING([--enable-compile-warnings=@<:@no/minimum/yes/maximum/error@:>@],
-                                 [Turn on compiler warnings]),,
-                  [enable_compile_warnings="m4_default([$1],[yes])"])
-
-    if test "x$GCC" != xyes; then
-       enable_compile_warnings=no
-    fi
-
-    warning_flags=
-    realsave_CFLAGS="$CFLAGS"
-
-    dnl These are warning flags that aren't marked as fatal.  Can be
-    dnl overridden on a per-project basis with -Wno-foo.
-    base_warn_flags=" \
-        -Wall \
-        -Wstrict-prototypes \
-        -Wnested-externs \
-    "
-
-    dnl These compiler flags typically indicate very broken or suspicious
-    dnl code.  Some of them such as implicit-function-declaration are
-    dnl just not default because gcc compiles a lot of legacy code.
-    dnl We choose to make this set into explicit errors.
-    base_error_flags=" \
-        -Werror=missing-prototypes \
-        -Werror=implicit-function-declaration \
-        -Werror=pointer-arith \
-        -Werror=init-self \
-        -Werror=format-security \
-        -Werror=format=2 \
-        -Werror=missing-include-dirs \
-        -Werror=return-type \
-    "
+code_coverage_sanitize = $(subst -,_,$(subst .,_,$(1)))
 
-    dnl Additional warning or error flags provided by the module author to
-    dnl allow stricter standards to be imposed on a per-module basis.
-    dnl The author can pass -W or -Werror flags here as they see fit.
-    additional_flags="m4_default([$2],[])"
+# Use recursive makes in order to ignore errors during check
+check-code-coverage:'"$CODE_COVERAGE_RULES_CHECK"'
 
-    case "$enable_compile_warnings" in
-    no)
-        warning_flags="-w"
-        ;;
-    minimum)
-        warning_flags="-Wall"
-        ;;
-    yes|maximum|error)
-        warning_flags="$base_warn_flags $base_error_flags $additional_flags"
-        ;;
-    *)
-        AC_MSG_ERROR(Unknown argument '$enable_compile_warnings' to --enable-compile-warnings)
-        ;;
-    esac
+# Capture code coverage data
+code-coverage-capture: code-coverage-capture-hook'"$CODE_COVERAGE_RULES_CAPTURE"'
 
-    if test "$enable_compile_warnings" = "error" ; then
-        warning_flags="$warning_flags -Werror"
-    fi
+# Hook rule executed before code-coverage-capture, overridable by the user
+code-coverage-capture-hook:
 
-    dnl Check whether GCC supports the warning options
-    for option in $warning_flags; do
-       save_CFLAGS="$CFLAGS"
-       CFLAGS="$CFLAGS $option"
-       AC_MSG_CHECKING([whether gcc understands $option])
-       AC_TRY_COMPILE([], [],
-           has_option=yes,
-           has_option=no,)
-       CFLAGS="$save_CFLAGS"
-       AC_MSG_RESULT([$has_option])
-       if test $has_option = yes; then
-           tested_warning_flags="$tested_warning_flags $option"
-       fi
-       unset has_option
-       unset save_CFLAGS
-    done
-    unset option
-    CFLAGS="$realsave_CFLAGS"
-    AC_MSG_CHECKING(what warning flags to pass to the C compiler)
-    AC_MSG_RESULT($tested_warning_flags)
+'"$CODE_COVERAGE_RULES_CLEAN"'
 
-    AC_ARG_ENABLE(iso-c,
-                  AS_HELP_STRING([--enable-iso-c],
-                                 [Try to warn if code is not ISO C ]),,
-                  [enable_iso_c=no])
+GITIGNOREFILES ?=
+GITIGNOREFILES += $(CODE_COVERAGE_OUTPUT_FILE) $(CODE_COVERAGE_OUTPUT_DIRECTORY)
 
-    AC_MSG_CHECKING(what language compliance flags to pass to the C compiler)
-    complCFLAGS=
-    if test "x$enable_iso_c" != "xno"; then
-       if test "x$GCC" = "xyes"; then
-       case " $CFLAGS " in
-           *[\ \       ]-ansi[\ \      ]*) ;;
-           *) complCFLAGS="$complCFLAGS -ansi" ;;
-       esac
-       case " $CFLAGS " in
-           *[\ \       ]-pedantic[\ \  ]*) ;;
-           *) complCFLAGS="$complCFLAGS -pedantic" ;;
-       esac
-       fi
-    fi
-    AC_MSG_RESULT($complCFLAGS)
+A''M_DISTCHECK_CONFIGURE_FLAGS ?=
+A''M_DISTCHECK_CONFIGURE_FLAGS += --disable-code-coverage
 
-    WARN_CFLAGS="$tested_warning_flags $complCFLAGS"
-    AC_SUBST(WARN_CFLAGS)
-],
-[[$0: This macro is deprecated. You should use AX_COMPILER_FLAGS instead and
-eliminate use of --enable-iso-c.
-See: http://www.gnu.org/software/autoconf-archive/ax_compiler_flags.html#ax_compiler_flags]])
+.PHONY: check-code-coverage code-coverage-capture code-coverage-capture-hook code-coverage-clean
+']
 
-dnl For C++, do basically the same thing.
+       AC_SUBST([CODE_COVERAGE_RULES])
+       m4_ifdef([_AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE([CODE_COVERAGE_RULES])])
+])
 
-AU_DEFUN([GNOME_CXX_WARNINGS],[
-  AC_ARG_ENABLE(cxx-warnings,
-                AS_HELP_STRING([--enable-cxx-warnings=@<:@no/minimum/yes@:>@]
-                               [Turn on compiler warnings.]),,
-                [enable_cxx_warnings="m4_default([$1],[minimum])"])
+# Configure paths for GLIB
+# Owen Taylor     1997-2001
 
-  AC_MSG_CHECKING(what warning flags to pass to the C++ compiler)
-  warnCXXFLAGS=
-  if test "x$GXX" != xyes; then
-    enable_cxx_warnings=no
-  fi
-  if test "x$enable_cxx_warnings" != "xno"; then
-    if test "x$GXX" = "xyes"; then
-      case " $CXXFLAGS " in
-      *[\ \    ]-Wall[\ \      ]*) ;;
-      *) warnCXXFLAGS="-Wall -Wno-unused" ;;
+dnl AM_PATH_GLIB_2_0([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND [, MODULES]]]])
+dnl Test for GLIB, and define GLIB_CFLAGS and GLIB_LIBS, if gmodule, gobject,
+dnl gthread, or gio is specified in MODULES, pass to pkg-config
+dnl
+AC_DEFUN([AM_PATH_GLIB_2_0],
+[dnl 
+dnl Get the cflags and libraries from pkg-config
+dnl
+AC_ARG_ENABLE(glibtest, [  --disable-glibtest      do not try to compile and run a test GLIB program],
+                   , enable_glibtest=yes)
+
+  pkg_config_args=glib-2.0
+  for module in . $4
+  do
+      case "$module" in
+         gmodule) 
+             pkg_config_args="$pkg_config_args gmodule-2.0"
+         ;;
+         gmodule-no-export) 
+             pkg_config_args="$pkg_config_args gmodule-no-export-2.0"
+         ;;
+         gobject) 
+             pkg_config_args="$pkg_config_args gobject-2.0"
+         ;;
+         gthread) 
+             pkg_config_args="$pkg_config_args gthread-2.0"
+         ;;
+         gio*) 
+             pkg_config_args="$pkg_config_args $module-2.0"
+         ;;
       esac
+  done
 
-      ## -W is not all that useful.  And it cannot be controlled
-      ## with individual -Wno-xxx flags, unlike -Wall
-      if test "x$enable_cxx_warnings" = "xyes"; then
-       warnCXXFLAGS="$warnCXXFLAGS -Wshadow -Woverloaded-virtual"
-      fi
+  PKG_PROG_PKG_CONFIG([0.16])
+
+  no_glib=""
+
+  if test "x$PKG_CONFIG" = x ; then
+    no_glib=yes
+    PKG_CONFIG=no
+  fi
+
+  min_glib_version=ifelse([$1], ,2.0.0,$1)
+  AC_MSG_CHECKING(for GLIB - version >= $min_glib_version)
+
+  if test x$PKG_CONFIG != xno ; then
+    ## don't try to run the test against uninstalled libtool libs
+    if $PKG_CONFIG --uninstalled $pkg_config_args; then
+         echo "Will use uninstalled version of GLib found in PKG_CONFIG_PATH"
+         enable_glibtest=no
+    fi
+
+    if $PKG_CONFIG --atleast-version $min_glib_version $pkg_config_args; then
+         :
+    else
+         no_glib=yes
     fi
   fi
-  AC_MSG_RESULT($warnCXXFLAGS)
 
-   AC_ARG_ENABLE(iso-cxx,
-                 AS_HELP_STRING([--enable-iso-cxx],
-                                [Try to warn if code is not ISO C++ ]),,
-                 [enable_iso_cxx=no])
+  if test x"$no_glib" = x ; then
+    GLIB_GENMARSHAL=`$PKG_CONFIG --variable=glib_genmarshal glib-2.0`
+    GOBJECT_QUERY=`$PKG_CONFIG --variable=gobject_query glib-2.0`
+    GLIB_MKENUMS=`$PKG_CONFIG --variable=glib_mkenums glib-2.0`
+    GLIB_COMPILE_RESOURCES=`$PKG_CONFIG --variable=glib_compile_resources gio-2.0`
 
-   AC_MSG_CHECKING(what language compliance flags to pass to the C++ compiler)
-   complCXXFLAGS=
-   if test "x$enable_iso_cxx" != "xno"; then
-     if test "x$GXX" = "xyes"; then
-      case " $CXXFLAGS " in
-      *[\ \    ]-ansi[\ \      ]*) ;;
-      *) complCXXFLAGS="$complCXXFLAGS -ansi" ;;
-      esac
+    GLIB_CFLAGS=`$PKG_CONFIG --cflags $pkg_config_args`
+    GLIB_LIBS=`$PKG_CONFIG --libs $pkg_config_args`
+    glib_config_major_version=`$PKG_CONFIG --modversion glib-2.0 | \
+           sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
+    glib_config_minor_version=`$PKG_CONFIG --modversion glib-2.0 | \
+           sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
+    glib_config_micro_version=`$PKG_CONFIG --modversion glib-2.0 | \
+           sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
+    if test "x$enable_glibtest" = "xyes" ; then
+      ac_save_CFLAGS="$CFLAGS"
+      ac_save_LIBS="$LIBS"
+      CFLAGS="$CFLAGS $GLIB_CFLAGS"
+      LIBS="$GLIB_LIBS $LIBS"
+dnl
+dnl Now check if the installed GLIB is sufficiently new. (Also sanity
+dnl checks the results of pkg-config to some extent)
+dnl
+      rm -f conf.glibtest
+      AC_TRY_RUN([
+#include <glib.h>
+#include <stdio.h>
+#include <stdlib.h>
 
-      case " $CXXFLAGS " in
-      *[\ \    ]-pedantic[\ \  ]*) ;;
-      *) complCXXFLAGS="$complCXXFLAGS -pedantic" ;;
-      esac
+int 
+main ()
+{
+  unsigned int major, minor, micro;
+
+  fclose (fopen ("conf.glibtest", "w"));
+
+  if (sscanf("$min_glib_version", "%u.%u.%u", &major, &minor, &micro) != 3) {
+     printf("%s, bad version string\n", "$min_glib_version");
+     exit(1);
+   }
+
+  if ((glib_major_version != $glib_config_major_version) ||
+      (glib_minor_version != $glib_config_minor_version) ||
+      (glib_micro_version != $glib_config_micro_version))
+    {
+      printf("\n*** 'pkg-config --modversion glib-2.0' returned %d.%d.%d, but GLIB (%d.%d.%d)\n", 
+             $glib_config_major_version, $glib_config_minor_version, $glib_config_micro_version,
+             glib_major_version, glib_minor_version, glib_micro_version);
+      printf ("*** was found! If pkg-config was correct, then it is best\n");
+      printf ("*** to remove the old version of GLib. You may also be able to fix the error\n");
+      printf("*** by modifying your LD_LIBRARY_PATH enviroment variable, or by editing\n");
+      printf("*** /etc/ld.so.conf. Make sure you have run ldconfig if that is\n");
+      printf("*** required on your system.\n");
+      printf("*** If pkg-config was wrong, set the environment variable PKG_CONFIG_PATH\n");
+      printf("*** to point to the correct configuration files\n");
+    } 
+  else if ((glib_major_version != GLIB_MAJOR_VERSION) ||
+          (glib_minor_version != GLIB_MINOR_VERSION) ||
+           (glib_micro_version != GLIB_MICRO_VERSION))
+    {
+      printf("*** GLIB header files (version %d.%d.%d) do not match\n",
+            GLIB_MAJOR_VERSION, GLIB_MINOR_VERSION, GLIB_MICRO_VERSION);
+      printf("*** library (version %d.%d.%d)\n",
+            glib_major_version, glib_minor_version, glib_micro_version);
+    }
+  else
+    {
+      if ((glib_major_version > major) ||
+        ((glib_major_version == major) && (glib_minor_version > minor)) ||
+        ((glib_major_version == major) && (glib_minor_version == minor) && (glib_micro_version >= micro)))
+      {
+        return 0;
+       }
+     else
+      {
+        printf("\n*** An old version of GLIB (%u.%u.%u) was found.\n",
+               glib_major_version, glib_minor_version, glib_micro_version);
+        printf("*** You need a version of GLIB newer than %u.%u.%u. The latest version of\n",
+              major, minor, micro);
+        printf("*** GLIB is always available from ftp://ftp.gtk.org.\n");
+        printf("***\n");
+        printf("*** If you have already installed a sufficiently new version, this error\n");
+        printf("*** probably means that the wrong copy of the pkg-config shell script is\n");
+        printf("*** being found. The easiest way to fix this is to remove the old version\n");
+        printf("*** of GLIB, but you can also set the PKG_CONFIG environment to point to the\n");
+        printf("*** correct copy of pkg-config. (In this case, you will have to\n");
+        printf("*** modify your LD_LIBRARY_PATH enviroment variable, or edit /etc/ld.so.conf\n");
+        printf("*** so that the correct libraries are found at run-time))\n");
+      }
+    }
+  return 1;
+}
+],, no_glib=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"])
+       CFLAGS="$ac_save_CFLAGS"
+       LIBS="$ac_save_LIBS"
      fi
-   fi
-  AC_MSG_RESULT($complCXXFLAGS)
-
-  WARN_CXXFLAGS="$CXXFLAGS $warnCXXFLAGS $complCXXFLAGS"
-  AC_SUBST(WARN_CXXFLAGS)
-],
-[[$0: This macro is deprecated. You should use AX_COMPILER_FLAGS instead and
-eliminate use of --enable-iso-cxx.
-See: http://www.gnu.org/software/autoconf-archive/ax_compiler_flags.html#ax_compiler_flags]])
-
-dnl pkg.m4 - Macros to locate and utilise pkg-config.   -*- Autoconf -*-
-dnl serial 11 (pkg-config-0.29)
-dnl
-dnl Copyright Â© 2004 Scott James Remnant <scott@netsplit.com>.
-dnl Copyright Â© 2012-2015 Dan Nicholson <dbn.lists@gmail.com>
-dnl
-dnl This program is free software; you can redistribute it and/or modify
-dnl it under the terms of the GNU General Public License as published by
-dnl the Free Software Foundation; either version 2 of the License, or
-dnl (at your option) any later version.
-dnl
-dnl This program is distributed in the hope that it will be useful, but
-dnl WITHOUT ANY WARRANTY; without even the implied warranty of
-dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-dnl General Public License for more details.
-dnl
-dnl You should have received a copy of the GNU General Public License
-dnl along with this program; if not, write to the Free Software
-dnl Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
-dnl 02111-1307, USA.
-dnl
-dnl As a special exception to the GNU General Public License, if you
-dnl distribute this file as part of a program that contains a
-dnl configuration script generated by Autoconf, you may include it under
-dnl the same distribution terms that you use for the rest of that
-dnl program.
+  fi
+  if test "x$no_glib" = x ; then
+     AC_MSG_RESULT(yes (version $glib_config_major_version.$glib_config_minor_version.$glib_config_micro_version))
+     ifelse([$2], , :, [$2])     
+  else
+     AC_MSG_RESULT(no)
+     if test "$PKG_CONFIG" = "no" ; then
+       echo "*** A new enough version of pkg-config was not found."
+       echo "*** See http://www.freedesktop.org/software/pkgconfig/"
+     else
+       if test -f conf.glibtest ; then
+        :
+       else
+          echo "*** Could not run GLIB test program, checking why..."
+          ac_save_CFLAGS="$CFLAGS"
+          ac_save_LIBS="$LIBS"
+          CFLAGS="$CFLAGS $GLIB_CFLAGS"
+          LIBS="$LIBS $GLIB_LIBS"
+          AC_TRY_LINK([
+#include <glib.h>
+#include <stdio.h>
+],      [ return ((glib_major_version) || (glib_minor_version) || (glib_micro_version)); ],
+        [ echo "*** The test program compiled, but did not run. This usually means"
+          echo "*** that the run-time linker is not finding GLIB or finding the wrong"
+          echo "*** version of GLIB. If it is not finding GLIB, you'll need to set your"
+          echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point"
+          echo "*** to the installed location  Also, make sure you have run ldconfig if that"
+          echo "*** is required on your system"
+         echo "***"
+          echo "*** If you have an old version installed, it is best to remove it, although"
+          echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH" ],
+        [ echo "*** The test program failed to compile or link. See the file config.log for the"
+          echo "*** exact error that occured. This usually means GLIB is incorrectly installed."])
+          CFLAGS="$ac_save_CFLAGS"
+          LIBS="$ac_save_LIBS"
+       fi
+     fi
+     GLIB_CFLAGS=""
+     GLIB_LIBS=""
+     GLIB_GENMARSHAL=""
+     GOBJECT_QUERY=""
+     GLIB_MKENUMS=""
+     GLIB_COMPILE_RESOURCES=""
+     ifelse([$3], , :, [$3])
+  fi
+  AC_SUBST(GLIB_CFLAGS)
+  AC_SUBST(GLIB_LIBS)
+  AC_SUBST(GLIB_GENMARSHAL)
+  AC_SUBST(GOBJECT_QUERY)
+  AC_SUBST(GLIB_MKENUMS)
+  AC_SUBST(GLIB_COMPILE_RESOURCES)
+  rm -f conf.glibtest
+])
 
-dnl PKG_PREREQ(MIN-VERSION)
-dnl -----------------------
-dnl Since: 0.29
+dnl GNOME_CODE_COVERAGE
 dnl
-dnl Verify that the version of the pkg-config macros are at least
-dnl MIN-VERSION. Unlike PKG_PROG_PKG_CONFIG, which checks the user's
-dnl installed version of pkg-config, this checks the developer's version
-dnl of pkg.m4 when generating configure.
+dnl Defines CODE_COVERAGE_CFLAGS and CODE_COVERAGE_LDFLAGS which should be
+dnl included in the CFLAGS and LIBS/LDFLAGS variables of every build target
+dnl (program or library) which should be built with code coverage support.
+dnl Also defines GNOME_CODE_COVERAGE_RULES which should be substituted in your
+dnl Makefile; and $enable_code_coverage which can be used in subsequent
+dnl configure output.
 dnl
-dnl To ensure that this macro is defined, also add:
-dnl m4_ifndef([PKG_PREREQ],
-dnl     [m4_fatal([must install pkg-config 0.29 or later before running autoconf/autogen])])
+dnl Note that all optimisation flags in CFLAGS must be disabled when code
+dnl coverage is enabled.
 dnl
-dnl See the "Since" comment for each macro you use to see what version
-dnl of the macros you require.
-m4_defun([PKG_PREREQ],
-[m4_define([PKG_MACROS_VERSION], [0.29])
-m4_if(m4_version_compare(PKG_MACROS_VERSION, [$1]), -1,
-    [m4_fatal([pkg.m4 version $1 or higher is required but ]PKG_MACROS_VERSION[ found])])
-])dnl PKG_PREREQ
-
-dnl PKG_PROG_PKG_CONFIG([MIN-VERSION])
-dnl ----------------------------------
-dnl Since: 0.16
+dnl Derived from Makefile.decl in GLib, originally licenced under LGPLv2.1+.
+dnl This file is licenced under LGPLv2.1+.
 dnl
-dnl Search for the pkg-config tool and set the PKG_CONFIG variable to
-dnl first found in the path. Checks that the version of pkg-config found
-dnl is at least MIN-VERSION. If MIN-VERSION is not specified, 0.9.0 is
-dnl used since that's the first version where most current features of
-dnl pkg-config existed.
-AC_DEFUN([PKG_PROG_PKG_CONFIG],
-[m4_pattern_forbid([^_?PKG_[A-Z_]+$])
-m4_pattern_allow([^PKG_CONFIG(_(PATH|LIBDIR|SYSROOT_DIR|ALLOW_SYSTEM_(CFLAGS|LIBS)))?$])
-m4_pattern_allow([^PKG_CONFIG_(DISABLE_UNINSTALLED|TOP_BUILD_DIR|DEBUG_SPEW)$])
-AC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility])
-AC_ARG_VAR([PKG_CONFIG_PATH], [directories to add to pkg-config's search path])
-AC_ARG_VAR([PKG_CONFIG_LIBDIR], [path overriding pkg-config's built-in search path])
-
-if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then
-       AC_PATH_TOOL([PKG_CONFIG], [pkg-config])
-fi
-if test -n "$PKG_CONFIG"; then
-       _pkg_min_version=m4_default([$1], [0.9.0])
-       AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version])
-       if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then
-               AC_MSG_RESULT([yes])
-       else
-               AC_MSG_RESULT([no])
-               PKG_CONFIG=""
-       fi
-fi[]dnl
-])dnl PKG_PROG_PKG_CONFIG
-
-dnl PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
-dnl -------------------------------------------------------------------
-dnl Since: 0.18
+dnl Usage example:
+dnl configure.ac:
+dnl    GNOME_CODE_COVERAGE
 dnl
-dnl Check to see whether a particular set of modules exists. Similar to
-dnl PKG_CHECK_MODULES(), but does not set variables or print errors.
+dnl Makefile.am:
+dnl    @GNOME_CODE_COVERAGE_RULES@
+dnl    my_program_LIBS = â€¦ $(CODE_COVERAGE_LDFLAGS) â€¦
+dnl    my_program_CFLAGS = â€¦ $(CODE_COVERAGE_CFLAGS) â€¦
 dnl
-dnl Please remember that m4 expands AC_REQUIRE([PKG_PROG_PKG_CONFIG])
-dnl only at the first occurence in configure.ac, so if the first place
-dnl it's called might be skipped (such as if it is within an "if", you
-dnl have to call PKG_CHECK_EXISTS manually
-AC_DEFUN([PKG_CHECK_EXISTS],
-[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
-if test -n "$PKG_CONFIG" && \
-    AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$1"]); then
-  m4_default([$2], [:])
-m4_ifvaln([$3], [else
-  $3])dnl
-fi])
+dnl This results in a â€ścheck-code-coverage” rule being added to any Makefile.am
+dnl which includes â€ś@GNOME_CODE_COVERAGE_RULES@” (assuming the module has been
+dnl configured with --enable-code-coverage). Running `make check-code-coverage`
+dnl in that directory will run the module’s test suite (`make check`) and build
+dnl a code coverage report detailing the code which was touched, then print the
+dnl URI for the report.
 
-dnl _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES])
-dnl ---------------------------------------------
-dnl Internal wrapper calling pkg-config via PKG_CONFIG and setting
-dnl pkg_failed based on the result.
-m4_define([_PKG_CONFIG],
-[if test -n "$$1"; then
-    pkg_cv_[]$1="$$1"
- elif test -n "$PKG_CONFIG"; then
-    PKG_CHECK_EXISTS([$3],
-                     [pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null`
-                     test "x$?" != "x0" && pkg_failed=yes ],
-                    [pkg_failed=yes])
- else
-    pkg_failed=untried
-fi[]dnl
-])dnl _PKG_CONFIG
+AU_DEFUN([GNOME_CODE_COVERAGE],[
+       AX_CODE_COVERAGE
+       GNOME_CODE_COVERAGE_RULES=$CODE_COVERAGE_RULES
 
-dnl _PKG_SHORT_ERRORS_SUPPORTED
-dnl ---------------------------
-dnl Internal check to see if pkg-config supports short errors.
-AC_DEFUN([_PKG_SHORT_ERRORS_SUPPORTED],
-[AC_REQUIRE([PKG_PROG_PKG_CONFIG])
-if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
-        _pkg_short_errors_supported=yes
-else
-        _pkg_short_errors_supported=no
-fi[]dnl
-])dnl _PKG_SHORT_ERRORS_SUPPORTED
+       AC_SUBST([GNOME_CODE_COVERAGE_RULES])
+       m4_ifdef([_AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE([GNOME_CODE_COVERAGE_RULES])])
+],
+[[$0: This macro is deprecated. You should use AX_CODE_COVERAGE instead and
+replace uses of GNOME_CODE_COVERAGE_RULES with CODE_COVERAGE_RULES.
+See: http://www.gnu.org/software/autoconf-archive/ax_code_coverage.html#ax_code_coverage]])
 
+# gnome-compiler-flags.m4
+#
+# serial 4
+#
 
-dnl PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
-dnl   [ACTION-IF-NOT-FOUND])
-dnl --------------------------------------------------------------
-dnl Since: 0.4.0
+dnl GNOME_COMPILE_WARNINGS
+dnl Turn on many useful compiler warnings and substitute the result into
+dnl WARN_CFLAGS
+dnl For now, only works on GCC
+dnl Pass the default value of the --enable-compile-warnings configure option as
+dnl the first argument to the macro, defaulting to 'yes'.
+dnl Additional warning/error flags can be passed as an optional second argument.
 dnl
-dnl Note that if there is a possibility the first call to
-dnl PKG_CHECK_MODULES might not happen, you should be sure to include an
-dnl explicit call to PKG_PROG_PKG_CONFIG in your configure.ac
-AC_DEFUN([PKG_CHECK_MODULES],
-[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
-AC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl
-AC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl
+dnl For example: GNOME_COMPILE_WARNINGS([maximum],[-Werror=some-flag -Wfoobar])
+AU_DEFUN([GNOME_COMPILE_WARNINGS],[
+    dnl ******************************
+    dnl More compiler warnings
+    dnl ******************************
 
-pkg_failed=no
-AC_MSG_CHECKING([for $1])
+    AC_ARG_ENABLE(compile-warnings, 
+                  AS_HELP_STRING([--enable-compile-warnings=@<:@no/minimum/yes/maximum/error@:>@],
+                                 [Turn on compiler warnings]),,
+                  [enable_compile_warnings="m4_default([$1],[yes])"])
 
-_PKG_CONFIG([$1][_CFLAGS], [cflags], [$2])
-_PKG_CONFIG([$1][_LIBS], [libs], [$2])
+    if test "x$GCC" != xyes; then
+       enable_compile_warnings=no
+    fi
 
-m4_define([_PKG_TEXT], [Alternatively, you may set the environment variables $1[]_CFLAGS
-and $1[]_LIBS to avoid the need to call pkg-config.
-See the pkg-config man page for more details.])
+    warning_flags=
+    realsave_CFLAGS="$CFLAGS"
 
-if test $pkg_failed = yes; then
-       AC_MSG_RESULT([no])
-        _PKG_SHORT_ERRORS_SUPPORTED
-        if test $_pkg_short_errors_supported = yes; then
-               $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "$2" 2>&1`
-        else 
-               $1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "$2" 2>&1`
-        fi
-       # Put the nasty error message in config.log where it belongs
-       echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD
+    dnl These are warning flags that aren't marked as fatal.  Can be
+    dnl overridden on a per-project basis with -Wno-foo.
+    base_warn_flags=" \
+        -Wall \
+        -Wstrict-prototypes \
+        -Wnested-externs \
+    "
 
-       m4_default([$4], [AC_MSG_ERROR(
-[Package requirements ($2) were not met:
+    dnl These compiler flags typically indicate very broken or suspicious
+    dnl code.  Some of them such as implicit-function-declaration are
+    dnl just not default because gcc compiles a lot of legacy code.
+    dnl We choose to make this set into explicit errors.
+    base_error_flags=" \
+        -Werror=missing-prototypes \
+        -Werror=implicit-function-declaration \
+        -Werror=pointer-arith \
+        -Werror=init-self \
+        -Werror=format-security \
+        -Werror=format=2 \
+        -Werror=missing-include-dirs \
+        -Werror=return-type \
+    "
 
-$$1_PKG_ERRORS
+    dnl Additional warning or error flags provided by the module author to
+    dnl allow stricter standards to be imposed on a per-module basis.
+    dnl The author can pass -W or -Werror flags here as they see fit.
+    additional_flags="m4_default([$2],[])"
 
-Consider adjusting the PKG_CONFIG_PATH environment variable if you
-installed software in a non-standard prefix.
+    case "$enable_compile_warnings" in
+    no)
+        warning_flags="-w"
+        ;;
+    minimum)
+        warning_flags="-Wall"
+        ;;
+    yes|maximum|error)
+        warning_flags="$base_warn_flags $base_error_flags $additional_flags"
+        ;;
+    *)
+        AC_MSG_ERROR(Unknown argument '$enable_compile_warnings' to --enable-compile-warnings)
+        ;;
+    esac
 
-_PKG_TEXT])[]dnl
-        ])
-elif test $pkg_failed = untried; then
-       AC_MSG_RESULT([no])
-       m4_default([$4], [AC_MSG_FAILURE(
-[The pkg-config script could not be found or is too old.  Make sure it
-is in your PATH or set the PKG_CONFIG environment variable to the full
-path to pkg-config.
+    if test "$enable_compile_warnings" = "error" ; then
+        warning_flags="$warning_flags -Werror"
+    fi
 
-_PKG_TEXT
+    dnl Check whether GCC supports the warning options
+    for option in $warning_flags; do
+       save_CFLAGS="$CFLAGS"
+       CFLAGS="$CFLAGS $option"
+       AC_MSG_CHECKING([whether gcc understands $option])
+       AC_TRY_COMPILE([], [],
+           has_option=yes,
+           has_option=no,)
+       CFLAGS="$save_CFLAGS"
+       AC_MSG_RESULT([$has_option])
+       if test $has_option = yes; then
+           tested_warning_flags="$tested_warning_flags $option"
+       fi
+       unset has_option
+       unset save_CFLAGS
+    done
+    unset option
+    CFLAGS="$realsave_CFLAGS"
+    AC_MSG_CHECKING(what warning flags to pass to the C compiler)
+    AC_MSG_RESULT($tested_warning_flags)
 
-To get pkg-config, see <http://pkg-config.freedesktop.org/>.])[]dnl
-        ])
-else
-       $1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS
-       $1[]_LIBS=$pkg_cv_[]$1[]_LIBS
-        AC_MSG_RESULT([yes])
-       $3
-fi[]dnl
-])dnl PKG_CHECK_MODULES
+    AC_ARG_ENABLE(iso-c,
+                  AS_HELP_STRING([--enable-iso-c],
+                                 [Try to warn if code is not ISO C ]),,
+                  [enable_iso_c=no])
 
+    AC_MSG_CHECKING(what language compliance flags to pass to the C compiler)
+    complCFLAGS=
+    if test "x$enable_iso_c" != "xno"; then
+       if test "x$GCC" = "xyes"; then
+       case " $CFLAGS " in
+           *[\ \       ]-ansi[\ \      ]*) ;;
+           *) complCFLAGS="$complCFLAGS -ansi" ;;
+       esac
+       case " $CFLAGS " in
+           *[\ \       ]-pedantic[\ \  ]*) ;;
+           *) complCFLAGS="$complCFLAGS -pedantic" ;;
+       esac
+       fi
+    fi
+    AC_MSG_RESULT($complCFLAGS)
 
-dnl PKG_CHECK_MODULES_STATIC(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
-dnl   [ACTION-IF-NOT-FOUND])
-dnl ---------------------------------------------------------------------
-dnl Since: 0.29
-dnl
-dnl Checks for existence of MODULES and gathers its build flags with
-dnl static libraries enabled. Sets VARIABLE-PREFIX_CFLAGS from --cflags
-dnl and VARIABLE-PREFIX_LIBS from --libs.
-dnl
-dnl Note that if there is a possibility the first call to
-dnl PKG_CHECK_MODULES_STATIC might not happen, you should be sure to
-dnl include an explicit call to PKG_PROG_PKG_CONFIG in your
-dnl configure.ac.
-AC_DEFUN([PKG_CHECK_MODULES_STATIC],
-[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
-_save_PKG_CONFIG=$PKG_CONFIG
-PKG_CONFIG="$PKG_CONFIG --static"
-PKG_CHECK_MODULES($@)
-PKG_CONFIG=$_save_PKG_CONFIG[]dnl
-])dnl PKG_CHECK_MODULES_STATIC
+    WARN_CFLAGS="$tested_warning_flags $complCFLAGS"
+    AC_SUBST(WARN_CFLAGS)
+],
+[[$0: This macro is deprecated. You should use AX_COMPILER_FLAGS instead and
+eliminate use of --enable-iso-c.
+See: http://www.gnu.org/software/autoconf-archive/ax_compiler_flags.html#ax_compiler_flags]])
 
+dnl For C++, do basically the same thing.
 
-dnl PKG_INSTALLDIR([DIRECTORY])
-dnl -------------------------
-dnl Since: 0.27
-dnl
-dnl Substitutes the variable pkgconfigdir as the location where a module
-dnl should install pkg-config .pc files. By default the directory is
-dnl $libdir/pkgconfig, but the default can be changed by passing
-dnl DIRECTORY. The user can override through the --with-pkgconfigdir
-dnl parameter.
-AC_DEFUN([PKG_INSTALLDIR],
-[m4_pushdef([pkg_default], [m4_default([$1], ['${libdir}/pkgconfig'])])
-m4_pushdef([pkg_description],
-    [pkg-config installation directory @<:@]pkg_default[@:>@])
-AC_ARG_WITH([pkgconfigdir],
-    [AS_HELP_STRING([--with-pkgconfigdir], pkg_description)],,
-    [with_pkgconfigdir=]pkg_default)
-AC_SUBST([pkgconfigdir], [$with_pkgconfigdir])
-m4_popdef([pkg_default])
-m4_popdef([pkg_description])
-])dnl PKG_INSTALLDIR
+AU_DEFUN([GNOME_CXX_WARNINGS],[
+  AC_ARG_ENABLE(cxx-warnings,
+                AS_HELP_STRING([--enable-cxx-warnings=@<:@no/minimum/yes@:>@]
+                               [Turn on compiler warnings.]),,
+                [enable_cxx_warnings="m4_default([$1],[minimum])"])
 
+  AC_MSG_CHECKING(what warning flags to pass to the C++ compiler)
+  warnCXXFLAGS=
+  if test "x$GXX" != xyes; then
+    enable_cxx_warnings=no
+  fi
+  if test "x$enable_cxx_warnings" != "xno"; then
+    if test "x$GXX" = "xyes"; then
+      case " $CXXFLAGS " in
+      *[\ \    ]-Wall[\ \      ]*) ;;
+      *) warnCXXFLAGS="-Wall -Wno-unused" ;;
+      esac
 
-dnl PKG_NOARCH_INSTALLDIR([DIRECTORY])
-dnl --------------------------------
-dnl Since: 0.27
-dnl
-dnl Substitutes the variable noarch_pkgconfigdir as the location where a
-dnl module should install arch-independent pkg-config .pc files. By
-dnl default the directory is $datadir/pkgconfig, but the default can be
-dnl changed by passing DIRECTORY. The user can override through the
-dnl --with-noarch-pkgconfigdir parameter.
-AC_DEFUN([PKG_NOARCH_INSTALLDIR],
-[m4_pushdef([pkg_default], [m4_default([$1], ['${datadir}/pkgconfig'])])
-m4_pushdef([pkg_description],
-    [pkg-config arch-independent installation directory @<:@]pkg_default[@:>@])
-AC_ARG_WITH([noarch-pkgconfigdir],
-    [AS_HELP_STRING([--with-noarch-pkgconfigdir], pkg_description)],,
-    [with_noarch_pkgconfigdir=]pkg_default)
-AC_SUBST([noarch_pkgconfigdir], [$with_noarch_pkgconfigdir])
-m4_popdef([pkg_default])
-m4_popdef([pkg_description])
-])dnl PKG_NOARCH_INSTALLDIR
+      ## -W is not all that useful.  And it cannot be controlled
+      ## with individual -Wno-xxx flags, unlike -Wall
+      if test "x$enable_cxx_warnings" = "xyes"; then
+       warnCXXFLAGS="$warnCXXFLAGS -Wshadow -Woverloaded-virtual"
+      fi
+    fi
+  fi
+  AC_MSG_RESULT($warnCXXFLAGS)
 
+   AC_ARG_ENABLE(iso-cxx,
+                 AS_HELP_STRING([--enable-iso-cxx],
+                                [Try to warn if code is not ISO C++ ]),,
+                 [enable_iso_cxx=no])
 
-dnl PKG_CHECK_VAR(VARIABLE, MODULE, CONFIG-VARIABLE,
-dnl [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
-dnl -------------------------------------------
-dnl Since: 0.28
-dnl
-dnl Retrieves the value of the pkg-config variable for the given module.
-AC_DEFUN([PKG_CHECK_VAR],
-[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
-AC_ARG_VAR([$1], [value of $3 for $2, overriding pkg-config])dnl
+   AC_MSG_CHECKING(what language compliance flags to pass to the C++ compiler)
+   complCXXFLAGS=
+   if test "x$enable_iso_cxx" != "xno"; then
+     if test "x$GXX" = "xyes"; then
+      case " $CXXFLAGS " in
+      *[\ \    ]-ansi[\ \      ]*) ;;
+      *) complCXXFLAGS="$complCXXFLAGS -ansi" ;;
+      esac
 
-_PKG_CONFIG([$1], [variable="][$3]["], [$2])
-AS_VAR_COPY([$1], [pkg_cv_][$1])
+      case " $CXXFLAGS " in
+      *[\ \    ]-pedantic[\ \  ]*) ;;
+      *) complCXXFLAGS="$complCXXFLAGS -pedantic" ;;
+      esac
+     fi
+   fi
+  AC_MSG_RESULT($complCXXFLAGS)
 
-AS_VAR_IF([$1], [""], [$5], [$4])dnl
-])dnl PKG_CHECK_VAR
+  WARN_CXXFLAGS="$CXXFLAGS $warnCXXFLAGS $complCXXFLAGS"
+  AC_SUBST(WARN_CXXFLAGS)
+],
+[[$0: This macro is deprecated. You should use AX_COMPILER_FLAGS instead and
+eliminate use of --enable-iso-cxx.
+See: http://www.gnu.org/software/autoconf-archive/ax_compiler_flags.html#ax_compiler_flags]])
 
 # Copyright (C) 2002-2014 Free Software Foundation, Inc.
 #
index 0967f2a..2e9ad7f 100755 (executable)
@@ -2,7 +2,7 @@
 # Attempt to guess a canonical system name.
 #   Copyright 1992-2016 Free Software Foundation, Inc.
 
-timestamp='2016-04-02'
+timestamp='2016-10-02'
 
 # This file is free software; you can redistribute it and/or modify it
 # under the terms of the GNU General Public License as published by
@@ -186,9 +186,12 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
            *) machine=${UNAME_MACHINE_ARCH}-unknown ;;
        esac
        # The Operating System including object format, if it has switched
-       # to ELF recently, or will in the future.
+       # to ELF recently (or will in the future) and ABI.
        case "${UNAME_MACHINE_ARCH}" in
-           arm*|earm*|i386|m68k|ns32k|sh3*|sparc|vax)
+           earm*)
+               os=netbsdelf
+               ;;
+           arm*|i386|m68k|ns32k|sh3*|sparc|vax)
                eval $set_cc_for_build
                if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \
                        | grep -q __ELF__
@@ -997,6 +1000,9 @@ EOF
        eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^CPU'`
        test x"${CPU}" != x && { echo "${CPU}-unknown-linux-${LIBC}"; exit; }
        ;;
+    mips64el:Linux:*:*)
+       echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
+       exit ;;
     openrisc*:Linux:*:*)
        echo or1k-unknown-linux-${LIBC}
        exit ;;
@@ -1029,6 +1035,9 @@ EOF
     ppcle:Linux:*:*)
        echo powerpcle-unknown-linux-${LIBC}
        exit ;;
+    riscv32:Linux:*:* | riscv64:Linux:*:*)
+       echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
+       exit ;;
     s390:Linux:*:* | s390x:Linux:*:*)
        echo ${UNAME_MACHINE}-ibm-linux-${LIBC}
        exit ;;
@@ -1408,18 +1417,17 @@ esac
 cat >&2 <<EOF
 $0: unable to guess system type
 
-This script, last modified $timestamp, has failed to recognize
-the operating system you are using. It is advised that you
-download the most up to date version of the config scripts from
+This script (version $timestamp), has failed to recognize the
+operating system you are using. If your script is old, overwrite
+config.guess and config.sub with the latest versions from:
 
   http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess
 and
   http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub
 
-If the version you run ($0) is already up to date, please
-send the following data and any information you think might be
-pertinent to <config-patches@gnu.org> in order to provide the needed
-information to handle your system.
+If $0 has already been updated, send the following data and any
+information you think might be pertinent to config-patches@gnu.org to
+provide the necessary information to handle your system.
 
 config.guess timestamp = $timestamp
 
index 8d39c4b..dd2ca93 100755 (executable)
@@ -2,7 +2,7 @@
 # Configuration validation subroutine script.
 #   Copyright 1992-2016 Free Software Foundation, Inc.
 
-timestamp='2016-03-30'
+timestamp='2016-11-04'
 
 # This file is free software; you can redistribute it and/or modify it
 # under the terms of the GNU General Public License as published by
@@ -117,7 +117,7 @@ case $maybe_os in
   nto-qnx* | linux-gnu* | linux-android* | linux-dietlibc | linux-newlib* | \
   linux-musl* | linux-uclibc* | uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | \
   knetbsd*-gnu* | netbsd*-gnu* | netbsd*-eabi* | \
-  kopensolaris*-gnu* | \
+  kopensolaris*-gnu* | cloudabi*-eabi* | \
   storm-chaos* | os2-emx* | rtmk-nova*)
     os=-$maybe_os
     basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`
@@ -301,6 +301,7 @@ case $basic_machine in
        | open8 | or1k | or1knd | or32 \
        | pdp10 | pdp11 | pj | pjl \
        | powerpc | powerpc64 | powerpc64le | powerpcle \
+       | pru \
        | pyramid \
        | riscv32 | riscv64 \
        | rl78 | rx \
@@ -428,6 +429,7 @@ case $basic_machine in
        | orion-* \
        | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \
        | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* \
+       | pru-* \
        | pyramid-* \
        | riscv32-* | riscv64-* \
        | rl78-* | romp-* | rs6000-* | rx-* \
@@ -643,6 +645,14 @@ case $basic_machine in
                basic_machine=m68k-bull
                os=-sysv3
                ;;
+       e500v[12])
+               basic_machine=powerpc-unknown
+               os=$os"spe"
+               ;;
+       e500v[12]-*)
+               basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'`
+               os=$os"spe"
+               ;;
        ebmon29k)
                basic_machine=a29k-amd
                os=-ebmon
@@ -1022,7 +1032,7 @@ case $basic_machine in
        ppc-* | ppcbe-*)
                basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'`
                ;;
-       ppcle | powerpclittle | ppc-le | powerpc-little)
+       ppcle | powerpclittle)
                basic_machine=powerpcle-unknown
                ;;
        ppcle-* | powerpclittle-*)
@@ -1032,7 +1042,7 @@ case $basic_machine in
                ;;
        ppc64-*) basic_machine=powerpc64-`echo $basic_machine | sed 's/^[^-]*-//'`
                ;;
-       ppc64le | powerpc64little | ppc64-le | powerpc64-little)
+       ppc64le | powerpc64little)
                basic_machine=powerpc64le-unknown
                ;;
        ppc64le-* | powerpc64little-*)
@@ -1389,7 +1399,7 @@ case $os in
              | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \
              | -chorusos* | -chorusrdb* | -cegcc* \
              | -cygwin* | -msys* | -pe* | -psos* | -moss* | -proelf* | -rtems* \
-             | -mingw32* | -mingw64* | -linux-gnu* | -linux-android* \
+             | -midipix* | -mingw32* | -mingw64* | -linux-gnu* | -linux-android* \
              | -linux-newlib* | -linux-musl* | -linux-uclibc* \
              | -uxpv* | -beos* | -mpeix* | -udk* | -moxiebox* \
              | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \
@@ -1399,7 +1409,7 @@ case $os in
              | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \
              | -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \
              | -skyos* | -haiku* | -rdos* | -toppers* | -drops* | -es* \
-             | -onefs* | -tirtos*)
+             | -onefs* | -tirtos* | -phoenix* | -fuchsia*)
        # Remember, each alternative MUST END IN *, to match a version number.
                ;;
        -qnx*)
index a920f36..3cdd5b6 100755 (executable)
--- a/configure
+++ b/configure
@@ -1,6 +1,6 @@
 #! /bin/sh
 # Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.69 for pygobject 3.22.0.
+# Generated by GNU Autoconf 2.69 for pygobject 3.24.0.
 #
 # Report bugs to <http://bugzilla.gnome.org/enter_bug.cgi?product=pygobject>.
 #
@@ -591,8 +591,8 @@ MAKEFLAGS=
 # Identity of this package.
 PACKAGE_NAME='pygobject'
 PACKAGE_TARNAME='pygobject'
-PACKAGE_VERSION='3.22.0'
-PACKAGE_STRING='pygobject 3.22.0'
+PACKAGE_VERSION='3.24.0'
+PACKAGE_STRING='pygobject 3.24.0'
 PACKAGE_BUGREPORT='http://bugzilla.gnome.org/enter_bug.cgi?product=pygobject'
 PACKAGE_URL='https://wiki.gnome.org/Projects/PyGObject/'
 
@@ -640,6 +640,7 @@ LIBOBJS
 GNOME_CODE_COVERAGE_RULES
 CODE_COVERAGE_RULES
 CODE_COVERAGE_LDFLAGS
+CODE_COVERAGE_LIBS
 CODE_COVERAGE_CXXFLAGS
 CODE_COVERAGE_CFLAGS
 CODE_COVERAGE_CPPFLAGS
@@ -1413,7 +1414,7 @@ if test "$ac_init_help" = "long"; then
   # Omit some internal or obsolete options to make the list less imposing.
   # This message is too long to be a string in the A/UX 3.1 sh.
   cat <<_ACEOF
-\`configure' configures pygobject 3.22.0 to adapt to many kinds of systems.
+\`configure' configures pygobject 3.24.0 to adapt to many kinds of systems.
 
 Usage: $0 [OPTION]... [VAR=VALUE]...
 
@@ -1484,7 +1485,7 @@ fi
 
 if test -n "$ac_init_help"; then
   case $ac_init_help in
-     short | recursive ) echo "Configuration of pygobject 3.22.0:";;
+     short | recursive ) echo "Configuration of pygobject 3.24.0:";;
    esac
   cat <<\_ACEOF
 
@@ -1628,7 +1629,7 @@ fi
 test -n "$ac_init_help" && exit $ac_status
 if $ac_init_version; then
   cat <<\_ACEOF
-pygobject configure 3.22.0
+pygobject configure 3.24.0
 generated by GNU Autoconf 2.69
 
 Copyright (C) 2012 Free Software Foundation, Inc.
@@ -1906,7 +1907,7 @@ cat >config.log <<_ACEOF
 This file contains any messages produced by compilers while
 running configure, to aid debugging if configure makes a mistake.
 
-It was created by pygobject $as_me 3.22.0, which was
+It was created by pygobject $as_me 3.24.0, which was
 generated by GNU Autoconf 2.69.  Invocation command line was
 
   $ $0 $@
@@ -2265,9 +2266,9 @@ $as_echo "#define PYGOBJECT_MAJOR_VERSION 3" >>confdefs.h
 PYGOBJECT_MAJOR_VERSION=3
 
 
-$as_echo "#define PYGOBJECT_MINOR_VERSION 22" >>confdefs.h
+$as_echo "#define PYGOBJECT_MINOR_VERSION 24" >>confdefs.h
 
-PYGOBJECT_MINOR_VERSION=22
+PYGOBJECT_MINOR_VERSION=24
 
 
 $as_echo "#define PYGOBJECT_MICRO_VERSION 0" >>confdefs.h
@@ -2794,7 +2795,7 @@ fi
 
 # Define the identity of the package.
  PACKAGE='pygobject'
- VERSION='3.22.0'
+ VERSION='3.24.0'
 
 
 cat >>confdefs.h <<_ACEOF
@@ -14866,7 +14867,7 @@ fi
         -Werror=return-type \
     "
 
-                additional_flags=""
+                additional_flags="-Wno-error=missing-prototypes"
 
     case "$enable_compile_warnings" in
     no)
@@ -15101,9 +15102,6 @@ fi
 
 fi
 
-               # List of supported lcov versions.
-               lcov_version_list="1.6 1.7 1.8 1.9 1.10 1.11 1.12"
-
                # Extract the first word of "lcov", so it can be a program name with args.
 set dummy lcov; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 
 
 
-               if  test "$LCOV" ; then :
-
-                       { $as_echo "$as_me:${as_lineno-$LINENO}: checking for lcov version" >&5
-$as_echo_n "checking for lcov version... " >&6; }
-if ${ax_cv_lcov_version+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-
-                               ax_cv_lcov_version=invalid
-                               lcov_version=`$LCOV -v 2>/dev/null | $SED -e 's/^.* //'`
-                               for lcov_check_version in $lcov_version_list; do
-                                       if test "$lcov_version" = "$lcov_check_version"; then
-                                               ax_cv_lcov_version="$lcov_check_version (ok)"
-                                       fi
-                               done
-
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_cv_lcov_version" >&5
-$as_echo "$ax_cv_lcov_version" >&6; }
-
-else
+               if  test -z "$LCOV" ; then :
 
-                       lcov_msg="To enable code coverage reporting you must have one of the following lcov versions installed: $lcov_version_list"
-                       as_fn_error $? "$lcov_msg" "$LINENO" 5
+                       as_fn_error $? "To enable code coverage reporting you must have lcov installed" "$LINENO" 5
 
 fi
 
-               case $ax_cv_lcov_version in
-                       ""|invalid)
-                               lcov_msg="You must have one of the following versions of lcov: $lcov_version_list (found: $lcov_version)."
-                               as_fn_error $? "$lcov_msg" "$LINENO" 5
-                               LCOV="exit 0;"
-                       ;;
-               esac
-
                if  test -z "$GENHTML" ; then :
 
                        as_fn_error $? "Could not find genhtml from the lcov package" "$LINENO" 5
 
 fi
 
-                               CODE_COVERAGE_CPPFLAGS="-DNDEBUG"
+                                               CODE_COVERAGE_CPPFLAGS="-DNDEBUG"
                CODE_COVERAGE_CFLAGS="-O0 -g -fprofile-arcs -ftest-coverage"
                CODE_COVERAGE_CXXFLAGS="-O0 -g -fprofile-arcs -ftest-coverage"
-               CODE_COVERAGE_LDFLAGS="-lgcov"
+               CODE_COVERAGE_LIBS="-lgcov"
+               CODE_COVERAGE_LDFLAGS="$CODE_COVERAGE_LIBS"
+
+
 
 
 
 
 
+               CODE_COVERAGE_RULES_CHECK='
+       -$(A''M_V_at)$(MAKE) $(AM_MAKEFLAGS) -k check
+       $(A''M_V_at)$(MAKE) $(AM_MAKEFLAGS) code-coverage-capture
+'
+               CODE_COVERAGE_RULES_CAPTURE='
+       $(code_coverage_v_lcov_cap)$(LCOV) $(code_coverage_quiet) $(addprefix --directory ,$(CODE_COVERAGE_DIRECTORY)) --capture --output-file "$(CODE_COVERAGE_OUTPUT_FILE).tmp" --test-name "$(call code_coverage_sanitize,$(PACKAGE_NAME)-$(PACKAGE_VERSION))" --no-checksum --compat-libtool $(CODE_COVERAGE_LCOV_SHOPTS) $(CODE_COVERAGE_LCOV_OPTIONS)
+       $(code_coverage_v_lcov_ign)$(LCOV) $(code_coverage_quiet) $(addprefix --directory ,$(CODE_COVERAGE_DIRECTORY)) --remove "$(CODE_COVERAGE_OUTPUT_FILE).tmp" "/tmp/*" $(CODE_COVERAGE_IGNORE_PATTERN) --output-file "$(CODE_COVERAGE_OUTPUT_FILE)" $(CODE_COVERAGE_LCOV_SHOPTS) $(CODE_COVERAGE_LCOV_RMOPTS)
+       -@rm -f $(CODE_COVERAGE_OUTPUT_FILE).tmp
+       $(code_coverage_v_genhtml)LANG=C $(GENHTML) $(code_coverage_quiet) $(addprefix --prefix ,$(CODE_COVERAGE_DIRECTORY)) --output-directory "$(CODE_COVERAGE_OUTPUT_DIRECTORY)" --title "$(PACKAGE_NAME)-$(PACKAGE_VERSION) Code Coverage" --legend --show-details "$(CODE_COVERAGE_OUTPUT_FILE)" $(CODE_COVERAGE_GENHTML_OPTIONS)
+       @echo "file://$(abs_builddir)/$(CODE_COVERAGE_OUTPUT_DIRECTORY)/index.html"
+'
+               CODE_COVERAGE_RULES_CLEAN='
+clean: code-coverage-clean
+distclean: code-coverage-clean
+code-coverage-clean:
+       -$(LCOV) --directory $(top_builddir) -z
+       -rm -rf $(CODE_COVERAGE_OUTPUT_FILE) $(CODE_COVERAGE_OUTPUT_FILE).tmp $(CODE_COVERAGE_OUTPUT_DIRECTORY)
+       -find . \( -name "*.gcda" -o -name "*.gcno" -o -name "*.gcov" \) -delete
+'
+
+else
+
+               CODE_COVERAGE_RULES_CHECK='
+       @echo "Need to reconfigure with --enable-code-coverage"
+'
+               CODE_COVERAGE_RULES_CAPTURE="$CODE_COVERAGE_RULES_CHECK"
+               CODE_COVERAGE_RULES_CLEAN=''
 
 fi
 
@@ -15309,36 +15308,15 @@ code_coverage_quiet_0 = --quiet
 code_coverage_sanitize = $(subst -,_,$(subst .,_,$(1)))
 
 # Use recursive makes in order to ignore errors during check
-check-code-coverage:
-ifeq ($(CODE_COVERAGE_ENABLED),yes)
-       -$(A''M_V_at)$(MAKE) $(AM_MAKEFLAGS) -k check
-       $(A''M_V_at)$(MAKE) $(AM_MAKEFLAGS) code-coverage-capture
-else
-       @echo "Need to reconfigure with --enable-code-coverage"
-endif
+check-code-coverage:'"$CODE_COVERAGE_RULES_CHECK"'
 
 # Capture code coverage data
-code-coverage-capture: code-coverage-capture-hook
-ifeq ($(CODE_COVERAGE_ENABLED),yes)
-       $(code_coverage_v_lcov_cap)$(LCOV) $(code_coverage_quiet) $(addprefix --directory ,$(CODE_COVERAGE_DIRECTORY)) --capture --output-file "$(CODE_COVERAGE_OUTPUT_FILE).tmp" --test-name "$(call code_coverage_sanitize,$(PACKAGE_NAME)-$(PACKAGE_VERSION))" --no-checksum --compat-libtool $(CODE_COVERAGE_LCOV_SHOPTS) $(CODE_COVERAGE_LCOV_OPTIONS)
-       $(code_coverage_v_lcov_ign)$(LCOV) $(code_coverage_quiet) $(addprefix --directory ,$(CODE_COVERAGE_DIRECTORY)) --remove "$(CODE_COVERAGE_OUTPUT_FILE).tmp" "/tmp/*" $(CODE_COVERAGE_IGNORE_PATTERN) --output-file "$(CODE_COVERAGE_OUTPUT_FILE)" $(CODE_COVERAGE_LCOV_SHOPTS) $(CODE_COVERAGE_LCOV_RMOPTS)
-       -@rm -f $(CODE_COVERAGE_OUTPUT_FILE).tmp
-       $(code_coverage_v_genhtml)LANG=C $(GENHTML) $(code_coverage_quiet) $(addprefix --prefix ,$(CODE_COVERAGE_DIRECTORY)) --output-directory "$(CODE_COVERAGE_OUTPUT_DIRECTORY)" --title "$(PACKAGE_NAME)-$(PACKAGE_VERSION) Code Coverage" --legend --show-details "$(CODE_COVERAGE_OUTPUT_FILE)" $(CODE_COVERAGE_GENHTML_OPTIONS)
-       @echo "file://$(abs_builddir)/$(CODE_COVERAGE_OUTPUT_DIRECTORY)/index.html"
-else
-       @echo "Need to reconfigure with --enable-code-coverage"
-endif
+code-coverage-capture: code-coverage-capture-hook'"$CODE_COVERAGE_RULES_CAPTURE"'
 
 # Hook rule executed before code-coverage-capture, overridable by the user
 code-coverage-capture-hook:
 
-ifeq ($(CODE_COVERAGE_ENABLED),yes)
-clean: code-coverage-clean
-code-coverage-clean:
-       -$(LCOV) --directory $(top_builddir) -z
-       -rm -rf $(CODE_COVERAGE_OUTPUT_FILE) $(CODE_COVERAGE_OUTPUT_FILE).tmp $(CODE_COVERAGE_OUTPUT_DIRECTORY)
-       -find . -name "*.gcda" -o -name "*.gcov" -delete
-endif
+'"$CODE_COVERAGE_RULES_CLEAN"'
 
 GITIGNOREFILES ?=
 GITIGNOREFILES += $(CODE_COVERAGE_OUTPUT_FILE) $(CODE_COVERAGE_OUTPUT_DIRECTORY)
@@ -16048,7 +16026,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
 # report actual input values of CONFIG_FILES etc. instead of their
 # values after options handling.
 ac_log="
-This file was extended by pygobject $as_me 3.22.0, which was
+This file was extended by pygobject $as_me 3.24.0, which was
 generated by GNU Autoconf 2.69.  Invocation command line was
 
   CONFIG_FILES    = $CONFIG_FILES
@@ -16115,7 +16093,7 @@ _ACEOF
 cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
 ac_cs_version="\\
-pygobject config.status 3.22.0
+pygobject config.status 3.24.0
 configured by $0, generated by GNU Autoconf 2.69,
   with options \\"\$ac_cs_config\\"
 
index 7ab11e3..44c3709 100644 (file)
@@ -17,7 +17,7 @@ m4_define(python3_min_ver, 3.1)
 
 dnl the pygobject version number
 m4_define(pygobject_major_version, 3)
-m4_define(pygobject_minor_version, 22)
+m4_define(pygobject_minor_version, 24)
 m4_define(pygobject_micro_version, 0)
 m4_define(pygobject_version, pygobject_major_version.pygobject_minor_version.pygobject_micro_version)
 
@@ -228,7 +228,7 @@ AC_SUBST(INTROSPECTION_SCANNER)
 AC_SUBST(INTROSPECTION_COMPILER)
 
 # compiler warnings, errors, required cflags, and code coverage support
-GNOME_COMPILE_WARNINGS([maximum])
+GNOME_COMPILE_WARNINGS([maximum], [-Wno-error=missing-prototypes])
 AC_MSG_CHECKING(for Gnome code coverage support)
 m4_ifdef([GNOME_CODE_COVERAGE],
          [AC_MSG_RESULT(yes)
index 1cec31f..3a897b1 100644 (file)
@@ -143,6 +143,7 @@ CODE_COVERAGE_CPPFLAGS = @CODE_COVERAGE_CPPFLAGS@
 CODE_COVERAGE_CXXFLAGS = @CODE_COVERAGE_CXXFLAGS@
 CODE_COVERAGE_ENABLED = @CODE_COVERAGE_ENABLED@
 CODE_COVERAGE_LDFLAGS = @CODE_COVERAGE_LDFLAGS@
+CODE_COVERAGE_LIBS = @CODE_COVERAGE_LIBS@
 CPP = @CPP@
 CPPFLAGS = @CPPFLAGS@
 CYGPATH_W = @CYGPATH_W@
index 7b90ec3..ee33cdd 100755 (executable)
@@ -126,5 +126,6 @@ def main():
     win.show_all()
     Gtk.main()
 
+
 if __name__ == '__main__':
     main()
index 4c8a20c..257e80a 100644 (file)
@@ -13,6 +13,7 @@ class MyObject(GObject.GObject):
     def readonly(self):
         return 'readonly'
 
+
 GObject.type_register(MyObject)
 
 print("MyObject properties: ", list(MyObject.props))
index 934b1c9..328eaaa 100644 (file)
@@ -303,6 +303,7 @@ CODE_COVERAGE_CPPFLAGS = @CODE_COVERAGE_CPPFLAGS@
 CODE_COVERAGE_CXXFLAGS = @CODE_COVERAGE_CXXFLAGS@
 CODE_COVERAGE_ENABLED = @CODE_COVERAGE_ENABLED@
 CODE_COVERAGE_LDFLAGS = @CODE_COVERAGE_LDFLAGS@
+CODE_COVERAGE_LIBS = @CODE_COVERAGE_LIBS@
 CPP = @CPP@
 CPPFLAGS = @CPPFLAGS@
 CYGPATH_W = @CYGPATH_W@
index e7e9e78..3c41e5c 100644 (file)
@@ -176,6 +176,7 @@ CODE_COVERAGE_CPPFLAGS = @CODE_COVERAGE_CPPFLAGS@
 CODE_COVERAGE_CXXFLAGS = @CODE_COVERAGE_CXXFLAGS@
 CODE_COVERAGE_ENABLED = @CODE_COVERAGE_ENABLED@
 CODE_COVERAGE_LDFLAGS = @CODE_COVERAGE_LDFLAGS@
+CODE_COVERAGE_LIBS = @CODE_COVERAGE_LIBS@
 CPP = @CPP@
 CPPFLAGS = @CPPFLAGS@
 CYGPATH_W = @CYGPATH_W@
index 2d30abf..eb711e1 100644 (file)
@@ -368,4 +368,5 @@ class OptionParser(optparse.OptionParser):
         args = args[2:-len(old_args)]
         return options, args
 
+
 make_option = Option
index b675adf..e9f8e33 100644 (file)
@@ -41,6 +41,7 @@ class OverridesStruct(GIMarshallingTests.OverridesStruct):
     def method(self):
         return GIMarshallingTests.OverridesStruct.method(self) / 7
 
+
 OverridesStruct = override(OverridesStruct)
 __all__.append('OverridesStruct')
 
@@ -66,5 +67,6 @@ class OverridesObject(GIMarshallingTests.OverridesObject):
         """Overridden doc string."""
         return GIMarshallingTests.OverridesObject.method(self) / 7
 
+
 OverridesObject = override(OverridesObject)
 __all__.append('OverridesObject')
index 5a7792d..ab0e83a 100644 (file)
@@ -251,7 +251,16 @@ class Variant(GLib.Variant):
         return GLib.Variant.new_tuple(elements)
 
     def __del__(self):
-        self.unref()
+        try:
+            self.unref()
+        except ImportError:
+            # Calling unref will cause gi and gi.repository.GLib to be
+            # imported. However, if the program is exiting, then these
+            # modules have likely been removed from sys.modules and will
+            # raise an exception. Assume that's the case for ImportError
+            # and ignore the exception since everything will be cleaned
+            # up, anyways.
+            pass
 
     def __str__(self):
         return self.print_(True)
@@ -468,6 +477,7 @@ def get_string(self):
     value, length = GLib.Variant.get_string(self)
     return value
 
+
 setattr(Variant, 'get_string', get_string)
 
 __all__.append('Variant')
@@ -478,6 +488,8 @@ def markup_escape_text(text, length=-1):
         return GLib.markup_escape_text(text.decode('UTF-8'), length)
     else:
         return GLib.markup_escape_text(text, length)
+
+
 __all__.append('markup_escape_text')
 
 
@@ -576,6 +588,7 @@ class MainLoop(GLib.MainLoop):
             # caught by _main_loop_sigint_handler()
             raise KeyboardInterrupt
 
+
 MainLoop = override(MainLoop)
 __all__.append('MainLoop')
 
@@ -585,6 +598,7 @@ class MainContext(GLib.MainContext):
     def iteration(self, may_block=True):
         return super(MainContext, self).iteration(may_block)
 
+
 MainContext = override(MainContext)
 __all__.append('MainContext')
 
@@ -634,6 +648,7 @@ class Source(GLib.Source):
 
     can_recurse = property(__get_can_recurse, __set_can_recurse)
 
+
 Source = override(Source)
 __all__.append('Source')
 
@@ -649,6 +664,7 @@ class Idle(Source):
         if priority != GLib.PRIORITY_DEFAULT:
             self.set_priority(priority)
 
+
 __all__.append('Idle')
 
 
@@ -662,6 +678,7 @@ class Timeout(Source):
         if priority != GLib.PRIORITY_DEFAULT:
             self.set_priority(priority)
 
+
 __all__.append('Timeout')
 
 
@@ -670,6 +687,7 @@ def idle_add(function, *user_data, **kwargs):
     priority = kwargs.get('priority', GLib.PRIORITY_DEFAULT_IDLE)
     return GLib.idle_add(priority, function, *user_data)
 
+
 __all__.append('idle_add')
 
 
@@ -677,6 +695,7 @@ def timeout_add(interval, function, *user_data, **kwargs):
     priority = kwargs.get('priority', GLib.PRIORITY_DEFAULT)
     return GLib.timeout_add(priority, interval, function, *user_data)
 
+
 __all__.append('timeout_add')
 
 
@@ -684,6 +703,7 @@ def timeout_add_seconds(interval, function, *user_data, **kwargs):
     priority = kwargs.get('priority', GLib.PRIORITY_DEFAULT)
     return GLib.timeout_add_seconds(priority, interval, function, *user_data)
 
+
 __all__.append('timeout_add_seconds')
 
 
@@ -741,6 +761,7 @@ def _io_add_watch_get_args(channel, priority_, condition, *cb_and_user_data, **k
 
     return real_channel, priority_, condition, func_fdtransform, user_data
 
+
 __all__.append('_io_add_watch_get_args')
 
 
@@ -749,6 +770,7 @@ def io_add_watch(*args, **kwargs):
     channel, priority, condition, func, user_data = _io_add_watch_get_args(*args, **kwargs)
     return GLib.io_add_watch(channel, priority, condition, func, *user_data)
 
+
 __all__.append('io_add_watch')
 
 
@@ -830,6 +852,7 @@ class IOChannel(GLib.IOChannel):
     # Python 2.x compatibility
     next = __next__
 
+
 IOChannel = override(IOChannel)
 __all__.append('IOChannel')
 
@@ -844,6 +867,7 @@ class PollFD(GLib.PollFD):
         self.fd = fd
         self.events = events
 
+
 PollFD = override(PollFD)
 __all__.append('PollFD')
 
@@ -891,6 +915,7 @@ def _child_watch_add_get_args(priority_or_pid, pid_or_callback, *args, **kwargs)
 
     return priority, pid, callback, user_data
 
+
 # we need this to be accessible for unit testing
 __all__.append('_child_watch_add_get_args')
 
@@ -900,12 +925,14 @@ def child_watch_add(*args, **kwargs):
     priority, pid, function, data = _child_watch_add_get_args(*args, **kwargs)
     return GLib.child_watch_add(priority, pid, function, *data)
 
+
 __all__.append('child_watch_add')
 
 
 def get_current_time():
     return GLib.get_real_time() * 0.000001
 
+
 get_current_time = deprecated(get_current_time, 'GLib.get_real_time()')
 
 __all__.append('get_current_time')
@@ -916,6 +943,7 @@ __all__.append('get_current_time')
 def filename_from_utf8(utf8string, len=-1):
     return GLib.filename_from_utf8(utf8string, len)[0]
 
+
 __all__.append('filename_from_utf8')
 
 
index 28408b2..2e8f755 100644 (file)
@@ -351,6 +351,7 @@ class Value(GObjectModule.Value):
     def __repr__(self):
         return '<Value (%s) %s>' % (self.g_type.name, self.get_value())
 
+
 Value = override(Value)
 __all__.append('Value')
 
@@ -361,6 +362,7 @@ def type_from_name(name):
         raise RuntimeError('unknown type name: %s' % name)
     return type_
 
+
 __all__.append('type_from_name')
 
 
@@ -370,6 +372,7 @@ def type_parent(type_):
         raise RuntimeError('no parent for type')
     return parent
 
+
 __all__.append('type_parent')
 
 
@@ -384,6 +387,7 @@ def signal_list_ids(type_):
     _validate_type_for_signal_method(type_)
     return GObjectModule.signal_list_ids(type_)
 
+
 __all__.append('signal_list_ids')
 
 
@@ -391,6 +395,7 @@ def signal_list_names(type_):
     ids = signal_list_ids(type_)
     return tuple(GObjectModule.signal_name(i) for i in ids)
 
+
 __all__.append('signal_list_names')
 
 
@@ -398,6 +403,7 @@ def signal_lookup(name, type_):
     _validate_type_for_signal_method(type_)
     return GObjectModule.signal_lookup(name, type_)
 
+
 __all__.append('signal_lookup')
 
 
@@ -430,6 +436,7 @@ def signal_query(id_or_name, type_=None):
                        res.signal_flags, res.return_type,
                        tuple(res.param_types))
 
+
 __all__.append('signal_query')
 
 
@@ -465,6 +472,7 @@ def signal_handler_block(obj, handler_id):
     GObjectModule.signal_handler_block(obj, handler_id)
     return _HandlerBlockManager(obj, handler_id)
 
+
 __all__.append('signal_handler_block')
 
 
@@ -486,6 +494,7 @@ def signal_parse_name(detailed_signal, itype, force_detail_quark):
     else:
         raise ValueError('%s: unknown signal name: %s' % (itype, detailed_signal))
 
+
 __all__.append('signal_parse_name')
 
 
@@ -493,6 +502,7 @@ def remove_emission_hook(obj, detailed_signal, hook_id):
     signal_id, detail = signal_parse_name(detailed_signal, obj, True)
     GObjectModule.signal_remove_emission_hook(signal_id, hook_id)
 
+
 __all__.append('remove_emission_hook')
 
 
@@ -503,6 +513,7 @@ def signal_accumulator_first_wins(ihint, return_accu, handler_return, user_data=
     # Stop emission but return the result of the last handler
     return (False, handler_return)
 
+
 __all__.append('signal_accumulator_first_wins')
 
 
@@ -510,6 +521,7 @@ def signal_accumulator_true_handled(ihint, return_accu, handler_return, user_dat
     # Stop emission if the last handler returns True
     return (not handler_return, handler_return)
 
+
 __all__.append('signal_accumulator_true_handled')
 
 
index baa8449..c5b9a39 100644 (file)
@@ -39,48 +39,51 @@ try:
 except (ValueError, ImportError):
     pass
 
+if hasattr(Gdk, 'Color'):
+    # Gdk.Color was deprecated since 3.14 and dropped in Gtk+-4.0
+    class Color(Gdk.Color):
+        MAX_VALUE = 65535
 
-class Color(Gdk.Color):
-    MAX_VALUE = 65535
+        def __init__(self, red, green, blue):
+            Gdk.Color.__init__(self)
+            self.red = red
+            self.green = green
+            self.blue = blue
 
-    def __init__(self, red, green, blue):
-        Gdk.Color.__init__(self)
-        self.red = red
-        self.green = green
-        self.blue = blue
+        def __eq__(self, other):
+            return self.equal(other)
 
-    def __eq__(self, other):
-        return self.equal(other)
+        def __repr__(self):
+            return 'Gdk.Color(red=%d, green=%d, blue=%d)' % (self.red, self.green, self.blue)
 
-    def __repr__(self):
-        return 'Gdk.Color(red=%d, green=%d, blue=%d)' % (self.red, self.green, self.blue)
+        red_float = property(fget=lambda self: self.red / float(self.MAX_VALUE),
+                             fset=lambda self, v: setattr(self, 'red', int(v * self.MAX_VALUE)))
 
-    red_float = property(fget=lambda self: self.red / float(self.MAX_VALUE),
-                         fset=lambda self, v: setattr(self, 'red', int(v * self.MAX_VALUE)))
+        green_float = property(fget=lambda self: self.green / float(self.MAX_VALUE),
+                               fset=lambda self, v: setattr(self, 'green', int(v * self.MAX_VALUE)))
 
-    green_float = property(fget=lambda self: self.green / float(self.MAX_VALUE),
-                           fset=lambda self, v: setattr(self, 'green', int(v * self.MAX_VALUE)))
+        blue_float = property(fget=lambda self: self.blue / float(self.MAX_VALUE),
+                              fset=lambda self, v: setattr(self, 'blue', int(v * self.MAX_VALUE)))
 
-    blue_float = property(fget=lambda self: self.blue / float(self.MAX_VALUE),
-                          fset=lambda self, v: setattr(self, 'blue', int(v * self.MAX_VALUE)))
+        def to_floats(self):
+            """Return (red_float, green_float, blue_float) triple."""
 
-    def to_floats(self):
-        """Return (red_float, green_float, blue_float) triple."""
+            return (self.red_float, self.green_float, self.blue_float)
 
-        return (self.red_float, self.green_float, self.blue_float)
+        @staticmethod
+        def from_floats(red, green, blue):
+            """Return a new Color object from red/green/blue values from 0.0 to 1.0."""
 
-    @staticmethod
-    def from_floats(red, green, blue):
-        """Return a new Color object from red/green/blue values from 0.0 to 1.0."""
+            return Color(int(red * Color.MAX_VALUE),
+                         int(green * Color.MAX_VALUE),
+                         int(blue * Color.MAX_VALUE))
 
-        return Color(int(red * Color.MAX_VALUE),
-                     int(green * Color.MAX_VALUE),
-                     int(blue * Color.MAX_VALUE))
 
-Color = override(Color)
-__all__.append('Color')
+    Color = override(Color)
+    __all__.append('Color')
 
-if Gdk._version == '3.0':
+if hasattr(Gdk, 'RGBA'):
+    # Introduced since Gtk+-3.0
     class RGBA(Gdk.RGBA):
         def __init__(self, red=1.0, green=1.0, blue=1.0, alpha=1.0):
             Gdk.RGBA.__init__(self)
@@ -243,6 +246,7 @@ class Event(Gdk.Event):
         base_repr = Gdk.Event.__repr__(self).strip("><")
         return "<%s type=%r>" % (base_repr, self.type)
 
+
 Event = override(Event)
 __all__.append('Event')
 
@@ -312,6 +316,7 @@ class DragContext(Gdk.DragContext):
         Gtk = get_introspection_module('Gtk')
         Gtk.drag_finish(self, success, del_, time)
 
+
 DragContext = override(DragContext)
 __all__.append('DragContext')
 
@@ -360,8 +365,10 @@ class Cursor(Gdk.Cursor):
 Cursor = override(Cursor)
 __all__.append('Cursor')
 
-color_parse = strip_boolean_result(Gdk.color_parse)
-__all__.append('color_parse')
+if hasattr(Gdk, 'color_parse'):
+    # Gdk.Color was deprecated since 3.14 and dropped in Gtk+-4.0
+    color_parse = strip_boolean_result(Gdk.color_parse)
+    __all__.append('color_parse')
 
 
 # Note, we cannot override the entire class as Gdk.Atom has no gtype, so just
@@ -436,6 +443,6 @@ if Gdk._version >= '3.0':
     SELECTION_TYPE_STRING = Gdk.atom_intern('STRING', True)
     __all__.append('SELECTION_TYPE_STRING')
 
-import sys
-
-initialized, argv = Gdk.init_check(sys.argv)
+if Gdk._version in ('2.0', '3.0'):
+    import sys
+    initialized, argv = Gdk.init_check(sys.argv)
index e646821..bb320a5 100644 (file)
@@ -116,6 +116,7 @@ class Settings(Gio.Settings):
     def keys(self):
         return self.list_keys()
 
+
 Settings = override(Settings)
 __all__.append('Settings')
 
@@ -235,5 +236,6 @@ class DBusProxy(Gio.DBusProxy):
     def __getattr__(self, name):
         return _DBusProxyMethodCall(self, name)
 
+
 DBusProxy = override(DBusProxy)
 __all__.append('DBusProxy')
index 831401c..2c0e870 100644 (file)
@@ -53,6 +53,7 @@ python module to use with Gtk 2.0"
 class PyGTKDeprecationWarning(PyGIDeprecationWarning):
     pass
 
+
 __all__.append('PyGTKDeprecationWarning')
 
 
@@ -69,6 +70,7 @@ def _construct_target_list(targets):
         target_entries.append(entry)
     return target_entries
 
+
 __all__.append('_construct_target_list')
 
 
@@ -202,210 +204,209 @@ Editable = override(Editable)
 __all__.append("Editable")
 
 
-class Action(Gtk.Action):
-    __init__ = deprecated_init(Gtk.Action.__init__,
-                               arg_names=('name', 'label', 'tooltip', 'stock_id'),
-                               category=PyGTKDeprecationWarning)
-
-Action = override(Action)
-__all__.append("Action")
-
-
-class RadioAction(Gtk.RadioAction):
-    __init__ = deprecated_init(Gtk.RadioAction.__init__,
-                               arg_names=('name', 'label', 'tooltip', 'stock_id', 'value'),
-                               category=PyGTKDeprecationWarning)
-
-RadioAction = override(RadioAction)
-__all__.append("RadioAction")
+if Gtk._version in ("2.0", "3.0"):
+    class Action(Gtk.Action):
+        __init__ = deprecated_init(Gtk.Action.__init__,
+                                   arg_names=('name', 'label', 'tooltip', 'stock_id'),
+                                   category=PyGTKDeprecationWarning)
+
+    Action = override(Action)
+    __all__.append("Action")
+
+    class RadioAction(Gtk.RadioAction):
+        __init__ = deprecated_init(Gtk.RadioAction.__init__,
+                                   arg_names=('name', 'label', 'tooltip', 'stock_id', 'value'),
+                                   category=PyGTKDeprecationWarning)
+
+    RadioAction = override(RadioAction)
+    __all__.append("RadioAction")
+
+    class ActionGroup(Gtk.ActionGroup):
+        __init__ = deprecated_init(Gtk.ActionGroup.__init__,
+                                   arg_names=('name',),
+                                   category=PyGTKDeprecationWarning)
+
+        def add_actions(self, entries, user_data=None):
+            """
+            The add_actions() method is a convenience method that creates a number
+            of gtk.Action  objects based on the information in the list of action
+            entry tuples contained in entries and adds them to the action group.
+            The entry tuples can vary in size from one to six items with the
+            following information:
+
+                * The name of the action. Must be specified.
+                * The stock id for the action. Optional with a default value of None
+                  if a label is specified.
+                * The label for the action. This field should typically be marked
+                  for translation, see the set_translation_domain() method. Optional
+                  with a default value of None if a stock id is specified.
+                * The accelerator for the action, in the format understood by the
+                  gtk.accelerator_parse() function. Optional with a default value of
+                  None.
+                * The tooltip for the action. This field should typically be marked
+                  for translation, see the set_translation_domain() method. Optional
+                  with a default value of None.
+                * The callback function invoked when the action is activated.
+                  Optional with a default value of None.
+
+            The "activate" signals of the actions are connected to the callbacks and
+            their accel paths are set to <Actions>/group-name/action-name.
+            """
+            try:
+                iter(entries)
+            except (TypeError):
+                raise TypeError('entries must be iterable')
+
+            def _process_action(name, stock_id=None, label=None, accelerator=None, tooltip=None, callback=None):
+                action = Action(name=name, label=label, tooltip=tooltip, stock_id=stock_id)
+                if callback is not None:
+                    if user_data is None:
+                        action.connect('activate', callback)
+                    else:
+                        action.connect('activate', callback, user_data)
+
+                self.add_action_with_accel(action, accelerator)
+
+            for e in entries:
+                # using inner function above since entries can leave out optional arguments
+                _process_action(*e)
+
+        def add_toggle_actions(self, entries, user_data=None):
+            """
+            The add_toggle_actions() method is a convenience method that creates a
+            number of gtk.ToggleAction objects based on the information in the list
+            of action entry tuples contained in entries and adds them to the action
+            group. The toggle action entry tuples can vary in size from one to seven
+            items with the following information:
+
+                * The name of the action. Must be specified.
+                * The stock id for the action. Optional with a default value of None
+                  if a label is specified.
+                * The label for the action. This field should typically be marked
+                  for translation, see the set_translation_domain() method. Optional
+                  with a default value of None if a stock id is specified.
+                * The accelerator for the action, in the format understood by the
+                  gtk.accelerator_parse() function. Optional with a default value of
+                  None.
+                * The tooltip for the action. This field should typically be marked
+                  for translation, see the set_translation_domain() method. Optional
+                  with a default value of None.
+                * The callback function invoked when the action is activated.
+                  Optional with a default value of None.
+                * A flag indicating whether the toggle action is active. Optional
+                  with a default value of False.
+
+            The "activate" signals of the actions are connected to the callbacks and
+            their accel paths are set to <Actions>/group-name/action-name.
+            """
 
+            try:
+                iter(entries)
+            except (TypeError):
+                raise TypeError('entries must be iterable')
+
+            def _process_action(name, stock_id=None, label=None, accelerator=None, tooltip=None, callback=None, is_active=False):
+                action = Gtk.ToggleAction(name=name, label=label, tooltip=tooltip, stock_id=stock_id)
+                action.set_active(is_active)
+                if callback is not None:
+                    if user_data is None:
+                        action.connect('activate', callback)
+                    else:
+                        action.connect('activate', callback, user_data)
+
+                self.add_action_with_accel(action, accelerator)
+
+            for e in entries:
+                # using inner function above since entries can leave out optional arguments
+                _process_action(*e)
+
+        def add_radio_actions(self, entries, value=None, on_change=None, user_data=None):
+            """
+            The add_radio_actions() method is a convenience method that creates a
+            number of gtk.RadioAction objects based on the information in the list
+            of action entry tuples contained in entries and adds them to the action
+            group. The entry tuples can vary in size from one to six items with the
+            following information:
+
+                * The name of the action. Must be specified.
+                * The stock id for the action. Optional with a default value of None
+                  if a label is specified.
+                * The label for the action. This field should typically be marked
+                  for translation, see the set_translation_domain() method. Optional
+                  with a default value of None if a stock id is specified.
+                * The accelerator for the action, in the format understood by the
+                  gtk.accelerator_parse() function. Optional with a default value of
+                  None.
+                * The tooltip for the action. This field should typically be marked
+                  for translation, see the set_translation_domain() method. Optional
+                  with a default value of None.
+                * The value to set on the radio action. Optional with a default
+                  value of 0. Should be specified in applications.
+
+            The value parameter specifies the radio action that should be set
+            active. The "changed" signal of the first radio action is connected to
+            the on_change callback (if specified and not None) and the accel paths
+            of the actions are set to <Actions>/group-name/action-name.
+            """
+            try:
+                iter(entries)
+            except (TypeError):
+                raise TypeError('entries must be iterable')
 
-class ActionGroup(Gtk.ActionGroup):
-    __init__ = deprecated_init(Gtk.ActionGroup.__init__,
-                               arg_names=('name',),
-                               category=PyGTKDeprecationWarning)
+            first_action = None
 
-    def add_actions(self, entries, user_data=None):
-        """
-        The add_actions() method is a convenience method that creates a number
-        of gtk.Action  objects based on the information in the list of action
-        entry tuples contained in entries and adds them to the action group.
-        The entry tuples can vary in size from one to six items with the
-        following information:
-
-            * The name of the action. Must be specified.
-            * The stock id for the action. Optional with a default value of None
-              if a label is specified.
-            * The label for the action. This field should typically be marked
-              for translation, see the set_translation_domain() method. Optional
-              with a default value of None if a stock id is specified.
-            * The accelerator for the action, in the format understood by the
-              gtk.accelerator_parse() function. Optional with a default value of
-              None.
-            * The tooltip for the action. This field should typically be marked
-              for translation, see the set_translation_domain() method. Optional
-              with a default value of None.
-            * The callback function invoked when the action is activated.
-              Optional with a default value of None.
-
-        The "activate" signals of the actions are connected to the callbacks and
-        their accel paths are set to <Actions>/group-name/action-name.
-        """
-        try:
-            iter(entries)
-        except (TypeError):
-            raise TypeError('entries must be iterable')
+            def _process_action(group_source, name, stock_id=None, label=None, accelerator=None, tooltip=None, entry_value=0):
+                action = RadioAction(name=name, label=label, tooltip=tooltip, stock_id=stock_id, value=entry_value)
 
-        def _process_action(name, stock_id=None, label=None, accelerator=None, tooltip=None, callback=None):
-            action = Action(name=name, label=label, tooltip=tooltip, stock_id=stock_id)
-            if callback is not None:
-                if user_data is None:
-                    action.connect('activate', callback)
-                else:
-                    action.connect('activate', callback, user_data)
+                # FIXME: join_group is a patch to Gtk+ 3.0
+                #        otherwise we can't effectively add radio actions to a
+                #        group.  Should we depend on 3.0 and error out here
+                #        or should we offer the functionality via a compat
+                #        C module?
+                if hasattr(action, 'join_group'):
+                    action.join_group(group_source)
 
-            self.add_action_with_accel(action, accelerator)
+                if value == entry_value:
+                    action.set_active(True)
 
-        for e in entries:
-            # using inner function above since entries can leave out optional arguments
-            _process_action(*e)
+                self.add_action_with_accel(action, accelerator)
+                return action
 
-    def add_toggle_actions(self, entries, user_data=None):
-        """
-        The add_toggle_actions() method is a convenience method that creates a
-        number of gtk.ToggleAction objects based on the information in the list
-        of action entry tuples contained in entries and adds them to the action
-        group. The toggle action entry tuples can vary in size from one to seven
-        items with the following information:
-
-            * The name of the action. Must be specified.
-            * The stock id for the action. Optional with a default value of None
-              if a label is specified.
-            * The label for the action. This field should typically be marked
-              for translation, see the set_translation_domain() method. Optional
-              with a default value of None if a stock id is specified.
-            * The accelerator for the action, in the format understood by the
-              gtk.accelerator_parse() function. Optional with a default value of
-              None.
-            * The tooltip for the action. This field should typically be marked
-              for translation, see the set_translation_domain() method. Optional
-              with a default value of None.
-            * The callback function invoked when the action is activated.
-              Optional with a default value of None.
-            * A flag indicating whether the toggle action is active. Optional
-              with a default value of False.
-
-        The "activate" signals of the actions are connected to the callbacks and
-        their accel paths are set to <Actions>/group-name/action-name.
-        """
+            for e in entries:
+                # using inner function above since entries can leave out optional arguments
+                action = _process_action(first_action, *e)
+                if first_action is None:
+                    first_action = action
 
-        try:
-            iter(entries)
-        except (TypeError):
-            raise TypeError('entries must be iterable')
-
-        def _process_action(name, stock_id=None, label=None, accelerator=None, tooltip=None, callback=None, is_active=False):
-            action = Gtk.ToggleAction(name=name, label=label, tooltip=tooltip, stock_id=stock_id)
-            action.set_active(is_active)
-            if callback is not None:
+            if first_action is not None and on_change is not None:
                 if user_data is None:
-                    action.connect('activate', callback)
+                    first_action.connect('changed', on_change)
                 else:
-                    action.connect('activate', callback, user_data)
-
-            self.add_action_with_accel(action, accelerator)
-
-        for e in entries:
-            # using inner function above since entries can leave out optional arguments
-            _process_action(*e)
-
-    def add_radio_actions(self, entries, value=None, on_change=None, user_data=None):
-        """
-        The add_radio_actions() method is a convenience method that creates a
-        number of gtk.RadioAction objects based on the information in the list
-        of action entry tuples contained in entries and adds them to the action
-        group. The entry tuples can vary in size from one to six items with the
-        following information:
-
-            * The name of the action. Must be specified.
-            * The stock id for the action. Optional with a default value of None
-              if a label is specified.
-            * The label for the action. This field should typically be marked
-              for translation, see the set_translation_domain() method. Optional
-              with a default value of None if a stock id is specified.
-            * The accelerator for the action, in the format understood by the
-              gtk.accelerator_parse() function. Optional with a default value of
-              None.
-            * The tooltip for the action. This field should typically be marked
-              for translation, see the set_translation_domain() method. Optional
-              with a default value of None.
-            * The value to set on the radio action. Optional with a default
-              value of 0. Should be specified in applications.
-
-        The value parameter specifies the radio action that should be set
-        active. The "changed" signal of the first radio action is connected to
-        the on_change callback (if specified and not None) and the accel paths
-        of the actions are set to <Actions>/group-name/action-name.
-        """
-        try:
-            iter(entries)
-        except (TypeError):
-            raise TypeError('entries must be iterable')
-
-        first_action = None
-
-        def _process_action(group_source, name, stock_id=None, label=None, accelerator=None, tooltip=None, entry_value=0):
-            action = RadioAction(name=name, label=label, tooltip=tooltip, stock_id=stock_id, value=entry_value)
-
-            # FIXME: join_group is a patch to Gtk+ 3.0
-            #        otherwise we can't effectively add radio actions to a
-            #        group.  Should we depend on 3.0 and error out here
-            #        or should we offer the functionality via a compat
-            #        C module?
-            if hasattr(action, 'join_group'):
-                action.join_group(group_source)
-
-            if value == entry_value:
-                action.set_active(True)
-
-            self.add_action_with_accel(action, accelerator)
-            return action
-
-        for e in entries:
-            # using inner function above since entries can leave out optional arguments
-            action = _process_action(first_action, *e)
-            if first_action is None:
-                first_action = action
-
-        if first_action is not None and on_change is not None:
-            if user_data is None:
-                first_action.connect('changed', on_change)
-            else:
-                first_action.connect('changed', on_change, user_data)
+                    first_action.connect('changed', on_change, user_data)
 
-ActionGroup = override(ActionGroup)
-__all__.append('ActionGroup')
+    ActionGroup = override(ActionGroup)
+    __all__.append('ActionGroup')
 
+    class UIManager(Gtk.UIManager):
+        def add_ui_from_string(self, buffer):
+            if not isinstance(buffer, _basestring):
+                raise TypeError('buffer must be a string')
 
-class UIManager(Gtk.UIManager):
-    def add_ui_from_string(self, buffer):
-        if not isinstance(buffer, _basestring):
-            raise TypeError('buffer must be a string')
+            length = len(buffer.encode('UTF-8'))
 
-        length = len(buffer.encode('UTF-8'))
+            return Gtk.UIManager.add_ui_from_string(self, buffer, length)
 
-        return Gtk.UIManager.add_ui_from_string(self, buffer, length)
+        def insert_action_group(self, buffer, length=-1):
+            return Gtk.UIManager.insert_action_group(self, buffer, length)
 
-    def insert_action_group(self, buffer, length=-1):
-        return Gtk.UIManager.insert_action_group(self, buffer, length)
-
-UIManager = override(UIManager)
-__all__.append('UIManager')
+    UIManager = override(UIManager)
+    __all__.append('UIManager')
 
 
 class ComboBox(Gtk.ComboBox, Container):
     get_active_iter = strip_boolean_result(Gtk.ComboBox.get_active_iter)
 
+
 ComboBox = override(ComboBox)
 __all__.append('ComboBox')
 
@@ -415,6 +416,7 @@ class Box(Gtk.Box):
                                arg_names=('homogeneous', 'spacing'),
                                category=PyGTKDeprecationWarning)
 
+
 Box = override(Box)
 __all__.append('Box')
 
@@ -425,6 +427,7 @@ class SizeGroup(Gtk.SizeGroup):
                                deprecated_defaults={'mode': Gtk.SizeGroupMode.VERTICAL},
                                category=PyGTKDeprecationWarning)
 
+
 SizeGroup = override(SizeGroup)
 __all__.append('SizeGroup')
 
@@ -434,6 +437,7 @@ class MenuItem(Gtk.MenuItem):
                                arg_names=('label',),
                                category=PyGTKDeprecationWarning)
 
+
 MenuItem = override(MenuItem)
 __all__.append('MenuItem')
 
@@ -469,6 +473,7 @@ class Builder(Gtk.Builder):
 
         return Gtk.Builder.add_objects_from_string(self, buffer, length, object_ids)
 
+
 Builder = override(Builder)
 __all__.append('Builder')
 
@@ -482,6 +487,7 @@ class Window(Gtk.Window):
                                arg_names=('type',),
                                category=PyGTKDeprecationWarning)
 
+
 Window = override(Window)
 __all__.append('Window')
 
@@ -568,6 +574,7 @@ class Dialog(Gtk.Dialog, Container):
         except (IndexError):
             raise TypeError('Must pass an even number of arguments')
 
+
 Dialog = override(Dialog)
 __all__.append('Dialog')
 
@@ -588,17 +595,19 @@ class MessageDialog(Gtk.MessageDialog, Dialog):
         self.set_property('secondary-use-markup', True)
         self.set_property('secondary-text', message_format)
 
+
 MessageDialog = override(MessageDialog)
 __all__.append('MessageDialog')
 
 
-class ColorSelectionDialog(Gtk.ColorSelectionDialog):
-    __init__ = deprecated_init(Gtk.ColorSelectionDialog.__init__,
-                               arg_names=('title',),
-                               category=PyGTKDeprecationWarning)
+if Gtk._version in ("2.0", "3.0"):
+    class ColorSelectionDialog(Gtk.ColorSelectionDialog):
+        __init__ = deprecated_init(Gtk.ColorSelectionDialog.__init__,
+                                   arg_names=('title',),
+                                   category=PyGTKDeprecationWarning)
 
-ColorSelectionDialog = override(ColorSelectionDialog)
-__all__.append('ColorSelectionDialog')
+    ColorSelectionDialog = override(ColorSelectionDialog)
+    __all__.append('ColorSelectionDialog')
 
 
 class FileChooserDialog(Gtk.FileChooserDialog):
@@ -606,17 +615,19 @@ class FileChooserDialog(Gtk.FileChooserDialog):
                                arg_names=('title', 'parent', 'action', 'buttons'),
                                category=PyGTKDeprecationWarning)
 
+
 FileChooserDialog = override(FileChooserDialog)
 __all__.append('FileChooserDialog')
 
 
-class FontSelectionDialog(Gtk.FontSelectionDialog):
-    __init__ = deprecated_init(Gtk.FontSelectionDialog.__init__,
-                               arg_names=('title',),
-                               category=PyGTKDeprecationWarning)
+if Gtk._version in ("2.0", "3.0"):
+    class FontSelectionDialog(Gtk.FontSelectionDialog):
+        __init__ = deprecated_init(Gtk.FontSelectionDialog.__init__,
+                                   arg_names=('title',),
+                                   category=PyGTKDeprecationWarning)
 
-FontSelectionDialog = override(FontSelectionDialog)
-__all__.append('FontSelectionDialog')
+    FontSelectionDialog = override(FontSelectionDialog)
+    __all__.append('FontSelectionDialog')
 
 
 class RecentChooserDialog(Gtk.RecentChooserDialog):
@@ -627,6 +638,7 @@ class RecentChooserDialog(Gtk.RecentChooserDialog):
                                deprecated_aliases={'recent_manager': 'manager'},
                                category=PyGTKDeprecationWarning)
 
+
 RecentChooserDialog = override(RecentChooserDialog)
 __all__.append('RecentChooserDialog')
 
@@ -640,6 +652,7 @@ class IconView(Gtk.IconView):
     get_visible_range = strip_boolean_result(Gtk.IconView.get_visible_range)
     get_dest_item_at_pos = strip_boolean_result(Gtk.IconView.get_dest_item_at_pos)
 
+
 IconView = override(IconView)
 __all__.append('IconView')
 
@@ -649,6 +662,7 @@ class ToolButton(Gtk.ToolButton):
                                arg_names=('stock_id',),
                                category=PyGTKDeprecationWarning)
 
+
 ToolButton = override(ToolButton)
 __all__.append('ToolButton')
 
@@ -656,6 +670,7 @@ __all__.append('ToolButton')
 class IMContext(Gtk.IMContext):
     get_surrounding = strip_boolean_result(Gtk.IMContext.get_surrounding)
 
+
 IMContext = override(IMContext)
 __all__.append('IMContext')
 
@@ -663,6 +678,7 @@ __all__.append('IMContext')
 class RecentInfo(Gtk.RecentInfo):
     get_application_info = strip_boolean_result(Gtk.RecentInfo.get_application_info)
 
+
 RecentInfo = override(RecentInfo)
 __all__.append('RecentInfo')
 
@@ -750,6 +766,7 @@ class TextBuffer(Gtk.TextBuffer):
 
     get_selection_bounds = strip_boolean_result(Gtk.TextBuffer.get_selection_bounds, fail_ret=())
 
+
 TextBuffer = override(TextBuffer)
 __all__.append('TextBuffer')
 
@@ -758,6 +775,7 @@ class TextIter(Gtk.TextIter):
     forward_search = strip_boolean_result(Gtk.TextIter.forward_search)
     backward_search = strip_boolean_result(Gtk.TextIter.backward_search)
 
+
 TextIter = override(TextIter)
 __all__.append('TextIter')
 
@@ -924,6 +942,7 @@ class TreeSortable(Gtk.TreeSortable, ):
     def set_default_sort_func(self, sort_func, user_data=None):
         super(TreeSortable, self).set_default_sort_func(sort_func, user_data)
 
+
 TreeSortable = override(TreeSortable)
 __all__.append('TreeSortable')
 
@@ -933,6 +952,7 @@ class TreeModelSort(Gtk.TreeModelSort):
                                arg_names=('model',),
                                category=PyGTKDeprecationWarning)
 
+
 TreeModelSort = override(TreeModelSort)
 __all__.append('TreeModelSort')
 
@@ -1017,6 +1037,7 @@ class ListStore(Gtk.ListStore, TreeModel, TreeSortable):
             else:
                 raise TypeError('Argument list must be in the form of (column, value, ...), ((columns,...), (values, ...)) or {column: value}.  No -1 termination is needed.')
 
+
 ListStore = override(ListStore)
 __all__.append('ListStore')
 
@@ -1123,6 +1144,7 @@ class TreeModelRow(object):
         child_iter = self.model.iter_children(self.iter)
         return TreeModelRowIter(self.model, child_iter)
 
+
 __all__.append('TreeModelRow')
 
 
@@ -1145,6 +1167,7 @@ class TreeModelRowIter(object):
     def __iter__(self):
         return self
 
+
 __all__.append('TreeModelRowIter')
 
 
@@ -1196,6 +1219,7 @@ class TreePath(Gtk.TreePath):
     def __getitem__(self, index):
         return self.get_indices()[index]
 
+
 TreePath = override(TreePath)
 __all__.append('TreePath')
 
@@ -1275,6 +1299,7 @@ class TreeStore(Gtk.TreeStore, TreeModel, TreeSortable):
             else:
                 raise TypeError('Argument list must be in the form of (column, value, ...), ((columns,...), (values, ...)) or {column: value}.  No -1 termination is needed.')
 
+
 TreeStore = override(TreeStore)
 __all__.append('TreeStore')
 
@@ -1321,6 +1346,7 @@ class TreeView(Gtk.TreeView, Container):
         self.insert_column(column, position)
         column.set_attributes(cell, **kwargs)
 
+
 TreeView = override(TreeView)
 __all__.append('TreeView')
 
@@ -1402,6 +1428,7 @@ class Button(Gtk.Button, Container):
         else:
             self._init(*args, **kwargs)
 
+
 Button = override(Button)
 __all__.append('Button')
 
@@ -1411,6 +1438,7 @@ class LinkButton(Gtk.LinkButton):
                                arg_names=('uri', 'label'),
                                category=PyGTKDeprecationWarning)
 
+
 LinkButton = override(LinkButton)
 __all__.append('LinkButton')
 
@@ -1420,6 +1448,7 @@ class Label(Gtk.Label):
                                arg_names=('label',),
                                category=PyGTKDeprecationWarning)
 
+
 Label = override(Label)
 __all__.append('Label')
 
@@ -1442,21 +1471,23 @@ class Adjustment(Gtk.Adjustment):
         if 'value' in kwargs:
             self.set_value(kwargs['value'])
 
+
 Adjustment = override(Adjustment)
 __all__.append('Adjustment')
 
 
-class Table(Gtk.Table, Container):
-    __init__ = deprecated_init(Gtk.Table.__init__,
-                               arg_names=('n_rows', 'n_columns', 'homogeneous'),
-                               deprecated_aliases={'n_rows': 'rows', 'n_columns': 'columns'},
-                               category=PyGTKDeprecationWarning)
+if Gtk._version in ("2.0", "3.0"):
+    class Table(Gtk.Table, Container):
+        __init__ = deprecated_init(Gtk.Table.__init__,
+                                   arg_names=('n_rows', 'n_columns', 'homogeneous'),
+                                   deprecated_aliases={'n_rows': 'rows', 'n_columns': 'columns'},
+                                   category=PyGTKDeprecationWarning)
 
-    def attach(self, child, left_attach, right_attach, top_attach, bottom_attach, xoptions=Gtk.AttachOptions.EXPAND | Gtk.AttachOptions.FILL, yoptions=Gtk.AttachOptions.EXPAND | Gtk.AttachOptions.FILL, xpadding=0, ypadding=0):
-        Gtk.Table.attach(self, child, left_attach, right_attach, top_attach, bottom_attach, xoptions, yoptions, xpadding, ypadding)
+        def attach(self, child, left_attach, right_attach, top_attach, bottom_attach, xoptions=Gtk.AttachOptions.EXPAND | Gtk.AttachOptions.FILL, yoptions=Gtk.AttachOptions.EXPAND | Gtk.AttachOptions.FILL, xpadding=0, ypadding=0):
+            Gtk.Table.attach(self, child, left_attach, right_attach, top_attach, bottom_attach, xoptions, yoptions, xpadding, ypadding)
 
-Table = override(Table)
-__all__.append('Table')
+    Table = override(Table)
+    __all__.append('Table')
 
 
 class ScrolledWindow(Gtk.ScrolledWindow):
@@ -1464,26 +1495,27 @@ class ScrolledWindow(Gtk.ScrolledWindow):
                                arg_names=('hadjustment', 'vadjustment'),
                                category=PyGTKDeprecationWarning)
 
+
 ScrolledWindow = override(ScrolledWindow)
 __all__.append('ScrolledWindow')
 
 
-class HScrollbar(Gtk.HScrollbar):
-    __init__ = deprecated_init(Gtk.HScrollbar.__init__,
-                               arg_names=('adjustment',),
-                               category=PyGTKDeprecationWarning)
-
-HScrollbar = override(HScrollbar)
-__all__.append('HScrollbar')
+if Gtk._version in ("2.0", "3.0"):
+    class HScrollbar(Gtk.HScrollbar):
+        __init__ = deprecated_init(Gtk.HScrollbar.__init__,
+                                   arg_names=('adjustment',),
+                                   category=PyGTKDeprecationWarning)
 
+    HScrollbar = override(HScrollbar)
+    __all__.append('HScrollbar')
 
-class VScrollbar(Gtk.VScrollbar):
-    __init__ = deprecated_init(Gtk.VScrollbar.__init__,
-                               arg_names=('adjustment',),
-                               category=PyGTKDeprecationWarning)
+    class VScrollbar(Gtk.VScrollbar):
+        __init__ = deprecated_init(Gtk.VScrollbar.__init__,
+                                   arg_names=('adjustment',),
+                                   category=PyGTKDeprecationWarning)
 
-VScrollbar = override(VScrollbar)
-__all__.append('VScrollbar')
+    VScrollbar = override(VScrollbar)
+    __all__.append('VScrollbar')
 
 
 class Paned(Gtk.Paned):
@@ -1493,35 +1525,36 @@ class Paned(Gtk.Paned):
     def pack2(self, child, resize=True, shrink=True):
         super(Paned, self).pack2(child, resize, shrink)
 
+
 Paned = override(Paned)
 __all__.append('Paned')
 
 
-class Arrow(Gtk.Arrow):
-    __init__ = deprecated_init(Gtk.Arrow.__init__,
-                               arg_names=('arrow_type', 'shadow_type'),
-                               category=PyGTKDeprecationWarning)
+if Gtk._version in ("2.0", "3.0"):
+    class Arrow(Gtk.Arrow):
+        __init__ = deprecated_init(Gtk.Arrow.__init__,
+                                   arg_names=('arrow_type', 'shadow_type'),
+                                   category=PyGTKDeprecationWarning)
 
-Arrow = override(Arrow)
-__all__.append('Arrow')
+    Arrow = override(Arrow)
+    __all__.append('Arrow')
 
+    class IconSet(Gtk.IconSet):
+        def __new__(cls, pixbuf=None):
+            if pixbuf is not None:
+                warnings.warn('Gtk.IconSet(pixbuf) has been deprecated. Please use: '
+                              'Gtk.IconSet.new_from_pixbuf(pixbuf)',
+                              PyGTKDeprecationWarning, stacklevel=2)
+                iconset = Gtk.IconSet.new_from_pixbuf(pixbuf)
+            else:
+                iconset = Gtk.IconSet.__new__(cls)
+            return iconset
 
-class IconSet(Gtk.IconSet):
-    def __new__(cls, pixbuf=None):
-        if pixbuf is not None:
-            warnings.warn('Gtk.IconSet(pixbuf) has been deprecated. Please use: '
-                          'Gtk.IconSet.new_from_pixbuf(pixbuf)',
-                          PyGTKDeprecationWarning, stacklevel=2)
-            iconset = Gtk.IconSet.new_from_pixbuf(pixbuf)
-        else:
-            iconset = Gtk.IconSet.__new__(cls)
-        return iconset
-
-    def __init__(self, *args, **kwargs):
-        return super(IconSet, self).__init__()
+        def __init__(self, *args, **kwargs):
+            return super(IconSet, self).__init__()
 
-IconSet = override(IconSet)
-__all__.append('IconSet')
+    IconSet = override(IconSet)
+    __all__.append('IconSet')
 
 
 class Viewport(Gtk.Viewport):
@@ -1529,6 +1562,7 @@ class Viewport(Gtk.Viewport):
                                arg_names=('hadjustment', 'vadjustment'),
                                category=PyGTKDeprecationWarning)
 
+
 Viewport = override(Viewport)
 __all__.append('Viewport')
 
@@ -1542,6 +1576,7 @@ class TreeModelFilter(Gtk.TreeModelFilter):
         iter = self.convert_iter_to_child_iter(iter)
         self.get_model().set_value(iter, column, value)
 
+
 TreeModelFilter = override(TreeModelFilter)
 __all__.append('TreeModelFilter')
 
@@ -1559,8 +1594,13 @@ _Gtk_main_quit = Gtk.main_quit
 def main_quit(*args):
     _Gtk_main_quit()
 
-stock_lookup = strip_boolean_result(Gtk.stock_lookup)
-__all__.append('stock_lookup')
 
-initialized, argv = Gtk.init_check(sys.argv)
-sys.argv = list(argv)
+if Gtk._version in ("2.0", "3.0"):
+    stock_lookup = strip_boolean_result(Gtk.stock_lookup)
+    __all__.append('stock_lookup')
+
+if Gtk._version == "4.0":
+    Gtk.init_check()
+else:
+    initialized, argv = Gtk.init_check(sys.argv)
+    sys.argv = list(argv)
index 11813bc..6e0976d 100644 (file)
@@ -176,6 +176,7 @@ CODE_COVERAGE_CPPFLAGS = @CODE_COVERAGE_CPPFLAGS@
 CODE_COVERAGE_CXXFLAGS = @CODE_COVERAGE_CXXFLAGS@
 CODE_COVERAGE_ENABLED = @CODE_COVERAGE_ENABLED@
 CODE_COVERAGE_LDFLAGS = @CODE_COVERAGE_LDFLAGS@
+CODE_COVERAGE_LIBS = @CODE_COVERAGE_LIBS@
 CPP = @CPP@
 CPPFLAGS = @CPPFLAGS@
 CYGPATH_W = @CYGPATH_W@
index 365e47b..067a628 100644 (file)
@@ -37,6 +37,7 @@ class FontDescription(Pango.FontDescription):
     def __init__(self, *args, **kwargs):
         return super(FontDescription, self).__init__()
 
+
 FontDescription = override(FontDescription)
 __all__.append('FontDescription')
 
@@ -49,5 +50,6 @@ class Layout(Pango.Layout):
     def set_markup(self, text, length=-1):
         super(Layout, self).set_markup(text, length)
 
+
 Layout = override(Layout)
 __all__.append('Layout')
index 5080b66..170b242 100644 (file)
@@ -684,14 +684,13 @@ _callable_cache_generate_args_cache_real (PyGICallableCache *callable_cache,
 static void
 _callable_cache_deinit_real (PyGICallableCache *cache)
 {
-    g_slist_free (cache->to_py_args);
-    g_slist_free (cache->arg_name_list);
-    g_hash_table_destroy (cache->arg_name_hash);
-    g_ptr_array_unref (cache->args_cache);
-    Py_XDECREF (cache->resulttuple_type);
-
-    if (cache->return_cache != NULL)
-        pygi_arg_cache_free (cache->return_cache);
+    g_clear_pointer (&cache->to_py_args, g_slist_free);
+    g_clear_pointer (&cache->arg_name_list, g_slist_free);
+    g_clear_pointer (&cache->arg_name_hash, g_hash_table_unref);
+    g_clear_pointer (&cache->args_cache, g_ptr_array_unref);
+    Py_CLEAR (cache->resulttuple_type);
+
+    g_clear_pointer (&cache->return_cache, pygi_arg_cache_free);
 }
 
 static gboolean
index 3810adf..08de64c 100644 (file)
@@ -176,6 +176,7 @@ CODE_COVERAGE_CPPFLAGS = @CODE_COVERAGE_CPPFLAGS@
 CODE_COVERAGE_CXXFLAGS = @CODE_COVERAGE_CXXFLAGS@
 CODE_COVERAGE_ENABLED = @CODE_COVERAGE_ENABLED@
 CODE_COVERAGE_LDFLAGS = @CODE_COVERAGE_LDFLAGS@
+CODE_COVERAGE_LIBS = @CODE_COVERAGE_LIBS@
 CPP = @CPP@
 CPPFLAGS = @CPPFLAGS@
 CYGPATH_W = @CYGPATH_W@
index 8acbcc2..9d3cb0c 100644 (file)
@@ -204,6 +204,7 @@ class _GObjectMetaBase(type):
 
         _gobject.type_register(cls, namespace.get('__gtype_name__'))
 
+
 _gobject._install_metaclass(_GObjectMetaBase)
 
 
index d0540c2..1603a25 100644 (file)
@@ -176,6 +176,7 @@ CODE_COVERAGE_CPPFLAGS = @CODE_COVERAGE_CPPFLAGS@
 CODE_COVERAGE_CXXFLAGS = @CODE_COVERAGE_CXXFLAGS@
 CODE_COVERAGE_ENABLED = @CODE_COVERAGE_ENABLED@
 CODE_COVERAGE_LDFLAGS = @CODE_COVERAGE_LDFLAGS@
+CODE_COVERAGE_LIBS = @CODE_COVERAGE_LIBS@
 CPP = @CPP@
 CPPFLAGS = @CPPFLAGS@
 CYGPATH_W = @CYGPATH_W@
index e976344..fd651f5 100644 (file)
@@ -99,6 +99,7 @@ def enable():
     from gi.repository import Gio
     sys.modules['gio'] = Gio
 
+
 _unset = object()
 
 
index 33b800a..70bfe67 100644 (file)
@@ -223,6 +223,7 @@ CODE_COVERAGE_CPPFLAGS = @CODE_COVERAGE_CPPFLAGS@
 CODE_COVERAGE_CXXFLAGS = @CODE_COVERAGE_CXXFLAGS@
 CODE_COVERAGE_ENABLED = @CODE_COVERAGE_ENABLED@
 CODE_COVERAGE_LDFLAGS = @CODE_COVERAGE_LDFLAGS@
+CODE_COVERAGE_LIBS = @CODE_COVERAGE_LIBS@
 CPP = @CPP@
 CPPFLAGS = @CPPFLAGS@
 CYGPATH_W = @CYGPATH_W@
index cb248d7..30ae125 100644 (file)
@@ -415,5 +415,6 @@ class TestReturnsAfterError(unittest.TestCase):
             res = self.model.iter_parent(child)
         self.assertEqual(res, None)
 
+
 if __name__ == '__main__':
     unittest.main()
index dd01af8..ba20cb4 100644 (file)
@@ -20,6 +20,8 @@ class MyUnknown(Unknown, testhelper.Interface):
     def do_iface_method(self):
         self.called = True
         Unknown.do_iface_method(self)
+
+
 GObject.type_register(MyUnknown)
 
 
@@ -32,6 +34,8 @@ class MyObject(GObject.GObject, testhelper.Interface):
 
     def do_iface_method(self):
         self.called = True
+
+
 GObject.type_register(MyObject)
 
 
index aa130ec..5980a66 100644 (file)
@@ -423,5 +423,6 @@ second line
             self.assertEqual(GLib.IOFlags.IS_SEEKABLE, GLib.IO_FLAG_IS_SEEKABLE)
             self.assertEqual(GLib.IOStatus.NORMAL, GLib.IO_STATUS_NORMAL)
 
+
 if __name__ == '__main__':
     unittest.main()
index f47c63b..6562413 100644 (file)
@@ -76,8 +76,8 @@ class TestGtk(unittest.TestCase):
         self.assertTrue(label2 in box)
         self.assertEqual(len(box), 2)
         self.assertTrue(box)
-        l = [x for x in box]
-        self.assertEqual(l, [label, label2])
+        labels = [x for x in box]
+        self.assertEqual(labels, [label, label2])
 
     def test_actions(self):
         self.assertEqual(Gtk.Action, gi.overrides.Gtk.Action)
@@ -615,9 +615,9 @@ class TestGtk(unittest.TestCase):
         self.assertEqual(viewport.props.hadjustment, hadjustment)
 
     def test_stock_lookup(self):
-        l = Gtk.stock_lookup('gtk-ok')
-        self.assertEqual(type(l), Gtk.StockItem)
-        self.assertEqual(l.stock_id, 'gtk-ok')
+        stock_item = Gtk.stock_lookup('gtk-ok')
+        self.assertEqual(type(stock_item), Gtk.StockItem)
+        self.assertEqual(stock_item.stock_id, 'gtk-ok')
         self.assertEqual(Gtk.stock_lookup('nosuchthing'), None)
 
     def test_gtk_main(self):
index ab71000..109fdb9 100644 (file)
@@ -1137,9 +1137,9 @@ class CPropertiesTestBase(object):
     def test_boxed_glist(self):
         self.assertEqual(self.get_prop(self.obj, 'some-boxed-glist'), [])
 
-        l = [GLib.MININT, 42, GLib.MAXINT]
-        self.set_prop(self.obj, 'some-boxed-glist', l)
-        self.assertEqual(self.get_prop(self.obj, 'some-boxed-glist'), l)
+        list_ = [GLib.MININT, 42, GLib.MAXINT]
+        self.set_prop(self.obj, 'some-boxed-glist', list_)
+        self.assertEqual(self.get_prop(self.obj, 'some-boxed-glist'), list_)
         self.set_prop(self.obj, 'some-boxed-glist', [])
         self.assertEqual(self.get_prop(self.obj, 'some-boxed-glist'), [])
 
@@ -1158,9 +1158,9 @@ class CPropertiesTestBase(object):
 
     @unittest.expectedFailure
     def test_boxed_glist_ctor(self):
-        l = [GLib.MININT, 42, GLib.MAXINT]
-        obj = GIMarshallingTests.PropertiesObject(some_boxed_glist=l)
-        self.assertEqual(self.get_prop(obj, 'some-boxed-glist'), l)
+        list_ = [GLib.MININT, 42, GLib.MAXINT]
+        obj = GIMarshallingTests.PropertiesObject(some_boxed_glist=list_)
+        self.assertEqual(self.get_prop(obj, 'some-boxed-glist'), list_)
 
     def test_variant(self):
         self.assertEqual(self.get_prop(self.obj, 'some-variant'), None)
index 92db5a0..91607f9 100644 (file)
@@ -659,6 +659,7 @@ class _TestCMarshaller:
         self.assertEqual(self.obj.emit("test-gvalue-ret", GObject.TYPE_STRING),
                          "hello")
 
+
 if 'generic-c-marshaller' in GObject.features:
     class TestCMarshaller(_TestCMarshaller, unittest.TestCase):
         pass