Commit 593a69c0 authored by Luis Rodrigo Gallardo Cruz's avatar Luis Rodrigo Gallardo Cruz Committed by Luis Rodrigo Gallardo Cruz

Imported Upstream version 0.18.cvs20060518

parents
File added
John Harper <jsh@unfactored.org>
rep-gtk is heavily based on guile-gtk, by Marius Vollmer and others
Please report bugs to the mailing list <rep-gtk-list@lists.sourceforge.net>
(or alternatively, to my sourceforge account <jsh@users.sourceforge.net>,
but mailing list messages often get quicker responses)
This diff is collapsed.
This diff is collapsed.
Please send all patches to the rep-gtk mailing list:
<rep-gtk-list@lists.sourceforge.net>.
When possible, please make patches in unified diff format (i.e. `diff -u').
- John Harper <jsh@unfactored.org>
Basic Installation
==================
These are generic installation instructions.
The `configure' shell script attempts to guess correct values for
various system-dependent variables used during compilation. It uses
those values to create a `Makefile' in each directory of the package.
It may also create one or more `.h' files containing system-dependent
definitions. Finally, it creates a shell script `config.status' that
you can run in the future to recreate the current configuration, a file
`config.cache' that saves the results of its tests to speed up
reconfiguring, and a file `config.log' containing compiler output
(useful mainly for debugging `configure').
If you need to do unusual things to compile the package, please try
to figure out how `configure' could check whether to do them, and mail
diffs or instructions to the address given in the `README' so they can
be considered for the next release. If at some point `config.cache'
contains results you don't want to keep, you may remove or edit it.
The file `configure.in' is used to create `configure' by a program
called `autoconf'. You only need `configure.in' if you want to change
it or regenerate `configure' using a newer version of `autoconf'.
The simplest way to compile this package is:
1. `cd' to the directory containing the package's source code and type
`./configure' to configure the package for your system. If you're
using `csh' on an old version of System V, you might need to type
`sh ./configure' instead to prevent `csh' from trying to execute
`configure' itself.
Running `configure' takes a while. While running, it prints some
messages telling which features it is checking for.
2. Type `make' to compile the package.
3. Optionally, type `make check' to run any self-tests that come with
the package.
4. Type `make install' to install the programs and any data files and
documentation.
5. You can remove the program binaries and object files from the
source code directory by typing `make clean'. To also remove the
files that `configure' created (so you can compile the package for
a different kind of computer), type `make distclean'. There is
also a `make maintainer-clean' target, but that is intended mainly
for the package's developers. If you use it, you may have to get
all sorts of other programs in order to regenerate files that came
with the distribution.
Compilers and Options
=====================
Some systems require unusual options for compilation or linking that
the `configure' script does not know about. You can give `configure'
initial values for variables by setting them in the environment. Using
a Bourne-compatible shell, you can do that on the command line like
this:
CC=c89 CFLAGS=-O2 LIBS=-lposix ./configure
Or on systems that have the `env' program, you can do it like this:
env CPPFLAGS=-I/usr/local/include LDFLAGS=-s ./configure
Compiling For Multiple Architectures
====================================
You can compile the package for more than one kind of computer at the
same time, by placing the object files for each architecture in their
own directory. To do this, you must use a version of `make' that
supports the `VPATH' variable, such as GNU `make'. `cd' to the
directory where you want the object files and executables to go and run
the `configure' script. `configure' automatically checks for the
source code in the directory that `configure' is in and in `..'.
If you have to use a `make' that does not supports the `VPATH'
variable, you have to compile the package for one architecture at a time
in the source code directory. After you have installed the package for
one architecture, use `make distclean' before reconfiguring for another
architecture.
Installation Names
==================
By default, `make install' will install the package's files in
`/usr/local/bin', `/usr/local/man', etc. You can specify an
installation prefix other than `/usr/local' by giving `configure' the
option `--prefix=PATH'.
You can specify separate installation prefixes for
architecture-specific files and architecture-independent files. If you
give `configure' the option `--exec-prefix=PATH', the package will use
PATH as the prefix for installing programs and libraries.
Documentation and other data files will still use the regular prefix.
In addition, if you use an unusual directory layout you can give
options like `--bindir=PATH' to specify different values for particular
kinds of files. Run `configure --help' for a list of the directories
you can set and what kinds of files go in them.
If the package supports it, you can cause programs to be installed
with an extra prefix or suffix on their names by giving `configure' the
option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'.
Optional Features
=================
Some packages pay attention to `--enable-FEATURE' options to
`configure', where FEATURE indicates an optional part of the package.
They may also pay attention to `--with-PACKAGE' options, where PACKAGE
is something like `gnu-as' or `x' (for the X Window System). The
`README' should mention any `--enable-' and `--with-' options that the
package recognizes.
For packages that use the X Window System, `configure' can usually
find the X include and library files automatically, but if it doesn't,
you can use the `configure' options `--x-includes=DIR' and
`--x-libraries=DIR' to specify their locations.
Specifying the System Type
==========================
There may be some features `configure' can not figure out
automatically, but needs to determine by the type of host the package
will run on. Usually `configure' can figure that out, but if it prints
a message saying it can not guess the host type, give it the
`--host=TYPE' option. TYPE can either be a short name for the system
type, such as `sun4', or a canonical name with three fields:
CPU-COMPANY-SYSTEM
See the file `config.sub' for the possible values of each field. If
`config.sub' isn't included in this package, then this package doesn't
need to know the host type.
If you are building compiler tools for cross-compiling, you can also
use the `--target=TYPE' option to select the type of system they will
produce code for and the `--build=TYPE' option to select the type of
system on which you are compiling the package.
Sharing Defaults
================
If you want to set default values for `configure' scripts to share,
you can create a site shell script called `config.site' that gives
default values for variables like `CC', `cache_file', and `prefix'.
`configure' looks for `PREFIX/share/config.site' if it exists, then
`PREFIX/etc/config.site' if it exists. Or, you can set the
`CONFIG_SITE' environment variable to the location of the site script.
A warning: not all `configure' scripts look for a site script.
Operation Controls
==================
`configure' recognizes the following options to control how it
operates.
`--cache-file=FILE'
Use and save the results of the tests in FILE instead of
`./config.cache'. Set FILE to `/dev/null' to disable caching, for
debugging `configure'.
`--help'
Print a summary of the options to `configure', and exit.
`--quiet'
`--silent'
`-q'
Do not print messages saying which checks are being made.
`--srcdir=DIR'
Look for the package's source code in directory DIR. Usually
`configure' can determine that directory automatically.
`--version'
Print the version of Autoconf used to generate the `configure'
script, and exit.
`configure' also accepts some other, not widely useful, options.
# Makefile.in -- input for rep-gtk Makefile
# Copyright (C) 1998 John Harper <john@dcs.warwick.ac.uk>
# $Id: Makefile.in,v 1.29 2002/02/13 07:50:27 jsh Exp $
SGTK_SRCS = rep-types.c
SGTK_OBJS = $(SGTK_SRCS:.c=.lo)
SRCS = rep-gtk.c gtk-support.c gtk-compat.c glib-glue.c gdk-glue.c gtk-glue.c gdk-pixbuf-glue.c
OBJS = $(SRCS:.c=.lo)
LIBGLADE_SRCS = libglade-support.c libglade-glue.c
LIBGLADE_OBJS = libglade-support.lo libglade-glue.lo
GNOME_LIBGLADE_OBJS = libglade-gnome-support.lo libglade-glue.lo
GNOMELIB_SRCS = gnomelib-support.c gnomelib-glue.c
GNOMELIB_OBJS = $(GNOMELIB_SRCS:.c=.lo)
GNOMEUI_SRCS = gnomeui-support.c gnomeui-glue.c
GNOMEUI_OBJS = $(GNOMEUI_SRCS:.c=.lo)
GNOME_CANVAS_SRCS = gnome-canvas-support.c gnome-canvas-glue.c
GNOME_CANVAS_OBJS = $(GNOME_CANVAS_SRCS:.c=.lo)
OUT = @OUT@
OUT_DESTS = $(foreach x, $(OUT), gui/$(x))
version=@version@
host_type=@host@
SHELL=/bin/sh
repexecdir=@REP_EXECDIR@
include $(repexecdir)/rules.mk
CC=@CC@
CPPFLAGS=@CPPFLAGS@
CFLAGS=@CFLAGS@
LDFLAGS=@LDFLAGS@
override CPPFLAGS += -DHAVE_CONFIG_H -I.
override CFLAGS += @GLIB_CFLAGS@ @GTK_CFLAGS@ @REP_CFLAGS@ @LIBGLADE_CFLAGS@ @GNOME_CFLAGS@ @GNOMEUI_CFLAGS@ @GNOME_CANVAS_CFLAGS@ @GDK_PIXBUF_CFLAGS@
REP_SGTK_LIBS=@GLIB_LIBS@ @LIBS@
REP_GTK_LIBS=@GTK_LIBS@ @LIBS@
REP_LIBGLADE_LIBS=@LIBGLADE_LIBS@ @LIBS@
REP_GNOMELIB_LIBS=@GNOME_LIBS@ @LIBS@
REP_GNOMEUI_LIBS=@GNOMEUI_LIBS@ @LIBS@
REP_GNOME_CANVAS_LIBS=@GNOME_CANVAS_LIBS@ @LIBS@
INSTALL=@INSTALL@
INSTALL_DATA=@INSTALL_DATA@
INSTALL_PROGRAM=@INSTALL_PROGRAM@
DESTDIR=
installdir=$(repexecdir)
top_srcdir=@top_srcdir@
top_builddir=.
VPATH=@top_srcdir@:.
.PHONY: clean realclean install
all : build_dirs $(OUT)
gtk-2/types.la : $(SGTK_OBJS)
$(rep_DL_LD) $(CPPFLAGS) $(CFLAGS) -o $@ $^ $(LDFLAGS) $(REP_SGTK_LIBS)
gtk-2/gtk.la : $(OBJS)
$(rep_DL_LD) $(CPPFLAGS) $(CFLAGS) -o $@ $^ $(LDFLAGS) $(REP_GTK_LIBS)
gtk-2/libglade.la : $(LIBGLADE_OBJS)
$(rep_DL_LD) $(CPPFLAGS) $(CFLAGS) -o $@ $^ $(LDFLAGS) $(REP_LIBGLADE_LIBS)
gtk-2/gnome-lib.la : $(GNOMELIB_OBJS)
$(rep_DL_LD) $(CPPFLAGS) $(CFLAGS) -o $@ $^ $(LDFLAGS) $(REP_GNOMELIB_LIBS)
gtk-2/gnome-ui.la : $(GNOMEUI_OBJS)
$(rep_DL_LD) $(CPPFLAGS) $(CFLAGS) -o $@ $^ $(LDFLAGS) $(REP_GNOMEUI_LIBS)
gtk-2/gnome-canvas.la : $(GNOME_CANVAS_OBJS)
$(rep_DL_LD) $(CPPFLAGS) $(CFLAGS) -o $@ $^ $(LDFLAGS) $(REP_GNOME_CANVAS_LIBS)
%-glue.c : %.defs build-gtk.jlc
rep build-gtk.jlc -f build-gtk-batch $< $@
build-gtk.jlc : build-gtk.jl
rep compiler -f compile-batch $<
libglade-gnome-support.lo : libglade-support.c
$(rep_LIBTOOL) --mode=compile $(CC) -c $(CPPFLAGS) $(CFLAGS) \
@GNOME_LIBGLADE_CFLAGS@ -DGLADE_GNOME=1 $< -o $@
install : all installdirs
set -e; for f in $(OUT); do \
$(rep_DL_INSTALL) $$f $(DESTDIR)$(installdir)/gui/gtk-2; \
done
set -e; for f in $(OUT_DESTS); do \
case $$f in \
gui/gtk-2/gtk.la|gui/gtk-2/gnome-lib.la) \
printf "\nrep_requires='gui.gtk-2.types'\n" >>$(DESTDIR)$(installdir)/$$f ;; \
gui/gkt-2/libglade.la|gui/gtk-2/gnome-ui.la|gui/gtk-2/gdk-pixbuf.la) \
printf "\nrep_requires='gui.gtk-2.gtk'\n" >>$(DESTDIR)$(installdir)/$$f ;; \
gui/gtk-2/gnome-canvas*.la) \
printf "\nrep_requires='gui.gtk-2.gnome-ui'\n" >>$(DESTDIR)$(installdir)/$$f ;; \
esac; \
done
for f in $(OUT_DESTS); do \
printf "\nrep_open_globally=yes\n" >>$(DESTDIR)$(installdir)/$$f; \
done
$(rep_INSTALL_ALIASES) -c . $(DESTDIR)$(installdir)
installdirs : $(top_srcdir)/mkinstalldirs
$(SHELL) $(top_srcdir)/mkinstalldirs $(DESTDIR)$(installdir)/gui/gtk-2
uninstall :
$(rep_DL_UNINSTALL) $(DESTDIR)$(installdir)/$(OUT)
clean :
rm -f *-glue.c *~ core *.jlc *.o *.lo *.la
rm -rf gtk-2
realclean : clean
rm -f Makefile config.cache config.log config.status config.h
rm -f rep-gtk.spec
cvsclean : realclean
rm -f aclocal.m4 configure
build_dirs : gtk-2
gtk-2 :
mkdir gtk-2
# hand-needed dependences
gtk-glue.c : gtk.defs gtktext.defs build-gtk.jlc
-*- text -*-
This is rep-gtk 0.0, a binding of GTK+/GNOME/libglade for the rep Lisp
system. It is based on Marius Vollmer's guile-gtk binding (initially
version 0.15, updated to 0.17), with a new glue-code generator.
For more details see:
http://rep-gtk.sourceforge.net/
Browse the CVS history at:
http://tizer.dcs.warwick.ac.uk:8080/cgi-bin/cvsweb/rep-gtk
Installation
============
Basically, `./configure ; make ; make install'. If you're building from
the CVS repository, execute `aclocal ; autoconf' first.
It requires Gtk+ version 2.
WARNING: The libglade and GNOME bindings are currently untested and
probably broken since the port to Gtk2, use at your own risk.
Usage
=====
Import the module gui.gtk-2.gtk to load the library, then call
functions as in guile-gtk. The only difference is that Lisp conventions
are used for booleans, i.e. nil for #f, and non-nil for #t.
See the included *.defs files for the details of how the library maps
to lisp functions.
libglade
========
From the libglade README file:
This library allows you to load glade interface files in a program
at runtime. It doesn't require GLADE to be used, but GLADE is by
far the easiest way to create the interface files.
So you can now use GLADE with rep! Here's an example from the
examples/test-libglade script:
(require 'gui.gtk-2.libglade)
(let ((xml (or (glade-xml-new (car command-line-args))
(error "something bad happened"))))
(glade-xml-signal-autoconnect xml)
(gtk-main))
The glade-xml-new function takes a filename, and creates a widget
hierarchy. glade-xml-signal-autoconnect connects all signal handlers to
the lisp functions named in the GLADE file. You can also use the
glade-xml-signal-connect function to connect individually named
handlers. (see libglade.defs for the complete function list)
GNOME
=====
There's also now reasonably complete bindings of gnome and gnomeui.
These extra modules will get built and installed:
gui.gtk-2.gnome-lib Non-UI GNOME functions, doesn't require GTK
gui.gtk-2.gnome-ui GNOME UI widgets and utilities
gui.gtk-2.gnome-canvas GNOME Canvas widgets and utilities
see the .defs files for the gruesome details about what goes in what.
The dependence tree is something like:
types -+- gtk -+- libglade
\ \
\ gnome-ui -+- gnome-canvas
\
gnome-lib
gui.gtk-2.types provides conversions for the basic C types (and GLIB's
GList and GSList types).
When `gui.gtk-2.gnome-ui' is loaded the gnome-init function is called
automatically. If the special variables `*gnome-app-id*' and
`*gnome-app-version*' are bound to strings, then these values will be
used, otherwise something will be fabricated.
However, if using `gui.gtk-2.gnome-lib' without `gui.gtk-2.gnome-ui',
you should call `gnomelib-init' manually.
Caveats
=======
It's still too easy to crash the Lisp interpreter through invalid use
of GTK..
rep-gtk HEAD now requires glib-2, gtk-2, etc..
It's currently in a pre-alpha state
Checkout the gtk-1-branch to get the gtk-1 version
All the modules have been moved into the gui.gtk-2 hierarchy, so
programs wanting to move from gtk-1 to gtk-2 will need to change
-*-Indented-Text-*-
These notes describe the format of the .defs files
(import "DEFS-FILE")
(include "DEFS-FILE")
(define-enum ENUM-TYPEDEF-NAME
(LISP-SYM CPP-MACRO)
...)
(define-flags FLAGS-TYPEDEF-NAME
(LISP-SYM CPP-MACRO)
...)
(define-boxed BOXED-TYPEDEF-NAME
ATTR ...)
where each ATTR is one of:
(copy C-COPY-FUN)
(free C-FREE-FUN)
(size "C sizeof expression")
(fields FIELD ...)
where each FIELD is (TYPE-SYM NAME-SYM OPTIONS...)
each OPTION may be `(setter t)' denoting that the field
is settable. Also `(getter FUNCTION-NAME)' defining a custom
method of retrieving the value
(define-object OBJECT-TYPEDEF-NAME (SUPER-CLASS-TYPEDEF)
ATTR ...)
where each ATTR is one of:
(fields FIELD ...) [as above]
(define-func C-FUNC-NAME
RETURN-VALUE [RET-OPTIONS...]
(ARG ...)
OPTIONS...)
where each ARG is (TYPE NAME-SYM [ARG-OPTIONS...)
and each OPTION may be one of:
(scm-name ACTUAL-NAME-STRING)
(protection ARG) ; gc protect callback for life of ARG
(protection t) ; gc protect callback always
(protection *result*) ; gc protect for life of RETURN-VALUE
(undeferred t) ; no scm interrupt protection?
(rest-arg t) ; last arg is &rest
and each ARG-OPTION may be one of:
(= "default expression")
(null-ok) ; allow nil
(protect-during)
and each RET-OPTION may be one of:
(copy nil) ; unimplemented?
(options OPTION ...)
where each OPTION can be:
(includes "#include expression")
(init-func "name of C function")
(other-inits "name of C function" ... )
(extra-init-code "code string")
(provide FEATURE)
the `provide' option generates the rep dl stub required to provide
FEATURE and call the init-func when loaded
GTK fundamental types seem to include:
invalid, none, char, bool, int, uint, long, ulong, float,
string, enum, flags, boxed, foreign, callback, args, pointer,
signal, c-callback, object
The guile-gtk .defs files seem to add the following:
static_string, full_callback, file-descriptor, list, slist,
double, SCM, cvec, cvecr, fvec, ret, tvec
static_string:
a static string returned from a function
full_callback:
a callback function used by the _full function variants (i.e.
gtk_signal_connect_full).
file-descriptor:
an integer file descriptor
double:
a double-precision float
SCM:
a scheme object
(list TYPE [MODE]):
a glib GList* (doubly-linked)
(slist TYPE [MODE]):
a glib GSList* (singly-linked)
(cvec TYPE [MODE]):
a counted-vector, stored in sgtk_cvec struct, in gtk_ function calls,
it expands ``cvec.data, cvec.len''
(cvecr TYPE [MODE]):
similar to cvec but expands ``cvec.len, cvec.data''
(fvec TYPE LEN [MODE]):
similar to cvec but fixed length
(ret TYPE):
similar to fvec but length is always one. used to mimic the C ``&foo''
idiom of returning multiple values
(tvec TYPE [MODE]):
zero-terminated vector
[ in the above, MODE is one of `in', `out' or `inout'. Defaults to `in' ]
This diff is collapsed.
-*- indented-text -*-
TODO
====
* fix the signal_connect_object stuff in libglade-support.c
* support the `define-struct' and `define-ptype' defs
* add/fix support for implementing new GObject classes in lisp
# generated automatically by aclocal 1.9.6 -*- Autoconf -*-
# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
# 2005 Free Software Foundation, Inc.
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE.
# pkg.m4 - Macros to locate and utilise pkg-config. -*- Autoconf -*-
#
# Copyright © 2004 Scott James Remnant <scott@netsplit.com>.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#
# As a special exception to the GNU General Public License, if you
# distribute this file as part of a program that contains a
# configuration script generated by Autoconf, you may include it under
# the same distribution terms that you use for the rest of that program.
# PKG_PROG_PKG_CONFIG([MIN-VERSION])
# ----------------------------------
AC_DEFUN([PKG_PROG_PKG_CONFIG],
[m4_pattern_forbid([^_?PKG_[A-Z_]+$])
m4_pattern_allow([^PKG_CONFIG(_PATH)?$])
AC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility])dnl
if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then
AC_PATH_TOOL([PKG_CONFIG], [pkg-config])
fi
if test -n "$PKG_CONFIG"; then
_pkg_min_version=m4_default([$1], [0.9.0])
AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version])
if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then
AC_MSG_RESULT([yes])
else
AC_MSG_RESULT([no])
PKG_CONFIG=""
fi
fi[]dnl
])# PKG_PROG_PKG_CONFIG
# PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
#
# Check to see whether a particular set of modules exists. Similar
# to PKG_CHECK_MODULES(), but does not set variables or print errors.
#
#
# Similar to PKG_CHECK_MODULES, make sure that the first instance of
# this or PKG_CHECK_MODULES is called, or make sure to call
# PKG_CHECK_EXISTS manually
# --------------------------------------------------------------
AC_DEFUN([PKG_CHECK_EXISTS],
[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
if test -n "$PKG_CONFIG" && \
AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$1"]); then
m4_ifval([$2], [$2], [:])
m4_ifvaln([$3], [else
$3])dnl
fi])
# _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES])
# ---------------------------------------------
m4_define([_PKG_CONFIG],
[if test -n "$PKG_CONFIG"; then
if test -n "$$1"; then
pkg_cv_[]$1="$$1"
else
PKG_CHECK_EXISTS([$3],
[pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null`],
[pkg_failed=yes])
fi
else
pkg_failed=untried
fi[]dnl
])# _PKG_CONFIG
# _PKG_SHORT_ERRORS_SUPPORTED
# -----------------------------
AC_DEFUN([_PKG_SHORT_ERRORS_SUPPORTED],
[AC_REQUIRE([PKG_PROG_PKG_CONFIG])
if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
_pkg_short_errors_supported=yes
else
_pkg_short_errors_supported=no
fi[]dnl
])# _PKG_SHORT_ERRORS_SUPPORTED
# PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
# [ACTION-IF-NOT-FOUND])
#
#
# Note that if there is a possibility the first call to
# PKG_CHECK_MODULES might not happen, you should be sure to include an
# explicit call to PKG_PROG_PKG_CONFIG in your configure.ac
#
#
# --------------------------------------------------------------
AC_DEFUN([PKG_CHECK_MODULES],
[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
AC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl
AC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl
pkg_failed=no
AC_MSG_CHECKING([for $1])
_PKG_CONFIG([$1][_CFLAGS], [cflags], [$2])
_PKG_CONFIG([$1][_LIBS], [libs], [$2])
m4_define([_PKG_TEXT], [Alternatively, you may set the environment variables $1[]_CFLAGS
and $1[]_LIBS to avoid the need to call pkg-config.
See the pkg-config man page for more details.])
if test $pkg_failed = yes; then
_PKG_SHORT_ERRORS_SUPPORTED
if test $_pkg_short_errors_supported = yes; then
$1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --errors-to-stdout --print-errors "$2"`
else