gir-repository r292 - in trunk: . m4



Author: johan
Date: Mon Feb  9 22:12:42 2009
New Revision: 292
URL: http://svn.gnome.org/viewvc/gir-repository?rev=292&view=rev

Log:
2009-02-09  Johan Dahlin  <jdahlin async com br>

    * configure.ac:
    * m4/introspection.m4:
    Add a m4 macro and use it in configure.




Added:
   trunk/m4/
   trunk/m4/introspection.m4
Modified:
   trunk/ChangeLog
   trunk/configure.ac

Modified: trunk/configure.ac
==============================================================================
--- trunk/configure.ac	(original)
+++ trunk/configure.ac	Mon Feb  9 22:12:42 2009
@@ -10,23 +10,15 @@
 AC_PREREQ(2.59)
 AC_INIT(gir-repository, gr_version,
         http://bugzilla.gnome.org/enter_bug.cgi?product=glib&component=introspection)
+AC_SUBST(ACLOCAL_AMFLAGS, "-I m4 -I .")
 AM_INIT_AUTOMAKE([-Wno-portability])
 AM_MAINTAINER_MODE
 AC_PROG_LIBTOOL
 AC_CONFIG_HEADER([config.h])
+AC_CONFIG_MACRO_DIR([m4])
 
-# GObject Introspection, required
-PKG_CHECK_MODULES(GOBJECT_INTROSPECTION, [gobject-introspection-1.0 >= 0.6.1])
-G_IR_SCANNER=`$PKG_CONFIG --variable=g_ir_scanner gobject-introspection-1.0`
-AC_SUBST(G_IR_SCANNER)
-G_IR_COMPILER=`$PKG_CONFIG --variable=g_ir_compiler gobject-introspection-1.0`
-AC_SUBST(G_IR_COMPILER)
-G_IR_GENERATE=`$PKG_CONFIG --variable=g_ir_generate gobject-introspection-1.0`
-AC_SUBST(G_IR_GENERATE)
-GIRDIR=`$PKG_CONFIG --variable=girdir gobject-introspection-1.0`
-AC_SUBST(GIRDIR)
-TYPELIBDIR="$($PKG_CONFIG --variable=typelibdir gobject-introspection-1.0)"
-AC_SUBST(TYPELIBDIR)
+# GObject Introspection
+GOBJECT_INTROSPECTION_REQUIRE(0.6.3)
 
 dnl dbus
 PKG_CHECK_MODULES(DBUS, dbus-glib-1,

Added: trunk/m4/introspection.m4
==============================================================================
--- (empty file)
+++ trunk/m4/introspection.m4	Mon Feb  9 22:12:42 2009
@@ -0,0 +1,69 @@
+dnl -*- mode: autoconf -*-
+
+# serial 1
+
+dnl Usage:
+dnl   GOBJECT_INTROSPECTION_CHECK([minimum-g-i-version])
+
+AC_DEFUN([GOBJECT_INTROSPECTION_CHECK],
+[
+  AC_BEFORE([AC_PROG_LIBTOOL],[$0])dnl setup libtool first
+  AC_BEFORE([AM_PROG_LIBTOOL],[$0])dnl setup libtool first
+
+  dnl enable/disable introspection
+  if test x$2 = xrequire; then
+     default=yes
+  else
+     default=no
+  fi
+
+  AC_ARG_ENABLE([introspection],
+    AS_HELP_STRING([--enable-introspection],
+                   [enable introspection for this build [[default=$default]]]),,
+    [enable_introspection=yes])
+
+  AC_MSG_CHECKING([for gobject-introspection])
+
+  if test x$2 = xrequire -a x$enable_introspection = xno; then
+     AC_MSG_ERROR([introspection is required, cannot be disabled])
+  fi
+
+  dnl presence/version checking
+  if test x$enable_introspection = xyes; then
+    ifelse([$1],[],
+      [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],,
+                        AC_MSG_ERROR([You need to have gobject-introspection >= $1 installed to build AC_PACKAGE_NAME]))])
+  fi
+
+  AC_MSG_RESULT([$enable_introspection])
+
+  G_IR_SCANNER=
+  G_IR_COMPILER=
+  G_IR_GENERATE=
+  GIRDIR=
+  TYPELIBDIR=
+  if test x$enable_introspection = xyes; then
+     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`
+     TYPELIBDIR="$($PKG_CONFIG --variable=typelibdir gobject-introspection-1.0)"
+  fi
+  AC_SUBST(G_IR_SCANNER)
+  AC_SUBST(G_IR_COMPILER)
+  AC_SUBST(G_IR_GENERATE)
+  AC_SUBST(GIRDIR)
+  AC_SUBST(TYPELIBDIR)
+
+  AM_CONDITIONAL([HAVE_INTROSPECTION], [test x$enable_introspection = xyes])
+])
+
+dnl Usage:
+dnl   GOBJECT_INTROSPECTION_REQUIRE([minimum-g-i-version])
+
+AC_DEFUN([GOBJECT_INTROSPECTION_REQUIRE],
+[
+  GOBJECT_INTROSPECTION_CHECK([$1], [require])
+])



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