Blame build/m4/introspection.m4

Packit b00eeb
dnl -*- mode: autoconf -*-
Packit b00eeb
dnl Copyright 2009 Johan Dahlin
Packit b00eeb
dnl
Packit b00eeb
dnl This file is free software; the author(s) gives unlimited
Packit b00eeb
dnl permission to copy and/or distribute it, with or without
Packit b00eeb
dnl modifications, as long as this notice is preserved.
Packit b00eeb
dnl
Packit b00eeb
Packit b00eeb
# serial 1
Packit b00eeb
Packit b00eeb
m4_define([_GOBJECT_INTROSPECTION_CHECK_INTERNAL],
Packit b00eeb
[
Packit b00eeb
    AC_BEFORE([AC_PROG_LIBTOOL],[$0])dnl setup libtool first
Packit b00eeb
    AC_BEFORE([AM_PROG_LIBTOOL],[$0])dnl setup libtool first
Packit b00eeb
    AC_BEFORE([LT_INIT],[$0])dnl setup libtool first
Packit b00eeb
Packit b00eeb
    dnl enable/disable introspection
Packit b00eeb
    m4_if([$2], [require],
Packit b00eeb
    [dnl
Packit b00eeb
        enable_introspection=yes
Packit b00eeb
    ],[dnl
Packit b00eeb
        AC_ARG_ENABLE(introspection,
Packit b00eeb
                  AS_HELP_STRING([--enable-introspection[=@<:@no/auto/yes@:>@]],
Packit b00eeb
                                 [Enable introspection for this build]),, 
Packit b00eeb
                                 [enable_introspection=auto])
Packit b00eeb
    ])dnl
Packit b00eeb
Packit b00eeb
    AC_MSG_CHECKING([for gobject-introspection])
Packit b00eeb
Packit b00eeb
    dnl presence/version checking
Packit b00eeb
    AS_CASE([$enable_introspection],
Packit b00eeb
    [no], [dnl
Packit b00eeb
        found_introspection="no (disabled, use --enable-introspection to enable)"
Packit b00eeb
    ],dnl
Packit b00eeb
    [yes],[dnl
Packit b00eeb
        PKG_CHECK_EXISTS([gobject-introspection-1.0],,
Packit b00eeb
                         AC_MSG_ERROR([gobject-introspection-1.0 is not installed]))
Packit b00eeb
        PKG_CHECK_EXISTS([gobject-introspection-1.0 >= $1],
Packit b00eeb
                         found_introspection=yes,
Packit b00eeb
                         AC_MSG_ERROR([You need to have gobject-introspection >= $1 installed to build AC_PACKAGE_NAME]))
Packit b00eeb
    ],dnl
Packit b00eeb
    [auto],[dnl
Packit b00eeb
        PKG_CHECK_EXISTS([gobject-introspection-1.0 >= $1], found_introspection=yes, found_introspection=no)
Packit b00eeb
	dnl Canonicalize enable_introspection
Packit b00eeb
	enable_introspection=$found_introspection
Packit b00eeb
    ],dnl
Packit b00eeb
    [dnl	
Packit b00eeb
        AC_MSG_ERROR([invalid argument passed to --enable-introspection, should be one of @<:@no/auto/yes@:>@])
Packit b00eeb
    ])dnl
Packit b00eeb
Packit b00eeb
    AC_MSG_RESULT([$found_introspection])
Packit b00eeb
Packit b00eeb
    INTROSPECTION_SCANNER=
Packit b00eeb
    INTROSPECTION_COMPILER=
Packit b00eeb
    INTROSPECTION_GENERATE=
Packit b00eeb
    INTROSPECTION_GIRDIR=
Packit b00eeb
    INTROSPECTION_TYPELIBDIR=
Packit b00eeb
    if test "x$found_introspection" = "xyes"; then
Packit b00eeb
       INTROSPECTION_SCANNER=`$PKG_CONFIG --variable=g_ir_scanner gobject-introspection-1.0`
Packit b00eeb
       INTROSPECTION_COMPILER=`$PKG_CONFIG --variable=g_ir_compiler gobject-introspection-1.0`
Packit b00eeb
       INTROSPECTION_GENERATE=`$PKG_CONFIG --variable=g_ir_generate gobject-introspection-1.0`
Packit b00eeb
       INTROSPECTION_GIRDIR=`$PKG_CONFIG --variable=girdir gobject-introspection-1.0`
Packit b00eeb
       INTROSPECTION_TYPELIBDIR="$($PKG_CONFIG --variable=typelibdir gobject-introspection-1.0)"
Packit b00eeb
       INTROSPECTION_CFLAGS=`$PKG_CONFIG --cflags gobject-introspection-1.0`
Packit b00eeb
       INTROSPECTION_LIBS=`$PKG_CONFIG --libs gobject-introspection-1.0`
Packit b00eeb
       INTROSPECTION_MAKEFILE=`$PKG_CONFIG --variable=datadir gobject-introspection-1.0`/gobject-introspection-1.0/Makefile.introspection
Packit b00eeb
    fi
Packit b00eeb
    AC_SUBST(INTROSPECTION_SCANNER)
Packit b00eeb
    AC_SUBST(INTROSPECTION_COMPILER)
Packit b00eeb
    AC_SUBST(INTROSPECTION_GENERATE)
Packit b00eeb
    AC_SUBST(INTROSPECTION_GIRDIR)
Packit b00eeb
    AC_SUBST(INTROSPECTION_TYPELIBDIR)
Packit b00eeb
    AC_SUBST(INTROSPECTION_CFLAGS)
Packit b00eeb
    AC_SUBST(INTROSPECTION_LIBS)
Packit b00eeb
    AC_SUBST(INTROSPECTION_MAKEFILE)
Packit b00eeb
Packit b00eeb
    AM_CONDITIONAL(HAVE_INTROSPECTION, test "x$found_introspection" = "xyes")
Packit b00eeb
])
Packit b00eeb
Packit b00eeb
Packit b00eeb
dnl Usage:
Packit b00eeb
dnl   GOBJECT_INTROSPECTION_CHECK([minimum-g-i-version])
Packit b00eeb
Packit b00eeb
AC_DEFUN([GOBJECT_INTROSPECTION_CHECK],
Packit b00eeb
[
Packit b00eeb
  _GOBJECT_INTROSPECTION_CHECK_INTERNAL([$1])
Packit b00eeb
])
Packit b00eeb
Packit b00eeb
dnl Usage:
Packit b00eeb
dnl   GOBJECT_INTROSPECTION_REQUIRE([minimum-g-i-version])
Packit b00eeb
Packit b00eeb
Packit b00eeb
AC_DEFUN([GOBJECT_INTROSPECTION_REQUIRE],
Packit b00eeb
[
Packit b00eeb
  _GOBJECT_INTROSPECTION_CHECK_INTERNAL([$1], [require])
Packit b00eeb
])