gir-repository r295 - trunk/m4



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

Log:
New version; Proper quoting, only add introspection when require isn't used, do a bit more using m4

Modified:
   trunk/m4/introspection.m4

Modified: trunk/m4/introspection.m4
==============================================================================
--- trunk/m4/introspection.m4	(original)
+++ trunk/m4/introspection.m4	Mon Feb  9 22:58:55 2009
@@ -7,57 +7,60 @@
 
 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
+    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)
+    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
+        enable_introspection="no (disabled, use --enable-introspection to enable)"
+    ],dnl
+    [yes|auto],[dnl
+      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],
+                          enable_introspection=yes,
+                          AC_MSG_ERROR([You need to have gobject-introspection >= $1 installed to build AC_PACKAGE_NAME]))])
+    ],dnl
+    [dnl	
+         AC_MSG_ERROR([invalid argument passed to --enable-introspection, should be one of @<:@no/auto/yes@:>@])
+    ])dnl
+
+    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])
+    AM_CONDITIONAL(HAVE_INTROSPECTION, test "x$enable_introspection" = "xyes")
 ])
 
 dnl Usage:



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