Changeset 650fb2c
- Timestamp:
- Jun 25, 2011, 5:46:42 AM (13 years ago)
- Branches:
- master, release-1.10, release-1.8, release-1.9
- Children:
- 16ce7a4, 25891a8, bc932fd
- Parents:
- 378ede7
- git-author:
- Anders Kaseorg <andersk@mit.edu> (06/25/11 05:41:35)
- git-committer:
- Anders Kaseorg <andersk@mit.edu> (06/25/11 05:46:42)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
m4/pkg.m4
r8073852 r650fb2c 1 1 # pkg.m4 - Macros to locate and utilise pkg-config. -*- Autoconf -*- 2 # serial 1 (pkg-config-0.24) 2 3 # 3 4 # Copyright © 2004 Scott James Remnant <scott@netsplit.com>. … … 26 27 AC_DEFUN([PKG_PROG_PKG_CONFIG], 27 28 [m4_pattern_forbid([^_?PKG_[A-Z_]+$]) 28 m4_pattern_allow([^PKG_CONFIG(_PATH)?$]) 29 AC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility])dnl 29 m4_pattern_allow([^PKG_CONFIG(_(PATH|LIBDIR|SYSROOT_DIR|ALLOW_SYSTEM_(CFLAGS|LIBS)))?$]) 30 m4_pattern_allow([^PKG_CONFIG_(DISABLE_UNINSTALLED|TOP_BUILD_DIR|DEBUG_SPEW)$]) 31 AC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility]) 32 AC_ARG_VAR([PKG_CONFIG_PATH], [directories to add to pkg-config's search path]) 33 AC_ARG_VAR([PKG_CONFIG_LIBDIR], [path overriding pkg-config's built-in search path]) 34 30 35 if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then 31 36 AC_PATH_TOOL([PKG_CONFIG], [pkg-config]) … … 40 45 PKG_CONFIG="" 41 46 fi 42 43 47 fi[]dnl 44 48 ])# PKG_PROG_PKG_CONFIG … … 49 53 # to PKG_CHECK_MODULES(), but does not set variables or print errors. 50 54 # 51 # 52 # Similar to PKG_CHECK_MODULES, make sure that the first instance of53 # this or PKG_CHECK_MODULES is called, or make sure to call54 # PKG_CHECK_EXISTS manually55 # Please remember that m4 expands AC_REQUIRE([PKG_PROG_PKG_CONFIG]) 56 # only at the first occurence in configure.ac, so if the first place 57 # it's called might be skipped (such as if it is within an "if", you 58 # have to call PKG_CHECK_EXISTS manually 55 59 # -------------------------------------------------------------- 56 60 AC_DEFUN([PKG_CHECK_EXISTS], … … 58 62 if test -n "$PKG_CONFIG" && \ 59 63 AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$1"]); then 60 m4_ ifval([$2],[$2], [:])64 m4_default([$2], [:]) 61 65 m4_ifvaln([$3], [else 62 66 $3])dnl 63 67 fi]) 64 68 65 66 69 # _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES]) 67 70 # --------------------------------------------- 68 71 m4_define([_PKG_CONFIG], 69 [if test -n "$PKG_CONFIG"; then 70 if test -n "$$1"; then 71 pkg_cv_[]$1="$$1" 72 else 73 PKG_CHECK_EXISTS([$3], 74 [pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null`], 75 [pkg_failed=yes]) 76 fi 77 else 78 pkg_failed=untried 72 [if test -n "$$1"; then 73 pkg_cv_[]$1="$$1" 74 elif test -n "$PKG_CONFIG"; then 75 PKG_CHECK_EXISTS([$3], 76 [pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null` 77 test "x$?" != "x0" && pkg_failed=yes ], 78 [pkg_failed=yes]) 79 else 80 pkg_failed=untried 79 81 fi[]dnl 80 82 ])# _PKG_CONFIG … … 118 120 119 121 if test $pkg_failed = yes; then 122 AC_MSG_RESULT([no]) 120 123 _PKG_SHORT_ERRORS_SUPPORTED 121 124 if test $_pkg_short_errors_supported = yes; then 122 $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors -- errors-to-stdout --print-errors "$2"`125 $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "$2" 2>&1` 123 126 else 124 $1[]_PKG_ERRORS=`$PKG_CONFIG -- errors-to-stdout --print-errors "$2"`127 $1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "$2" 2>&1` 125 128 fi 126 129 # Put the nasty error message in config.log where it belongs 127 130 echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD 128 131 129 ifelse([$4], , [AC_MSG_ERROR(dnl132 m4_default([$4], [AC_MSG_ERROR( 130 133 [Package requirements ($2) were not met: 131 134 … … 135 138 installed software in a non-standard prefix. 136 139 137 _PKG_TEXT 138 ])], 139 [AC_MSG_RESULT([no]) 140 $4]) 140 _PKG_TEXT])[]dnl 141 ]) 141 142 elif test $pkg_failed = untried; then 142 ifelse([$4], , [AC_MSG_FAILURE(dnl 143 AC_MSG_RESULT([no]) 144 m4_default([$4], [AC_MSG_FAILURE( 143 145 [The pkg-config script could not be found or is too old. Make sure it 144 146 is in your PATH or set the PKG_CONFIG environment variable to the full … … 147 149 _PKG_TEXT 148 150 149 To get pkg-config, see <http://pkg-config.freedesktop.org/>.]) ],150 [$4])151 To get pkg-config, see <http://pkg-config.freedesktop.org/>.])[]dnl 152 ]) 151 153 else 152 154 $1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS 153 155 $1[]_LIBS=$pkg_cv_[]$1[]_LIBS 154 156 AC_MSG_RESULT([yes]) 155 ifelse([$3], , :, [$3])157 $3 156 158 fi[]dnl 157 159 ])# PKG_CHECK_MODULES
Note: See TracChangeset
for help on using the changeset viewer.