mirror of
https://github.com/cryb-to/cryb-to.git
synced 2024-11-23 22:25:46 +00:00
Add support for version checks.
This commit is contained in:
parent
42e19ba158
commit
e603e0bc2e
1 changed files with 42 additions and 10 deletions
|
@ -28,7 +28,7 @@ dnl OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
|||
dnl SUCH DAMAGE.
|
||||
dnl
|
||||
|
||||
m4_define([AX_PKG_CONFIG_MACROS_VERSION], [0.20170404])
|
||||
m4_define([AX_PKG_CONFIG_MACROS_VERSION], [0.20180506])
|
||||
|
||||
dnl
|
||||
dnl AX_PROG_PKG_CONFIG([min-version])
|
||||
|
@ -39,8 +39,10 @@ dnl
|
|||
AC_DEFUN([AX_PROG_PKG_CONFIG], [
|
||||
m4_pattern_forbid([^AX_PKG_CONFIG_[A-Z_]+$])
|
||||
AC_ARG_VAR([PKG_CONFIG], [path to pkg-config binary])
|
||||
AC_ARG_VAR([PKG_CONFIG_PATH], [list of directories to prepend to default search path])
|
||||
AC_ARG_VAR([PKG_CONFIG_LIBDIR], [list of directories to search instead of default search path])
|
||||
AC_ARG_VAR([PKG_CONFIG_PATH],
|
||||
[list of directories to prepend to default search path])
|
||||
AC_ARG_VAR([PKG_CONFIG_LIBDIR],
|
||||
[list of directories to search instead of default search path])
|
||||
if test x"${PKG_CONFIG}" = x"" ; then
|
||||
AC_PATH_PROGS([PKG_CONFIG], [pkgconf pkg-config]) >/dev/null
|
||||
else
|
||||
|
@ -97,12 +99,17 @@ AC_DEFUN([AX_PKG_CONFIG_VAR], [
|
|||
])
|
||||
|
||||
dnl
|
||||
dnl AX_PKG_CONFIG_CHECK(package-name,
|
||||
dnl AX_PKG_CONFIG_CHECK(package-name, [version-spec],
|
||||
dnl [action-if-found], [action-if-not-found])
|
||||
dnl -------------------------------------------
|
||||
dnl
|
||||
dnl Check if the specified package is installed. If it is, define
|
||||
dnl HAVE_PACKAGE, PACKAGE_VERSION, PACKAGE_CFLAGS and PACKAGE_LIBS.
|
||||
dnl
|
||||
dnl The second argument, if non-empty, specifies a minimum (>=1.2.3 or
|
||||
dnl >1.2.3), maximum (<=1.2.3 or <1.2.3) or exact (==1.2.3 or =1.2.3
|
||||
dnl or 1.2.3) version to look for.
|
||||
dnl
|
||||
dnl The specified actions are performed in addition to the standard
|
||||
dnl actions.
|
||||
dnl
|
||||
|
@ -110,10 +117,35 @@ AC_DEFUN([AX_PKG_CONFIG_CHECK], [
|
|||
AC_REQUIRE([AX_PROG_PKG_CONFIG])
|
||||
m4_define([_P], AS_TR_SH([m4_toupper([$1])]))
|
||||
m4_define([_p], AS_TR_SH([m4_tolower([$1])]))
|
||||
dnl
|
||||
ver="$2"
|
||||
ver="${ver##*\[<=>\]}"
|
||||
case "$2" in
|
||||
"")
|
||||
vopt=""
|
||||
vtext="$1"
|
||||
;;
|
||||
">=$ver"|">$ver")
|
||||
vopt="--atleast-version=$ver"
|
||||
vtext="$1 $ver or newer"
|
||||
;;
|
||||
"<=$ver"|"<$ver")
|
||||
vopt="--max-version=$ver"
|
||||
vtext="$1 $ver or older"
|
||||
;;
|
||||
"==$ver"|"=$ver"|"$ver")
|
||||
vopt="--exact-version=$ver"
|
||||
vtext="$1 $ver"
|
||||
;;
|
||||
*)
|
||||
AC_MSG_ERROR([invalid version specification: "$2"])
|
||||
;;
|
||||
esac
|
||||
dnl
|
||||
AC_ARG_VAR(_P[_CFLAGS], [C compiler flags for $1])
|
||||
AC_ARG_VAR(_P[_LIBS], [linker flags for $1])
|
||||
AC_MSG_CHECKING([if $1 is installed])
|
||||
if AC_RUN_LOG(["${PKG_CONFIG}" --exists --print-errors "$1"]) ; then
|
||||
AC_MSG_CHECKING([if ${vtext} is installed])
|
||||
if AC_RUN_LOG(["${PKG_CONFIG}" --exists $vopt --print-errors "$1"]) ; then
|
||||
AC_MSG_RESULT([yes])
|
||||
[ax_pc_cv_have_]_p=yes
|
||||
AC_DEFINE([HAVE_]_P, [1], [Define to 1 if you have $1])
|
||||
|
@ -133,11 +165,11 @@ dnl
|
|||
AC_SUBST(_P[_LIBS], [$ax_pc_cv_]_p[_libs])
|
||||
AC_MSG_RESULT([${ax_pc_cv_]_p[_libs:-none}])
|
||||
dnl
|
||||
m4_default([$2], [:])
|
||||
m4_default([$3], [:])
|
||||
else
|
||||
AC_MSG_RESULT([no])
|
||||
[ax_pc_cv_have_]_p=no
|
||||
m4_default([$3], [:])
|
||||
m4_default([$4], [:])
|
||||
fi
|
||||
m4_ifdef([AM_CONDITIONAL], [
|
||||
AM_CONDITIONAL([HAVE_]_P, [test x"$ax_pc_cv_have_]_p[" = x"yes"])
|
||||
|
@ -145,13 +177,13 @@ dnl
|
|||
])
|
||||
|
||||
dnl
|
||||
dnl AX_PKG_CONFIG_REQUIRE(package-name)
|
||||
dnl AX_PKG_CONFIG_REQUIRE(package-name, [version-spec])
|
||||
dnl -----------------------------------
|
||||
dnl
|
||||
dnl As above, but fail if the package is not installed.
|
||||
dnl
|
||||
AC_DEFUN([AX_PKG_CONFIG_REQUIRE], [
|
||||
AX_PKG_CONFIG_CHECK([$1], [], [
|
||||
AX_PKG_CONFIG_CHECK([$1], [$2], [], [
|
||||
AC_MSG_ERROR([cannot proceed without $1])
|
||||
])
|
||||
])
|
||||
|
|
Loading…
Reference in a new issue