You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

229 lines
8.3 KiB

  1. # generated automatically by aclocal 1.14.1 -*- Autoconf -*-
  2. # Copyright (C) 1996-2013 Free Software Foundation, Inc.
  3. # This file is free software; the Free Software Foundation
  4. # gives unlimited permission to copy and/or distribute it,
  5. # with or without modifications, as long as this notice is preserved.
  6. # This program is distributed in the hope that it will be useful,
  7. # but WITHOUT ANY WARRANTY, to the extent permitted by law; without
  8. # even the implied warranty of MERCHANTABILITY or FITNESS FOR A
  9. # PARTICULAR PURPOSE.
  10. m4_ifndef([AC_CONFIG_MACRO_DIRS], [m4_defun([_AM_CONFIG_MACRO_DIRS], [])m4_defun([AC_CONFIG_MACRO_DIRS], [_AM_CONFIG_MACRO_DIRS($@)])])
  11. # pkg.m4 - Macros to locate and utilise pkg-config. -*- Autoconf -*-
  12. # serial 1 (pkg-config-0.24)
  13. #
  14. # Copyright © 2004 Scott James Remnant <scott@netsplit.com>.
  15. #
  16. # This program is free software; you can redistribute it and/or modify
  17. # it under the terms of the GNU General Public License as published by
  18. # the Free Software Foundation; either version 2 of the License, or
  19. # (at your option) any later version.
  20. #
  21. # This program is distributed in the hope that it will be useful, but
  22. # WITHOUT ANY WARRANTY; without even the implied warranty of
  23. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  24. # General Public License for more details.
  25. #
  26. # You should have received a copy of the GNU General Public License
  27. # along with this program; if not, write to the Free Software
  28. # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  29. #
  30. # As a special exception to the GNU General Public License, if you
  31. # distribute this file as part of a program that contains a
  32. # configuration script generated by Autoconf, you may include it under
  33. # the same distribution terms that you use for the rest of that program.
  34. # PKG_PROG_PKG_CONFIG([MIN-VERSION])
  35. # ----------------------------------
  36. AC_DEFUN([PKG_PROG_PKG_CONFIG],
  37. [m4_pattern_forbid([^_?PKG_[A-Z_]+$])
  38. m4_pattern_allow([^PKG_CONFIG(_(PATH|LIBDIR|SYSROOT_DIR|ALLOW_SYSTEM_(CFLAGS|LIBS)))?$])
  39. m4_pattern_allow([^PKG_CONFIG_(DISABLE_UNINSTALLED|TOP_BUILD_DIR|DEBUG_SPEW)$])
  40. AC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility])
  41. AC_ARG_VAR([PKG_CONFIG_PATH], [directories to add to pkg-config's search path])
  42. AC_ARG_VAR([PKG_CONFIG_LIBDIR], [path overriding pkg-config's built-in search path])
  43. if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then
  44. AC_PATH_TOOL([PKG_CONFIG], [pkg-config])
  45. fi
  46. if test -n "$PKG_CONFIG"; then
  47. _pkg_min_version=m4_default([$1], [0.9.0])
  48. AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version])
  49. if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then
  50. AC_MSG_RESULT([yes])
  51. else
  52. AC_MSG_RESULT([no])
  53. PKG_CONFIG=""
  54. fi
  55. fi[]dnl
  56. ])# PKG_PROG_PKG_CONFIG
  57. # PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
  58. #
  59. # Check to see whether a particular set of modules exists. Similar
  60. # to PKG_CHECK_MODULES(), but does not set variables or print errors.
  61. #
  62. # Please remember that m4 expands AC_REQUIRE([PKG_PROG_PKG_CONFIG])
  63. # only at the first occurence in configure.ac, so if the first place
  64. # it's called might be skipped (such as if it is within an "if", you
  65. # have to call PKG_CHECK_EXISTS manually
  66. # --------------------------------------------------------------
  67. AC_DEFUN([PKG_CHECK_EXISTS],
  68. [AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
  69. if test -n "$PKG_CONFIG" && \
  70. AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$1"]); then
  71. m4_default([$2], [:])
  72. m4_ifvaln([$3], [else
  73. $3])dnl
  74. fi])
  75. # _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES])
  76. # ---------------------------------------------
  77. m4_define([_PKG_CONFIG],
  78. [if test -n "$$1"; then
  79. pkg_cv_[]$1="$$1"
  80. elif test -n "$PKG_CONFIG"; then
  81. PKG_CHECK_EXISTS([$3],
  82. [pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null`
  83. test "x$?" != "x0" && pkg_failed=yes ],
  84. [pkg_failed=yes])
  85. else
  86. pkg_failed=untried
  87. fi[]dnl
  88. ])# _PKG_CONFIG
  89. # _PKG_SHORT_ERRORS_SUPPORTED
  90. # -----------------------------
  91. AC_DEFUN([_PKG_SHORT_ERRORS_SUPPORTED],
  92. [AC_REQUIRE([PKG_PROG_PKG_CONFIG])
  93. if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
  94. _pkg_short_errors_supported=yes
  95. else
  96. _pkg_short_errors_supported=no
  97. fi[]dnl
  98. ])# _PKG_SHORT_ERRORS_SUPPORTED
  99. # PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
  100. # [ACTION-IF-NOT-FOUND])
  101. #
  102. #
  103. # Note that if there is a possibility the first call to
  104. # PKG_CHECK_MODULES might not happen, you should be sure to include an
  105. # explicit call to PKG_PROG_PKG_CONFIG in your configure.ac
  106. #
  107. #
  108. # --------------------------------------------------------------
  109. AC_DEFUN([PKG_CHECK_MODULES],
  110. [AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
  111. AC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl
  112. AC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl
  113. pkg_failed=no
  114. AC_MSG_CHECKING([for $1])
  115. _PKG_CONFIG([$1][_CFLAGS], [cflags], [$2])
  116. _PKG_CONFIG([$1][_LIBS], [libs], [$2])
  117. m4_define([_PKG_TEXT], [Alternatively, you may set the environment variables $1[]_CFLAGS
  118. and $1[]_LIBS to avoid the need to call pkg-config.
  119. See the pkg-config man page for more details.])
  120. if test $pkg_failed = yes; then
  121. AC_MSG_RESULT([no])
  122. _PKG_SHORT_ERRORS_SUPPORTED
  123. if test $_pkg_short_errors_supported = yes; then
  124. $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "$2" 2>&1`
  125. else
  126. $1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "$2" 2>&1`
  127. fi
  128. # Put the nasty error message in config.log where it belongs
  129. echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD
  130. m4_default([$4], [AC_MSG_ERROR(
  131. [Package requirements ($2) were not met:
  132. $$1_PKG_ERRORS
  133. Consider adjusting the PKG_CONFIG_PATH environment variable if you
  134. installed software in a non-standard prefix.
  135. _PKG_TEXT])[]dnl
  136. ])
  137. elif test $pkg_failed = untried; then
  138. AC_MSG_RESULT([no])
  139. m4_default([$4], [AC_MSG_FAILURE(
  140. [The pkg-config script could not be found or is too old. Make sure it
  141. is in your PATH or set the PKG_CONFIG environment variable to the full
  142. path to pkg-config.
  143. _PKG_TEXT
  144. To get pkg-config, see <http://pkg-config.freedesktop.org/>.])[]dnl
  145. ])
  146. else
  147. $1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS
  148. $1[]_LIBS=$pkg_cv_[]$1[]_LIBS
  149. AC_MSG_RESULT([yes])
  150. $3
  151. fi[]dnl
  152. ])# PKG_CHECK_MODULES
  153. # PKG_INSTALLDIR(DIRECTORY)
  154. # -------------------------
  155. # Substitutes the variable pkgconfigdir as the location where a module
  156. # should install pkg-config .pc files. By default the directory is
  157. # $libdir/pkgconfig, but the default can be changed by passing
  158. # DIRECTORY. The user can override through the --with-pkgconfigdir
  159. # parameter.
  160. AC_DEFUN([PKG_INSTALLDIR],
  161. [m4_pushdef([pkg_default], [m4_default([$1], ['${libdir}/pkgconfig'])])
  162. m4_pushdef([pkg_description],
  163. [pkg-config installation directory @<:@]pkg_default[@:>@])
  164. AC_ARG_WITH([pkgconfigdir],
  165. [AS_HELP_STRING([--with-pkgconfigdir], pkg_description)],,
  166. [with_pkgconfigdir=]pkg_default)
  167. AC_SUBST([pkgconfigdir], [$with_pkgconfigdir])
  168. m4_popdef([pkg_default])
  169. m4_popdef([pkg_description])
  170. ]) dnl PKG_INSTALLDIR
  171. # PKG_NOARCH_INSTALLDIR(DIRECTORY)
  172. # -------------------------
  173. # Substitutes the variable noarch_pkgconfigdir as the location where a
  174. # module should install arch-independent pkg-config .pc files. By
  175. # default the directory is $datadir/pkgconfig, but the default can be
  176. # changed by passing DIRECTORY. The user can override through the
  177. # --with-noarch-pkgconfigdir parameter.
  178. AC_DEFUN([PKG_NOARCH_INSTALLDIR],
  179. [m4_pushdef([pkg_default], [m4_default([$1], ['${datadir}/pkgconfig'])])
  180. m4_pushdef([pkg_description],
  181. [pkg-config arch-independent installation directory @<:@]pkg_default[@:>@])
  182. AC_ARG_WITH([noarch-pkgconfigdir],
  183. [AS_HELP_STRING([--with-noarch-pkgconfigdir], pkg_description)],,
  184. [with_noarch_pkgconfigdir=]pkg_default)
  185. AC_SUBST([noarch_pkgconfigdir], [$with_noarch_pkgconfigdir])
  186. m4_popdef([pkg_default])
  187. m4_popdef([pkg_description])
  188. ]) dnl PKG_NOARCH_INSTALLDIR
  189. # PKG_CHECK_VAR(VARIABLE, MODULE, CONFIG-VARIABLE,
  190. # [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
  191. # -------------------------------------------
  192. # Retrieves the value of the pkg-config variable for the given module.
  193. AC_DEFUN([PKG_CHECK_VAR],
  194. [AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
  195. AC_ARG_VAR([$1], [value of $3 for $2, overriding pkg-config])dnl
  196. _PKG_CONFIG([$1], [variable="][$3]["], [$2])
  197. AS_VAR_COPY([$1], [pkg_cv_][$1])
  198. AS_VAR_IF([$1], [""], [$5], [$4])dnl
  199. ])# PKG_CHECK_VAR