annotate src/libvorbis-1.3.3/m4/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 05aa0afa9217
children
rev   line source
Chris@1 1 # pkg.m4 - Macros to locate and utilise pkg-config. -*- Autoconf -*-
Chris@1 2 #
Chris@1 3 # Copyright © 2004 Scott James Remnant <scott@netsplit.com>.
Chris@1 4 #
Chris@1 5 # This program is free software; you can redistribute it and/or modify
Chris@1 6 # it under the terms of the GNU General Public License as published by
Chris@1 7 # the Free Software Foundation; either version 2 of the License, or
Chris@1 8 # (at your option) any later version.
Chris@1 9 #
Chris@1 10 # This program is distributed in the hope that it will be useful, but
Chris@1 11 # WITHOUT ANY WARRANTY; without even the implied warranty of
Chris@1 12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Chris@1 13 # General Public License for more details.
Chris@1 14 #
Chris@1 15 # You should have received a copy of the GNU General Public License
Chris@1 16 # along with this program; if not, write to the Free Software
Chris@1 17 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
Chris@1 18 #
Chris@1 19 # As a special exception to the GNU General Public License, if you
Chris@1 20 # distribute this file as part of a program that contains a
Chris@1 21 # configuration script generated by Autoconf, you may include it under
Chris@1 22 # the same distribution terms that you use for the rest of that program.
Chris@1 23
Chris@1 24 # PKG_PROG_PKG_CONFIG([MIN-VERSION])
Chris@1 25 # ----------------------------------
Chris@1 26 AC_DEFUN([PKG_PROG_PKG_CONFIG],
Chris@1 27 [m4_pattern_forbid([^_?PKG_[A-Z_]+$])
Chris@1 28 m4_pattern_allow([^PKG_CONFIG(_PATH)?$])
Chris@1 29 AC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility])dnl
Chris@1 30 if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then
Chris@1 31 AC_PATH_TOOL([PKG_CONFIG], [pkg-config])
Chris@1 32 fi
Chris@1 33 if test -n "$PKG_CONFIG"; then
Chris@1 34 _pkg_min_version=m4_default([$1], [0.9.0])
Chris@1 35 AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version])
Chris@1 36 if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then
Chris@1 37 AC_MSG_RESULT([yes])
Chris@1 38 else
Chris@1 39 AC_MSG_RESULT([no])
Chris@1 40 PKG_CONFIG=""
Chris@1 41 fi
Chris@1 42
Chris@1 43 fi[]dnl
Chris@1 44 ])# PKG_PROG_PKG_CONFIG
Chris@1 45
Chris@1 46 # PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
Chris@1 47 #
Chris@1 48 # Check to see whether a particular set of modules exists. Similar
Chris@1 49 # to PKG_CHECK_MODULES(), but does not set variables or print errors.
Chris@1 50 #
Chris@1 51 #
Chris@1 52 # Similar to PKG_CHECK_MODULES, make sure that the first instance of
Chris@1 53 # this or PKG_CHECK_MODULES is called, or make sure to call
Chris@1 54 # PKG_CHECK_EXISTS manually
Chris@1 55 # --------------------------------------------------------------
Chris@1 56 AC_DEFUN([PKG_CHECK_EXISTS],
Chris@1 57 [AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
Chris@1 58 if test -n "$PKG_CONFIG" && \
Chris@1 59 AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$1"]); then
Chris@1 60 m4_ifval([$2], [$2], [:])
Chris@1 61 m4_ifvaln([$3], [else
Chris@1 62 $3])dnl
Chris@1 63 fi])
Chris@1 64
Chris@1 65
Chris@1 66 # _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES])
Chris@1 67 # ---------------------------------------------
Chris@1 68 m4_define([_PKG_CONFIG],
Chris@1 69 [if test -n "$PKG_CONFIG"; then
Chris@1 70 if test -n "$$1"; then
Chris@1 71 pkg_cv_[]$1="$$1"
Chris@1 72 else
Chris@1 73 PKG_CHECK_EXISTS([$3],
Chris@1 74 [pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null`],
Chris@1 75 [pkg_failed=yes])
Chris@1 76 fi
Chris@1 77 else
Chris@1 78 pkg_failed=untried
Chris@1 79 fi[]dnl
Chris@1 80 ])# _PKG_CONFIG
Chris@1 81
Chris@1 82 # _PKG_SHORT_ERRORS_SUPPORTED
Chris@1 83 # -----------------------------
Chris@1 84 AC_DEFUN([_PKG_SHORT_ERRORS_SUPPORTED],
Chris@1 85 [AC_REQUIRE([PKG_PROG_PKG_CONFIG])
Chris@1 86 if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
Chris@1 87 _pkg_short_errors_supported=yes
Chris@1 88 else
Chris@1 89 _pkg_short_errors_supported=no
Chris@1 90 fi[]dnl
Chris@1 91 ])# _PKG_SHORT_ERRORS_SUPPORTED
Chris@1 92
Chris@1 93
Chris@1 94 # PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
Chris@1 95 # [ACTION-IF-NOT-FOUND])
Chris@1 96 #
Chris@1 97 #
Chris@1 98 # Note that if there is a possibility the first call to
Chris@1 99 # PKG_CHECK_MODULES might not happen, you should be sure to include an
Chris@1 100 # explicit call to PKG_PROG_PKG_CONFIG in your configure.ac
Chris@1 101 #
Chris@1 102 #
Chris@1 103 # --------------------------------------------------------------
Chris@1 104 AC_DEFUN([PKG_CHECK_MODULES],
Chris@1 105 [AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
Chris@1 106 AC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl
Chris@1 107 AC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl
Chris@1 108
Chris@1 109 pkg_failed=no
Chris@1 110 AC_MSG_CHECKING([for $1])
Chris@1 111
Chris@1 112 _PKG_CONFIG([$1][_CFLAGS], [cflags], [$2])
Chris@1 113 _PKG_CONFIG([$1][_LIBS], [libs], [$2])
Chris@1 114
Chris@1 115 m4_define([_PKG_TEXT], [Alternatively, you may set the environment variables $1[]_CFLAGS
Chris@1 116 and $1[]_LIBS to avoid the need to call pkg-config.
Chris@1 117 See the pkg-config man page for more details.])
Chris@1 118
Chris@1 119 if test $pkg_failed = yes; then
Chris@1 120 _PKG_SHORT_ERRORS_SUPPORTED
Chris@1 121 if test $_pkg_short_errors_supported = yes; then
Chris@1 122 $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --errors-to-stdout --print-errors "$2"`
Chris@1 123 else
Chris@1 124 $1[]_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "$2"`
Chris@1 125 fi
Chris@1 126 # Put the nasty error message in config.log where it belongs
Chris@1 127 echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD
Chris@1 128
Chris@1 129 ifelse([$4], , [AC_MSG_ERROR(dnl
Chris@1 130 [Package requirements ($2) were not met:
Chris@1 131
Chris@1 132 $$1_PKG_ERRORS
Chris@1 133
Chris@1 134 Consider adjusting the PKG_CONFIG_PATH environment variable if you
Chris@1 135 installed software in a non-standard prefix.
Chris@1 136
Chris@1 137 _PKG_TEXT
Chris@1 138 ])],
Chris@1 139 [AC_MSG_RESULT([no])
Chris@1 140 $4])
Chris@1 141 elif test $pkg_failed = untried; then
Chris@1 142 ifelse([$4], , [AC_MSG_FAILURE(dnl
Chris@1 143 [The pkg-config script could not be found or is too old. Make sure it
Chris@1 144 is in your PATH or set the PKG_CONFIG environment variable to the full
Chris@1 145 path to pkg-config.
Chris@1 146
Chris@1 147 _PKG_TEXT
Chris@1 148
Chris@1 149 To get pkg-config, see <http://pkg-config.freedesktop.org/>.])],
Chris@1 150 [$4])
Chris@1 151 else
Chris@1 152 $1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS
Chris@1 153 $1[]_LIBS=$pkg_cv_[]$1[]_LIBS
Chris@1 154 AC_MSG_RESULT([yes])
Chris@1 155 ifelse([$3], , :, [$3])
Chris@1 156 fi[]dnl
Chris@1 157 ])# PKG_CHECK_MODULES