Blame common/m4/introspection.m4

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