Chris@0: # extra_pkg.m4 - Macros to locate and utilise pkg-config. -*- Autoconf -*- Chris@0: # Chris@0: # Copyright (c) 2004 Scott James Remnant . Chris@0: # Chris@0: # This program is free software; you can redistribute it and/or modify Chris@0: # it under the terms of the GNU General Public License as published by Chris@0: # the Free Software Foundation; either version 2 of the License, or Chris@0: # (at your option) any later version. Chris@0: # Chris@0: # This program is distributed in the hope that it will be useful, but Chris@0: # WITHOUT ANY WARRANTY; without even the implied warranty of Chris@0: # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Chris@0: # General Public License for more details. Chris@0: # Chris@0: # You should have received a copy of the GNU General Public License Chris@0: # along with this program; if not, write to the Free Software Chris@0: # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. Chris@0: # Chris@0: # As a special exception to the GNU General Public License, if you Chris@0: # distribute this file as part of a program that contains a Chris@0: # configuration script generated by Autoconf, you may include it under Chris@0: # the same distribution terms that you use for the rest of that program. Chris@0: Chris@0: # -------------------------------------------------------------- Chris@0: # PKG_CHECK_MOD_VERSION(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND], Chris@0: # [ACTION-IF-NOT-FOUND]) Chris@0: # Chris@0: # This is a very slight modification to the macro PKG_CHECK_MODULES that Chris@0: # is in the original pkg.m4 file. It prints the versions in the checking Chris@0: # message (erikd@mega-nerd.com). Chris@0: Chris@0: AC_DEFUN([PKG_CHECK_MOD_VERSION], Chris@0: [AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl Chris@0: AC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl Chris@0: AC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl Chris@0: Chris@0: pkg_failed=no Chris@0: AC_MSG_CHECKING([for $2 ]) Chris@0: Chris@0: _PKG_CONFIG([$1][_CFLAGS], [cflags], [$2]) Chris@0: _PKG_CONFIG([$1][_LIBS], [libs], [$2]) Chris@0: Chris@0: m4_define([_PKG_TEXT], [Alternatively, you may set the environment variables $1[]_CFLAGS Chris@0: and $1[]_LIBS to avoid the need to call pkg-config. Chris@0: See the pkg-config man page for more details.]) Chris@0: Chris@0: if test $pkg_failed = yes; then Chris@0: _PKG_SHORT_ERRORS_SUPPORTED Chris@0: if test $_pkg_short_errors_supported = yes; then Chris@0: $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --errors-to-stdout --print-errors "$2"` Chris@0: else Chris@0: $1[]_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "$2"` Chris@0: fi Chris@0: # Put the nasty error message in config.log where it belongs Chris@0: echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD Chris@0: Chris@0: ifelse([$4], , [AC_MSG_ERROR(dnl Chris@0: [Package requirements ($2) were not met: Chris@0: Chris@0: $$1_PKG_ERRORS Chris@0: Chris@0: Consider adjusting the PKG_CONFIG_PATH environment variable if you Chris@0: installed software in a non-standard prefix. Chris@0: Chris@0: _PKG_TEXT Chris@0: ])], Chris@0: [AC_MSG_RESULT([no]) Chris@0: $4]) Chris@0: elif test $pkg_failed = untried; then Chris@0: ifelse([$4], , [AC_MSG_FAILURE(dnl Chris@0: [The pkg-config script could not be found or is too old. Make sure it Chris@0: is in your PATH or set the PKG_CONFIG environment variable to the full Chris@0: path to pkg-config. Chris@0: Chris@0: _PKG_TEXT Chris@0: Chris@0: To get pkg-config, see .])], Chris@0: [$4]) Chris@0: else Chris@0: $1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS Chris@0: $1[]_LIBS=$pkg_cv_[]$1[]_LIBS Chris@0: AC_MSG_RESULT([yes]) Chris@0: ifelse([$3], , :, [$3]) Chris@0: fi[]dnl Chris@0: ])# PKG_CHECK_MOD_VERSION