diff options
author | Erik de Castro Lopo <erikd@mega-nerd.com> | 2008-06-29 09:01:05 +1000 |
---|---|---|
committer | Erik de Castro Lopo <erikd@mega-nerd.com> | 2008-06-29 09:01:05 +1000 |
commit | 4f249e76fbb8649135779ef14cd307cd0350d018 (patch) | |
tree | a10aeb12289e67a31053d4d9a81a254416930774 /M4 | |
parent | 3dbb868c311bc5f7fc9861eb489db1d953fbc1e2 (diff) |
Add m4 macro PKG_CHECK_MOD_VERSION which is a hacked version of PKG_CHECK_MODULES.
Diffstat (limited to 'M4')
-rw-r--r-- | M4/Makefile.am | 2 | ||||
-rw-r--r-- | M4/extra_pkg.m4 | 85 |
2 files changed, 86 insertions, 1 deletions
diff --git a/M4/Makefile.am b/M4/Makefile.am index 3ea1b7f..1ec5172 100644 --- a/M4/Makefile.am +++ b/M4/Makefile.am @@ -1,5 +1,5 @@ ## Process this file with automake to produce Makefile.in EXTRA_DIST = add_cflags.m4 clip_mode.m4 endian.m4 extra_largefile.m4 \ - flexible_array.m4 llrint.m4 lrint.m4 lrintf.m4 octave.m4 + flexible_array.m4 llrint.m4 lrint.m4 lrintf.m4 octave.m4 extra_pkg.m4 diff --git a/M4/extra_pkg.m4 b/M4/extra_pkg.m4 new file mode 100644 index 0000000..b0297df --- /dev/null +++ b/M4/extra_pkg.m4 @@ -0,0 +1,85 @@ +# extra_pkg.m4 - Macros to locate and utilise pkg-config. -*- Autoconf -*- +# +# Copyright (c) 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_CHECK_MODULE_VERSION(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND], +# [ACTION-IF-NOT-FOUND]) +# +# This is a very slight modification to the macro PKG_CHECK_MODULES that +# is in the original pkg.m4 file. It prints the versions in the checking +# message (erikd@mega-nerd.com). + +AC_DEFUN([PKG_CHECK_MODULE_VERSION], +[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 $2 ]) + +_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 + $1[]_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "$2"` + fi + # Put the nasty error message in config.log where it belongs + echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD + + ifelse([$4], , [AC_MSG_ERROR(dnl +[Package requirements ($2) were not met: + +$$1_PKG_ERRORS + +Consider adjusting the PKG_CONFIG_PATH environment variable if you +installed software in a non-standard prefix. + +_PKG_TEXT +])], + [AC_MSG_RESULT([no]) + $4]) +elif test $pkg_failed = untried; then + ifelse([$4], , [AC_MSG_FAILURE(dnl +[The pkg-config script could not be found or is too old. Make sure it +is in your PATH or set the PKG_CONFIG environment variable to the full +path to pkg-config. + +_PKG_TEXT + +To get pkg-config, see <http://pkg-config.freedesktop.org/>.])], + [$4]) +else + $1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS + $1[]_LIBS=$pkg_cv_[]$1[]_LIBS + AC_MSG_RESULT([yes]) + ifelse([$3], , :, [$3]) +fi[]dnl +])# PKG_CHECK_MODULE_VERSION |