[pygobject] Port from gnome-common to autoconf-archive



commit 8578ed7e9fd0486fd10e71d24f2e9f969793af8d
Author: Christoph Reiter <creiter src gnome org>
Date:   Tue Jan 24 18:58:48 2017 +0100

    Port from gnome-common to autoconf-archive
    
    See https://wiki.gnome.org/Projects/GnomeCommon/Migration
    
    Visible changes:
    
    * --enable-compile-warnings is now [no/auto/yes] instead of
      [no/minimum/yes/maximum/error]
    * warnings are errors by default except for releases or if
      --disable-Werror is passed (which is the default in jhbuild)
    
    AX_APPEND_COMPILE_FLAGS() gets used to disable some warnings enabled by
    AX_COMPILER_FLAGS() because they trigger with pycairo/python headers.
    
    Tested with gcc 6.3, clang 3.8.1
    
    https://bugzilla.gnome.org/show_bug.cgi?id=777713

 .gitignore              |    3 +++
 Makefile.am             |    8 +++-----
 autogen.sh              |   44 ++++++++++++++++++++++++++++++--------------
 configure.ac            |   44 +++++++++++++-------------------------------
 gi/Makefile.am          |   10 ++++++++++
 gi/_gobject/Makefile.am |    3 ---
 m4/as-ac-expand.m4      |   40 ----------------------------------------
 m4/jhflags.m4           |   21 ---------------------
 tests/Makefile.am       |    9 ++++++---
 9 files changed, 65 insertions(+), 117 deletions(-)
---
diff --git a/.gitignore b/.gitignore
index 8664413..565e226 100644
--- a/.gitignore
+++ b/.gitignore
@@ -55,6 +55,9 @@ Makefile.in
 /m4/ltsugar.m4
 /m4/ltversion.m4
 /m4/lt~obsolete.m4
+/m4/glib-2.0.m4
+/m4/pkg.m4
+/m4/ax_*.m4
 /missing
 /mkinstalldirs
 /omf.make
diff --git a/Makefile.am b/Makefile.am
index 8f2e60f..1664aa1 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -1,5 +1,4 @@
-ACLOCAL_AMFLAGS = -I m4 ${ACLOCAL_FLAGS}
-AUTOMAKE_OPTIONS = 1.7
+ACLOCAL_AMFLAGS = -I m4
 
 # Limit PyFlakes and PEP8 to these directories.
 pycheck_dirs = examples gi tests pygtkcompat
@@ -21,9 +20,8 @@ EXTRA_DIST = \
        PKG-INFO \
        PKG-INFO.in \
        pygi-convert.sh \
-       m4/as-ac-expand.m4 \
-       m4/jhflags.m4 \
        m4/python.m4 \
+       m4/introspection.m4 \
        setup.py
 
 MAINTAINERCLEANFILES = \
@@ -167,4 +165,4 @@ check.valgrindlog:
 check.valgrindxml:
        cd tests && $(MAKE) check.valgrindxml
 
-@GNOME_CODE_COVERAGE_RULES@
+@CODE_COVERAGE_RULES@
diff --git a/autogen.sh b/autogen.sh
index f58b081..7c1aaa4 100755
--- a/autogen.sh
+++ b/autogen.sh
@@ -1,21 +1,37 @@
 #!/bin/sh
 # Run this to generate all the initial makefiles, etc.
-set -e
-srcdir=`dirname $0`
-test -z "$srcdir" && srcdir=.
+test -n "$srcdir" || srcdir=$(dirname "$0")
+test -n "$srcdir" || srcdir=.
 
-PKG_NAME="pygobject"
+olddir=$(pwd)
 
