annotate src/libsndfile-1.0.27/M4/extra_pkg.m4 @ 83:ae30d91d2ffe

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