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