diff options
author | Xan Lopez <xan@gnome.org> | 2009-12-26 01:55:48 +0800 |
---|---|---|
committer | Xan Lopez <xan@gnome.org> | 2009-12-26 02:25:11 +0800 |
commit | 5ed79e7e20e53a2aa2e3ace40ebbb13584c09f2a (patch) | |
tree | ce80d20269c776e8231bdd37eccf2bb52e3143cb | |
parent | 0b844bedb99264ae3699fb6a6aafa5e716b8c5ac (diff) | |
download | gsoc2013-epiphany-5ed79e7e20e53a2aa2e3ace40ebbb13584c09f2a.tar.gz gsoc2013-epiphany-5ed79e7e20e53a2aa2e3ace40ebbb13584c09f2a.tar.zst gsoc2013-epiphany-5ed79e7e20e53a2aa2e3ace40ebbb13584c09f2a.zip |
Use introspection.m4 file to detect introspection support
-rw-r--r-- | configure.ac | 40 | ||||
-rw-r--r-- | m4/introspection.m4 | 94 | ||||
-rw-r--r-- | src/Makefile.am | 14 |
3 files changed, 108 insertions, 40 deletions
diff --git a/configure.ac b/configure.ac index f93880cfa..13423f04f 100644 --- a/configure.ac +++ b/configure.ac @@ -215,40 +215,14 @@ EPIPHANY_FEATURES= # GObject Introspection # ********************* -AC_MSG_CHECKING([whether to enable GObject introspection support]) -AC_ARG_ENABLE([introspection], - [AS_HELP_STRING([--enable-introspection],[Enable GObject introspection (default: disabled)])], - [],[enable_introspection=no]) -AC_MSG_RESULT([$enable_introspection]) - -G_IR_SCANNER= -G_IR_COMPILER= -G_IR_GENERATE= -GIRDIR= -GIRTYPELIBDIR= - -if test "$enable_introspection" = "yes"; then - EPIPHANY_FEATURES="$EPIPHANY_FEATURES introspection" - - GOBJECT_INTROSPECTION_REQUIRED=0.6.2 - PKG_CHECK_MODULES([INTROSPECTION],[gobject-introspection-1.0 >= $GOBJECT_INTROSPECTION_REQUIRED]) - - G_IR_SCANNER="$($PKG_CONFIG --variable=g_ir_scanner gobject-introspection-1.0)" - G_IR_COMPILER="$($PKG_CONFIG --variable=g_ir_compiler gobject-introspection-1.0)" - G_IR_GENERATE="$($PKG_CONFIG --variable=g_ir_generate gobject-introspection-1.0)" - GIRDIR="$($PKG_CONFIG --variable=girdir gobject-introspection-1.0)" - GIRTYPELIBDIR="$($PKG_CONFIG --variable=typelibdir gobject-introspection-1.0)" +GOBJECT_INTROSPECTION_CHECK([0.6.7]) - AC_DEFINE([ENABLE_INTROSPECTION],[1],[Define to enable GObject introspection support]) +if test "$found_introspection" = "yes"; then + EPIPHANY_FEATURES="$EPIPHANY_FEATURES introspection" + AC_DEFINE([ENABLE_INTROSPECTION], [1], [Define to enable introspection support]) fi -AC_SUBST([G_IR_SCANNER]) -AC_SUBST([G_IR_COMPILER]) -AC_SUBST([G_IR_GENERATE]) -AC_SUBST([GIRDIR]) -AC_SUBST([GIRTYPELIBDIR]) - -AM_CONDITIONAL([ENABLE_INTROSPECTION],[test "$enable_introspection" = "yes"]) +AC_SUBST([EPIPHANY_FEATURES]) # **** # Seed @@ -260,7 +234,7 @@ AC_ARG_ENABLE([seed], [],[enable_seed=no]) AC_MSG_RESULT([$enable_seed]) -if test "$enable_seed" = "yes" -a "$enable_introspection" != "yes"; then +if test "$enable_seed" = "yes" -a "$found_introspection" != "yes"; then AC_MSG_ERROR([GObject introspection support must be enabled for Seed]) fi @@ -491,7 +465,7 @@ Epiphany was configured with the following options: Zeroconf bookmarks support : $enable_zeroconf NetworkManager support : $enable_network_manager - GObject introspection : $enable_introspection + GObject introspection : $found_introspection Seed support : $enable_seed NSS support : $enable_nss Build tests : $enable_tests diff --git a/m4/introspection.m4 b/m4/introspection.m4 new file mode 100644 index 000000000..589721c5a --- /dev/null +++ b/m4/introspection.m4 @@ -0,0 +1,94 @@ +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 + [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]) +]) diff --git a/src/Makefile.am b/src/Makefile.am index 2ba6f2392..725db9f3f 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -170,7 +170,7 @@ epiphany_LDADD = \ $(DBUS_LIBS) \ $(LIBINTL) -if ENABLE_INTROSPECTION +if HAVE_INTROSPECTION epiphany_CFLAGS += $(INTROSPECTION_CFLAGS) epiphany_LDADD += $(INTROSPECTION_LIBS) endif @@ -266,7 +266,7 @@ CLEANFILES = $(stamp_files) $(BUILT_SOURCES) DISTCLEANFILES = $(stamp_files) $(BUILT_SOURCES) MAINTAINERCLEANFILES = $(stamp_files) $(BUILT_SOURCES) -if ENABLE_INTROSPECTION +if HAVE_INTROSPECTION EPHY_GIR_H_FILES = \ $(top_srcdir)/embed/ephy-embed.h \ $(top_srcdir)/embed/ephy-embed-container.h \ @@ -335,10 +335,10 @@ EPHY_GIR_C_FILES = \ $(top_srcdir)/src/ephy-window.c \ $(NULL) -Epiphany-$(EPIPHANY_API_VERSION).gir: $(G_IR_SCANNER) $(EPHY_GIR_H_FILES) \ +Epiphany-$(EPIPHANY_API_VERSION).gir: $(INTROSPECTION_SCANNER) $(EPHY_GIR_H_FILES) \ $(EPHY_GIR_C_FILES) epiphany $(AM_V_GEN) PKG_CONFIG_PATH=$(top_builddir)/data:$$PKG_CONFIG_PATH \ - $(G_IR_SCANNER) -v \ + $(INTROSPECTION_SCANNER) -v \ --namespace Epiphany \ --nsversion=$(EPIPHANY_API_VERSION) \ --add-include-path=. \ @@ -364,10 +364,10 @@ gir_DATA = Epiphany-$(EPIPHANY_API_VERSION).gir typelibsdir = $(GIRTYPELIBDIR) typelibs_DATA = Epiphany-$(EPIPHANY_API_VERSION).typelib -Epiphany-$(EPIPHANY_API_VERSION).typelib: Epiphany-$(EPIPHANY_API_VERSION).gir $(G_IR_COMPILER) - $(AM_V_GEN) g-ir-compiler Epiphany-$(EPIPHANY_API_VERSION).gir -o Epiphany-$(EPIPHANY_API_VERSION).typelib +Epiphany-$(EPIPHANY_API_VERSION).typelib: Epiphany-$(EPIPHANY_API_VERSION).gir $(INTROSPECTION_COMPILER) + $(AM_V_GEN) $(INTROSPECTION_COMPILER) Epiphany-$(EPIPHANY_API_VERSION).gir -o Epiphany-$(EPIPHANY_API_VERSION).typelib EXTRA_DIST += Epiphany-$(EPIPHANY_API_VERSION).gir CLEANFILES += $(gir_DATA) $(typelibs_DATA) -endif # ENABLE_INTROSPECTION +endif # HAVE_INTROSPECTION |