Mercurial > hg > sv-dependency-builds
comparison src/libsndfile-1.0.27/M4/extra_pkg.m4 @ 40:1df64224f5ac
Current libsndfile source
author | Chris Cannam |
---|---|
date | Tue, 18 Oct 2016 13:22:47 +0100 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
39:7ddb4fc30dac | 40:1df64224f5ac |
---|---|
1 # extra_pkg.m4 - Macros to locate and utilise pkg-config. -*- Autoconf -*- | |
2 # | |
3 # Copyright (c) 2008-2012 Erik de Castro Lopo <erikd@mega-nerd.com> | |
4 # Copyright (c) 2004 Scott James Remnant <scott@netsplit.com>. | |
5 # | |
6 # This program is free software; you can redistribute it and/or modify | |
7 # it under the terms of the GNU General Public License as published by | |
8 # the Free Software Foundation; either version 2 of the License, or | |
9 # (at your option) any later version. | |
10 # | |
11 # This program is distributed in the hope that it will be useful, but | |
12 # WITHOUT ANY WARRANTY; without even the implied warranty of | |
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
14 # General Public License for more details. | |
15 # | |
16 # You should have received a copy of the GNU General Public License | |
17 # along with this program; if not, write to the Free Software | |
18 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | |
19 # | |
20 # As a special exception to the GNU General Public License, if you | |
21 # distribute this file as part of a program that contains a | |
22 # configuration script generated by Autoconf, you may include it under | |
23 # the same distribution terms that you use for the rest of that program. | |
24 | |
25 # -------------------------------------------------------------- | |
26 # PKG_CHECK_MOD_VERSION(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND], | |
27 # [ACTION-IF-NOT-FOUND]) | |
28 # | |
29 # This is a very slight modification to the macro PKG_CHECK_MODULES that | |
30 # is in the original pkg.m4 file. It prints the versions in the checking | |
31 # message (erikd@mega-nerd.com). | |
32 | |
33 AC_DEFUN([PKG_CHECK_MOD_VERSION], | |
34 [AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl | |
35 AC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl | |
36 AC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl | |
37 | |
38 pkg_failed=no | |
39 AC_MSG_CHECKING([for $2 ]) | |
40 | |
41 _PKG_CONFIG([$1][_CFLAGS], [cflags], [$2]) | |
42 _PKG_CONFIG([$1][_LIBS], [libs], [$2]) | |
43 | |
44 pkg_link_saved_CFLAGS=$CFLAGS | |
45 pkg_link_saved_LIBS=$LIBS | |
46 | |
47 eval "pkg_CFLAGS=\${pkg_cv_[]$1[]_CFLAGS}" | |
48 eval "pkg_LIBS=\${pkg_cv_[]$1[]_LIBS}" | |
49 | |
50 CFLAGS="$CFLAGS $pkg_CFLAGS" | |
51 LIBS="$LIBS $pkg_LIBS" | |
52 | |
53 AC_TRY_LINK([], puts ("");, pkg_link=yes, pkg_link=no) | |
54 | |
55 CFLAGS=$pkg_link_saved_CFLAGS | |
56 LIBS=$pkg_link_saved_LIBS | |
57 | |
58 if test $pkg_link = no ; then | |
59 $as_echo_n "link failed ... " | |
60 pkg_failed=yes | |
61 fi | |
62 | |
63 m4_define([_PKG_TEXT], [Alternatively, you may set the environment variables $1[]_CFLAGS | |
64 and $1[]_LIBS to avoid the need to call pkg-config. | |
65 See the pkg-config man page for more details.]) | |
66 | |
67 if test $pkg_failed = yes; then | |
68 _PKG_SHORT_ERRORS_SUPPORTED | |
69 if test $_pkg_short_errors_supported = yes; then | |
70 $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --errors-to-stdout --print-errors "$2"` | |
71 else | |
72 $1[]_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "$2"` | |
73 fi | |
74 # Put the nasty error message in config.log where it belongs | |
75 echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD | |
76 | |
77 ifelse([$4], , [AC_MSG_ERROR(dnl | |
78 [Package requirements ($2) were not met: | |
79 | |
80 $$1_PKG_ERRORS | |
81 | |
82 Consider adjusting the PKG_CONFIG_PATH environment variable if you | |
83 installed software in a non-standard prefix. | |
84 | |
85 _PKG_TEXT | |
86 ])], | |
87 [AC_MSG_RESULT([no]) | |
88 $4]) | |
89 elif test $pkg_failed = untried; then | |
90 ifelse([$4], , [AC_MSG_FAILURE(dnl | |
91 [The pkg-config script could not be found or is too old. Make sure it | |
92 is in your PATH or set the PKG_CONFIG environment variable to the full | |
93 path to pkg-config. | |
94 | |
95 _PKG_TEXT | |
96 | |
97 To get pkg-config, see <http://pkg-config.freedesktop.org/>.])], | |
98 [$4]) | |
99 else | |
100 $1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS | |
101 $1[]_LIBS=$pkg_cv_[]$1[]_LIBS | |
102 AC_MSG_RESULT([yes]) | |
103 ifelse([$3], , :, [$3]) | |
104 fi[]dnl | |
105 ])# PKG_CHECK_MOD_VERSION |