Commit 0388646b authored by Philip Withnall's avatar Philip Withnall Committed by Olivier Crête

build: Add GObject introspection support

This bumps our autoconf requirement to 2.62 (from 2.59c) and disables
automake portability warnings.

It does not introduce a hard dependency on gobject-introspection; but if
available, it requires version 1.30.0. Support can be enabled with
--enable-introspection, and is required to make distcheck.

The generated introspection file has not been checked thoroughly, and
may expose internal symbols. A lot of new annotations are needed to make
many of the symbols usable.
parent 9981969d
......@@ -66,6 +66,8 @@ agent/test-fallback
agent/test-fullmode
agent/test-restart
agent/test-thread
agent/Nice-*.gir
agent/Nice-*.typelib
# stun/ stuff
......
......@@ -21,7 +21,7 @@ SUBDIRS = \
tests \
examples
DISTCHECK_CONFIGURE_FLAGS = --disable-assert -enable-gtk-doc
DISTCHECK_CONFIGURE_FLAGS = --disable-assert -enable-gtk-doc --enable-introspection
EXTRA_DIST = \
COPYING.LGPL \
......@@ -31,7 +31,8 @@ EXTRA_DIST = \
scripts/lcov.mk \
scripts/lcov.sh \
scripts/valgrind.sh \
win32
win32 \
m4/introspection.m4
MAINTAINERCLEANFILES = ar-lib
......
......@@ -57,7 +57,10 @@ libagent_la_SOURCES = \
libagent_la_LIBADD = \
$(top_builddir)/random/libnice-random.la \
$(top_builddir)/socket/libsocket.la \
$(top_builddir)/stun/libstun.la
$(top_builddir)/stun/libstun.la \
$(GLIB_LIBS) \
$(GUPNP_LIBS) \
$(NULL)
libagent_la_DEPENDENCIES = \
$(top_builddir)/random/libnice-random.la \
$(top_builddir)/socket/libsocket.la \
......@@ -75,3 +78,33 @@ pkginclude_HEADERS = \
if WINDOWS
libagent_la_LIBADD += -liphlpapi -lws2_32
endif
#
# GObject introspection
#
# We need --accept-unprefixed because of PseudoTcp and TurnServer.
#
-include $(INTROSPECTION_MAKEFILE)
INTROSPECTION_GIRS =
INTROSPECTION_SCANNER_ARGS = --add-include-path=$(srcdir) --warn-all --accept-unprefixed
INTROSPECTION_COMPILER_ARGS = --includedir=$(srcdir)
if HAVE_INTROSPECTION
introspection_sources = $(pkginclude_HEADERS)
Nice-0.0.gir: libagent.la
Nice_0_0_gir_INCLUDES = GObject-2.0 Gio-2.0
Nice_0_0_gir_EXPORT_PACKAGES = nice
Nice_0_0_gir_CFLAGS = $(AM_CFLAGS)
Nice_0_0_gir_LIBS = libagent.la
Nice_0_0_gir_FILES = $(introspection_sources)
INTROSPECTION_GIRS += Nice-0.0.gir
girdir = $(datadir)/gir-1.0
gir_DATA = $(INTROSPECTION_GIRS)
typelibdir = $(libdir)/girepository-1.0
typelib_DATA = $(INTROSPECTION_GIRS:.gir=.typelib)
CLEANFILES += $(gir_DATA) $(typelib_DATA)
endif
AC_PREREQ(2.59c)
AC_PREREQ(2.62)
dnl Always compile with -Wall; if --enable-compile-warnings=error is passed,
dnl also use -Werror. git and pre-releases default to -Werror
......@@ -12,7 +12,7 @@ AC_CANONICAL_TARGET
AC_CONFIG_SRCDIR([agent/agent.c])
AC_CONFIG_HEADERS([config.h])
AM_INIT_AUTOMAKE([1.12 -Wall])
AM_INIT_AUTOMAKE([1.12 -Wall -Wno-portability])
AC_CONFIG_FILES([
Makefile
......@@ -314,6 +314,10 @@ GTK_DOC_CHECK(1.9)
],[
AM_CONDITIONAL([ENABLE_GTK_DOC], false)
])
# GObject introspection
GOBJECT_INTROSPECTION_CHECK([1.30.0])
AC_CONFIG_MACRO_DIR(m4)
AC_OUTPUT
......
dnl -*- mode: autoconf -*-
dnl Copyright 2009 Johan Dahlin
dnl
dnl This file is free software; the author(s) gives unlimited
dnl permission to copy and/or distribute it, with or without
dnl modifications, as long as this notice is preserved.
dnl
# serial 1
m4_define([_GOBJECT_INTROSPECTION_CHECK_INTERNAL],
[
AC_BEFORE([AC_PROG_LIBTOOL],[$0])dnl setup libtool first
AC_BEFORE([AM_PROG_LIBTOOL],[$0])dnl setup libtool first
AC_BEFORE([LT_INIT],[$0])dnl setup libtool first
dnl enable/disable introspection
m4_if([$2], [require],
[dnl
enable_introspection=yes
],[dnl
AC_ARG_ENABLE(introspection,
AS_HELP_STRING([--enable-introspection[=@<:@no/auto/yes@:>@]],
[Enable introspection for this build]),,
[enable_introspection=auto])
])dnl
AC_MSG_CHECKING([for gobject-introspection])
dnl presence/version checking
AS_CASE([$enable_introspection],
[no], [dnl
found_introspection="no (disabled, use --enable-introspection to enable)"
],dnl
[yes],[dnl
PKG_CHECK_EXISTS([gobject-introspection-1.0],,
AC_MSG_ERROR([gobject-introspection-1.0 is not installed]))
PKG_CHECK_EXISTS([gobject-introspection-1.0 >= $1],
found_introspection=yes,
AC_MSG_ERROR([You need to have gobject-introspection >= $1 installed to build AC_PACKAGE_NAME]))
],dnl
[auto],[dnl
PKG_CHECK_EXISTS([gobject-introspection-1.0 >= $1], found_introspection=yes, found_introspection=no)
dnl Canonicalize enable_introspection
enable_introspection=$found_introspection
],dnl
[dnl
AC_MSG_ERROR([invalid argument passed to --enable-introspection, should be one of @<:@no/auto/yes@:>@])
])dnl
AC_MSG_RESULT([$found_introspection])
INTROSPECTION_SCANNER=
INTROSPECTION_COMPILER=
INTROSPECTION_GENERATE=
INTROSPECTION_GIRDIR=
INTROSPECTION_TYPELIBDIR=
if test "x$found_introspection" = "xyes"; then
INTROSPECTION_SCANNER=`$PKG_CONFIG --variable=g_ir_scanner gobject-introspection-1.0`
INTROSPECTION_COMPILER=`$PKG_CONFIG --variable=g_ir_compiler gobject-introspection-1.0`
INTROSPECTION_GENERATE=`$PKG_CONFIG --variable=g_ir_generate gobject-introspection-1.0`
INTROSPECTION_GIRDIR=`$PKG_CONFIG --variable=girdir gobject-introspection-1.0`
INTROSPECTION_TYPELIBDIR="$($PKG_CONFIG --variable=typelibdir gobject-introspection-1.0)"
INTROSPECTION_CFLAGS=`$PKG_CONFIG --cflags gobject-introspection-1.0`
INTROSPECTION_LIBS=`$PKG_CONFIG --libs gobject-introspection-1.0`
INTROSPECTION_MAKEFILE=`$PKG_CONFIG --variable=datadir gobject-introspection-1.0`/gobject-introspection-1.0/Makefile.introspection
fi
AC_SUBST(INTROSPECTION_SCANNER)
AC_SUBST(INTROSPECTION_COMPILER)
AC_SUBST(INTROSPECTION_GENERATE)
AC_SUBST(INTROSPECTION_GIRDIR)
AC_SUBST(INTROSPECTION_TYPELIBDIR)
AC_SUBST(INTROSPECTION_CFLAGS)
AC_SUBST(INTROSPECTION_LIBS)
AC_SUBST(INTROSPECTION_MAKEFILE)
AM_CONDITIONAL(HAVE_INTROSPECTION, test "x$found_introspection" = "xyes")
])
dnl Usage:
dnl GOBJECT_INTROSPECTION_CHECK([minimum-g-i-version])
AC_DEFUN([GOBJECT_INTROSPECTION_CHECK],
[
_GOBJECT_INTROSPECTION_CHECK_INTERNAL([$1])
])
dnl Usage:
dnl GOBJECT_INTROSPECTION_REQUIRE([minimum-g-i-version])
AC_DEFUN([GOBJECT_INTROSPECTION_REQUIRE],
[
_GOBJECT_INTROSPECTION_CHECK_INTERNAL([$1], [require])
])
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment