annotate src/libvorbis-1.3.3/m4/pkg.m4 @ 169:223a55898ab9 tip default

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