-(test -f $srcdir/configure.ac \
-  && test -f $srcdir/$PKG_NAME.doap) || {
-    echo -n "**Error**: Directory "\`$srcdir\'" does not look like the"
-    echo " top-level $PKG_NAME directory"
-    exit 1
-}
+cd $srcdir
 
-which gnome-autogen.sh || {
-    echo "You need to install gnome-common."
-    exit 1
+(test -f configure.ac) || {
+        echo "*** ERROR: Directory '$srcdir' does not look like the top-level project directory ***"
+        exit 1
 }
 
-. gnome-autogen.sh "$@"
+# shellcheck disable=SC2016
+PKG_NAME=$(autoconf --trace 'AC_INIT:$1' configure.ac)
+
+if [ "$#" = 0 -a "x$NOCONFIGURE" = "x" ]; then
+        echo "*** WARNING: I am going to run 'configure' with no arguments." >&2
+        echo "*** If you wish to pass any to it, please specify them on the" >&2
+        echo "*** '$0' command line." >&2
+        echo "" >&2
+fi
+
+aclocal -I m4 --install || exit 1
+autoreconf --verbose --force --install || exit 1
+
+cd "$olddir"
+if [ "$NOCONFIGURE" = "" ]; then
+        $srcdir/configure "$@" || exit 1
+
+        if [ "$1" = "--help" ]; then exit 0 else
+                echo "Now type 'make' to compile $PKG_NAME" || exit 1
+        fi
+else
+        echo "Skipping configure process."
+fi
diff --git a/configure.ac b/configure.ac
index 2dafac2..db256a7 100644
--- a/configure.ac
+++ b/configure.ac
@@ -31,7 +31,7 @@ m4_define(gio_required_version, 2.38.0)
 AC_INIT([pygobject],[pygobject_version],
        [http://bugzilla.gnome.org/enter_bug.cgi?product=pygobject],
        [pygobject],[https://wiki.gnome.org/Projects/PyGObject/])
-AC_SUBST(ACLOCAL_AMFLAGS, "-I m4 -I .")
+AX_IS_RELEASE([minor-version])
 AC_CONFIG_MACRO_DIR([m4])
 AC_CONFIG_SRCDIR([gi/gimodule.c])
 
@@ -48,9 +48,6 @@ m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES(yes)])
 # See https://debbugs.gnu.org/cgi/bugreport.cgi?bug=8847
 AM_INIT_AUTOMAKE([1.12.6 foreign no-dist-gzip dist-xz])
 
-dnl put the ACLOCAL flags in the makefile
-ACLOCAL="$ACLOCAL $ACLOCAL_FLAGS"
-
 AC_CANONICAL_BUILD
 AC_CANONICAL_HOST
 AC_MSG_CHECKING([for build time linking with Python (Darwin and Win32)])
@@ -173,8 +170,6 @@ fi
 PYTHON_BASENAME=`basename $PYTHON`
 AC_SUBST([PYTHON_BASENAME])
 
-AS_AC_EXPAND(DATADIR, $datadir)
-
 dnl libffi
 PKG_CHECK_MODULES(FFI, libffi >= 3.0)
 LIBFFI_PC=libffi
@@ -196,6 +191,8 @@ PKG_CHECK_MODULES(GI,
     gobject-introspection-1.0 >= introspection_required_version
 )
 
+GOBJECT_INTROSPECTION_CHECK(introspection_required_version)
+
 GI_DATADIR=$($PKG_CONFIG --variable=gidatadir gobject-introspection-1.0)
 AC_SUBST(GI_DATADIR)
 
@@ -221,32 +218,16 @@ AC_ARG_WITH(common,
     with_common=yes)
 AM_CONDITIONAL(WITH_COMMON, test "$with_common" = "yes")
 
-INTROSPECTION_SCANNER=`$PKG_CONFIG --variable=g_ir_scanner gobject-introspection-1.0`
-INTROSPECTION_COMPILER=`$PKG_CONFIG --variable=g_ir_compiler gobject-introspection-1.0`
-
-AC_SUBST(INTROSPECTION_SCANNER)
-AC_SUBST(INTROSPECTION_COMPILER)
-
-# compiler warnings, errors, required cflags, and code coverage support
-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)
-          GNOME_CODE_COVERAGE],
-         [AC_MSG_RESULT(no)
-          GNOME_CODE_COVERAGE_RULES=''
-          AC_SUBST([GNOME_CODE_COVERAGE_RULES])
-          enable_code_coverage="no"])
-
-if test "x$GCC" = "xyes"; then
-  JH_ADD_CFLAG([-Wall])
-  JH_ADD_CFLAG([-Werror=unused-variable])
-  JH_ADD_CFLAG([-fno-strict-aliasing])
-  JH_ADD_CFLAG([-Werror=declaration-after-statement])
-fi
+AX_COMPILER_FLAGS()
+# Disable some warnings, either because they get generated by headers of
+# dependencies we don't control or because it was hard to fix them.
+# Feel free and try to get rid of them.
+# For clang only:
+AX_APPEND_COMPILE_FLAGS([-Wno-unknown-warning-option -Wno-incompatible-pointer-types-discards-qualifiers 
-Wno-cast-align])
+# For gcc + clang:
+AX_APPEND_COMPILE_FLAGS([-Wno-discarded-qualifiers -Wno-redundant-decls -Wno-switch-enum -Wno-undef])
 
-CFLAGS="$CFLAGS $WARN_CFLAGS $CODE_COVERAGE_CFLAGS"
-LDFLAGS="$LDFLAGS $CODE_COVERAGE_CFLAGS"
+AX_CODE_COVERAGE()
 
 AC_CONFIG_FILES(
   Makefile
@@ -265,6 +246,7 @@ AC_OUTPUT
 AC_MSG_RESULT([
        pygobject $VERSION
 
+       Is release:                     $ax_is_release
        Using python interpreter:       $PYTHON
        cairo support:                  $enable_cairo
        thread support:                 $enable_thread
diff --git a/gi/Makefile.am b/gi/Makefile.am
index 319f2ce..9a8b7ec 100644
--- a/gi/Makefile.am
+++ b/gi/Makefile.am
@@ -121,17 +121,22 @@ _gi_la_SOURCES = \
        pygi-hashtable.c \
        pygi-hashtable.h
 _gi_la_CFLAGS = \
+       $(CODE_COVERAGE_CFLAGS) \
+       $(WARN_CFLAGS) \
        $(extension_cppflags) \
        $(GLIB_CFLAGS) \
        $(GI_CFLAGS)
 _gi_la_CPPFLAGS = \
+       $(CODE_COVERAGE_CPPFLAGS) \
        $(extension_cppflags)
 _gi_la_LIBADD = \
+       $(CODE_COVERAGE_LIBS) \
        $(extension_libadd) \
        $(GLIB_LIBS) \
        $(GI_LIBS) \
        $(FFI_LIBS)
 _gi_la_LDFLAGS = \
+       $(WARN_LDFLAGS) \
        $(extension_ldflags) \
        -export-symbols-regex "init_gi|PyInit__gi"
 
@@ -142,17 +147,22 @@ endif
 _gi_cairo_la_SOURCES = \
        pygi-foreign-cairo.c
 _gi_cairo_la_CFLAGS = \
+       $(CODE_COVERAGE_CFLAGS) \
+       $(WARN_CFLAGS) \
        $(GI_CFLAGS) \
        $(CAIRO_CFLAGS) \
        $(PYCAIRO_CFLAGS)
 _gi_cairo_la_CPPFLAGS = \
+       $(CODE_COVERAGE_CPPFLAGS) \
        $(extension_cppflags)
 _gi_cairo_la_LIBADD = \
+       $(CODE_COVERAGE_LIBS) \
        $(extension_libadd) \
        $(GI_LIBS) \
        $(CAIRO_LIBS) \
        $(PYCAIRO_LIBS)
 _gi_cairo_la_LDFLAGS = \
+       $(WARN_LDFLAGS) \
        $(extension_ldflags) \
        -export-symbols-regex "init_gi_cairo|PyInit__gi_cairo"
 
diff --git a/gi/_gobject/Makefile.am b/gi/_gobject/Makefile.am
index 37068b8..312b17d 100644
--- a/gi/_gobject/Makefile.am
+++ b/gi/_gobject/Makefile.am
@@ -1,6 +1,3 @@
-AUTOMAKE_OPTIONS = 1.7
-PLATFORM_VERSION = 3.0
-
 pygobjectdir = $(pyexecdir)/gi/_gobject
 
 pygobject_PYTHON = \
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 3c907f1..8f352bb 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -10,6 +10,7 @@ dist_libgimarshallingtests_la_SOURCES = \
        $(srcdir)/gimarshallingtestsextra.c \
        $(srcdir)/gimarshallingtestsextra.h
 
+# We don't control the source so don't pass WARN_CFLAGS etc
 libgimarshallingtests_la_CFLAGS = $(GLIB_CFLAGS)
 libgimarshallingtests_la_LDFLAGS = -module -avoid-version $(GLIB_LIBS) -no-undefined
 
@@ -35,6 +36,7 @@ if ENABLE_CAIRO
 check_LTLIBRARIES += libregress.la
 test_typelibs += Regress-1.0.typelib
 nodist_libregress_la_SOURCES = $(GI_DATADIR)/tests/regress.c $(GI_DATADIR)/tests/regress.h
+# We don't control the source so don't pass WARN_CFLAGS etc
 libregress_la_CFLAGS = $(GIO_CFLAGS) $(CAIRO_CFLAGS)
 libregress_la_LDFLAGS = -module -avoid-version $(GIO_LIBS) $(CAIRO_LIBS) -no-undefined
 
@@ -63,9 +65,10 @@ CLEANFILES += Regress-1.0.gir Regress-1.0.typelib GIMarshallingTests-1.0.gir GIM
 
 check_LTLIBRARIES += testhelper.la
 
-testhelper_la_CFLAGS = -I$(top_srcdir)/gi $(PYTHON_INCLUDES) $(GLIB_CFLAGS)
-testhelper_la_LDFLAGS = -module -avoid-version -no-undefined $(PYTHON_LIBS)
-testhelper_la_LIBADD = $(GLIB_LIBS)
+testhelper_la_CFLAGS = $(CODE_COVERAGE_CFLAGS) $(WARN_CFLAGS) -I$(top_srcdir)/gi $(PYTHON_INCLUDES) 
$(GLIB_CFLAGS)
+testhelper_la_CPPFLAGS = $(CODE_COVERAGE_CPPFLAGS)
+testhelper_la_LDFLAGS = $(WARN_LDFLAGS) -module -avoid-version -no-undefined $(PYTHON_LIBS)
+testhelper_la_LIBADD = $(CODE_COVERAGE_LIBS) $(GLIB_LIBS)
 testhelper_la_SOURCES = \
        testhelpermodule.c \
        test-floating.c \


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