From 6c27418ab4040c48fae21fdad336398b326a1730 Mon Sep 17 00:00:00 2001 From: Gergely Polonkai Date: Thu, 10 Mar 2016 20:20:52 +0100 Subject: [PATCH] Update configure.ac * Find Vala * Remove Python related checks * Some minor refactoring --- configure.ac | 90 ++++++++++++++++++++-------------------------------- m4/valac.m4 | 76 ++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 111 insertions(+), 55 deletions(-) create mode 100644 m4/valac.m4 diff --git a/configure.ac b/configure.ac index c077915..72f964e 100644 --- a/configure.ac +++ b/configure.ac @@ -1,48 +1,49 @@ -AC_PREREQ([2.60]) +# Process this file with autoconf to produce a configure script -# Making releases: -# set the new version number: -# odd minor -> development series -# even minor -> stable series -# increment micro for each release within a series -# set nano_version to 0 -# make the release, tag it -# set nano_version to 1 +### Version numbers -m4_define([matrix_major_version], [0]) -m4_define([matrix_minor_version], [0]) -m4_define([matrix_micro_version], [0]) -m4_define([matrix_nano_version], [1]) +# Release Versions +m4_define([tp_matrix_major_version], [0]) +m4_define([tp_matrix_minor_version], [0]) +m4_define([tp_matrix_micro_version], [0]) +m4_define([tp_matrix_nano_version], [1]) -m4_define([matrix_base_version], - [matrix_major_version.matrix_minor_version.matrix_micro_version]) -m4_define([matrix_version], - [m4_if(matrix_nano_version, 0, - [matrix_base_version], - [matrix_base_version].[matrix_nano_version])]) +m4_define([tp_matrix_base_version], + [tp_matrix_major_version.tp_matrix_minor_version.tp_matrix_micro_version]) +m4_define([tp_matrix_version], + [m4_if(tp_matrix_nano_version, 0, + [tp_matrix_base_version], + [tp_matrix_base_version].[tp_matrix_nano_version])]) -AC_INIT([telepathy-matrix], [matrix_version]) +### Setup -AC_CONFIG_MACRO_DIR([m4]) -AC_CONFIG_AUX_DIR([build-aux]) +# Initialise autoconf with project details, version +AC_INIT([telepathy-matrix], matrix_version, + [gergely@polonkai.eu], [telepathy-matrix]) # Enable silent build rules by default, requires at least # Automake-1.11. Disable by either passing --disable-silent-rules to # configure or passing V=1 to make m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])]) -AM_INIT_AUTOMAKE([1.9 -Wno-portability subdir-objects]) +AC_PREREQ([2.60]) -AM_PROG_LIBTOOL +AC_CONFIG_MACRO_DIR([m4]) AM_CONFIG_HEADER(config.h) -AC_PROG_MKDIR_P +AC_CONFIG_AUX_DIR([build-aux]) +AM_INIT_AUTOMAKE([1.9 -Wno-portability subdir-objects]) dnl check for tools AC_PROG_CC AC_PROG_CC_STDC +AM_PROG_LIBTOOL +AC_PROG_MKDIR_P AM_PROG_AS -AS_IF([test matrix_nano_version = 0], +VALAC_CHECK + + +AS_IF([test tp_matrix_nano_version = 0], [ # version x.y.z - "official release", # disable extra checks by default AC_ARG_ENABLE([fatal-warnings], @@ -104,26 +105,6 @@ AC_CHECK_PROGS([XSLTPROC], [xsltproc]) AS_IF([test -z "$XSLTPROC"], [AC_MSG_ERROR([xsltproc (from the libxslt source package) is required])]) -AM_PATH_PYTHON([2.3]) - -dnl check for a version of python that can run the twisted tests -AC_MSG_CHECKING([for Python with Twisted and IRC protocol support]) -for TEST_PYTHON in python2.5 python2.6 python; do - AS_IF([$TEST_PYTHON -c "from sys import version_info; import dbus, dbus.mainloop.glib; raise SystemExit(version_info < (2, 5, 0, 'final', 0))" >/dev/null 2>&1], - [ - AS_IF([$TEST_PYTHON -c "import twisted.words.protocols.irc, twisted.internet.reactor" >/dev/null 2>&1], - [ - AM_CONDITIONAL([WANT_TWISTED_TESTS], [true]) - break - ], - [TEST_PYTHON=no]) - ]) -done -AC_MSG_RESULT([$TEST_PYTHON]) -AC_SUBST(TEST_PYTHON) -AM_CONDITIONAL([WANT_TWISTED_TESTS], test xno != x$TEST_PYTHON) - - AS_AC_EXPAND(DATADIR, $datadir) DBUS_SERVICES_DIR="$DATADIR/dbus-1/services" AC_SUBST(DBUS_SERVICES_DIR) @@ -131,12 +112,11 @@ AC_DEFINE_UNQUOTED(DBUS_SERVICES_DIR, "$DBUS_SERVICES_DIR", [DBus services direc AC_CHECK_FUNCS(strnlen) -AC_OUTPUT( Makefile \ - data/Makefile \ - m4/Makefile \ - src/Makefile \ -dnl tests/Makefile \ -dnl tests/twisted/Makefile \ -dnl tests/twisted/tools/Makefile \ - tools/Makefile \ -) +AC_CONFIG_FILES([ + Makefile + data/Makefile + m4/Makefile + src/Makefile + tools/Makefile +]) +AC_OUTPUT diff --git a/m4/valac.m4 b/m4/valac.m4 new file mode 100644 index 0000000..f889bef --- /dev/null +++ b/m4/valac.m4 @@ -0,0 +1,76 @@ +dnl vapigen.m4 +dnl +dnl Copyright 2014 Daniel Espinosa +dnl +dnl This library is free software; you can redistribute it and/or +dnl modify it under the terms of the GNU Lesser General Public +dnl License as published by the Free Software Foundation; either +dnl version 2.1 of the License, or (at your option) any later version. +dnl +dnl This library is distributed in the hope that it will be useful, +dnl but WITHOUT ANY WARRANTY; without even the implied warranty of +dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +dnl Lesser General Public License for more details. +dnl +dnl You should have received a copy of the GNU Lesser General Public +dnl License along with this library; if not, write to the Free Software +dnl Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +# VALAC_CHECK([VERSION], [API_VERSION]) +# -------------------------------------- +# Check valac existence and version. +m4_define([_VALAC_CHECK_INTERNAL], +[ + AC_REQUIRE([PKG_PROG_PKG_CONFIG]) + AS_IF([ test "x$2" = "x" ], [ + AM_PROG_VALAC($1) + AS_IF([ test "x$VALAC" = "xno"], [ + check_prog=no + AC_MSG_ERROR([valac is not installed]) + ], [ + check_prog=yes + VALAC_VERSION=`$VALAC --api-version` + VAPIDIR=$datadir/vala-$VALAC_VERSION/vapi + VAPIDIR_UNVERSIONED=$datadir/vala-$VALAC_VERSION/vapi + ]) + ], [ + AS_IF([ test "x$1" = "x"], [ + vala_pkg="libvala-$2" + ], [ + vala_pkg="libvala-$2 >= $1" + ]) + AC_MSG_CHECKING([for $vala_pkg]) + PKG_CHECK_EXISTS([ $vala_pkg ], [ + vala_pkg_found=yes + VAPIGEN=`$PKG_CONFIG --variable=vapigen libvala-$2` + VAPIGEN_MAKEFILE=`$PKG_CONFIG --variable=datadir libvala-$2`/vala/Makefile.vapigen + VAPIDIR=`$PKG_CONFIG --variable=vapidir libvala-$2` + GEN_INTROSPECT=`$PKG_CONFIG --variable=gen_introspect libvala-$2` + vala_datadir=`$PKG_CONFIG --variable=datadir libvala-$2` + VAPIDIR_UNVERSIONED=$vala_datadir/vala/vapi + VALA_GEN_INTROSPECT=`$PKG_CONFIG --variable=vala_gen_introspect libvala-$2` + ], [ + vala_pkg_found=no + AC_MSG_ERROR([no package libvala-$2 is installed]) + ]) + AC_MSG_RESULT([$vala_pkg_found]) + ]) + AC_SUBST([VAPIGEN]) + AC_SUBST([VAPIGEN_VAPIDIR]) + AC_SUBST([VAPIDIR]) + AC_SUBST([VAPIDIR_UNVERSIONED]) + AC_SUBST([VAPIGEN_MAKEFILE]) + AC_SUBST([GEN_INTROSPECT]) + AC_SUBST([VALA_GEN_INTROSPECT]) + AC_SUBST([VALAC_VERSION]) +]) + +dnl Check VAPIGEN +# VALAC_CHECK([VERSION], [API_VERSION], [DEFAULT]) +# -------------------------------------- +# Check vapigen existence and version. +AC_DEFUN([VALAC_CHECK], +[ + _VALAC_CHECK_INTERNAL($1,$2,$3) +] +)