summaryrefslogtreecommitdiffstats
path: root/m4/libo_pkg_version.m4
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-15 05:54:39 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-15 05:54:39 +0000
commit267c6f2ac71f92999e969232431ba04678e7437e (patch)
tree358c9467650e1d0a1d7227a21dac2e3d08b622b2 /m4/libo_pkg_version.m4
parentInitial commit. (diff)
downloadlibreoffice-267c6f2ac71f92999e969232431ba04678e7437e.tar.xz
libreoffice-267c6f2ac71f92999e969232431ba04678e7437e.zip
Adding upstream version 4:24.2.0.upstream/4%24.2.0
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'm4/libo_pkg_version.m4')
-rw-r--r--m4/libo_pkg_version.m448
1 files changed, 48 insertions, 0 deletions
diff --git a/m4/libo_pkg_version.m4 b/m4/libo_pkg_version.m4
new file mode 100644
index 0000000000..c004b92b2b
--- /dev/null
+++ b/m4/libo_pkg_version.m4
@@ -0,0 +1,48 @@
+dnl -*- Mode: Autoconf; tab-width: 4; indent-tabs-mode: nil; fill-column: 102 -*-
+#
+# This file is part of the LibreOffice project.
+#
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+#
+
+m4_define([_libo_define_pkg_version], [
+ save_IFS="$IFS"
+ IFS=.
+ echo "$ver" | while read major minor micro; do
+ AC_DEFINE_UNQUOTED([$1_VERSION_MAJOR], [$major])
+ AC_DEFINE_UNQUOTED([$1_VERSION_MINOR], [$minor])
+ AC_DEFINE_UNQUOTED([$1_VERSION_MICRO], [$micro])
+ done
+ IFS="$save_IFS"
+])
+
+m4_define([_libo_define_pkg_version_direct], [
+ AC_DEFINE([$1_VERSION_MAJOR], [$2])
+ AC_DEFINE([$1_VERSION_MINOR], [$3])
+ AC_DEFINE([$1_VERSION_MICRO], [$4])
+])
+
+# libo_PKG_VERSION(VARIABLE-STEM, MODULE, BUNDLED-VERSION)
+AC_DEFUN([libo_PKG_VERSION], [
+ AS_IF([test -n "$SYSTEM_$1"], [
+ AC_REQUIRE([PKG_PROG_PKG_CONFIG])
+ AC_MSG_CHECKING([for $1 version])
+ AS_IF([test -n "$PKG_CONFIG"], [
+ ver=`$PKG_CONFIG --modversion "$2"`
+ AS_IF([test -n "$ver"], [
+ AC_MSG_RESULT([$ver])
+ _libo_define_pkg_version([$1], [$ver])
+ ], [
+ AC_MSG_ERROR([not found])
+ ])
+ ], [
+ AC_MSG_ERROR([not found])
+ ])
+ ], [
+ _libo_define_pkg_version_direct([$1], m4_translit([$3], [.], [,]))
+ ])
+])
+
+dnl vim:set shiftwidth=4 softtabstop=4 expandtab: